Human-gated, phased execution

The failure mode of an autonomous coding agent is running away. The fix isn't more trust — it's structure: phased execution, hand-backs, and gates. Keep a factory powerful without letting it off the leash.

An autonomous coding agent has one dramatic failure mode: it runs away. Given a big task, it does phases one through six, makes a dozen reasonable-sounding assumptions, and hands back a result that’s wrong in a way that’s expensive to unwind. You didn’t get a shortcut; you got a large bill of work you now have to review in one lump.

The fix is not more trust. It’s structure: make the factory work in phases, hand back at the seams, and let a human steer between them.

What a gated run looks like

   plan (reviewed up front)
        │
        ▼
 ┌──────────────┐  gate   ┌──────────────┐  gate   ┌─────────┐
 │  phase 1–3   │ ───────▶│  phase 4–6   │ ───────▶│  done   │
 │   (factory)  │  human  │   (factory)  │  human  │         │
 └──────────────┘ decision └──────────────┘ decision └─────────┘
                          ┌─────────────┐
                          │ stop & wait │
                          │ persist     │
                          │ notify      │
                          └─────────────┘

The load-bearing behavior is the box in the middle: at a gate the factory stops, persists its exact state, notifies the right person, and waits. It does not guess its way through. A factory that can’t pause is a factory you can’t trust with anything irreversible.

Phased execution with hand-backs

Break the work into phases and let the factory do a batch, then stop. “Do phases 1–3, hand back, then 4–6.” The human reviews the checkpoint — is the direction right? — corrects course, and releases the next batch. The factory never gets to be twelve phases deep before a human looks at it.

This is the difference between a tool you can hand real work to and a toy. The gates are where judgment lives; the factory is where throughput lives. You want both, in the right places.

Review before the factory runs, not after

The other half is front-loading. The developer refines the plan interactively and runs explicit review passes — an architecture review, a plan review — before the factory executes anything. The factory should execute a vetted plan, not a first draft. Reviewing a plan is cheap; reviewing a finished, wrong implementation is not.

Decision gates: stop and wait, cleanly

A gate is a decision point: merge or not, take this approach or that, or an agent that’s stopped and waiting on a choice. The gate is a first-class record, not an implicit pause:

{
  "gate_id": "g-2",
  "phase": "p1-3",
  "opened_at": "…",
  "state": "awaiting",            // awaiting | resolved
  "decided_by": null,             // human | agent — set when resolved
  "decision": null,               // proceed | revise | abort
  "note": "direction looks right; proceed to 4-6"
}

That record is what turns “the agent is waiting” into something auditable — and it’s exactly the kind of human-vs-agent decision that provenance needs to capture.

The autonomy dial

Autonomy isn’t a global on/off. It’s set per repo and per task class. A documentation change can run end-to-end; a change to core data structures stops at every seam. And autonomy should be earned: a task class that has been green and reviewed many times can be granted more latitude; a new one starts gated.

A minimal way to express it, per task:

task:
  plan_reviewed_by: human
  phases:
    - id: p1-3
      gate_after: true
      gate: { type: human }
    - id: p4-6
      gate_after: true
      gate: { type: human }
    # an earned, low-risk class would drop gate_after on later phases

The trade-off, stated plainly

A gate is a latency and attention tax in exchange for a runaway bound. Every gate you add slows the happy path and costs a human a context switch; every gate you remove trades that away for the risk that the agent commits an expensive, hard-to-reverse mistake before anyone looks. There is no setting that’s free.

The honest way to hold the dial is to price it per task class: the more irreversible and shared the change, the more a gate is worth; the more reversible and local, the cheaper it is to let the agent run. “How many gates?” is the wrong question — “how much does a wrong guess cost here, and how reversible is it?” is the right one.

Open questions

  • Gate fatigue. If every task stops at three gates, humans stop reading them and start rubber-stamping — which buys none of the safety and all of the latency. How do you keep a gate meaningful at volume? I don’t have a clean answer; it’s the failure mode I worry about most.
  • Clean resume. “Persist state and wait” is easy to say and hard to make bulletproof — the factory has to be able to resume exactly where it stopped, after an arbitrary delay, without re-doing or losing work. The state model is the hard part.
  • Who decides at the gate? A human, obviously — but which human, and what do they see? The right artifact at a gate is a small, reviewable checkpoint, not a raw diff. Designing that checkpoint is its own problem.

This is part of the Software Factory series, and it pairs with the factory that doesn’t eat your budget — the more autonomy you turn up, the harder the other boundaries have to hold.

#software-factory#agents#devex
← All posts