How it works

Fast when routine.
Orthogonal when consequential.

AgentFlow 2.0 replaces uniform multi-step ceremony with risk-calibrated control loops. Routine slices collapse into a single oracle-pinned builder pass; consequential work escalates to separate seats, clean-context councils, cross-family Four-Eyes review, and out-of-band supervisory steering.

Follow one change through 2.0.

  1. Shape intent and classify risk (Phases 0–1).

    Product and analysis define the outcome, acceptance criteria, and slice boundaries (`pm.*` writes only `.agentflow/**` and `goals/**`). The slice is classified from `P0`/`P1` (routine) to `P2–P4` (cross-cutting or high-assurance), and checked against the consequence floor (`auth`, `crypto`, `storage`, `locking`, `migration`, `tests/oracles/**`).

    Goal spec + AcceptanceContract + complexity class (P0–P4)
  2. Pin the architecture and oracle digest (Phases 2–3).

    Before any implementation begins, `orch.arch` (and a clean-context Council at `effort: high` when `P2+`) locks the design and pins the cryptographic SHA-256 digest of `tests/oracles/**`. Builder seats (`dev.build`) are barred by path-ownership rules from modifying oracle files.

    Phase 3 Oracle Digest Pin + RoleHandoff
  3. Execute proportionally: Composite Pass vs. Seat Separation (Phases 3–5).

    For routine `P0`/`P1` slices with a pinned oracle digest, `dev.build` executes a single-turn Composite Phase 3–5 Builder Pass inside an isolated git worktree (`.worktrees/<branch>`) at `effort: medium`, spawning ephemeral L2 subagents for code search and test runs. If the slice is `P2–P4` or touches a consequence-floor path, AgentFlow enforces full Phase 3 → 4 → 5 → 6 seat separation.

    DeliveryReceipt + candidate SHA + L2 subagent evidence
  4. Verify deterministically, then review orthogonally (Phase 6).

    Code gates verify the oracle digest, path ownership, candidate SHA, and test exit codes first. Next, Dynamic Reviewer Dispatch assigns `rev.review` to an orthogonal model family (`Claude` ↔ `GPT` ↔ `Gemini`) so no model family grades its own homework. If rework is requested, Sticky Builder Return Affinity routes the slice back to the exact builder seat and worktree.

    Deterministic gate report + Cross-family Four-Eyes verdict
  5. Intercept rework spirals and evolve the process (Plane 1 & Plane 3).

    If `reworkRounds > 2`, the Epoch Circuit Breaker freezes the slice. The Grounded Decider Port (`d3-flash`) classifies the failure (`transient`, `architectural_conflict`, `oracle_gap`, `spec_ambiguity`) so out-of-band `steer.lead` can execute `unfreeze` or `accept_and_register`. Meanwhile, out-of-band `eval.tester` and trace extractors feed the Closed-Loop RSI engine.

    Decider classification + Steer resolution + RSI refinement proposal

Adaptive execution substrates

Three ways to run the loop.
Auto-detected on your machine.

You do not need a multi-agent daemon to adopt AgentFlow 2.0. `doctor-env` inspects your environment and maps the workflow onto `S0`, `S1`, or `S2`.

S0 · single-agent

Single-CLI + L2 Subagents

Uses a single installed CLI (`claude`, `codex`, `agy`, `pi`, or `grok`). One parent session steps through role phases sequentially and spawns native ephemeral L2 subagents for read-only codebase exploration and test verification.

Requires: 1 supported CLI · 0 daemons
S1 · optional-multi-agent

Multi-CLI Orthogonal Four-Eyes

Uses two or more CLIs from different model families on the same workstation. The primary CLI executes the Composite Phase 3–5 Builder Pass while an orthogonal CLI performs independent Phase 6 Four-Eyes review and Council checks.

Requires: 2+ CLIs (e.g. Claude + Codex/Agy) · 0 daemons

Deterministic gates + Grounded Decider Port

Code checks invariants.
The Decider classifies ambiguity.
Humans own authority.

AgentFlow never spends a frontier model call to check whether an artifact exists, whether an oracle was tampered with, or whether a seat wrote outside its allowed paths.

01 / Code invariants first

