04 · Architecture
Rust drives · Pi plans and builds · Herdr runs agents · OpenSpec specifies
The boundary is intentional: a one-shot Pi planner may only read the worktree and propose each step's agents, and the agents may only write their result files; the Rust host runs the steps and alone validates and persists status transitions, approvals, and worktree operations.
flowchart LR
human(["Human operator"])
tui["Cronos CLI / TUI<br/>Review view · approvals<br/>resume · recovery"]
subgraph host["Cronos Rust host · state owner"]
queue["Ready queue<br/>Priority or agent prioritizer<br/>parallel tracks up to capacity"]
state[("Project + task JSON<br/>check command · revisions")]
workspace["Per-attempt worktree<br/>local branch · .cronos/ excluded"]
stepRunner["Workflow engine<br/>Per-task step lock · agent limits<br/>prompt contract · JSON results<br/>worktree checks"]
check["Project check command<br/>after verification agents<br/>no shell · process group"]
revision(["Automatic revision<br/>back to code generation<br/>max 3 per attempt"])
approval{{"Human approval<br/>Specs + final code"}}
archive["Archive OpenSpec change<br/>single docs commit"]
merger["Local merge<br/>dirty base waits"]
end
subgraph orchestration["Rust orchestration"]
runner["Task runner process<br/>one per active task<br/>loops until a gate"]
planner["Step planner<br/>one-shot read-only Pi<br/>default plan on failure"]
end
subgraph herdr["Herdr agent runtime"]
agents["Step agents<br/>1 spec author; 1-4 writers, reviewers,<br/>verifiers, or docs agents<br/>per-step time limits; one pane each"]
end
openspec["OpenSpec<br/>one change per task"]
repository[("User's local Git repository<br/>committed openspec/")]
completed(["Completed"])
error(["Error"])
rejected(["Rejected"])
human --> tui
tui -->|create project, task, check command| queue
queue -->|load and persist| state
queue -->|assign attempt| workspace
queue -->|launch or resume task| runner
workspace --> repository
runner -->|task, findings, notes| state
runner -->|plan each agent step| planner
planner -->|read only| workspace
runner -->|validated agents| stepRunner
stepRunner -->|prompt + Rust contract| agents
agents -->|JSON result files; wait for all| stepRunner
agents -->|work in assigned worktree| workspace
agents -->|specification step| openspec
stepRunner -->|verification passed| check
stepRunner -->|changes_requested| revision
check -->|non-zero exit or leftover files| revision
revision --> stepRunner
check -->|passed| approval
stepRunner -->|validated step and activity| state
stepRunner -->|specs validated| approval
tui -->|review, approve or request revision| approval
approval -->|validated decision| state
approval -->|continue or revise| stepRunner
stepRunner -->|documentation agents done| archive
archive --> workspace
archive -->|after the runner stops| merger
merger <-->|worktree and local merge| repository
merger -->|success| completed
merger -. conflict: abort .-> revision
merger -. other merge failure: abort .-> error
completed --> state
agents -. crash, timeout, invalid or failed result: cancel siblings .-> error
stepRunner -. worktree or OpenSpec check failed .-> error
revision -. limit reached .-> error
error -->|stop stale agents, then retry step: same attempt| stepRunner
error -->|retry or clarify: new attempt| workspace
error -->|human abandons| rejected
rejected --> state
classDef person fill:#F1F5FA,stroke:#667A90,color:#16283D,stroke-width:1.5px
classDef host fill:#EAF5F4,stroke:#188C83,color:#153C42,stroke-width:1.5px
classDef agent fill:#F0EEFA,stroke:#7966B5,color:#302950,stroke-width:1.5px
classDef external fill:#FFF4E3,stroke:#C38A3E,color:#4B371F,stroke-width:1.5px
classDef success fill:#E7F6EC,stroke:#39935B,color:#183E27,stroke-width:1.5px
classDef failure fill:#FFF0ED,stroke:#CB6A56,color:#55271F,stroke-width:1.5px
classDef loop fill:#FFF8E8,stroke:#C9962B,color:#4B371F,stroke-width:1.5px
class human,tui person
class queue,state,workspace,stepRunner,check,approval,archive,merger,runner host
class revision loop
class planner,agents agent
class openspec,repository external
class completed success
class error,rejected failure
Loading architecture diagram…
Tasks run on parallel tracks up to the project's capacity (one by default), each with its own worktree and task runner, while independent agents within each task's active step run concurrently.