joey.hersh

systems / cyrus-v2

Cyrus-v2

An agent-orchestration platform with a budget and a scheduler

Agents are cheap. Budgets, schedules, and evidence are the platform.

Period
March 2026
My role
Sole human author. Designed the relay, orchestrator, metering, scheduling, and PM agent on top of a forked project tracker, and built them with coding agents I directed and reviewed.
State
Working platform, phases one through five complete with passing test reports. The harness I use to run agents against real backlogs.
  • 5Agent providers behind one interfaceClaude Code, Codex, Gemini, OpenCode, OpenClaw
  • 22 / 22Metering testsbudgets, rate limits, throughput, forecasting
  • 26Orchestrator tools exposed to the PM agent
  • ≈5K linesCyrus-specific coderelay plus orchestrator, metering, scheduling, lifecycle
  • TypeScript
  • Python
  • Django
  • Postgres
  • Claude Code
  • Codex
  • Gemini CLI
  • OpenCode
  • OpenClaw
  • Langfuse
an isometric switchboard/relay box with five cables plugging in on one side and a single ribbon leaving the other, a small gauge dial on the front
Five coding agents behind one relay, metered against a budget.
cyrus-v2.dispatch: architecture flowheartbeat loopscan dispatchbudget blockerescalateWork itemsforked tracker · Postgresforked tracker · PostgresCyrus PM agentgroom · triage · auditgroom · triage · auditSchedulerpriority · cooldown · circuit breakerpriority · cooldown · cir…Meteringpool budgets · rate limitspool budgets · rate limitsRelayone event streamone event streamCoding agentsClaude Code · Codex · Gemini · OpenCodeClaude Code · Codex · Gem…Lifecycle auditcompliance before donecompliance before doneMeescalations onlyescalations only

Diagram nodes, in flow order: Work items (forked tracker · Postgres); Cyrus PM agent (groom · triage · audit); Scheduler (priority · cooldown · circuit breaker); Metering (pool budgets · rate limits); Relay (one event stream); Coding agents (Claude Code · Codex · Gemini · OpenCode); Lifecycle audit (compliance before done); Me (escalations only).

deterministic code model judgment human durable state tool / API

Why a second Cyrus

The first Cyrus was a 2023 project, built on the original release of LangChain: a low-code framework for event-driven multi-agent apps with deterministic prompt bundles, YAML function contracts, mixed-model routing, and a session cache. It taught me that the agent loop is the easy part. What I actually needed by 2026 was a way to run several coding agents against a real backlog without blowing through a subscription or losing track of what they'd done.

The architecture

Work items are the unit. I forked an open-source project tracker so that stories, cycles, goals, and KPIs already existed with a database and an API. Cyrus adds compute pools, allocations, sessions, and usage records as first-class models.

The relay is a TypeScript service that spawns coding agents as subprocesses and normalizes their output into one event stream. Claude Code, Codex, Gemini CLI, and OpenCode each have an adapter; OpenClaw talks over a gateway protocol. Every adapter reports token usage with cache reads, cache writes, reasoning tokens, and a per-model cost breakdown, because "how much did that cost" is the first question I ask.

Metering tracks each session against its compute pool: financial budget for API-billed pools, rate limits and throughput for subscription pools, with an uncertainty margin applied to estimates. It refuses dispatch when a budget is exhausted and warns at ninety percent.

The scheduler computes a dispatch plan from active allocations: effective priority, cooldowns, circuit breakers on repeated failure, a lock so two schedulers can't collide, and an intensity setting derived from budget runway. When a pool runs dry it files a blocker on the work item instead of silently stalling.

Lifecycle wraps start and complete. Completion runs a compliance audit and posts a report to the work item; a story without a description or evidence doesn't get to close.

The Cyrus PM agent runs on OpenClaw between dispatches: visionary ideation, backlog grooming, janitor triage, and alignment audits, each a scheduled heartbeat loop with access to twenty-six orchestrator tools through a management command. Worker agents get a "completion maestro" skill that forces pre-flight checks and ground-truth verification before code changes.

What the tests cover

Phase reports in the repo record the metering engine at 22 of 22 tests passing: budget checks, rate-limit monitoring, throughput validation, capacity forecasting. Integration scripts exercise dispatch through a mock relay, subscription pools, and budget aggregation across sessions. There are live-dispatch tests I run by hand against real agents.

What it's for

It is the harness behind a lot of the software on this site. It is also a research vehicle for the question I keep coming back to: what has to be deterministic for an autonomous system to be trustworthy? My answer so far is budgets, schedules, and evidence.

Cyrus-v2, in twenty-five seconds

Cyrus-v2 turns a backlog into agent sessions: five coding agents behind one relay, every token metered, a scheduler that knows when to stop, and a PM agent that grooms the board while you sleep.