Deterministic validators check candidate SHA, Phase 3 oracle digest integrity, path-ownership rules (`pm.*`, `steer.*`, `dev.build*`, `dev.test-eng`), and compiler/test exit codes. Failed invariants block immediately.

02 / Grounded Decider Port

Only after deterministic checks pass does the fast, low-cost decider port (`d3-flash`, fallback `gemini-3.8-flash` / `gpt-6-mini`) classify rework loops, defect severity, and circuit-breaker escalations for `steer.lead`.

03 / Supervisory & human gates

Out-of-rig `steer.lead` governs `unfreeze`, `accept_and_register`, and `merge` verbs with zero code write access (`allow: []`). High-assurance `P4` slices require explicit human security and acceptance sign-off.

Zero self-waiver invariant: Neither an execution seat nor the Grounded Decider Port can waive a failing deterministic check, alter a pinned oracle digest, or bypass a required human gate.

Proportional ceremony & consequence floors

Speed for `P0`/`P1`.
Full separation when risk rises.

AgentFlow scales coordination depth automatically based on complexity class (`P0`–`P4`) and the `CONSEQUENCE_FLOOR_RE` path guard.

P0 / P1 Routine slices — Composite Phase 3–5 Builder Pass

When the Phase 3 oracle digest is pinned and no high-consequence path is touched, `dev.build` executes Phases 3, 4, and 5 in a single worktree turn (`effort: medium`) using internal L2 subagents. Deterministic gates and `dev.qa` / `rev.review` verify the result before acceptance.

P2 Cross-domain slices — Bilateral contract + Orthogonal Four-Eyes

Separates planning (`orch.arch`), implementation (`dev.build`), and QA verification (`dev.qa`), followed by cross-family Phase 6 review (`rev.review`) with Sticky Builder Return Affinity if rework is needed.

P3 Architecture / Consequence Floor — Clean-Context Council + Full Seat Separation

Triggered automatically for `P3` work or any diff touching `auth`, `crypto`, `storage`, `locking`, `migration`, or `tests/oracles/**`. Convening a Council spawns clean-context (<40k token) advisers at `effort: high` so deep reasoning never degrades inside a polluted builder transcript.

P4 Sensitive / High-Assurance — Council + Human Security & Acceptance Gate

Combines full seat separation, clean-context Council advice, cross-family Four-Eyes review, and a delivery-bound human approval on the open PR before merge.

Read the collaboration and escalation protocol ↗

Nine canonical roles → Lean 4-Seat Squad

Preserve every responsibility.
Eliminate the handoff tax.

AgentFlow retains nine canonical lifecycle responsibilities for auditability, while projecting them onto four persistent L1 execution seats plus two out-of-band supervisory/RSI seats.

  • 1. orch.arch (L1 Execution Seat)Owns Architect, Implementation Planner, and PR Readiness responsibilities (`architect-lead`, `effort: medium`, clean-context `high` for Phase 2).
  • 2. dev.build (L1 Execution Seat)Owns Developer & Technical Writer implementation inside `.worktrees/<branch>` (`deep-reasoning`, `effort: medium`, spawns L2 subagents).
  • 3. dev.qa (L1 Execution Seat)Owns Tester validation and verification verdicts (`lightweight`, `effort: low`, read-only against `src/**`).
  • 4. rev.review (L1 Execution Seat)Owns independent Phase 6 Reviewer judgment via cross-family Four-Eyes dispatch (`deep-reasoning`, `effort: medium` / clean `high`).
  • 5. steer.lead (Plane 1 Supervisory)Out-of-rig Product Manager / Analyst / Steerer authority (`allow: []` code writes; governs goals, `unfreeze`, `accept_and_register`, `merge`).
  • 6. eval.tester (Plane 3 RSI)Out-of-band black-box surface prober and trace evaluator feeding Closed-Loop Recursive Self-Improvement (`lightweight`, `effort: low`).

In `S0` (Single-CLI), one executor wears the execution hats sequentially while enforcing the same phase contracts and path rules. In `S2` (OpenRig), the Lean 4-Seat Squad is the default topology (`--topology 6-seat` remains available when dedicated `dev.test-eng` and `ops.pr` seats are desired).

Inspect the role catalog and seat projection ↗

See the technical design

Explore the three planes
and model calibration.