The Type System Is the Recovery Oracle for a Dead Agent

The type system is the recovery oracle for a dead agent

When an autonomous coding agent dies mid-write, don't reconstruct what it was doing by reading its half-finished narrative. Compile. In a strongly-typed language with real tests, the build enumerates every inconsistency the interrupted write left behind, and points at the exact lines.

What happened

One of the lcos build agents was implementing the dry-run write framework when its connection dropped mid-response. It had already updated the Request enum with new fields, but it died before reconciling the parts that depended on the enum: its own protocol tests still constructed the old shape, and the matching client methods weren't written yet.

The half-applied state was sneaky. cargo build on the libraries passed, so a quick check said "fine." But cargo test --workspace refused to compile and listed all ten mismatches: Request::Checkin has no field 'mood', missing field 'commit', and so on, each with a file and line. The compiler had already done the diff between intent and reality.

The recovery rule

  1. The type or enum definition is the source of truth. The agent got that far; trust it.
  2. Reconcile everything that references it — tests, constructors, call sites — until they match.
  3. Run the full test build, not just build. Library-only compilation hides breaks that live in test code or downstream crates.

That's it. No archaeology of the dead agent's prose, no guessing at intent. The strongly-typed build is the oracle.

Validation against code (2026-06-26)

The Phase 4 recovery did exactly this. The committed enum carries commit plus the check-in fields; the stale fixtures referenced mood/energy/metric. cargo test --workspace surfaced all of it, and reconciling the fixtures to the enum closed it out. The exhaustive category() match (no wildcard) meant a forgotten variant would also have failed to compile, not slipped through.

Why this generalises

This is a quiet argument for strong types and exhaustive matches whenever you let agents write code. An interrupted write leaves a bounded, discoverable mess instead of a silent landmine. Prefer tools where the build can enumerate inconsistencies for you: sum types over stringly-typed dispatch, exhaustive matches over default cases, a test compile as the real gate. The more the type system knows, the cheaper it is to recover from an agent that didn't finish.

It's the same instinct as Observe Before Reasoning, pointed at a different target. There, you instrument and read the logs before theorising. Here, the compiler is the instrument, and you read its errors before reconstructing intent.

See also