All posts

Plan first, then prove it

How a writing run in muxcode plans a change, builds it and proves it, and why a model's yes is never enough to pass the work.

At a glance

  • A writing run plans first, builds second and proves it last, one route at a time. A small change your checks can prove runs solo instead.
  • The gate is the host's own code. It checks scope, exit codes, secrets and project checks before any judge, and costs no tokens.
  • Clef answers with a probability, and the host acts only when it clears a fixed bar, such as 0.6, 0.7, 0.8 or 0.85. It no longer picks a seat's effort or worker.
  • A run's tokens and active time grow with the repository, from 750,000 and 60 minutes to 3,000,000 and 180, and every run stops at 40 attempts.

A writing run in muxcode, one that changes your code, plans first, builds second and proves it last. No model’s yes passes the work alone: the host, muxcode’s own code around the models, checks the change before any judge does, and no model can pass failed verification. The one exception to planning first is a change small enough for your own checks to prove; the next section says when that is.

  1. RootDeepSeek V4.1 Flash · starts the run
  2. PlanArchitect · Opus 5.5 · high
    contract 1contract 2contract 3contract 4
  3. Plan checkhost code and Clef · no model re-reads it
  4. WorkerOpus 5.5 · medium
  5. Gatehost code · no model
    exit codesscopesecretsproject checks
  6. JudgeOpus 5.5 · high · four lenses
    contracttestsscopeyour words accept
failed check or reject
RetryOpus 5.5 · high · once per route
the gate a second failed check stops the run a second reject pauses it: Resume tries once more

One route, in order. The Architect, one model at high, plans. The plan check and the gate between worker and judge are code, not a model. The retry is the worker’s model one level up, and the judge reads the change in a session of its own.

Which lane a change takes

From muxcode 1.0.12, Clef reads each change once, at intake, and answers three narrow questions: would a check the project already has catch a wrong change, is there one place to edit, and would a wrong change still pass the tests? Code picks the lane from the answers.

Lane What runs When
Solo One worker, no plan or judge. Your project’s checks run before and after, and they are the proof. Clef is sure a check proves it (0.6) and it is confined (0.85), and leans no on subtle (under 0.5). Local tasks only.
Workflow The route below: plan, worker, gate, judge. Any doubt.
Workflow and a second reviewer The route below, then a reviewer on another model reads the verified change without the judge’s verdict. Only its accept completes the run. Clef is sure a wrong change would pass the tests (0.8), the change touches concurrency, a migration or auth, billing or infrastructure, or the last gate reads High risk.

A solo change goes to the full workflow, from the tree it left, when a check that passed before fails after, the gate flags a risk such as a manifest, agent configuration or a dependency, the worker changed nothing, or the project has no checks. An answer from anything but Clef itself never picks solo.

We froze the lane’s bars before writing a 30-case holdout to test them. On it, no change went solo by mistake and 9 of 10 true solo changes did. On the benchmark tasks a single agent and the default workflow both passed 24 of 24, and the workflow used about 30% more tokens. Those are small, hand-written sets; we don’t claim more from them.

The seats, in order

A run has five seats by default, each a role with its own model and effort. Effort is how hard a model reasons: low, medium, high, xhigh or max. Each seat keeps its model and effort for the whole attempt.

  • Root: DeepSeek V4.1 Flash, the model Pro and Pro+ include on mux; in a team workspace, your own plan counts. Chat on it, and it starts the run.
  • Architect: Claude Opus 5.5, at high, plans and replans.
  • Worker: Claude Opus 5.5, at medium, writes the change.
  • Retry: Claude Opus 5.5, at high, the worker’s model one level up, takes over after a failure.
  • Judge: Claude Opus 5.5, at high, accepts or rejects.

No model reviews the plan: muxcode’s lint and contract screen read it, and it goes to the worker. Until 1.0.27 the Architect re-read its own in a fresh session; that step cost about as much as the plan and rarely sent back anything the lint had not already named. A workflow you build can still name a critic or a review panel. The judge reads the finished change in a session of its own and may share the worker’s model, as the shipped one does; put it on another vendor’s model for a second opinion on every change. If it is not available on your sign-ins, muxcode seats another model that wrote nothing in the run.

On a paid plan, a seat whose sign-in you lack runs on the root’s DeepSeek, at its own level, until you sign in. The judge falls back to DeepSeek only when no other model is offered.

Cowork’s issue workflow, which starts only from Cowork with a GitHub issue, runs every seat, the judge too, on DeepSeek V4.1 Flash at max, and an issue never runs solo. Its first contract only writes a test, which must fail on the untouched code on its assertion, not on a compile, import or collection error (for a feature, a failure because the API the test calls does not exist yet counts); every later contract freezes that test, and the last one runs it. That test, not a second model, is the check.

Only the seats that write the change, the worker and the retry, save to workspace memory; the others read it.

Clef reads, the host decides

Clef, the classifier, is Cloudflare’s 27B decision model, run as @cf/cloudflare/clef on Workers AI. Until muxcode 1.0.12 it ran as the smaller clef-flash; on muxcode’s calibration set Clef met its bar on 16 of 19 question groups, Flash on 10. Why a probability and not a yes says how each bar is set and checked, and why a chat model’s yes never meets one. It answers the host’s questions with probabilities, which the host holds to fixed bars. It never writes code.

0 0.5 1 0.6 a check failing in a new way 0.7 contract screen 0.8 block triage 0.85 a worker drifting or stuck 0.52 no change 0.91 acts example answers, held to the 0.85 bar

A sure answer is one over its bar. Each question has a fixed bar; the dots are made-up answers to a 0.85 question. Below the bar, nothing changes. The gate’s bars were checked on a small labelled set; the others are policy, not yet measured.

Clef runs on Pro, Pro+ or a Pro trial, or with your own Cloudflare API token and account ID; in a team workspace, your own plan counts.

Clef used to pick a level in each seat’s range before most worker and retry calls, and could move a work package to a cheaper worker. In a live comparison on 19 October 2026, 164 effort readings and 10 worker readings changed no decision, while runs with Clef used 1.3% more model tokens and took 27% longer at the median. muxcode 1.0.12 removed both. Effort, one generation at a time describes how the effort reading worked.

The workflow itself runs on every plan. Hobby includes no model, so there you pick a root from your own sign-ins in Settings → Agents; the chain is the same, and the host’s code decides wherever Clef would read. To work without it, switch it off in Settings → Agents, or chat on a model other than the root.

The contract

The Architect’s plan is one to four contracts, written limits a worker stays inside, each a route worked in turn.

Contract 1 of up to 4example values

Goal
What done means, in wordsReject an empty name at sign-up
Kind
Logic, UI or terminallogic
May edit
The paths the worker may changesrc/signup/**
Frozen
Paths it must not touchmigrations/**
Verify
Commands that must exit 0pnpm test
Context gaps
What only you can supply; any gap stops the runnone

What a worker is held to. Each contract names the goal, the kind of change (logic, UI or terminal), the paths the worker may edit, frozen ones it may not, and the commands that verify it. A context gap, something only you can supply, stops the run.

Before the worker starts

The host screens the plan before any worker runs, then takes a baseline.

  1. A mechanical screen catches a check you named in backticks that nothing runs, and verification that can’t fail, like npm test || true.
  2. If that finds nothing, Clef reads whether a contract skips a named check, needs a file it can’t edit, breaks your rule, or would pass a wrong change. A yes at 0.7 sends it back. Both screens share one send-back per run.
  3. A lint, the host’s static check, sends back a plan naming a missing program or a folder that doesn’t exist; a second failure stops the run.
  4. The baseline: the host runs the contract’s checks and up to 10 of the project’s own, none that write files, on the untouched tree.
one send-back between them, per run
Mechanical screenhost code
A check you named in backticks that nothing runs; verification that can't fail, like npm test || true
sends the plan back
Contract screenClef · yes at 0.7
Runs if the first finds nothing. Skips a named check, needs a file it can't edit, breaks your rule, or would pass a wrong change
sends the plan back
Linthost code
A missing program, or a folder that doesn't exist
sends it backa second failure stops the run
Baselinehost code
Runs the contract's checks and up to 10 of the project's own, none that write files, on the untouched tree
the worker starts

Code first, Clef second. Clef reads the contract only if the mechanical screen finds nothing, and both share one send-back per run. The baseline is what the gate later compares against.

While the worker works

The host watches the worker and can steer or end it.

  • After each edit, it runs any per-file checks the plan names and shows the worker what broke.
  • Three identical failures of one command earn a steer, a host message to change course; five end the worker.
  • Every 8 tool calls, Clef reads whether the worker has drifted or is stuck: one sure reading at 0.85 steers it, a second ends it.

A worker that reports itself blocked goes to triage, where Clef reads why. A 0.8 reading of a missing tool or a question only you can answer pauses the run, retry unspent. Without Clef, only a missing program the worker names does.

The gate, then the judge

The gate, the host’s checks on the finished attempt, costs no tokens; the judge reads the work only after it passes.

  • Scope: a file changed outside the contract pauses the run; a frozen path touched stops it.
  • Verification: every verification command must exit 0.
  • Secrets: a scan fails a known key format the change adds, unless the worker marks its line as a fixture, which the judge sees.
  • Project checks count only if they fail twice. One then fails the change if it passed before, or shows a new failing test, more failures, or a check that Clef reads at 0.6 as failing in a new way.
  • Weaker checks: a rewritten script that checks less fails on a 0.65 Clef reading, and an added test that only checks the code ran on a 0.75 one. Without Clef, code catches only a script that can’t fail or is gone, or a test asserting nothing or only that something exists.
Scope
codeA file changed outside the contract pauses the runA frozen path touched stops it
nothing
Verification
codeEvery verification command must exit 0 or it fails
nothing
Secrets
codeA known key format the change adds failsunless the worker marks its line as a fixture, which the judge sees
nothing
Project checkscount only if they fail twice
codeFails the change if the check passed before, or shows a new failing test, or more failures
Clef · 0.6Or a check that fails in a new way, read at 0.6
Weaker checksa rewritten script, an added test
code, without ClefCatches only a script that can't fail or is gone, or a test asserting nothing or only that something exists
Clef · 0.65 · 0.75Fails a script that checks less at 0.65, or a test that only checks the code ran at 0.75. Any Clef answer replaces the code rule, so one under its bar passes a test the code would fail
Then the judge contracttestsscopeyour words Each lens passes or fails. An accept that fails a lens is a reject.

Where code and Clef part. Most checks are code alone. For a weakened script or an empty test, a Clef answer replaces the code rule, so one under its bar passes a test the code would fail.

The judge reads through four lenses, each pass or fail: the contract, the tests, the scope, and your own words, which every seat reads. An accept that fails a lens is a reject.

A reject goes to the retry, replanned first if the plan was at fault, once per route. A failed gate goes to the same retry, and spends the same one. A second failed gate stops the run. A reject after the retry pauses it instead, with the verified work kept, and Resume puts one more worker on the judge’s points. A Cowork issue run does not wait: its failing test decides, and a reject leaves the issue free for a new start.

When the lane or the last gate calls for one, the judge’s accept is not the end. A second reviewer, on a model none of the writers or the judge use, reads the same verified change without the judge’s verdict, and only its accept completes the run. A reject from either goes back like any reject.

What the shape really is

A writing run is a chain, not a parallel graph: one route at a time, one writing run per checkout. The only parallel work is up to four read-only readers in an analysis run, an investigation you ask for. With two or more routes, the host and the judge check the combined change once more; a failure there stops the run.

under 300 files
750,000 tokens
60 minutes of active time
300 to 999 files
1,125,000 tokens
90 minutes of active time
1,000 files or more
3,000,000 tokens
180 minutes of active time
every run, any size
40 attempts every step counts, the gate included

The host sizes a run’s tokens and active time by the files in the repository, and stops every run at 40 attempts, whichever limit it reaches first. Cache reads, pauses and the project’s own checks don’t count. A Cowork issue run pauses as Needs you at its tokens or time instead, and Resume gives it as much again.

Our simulator runs 36 scripted changes in seven languages through the real gate. We reported on 2026-09-24 that the gate got all 36 right with Jev and 34 on code alone, missing the Maven and Gradle build-file changes. We wrote those cases; we haven’t yet measured the gate on real projects, or Clef against its bars.

The working where each number comes from

Each number is from muxcode 0.12.7’s code, read on 2026-09-28, and read again in muxcode 1.0.5 on 2026-10-06, unless noted.

  • 0.7, 0.8, 0.85: Clef’s probability bars; policy, not yet measured. Read again in muxcode 1.0.6’s source on 2026-10-07 (the contract screen’s defect bar, block triage, and the worker, routing and gate readings), and in the Clef guide.
  • 0.91 and 0.52: made-up answers in the figure, to show a bar at work; not readings. Until 19 October 2026 the figures also showed 0.62 and 0.72.
  • 0.6, 0.65 and 0.75: the gate’s Clef bars for a new way of failing, a weakened check and a test that only checks the code ran, recalibrated in muxcode 1.0.12 on 2026-10-19 and checked on a separate set of 84 cases (intake.rs, CHANGELOG/1.070.md). Until then all three were 0.85.
  • Five seats: muxcode 1.0.12’s shipped workflow and preflight (orchestration.rs, workflow/preflight.rs), read on 2026-10-19. Until 1.0.27 the judge was GPT-6.1 Sol at high, on a model no writer used, and the retry was Claude Fable 5.1 at xhigh.
  • No plan re-read; retry and judge on Opus 5.5 at high; a judge may share the worker’s model; a quarter less cost: reviews_plans and shipped in muxcode 1.0.27’s orchestration/spec.rs, workflow/engine.rs and workflow/preflight.rs, read on 2026-11-13. The comparison is docs/benchmarks/2026-11-13-orchestration/results.json in muxcode: six tasks, one run each, on one roster (Claude Fable 5.2 Architect, Opus 5.5 worker). With the re-read and a GPT-6.1 Sol judge at max a run averaged $0.64 and 166 s; without the re-read and with an Opus 5.5 judge at high, $0.47 and 91 s. Every hidden check passed both ways. The shipped roster itself averaged $0.32 and 67 s; its predecessor was not run.
  • Root on DeepSeek V4.1 Flash, seats run on it until you sign in: shipped in muxcode 1.0.19’s orchestration.rs (stand_in_on_root, judge_on_root in preflight), read on 2026-10-28; the root moved in 1.0.16 (CHANGELOG/1.081.md) and the stand-ins came in 1.0.17 (1.082.md).
  • The issue workflow: every seat on mux’s included model at max, never solo, its first contract a failing test (orchestration.rs, workflow/engine.rs, workflow/reproduce.rs and CHANGELOG/1.091.md in muxcode 1.0.19), read on 2026-10-28.
  • 164 and 10 readings, 1.3% and 27%: the live comparison of 19 October 2026 in muxcode’s benchmark post, which is why effort and worker readings were removed in 1.0.12.
  • 4 readings at medium: sure at 0.92 to 0.98, in the first live run of the shipped worker, before effort readings were removed in muxcode 1.0.12.
  • Every 8 tool calls: the worker check’s interval, read in muxcode 1.0.6’s source on 2026-10-07.
  • Routing: who kept a package under 0.85 (a reasoning minimum, missing evidence, high risk), from the Clef guide on 2026-10-07. Worker routing was removed in muxcode 1.0.12.
  • 750,000 tokens, 60 minutes, 40 attempts: cache reads and pauses don’t count; every step is an attempt, the gate included. RUN_TOKENS and RUN_TIME_MS in muxcode 1.0.19’s workflow/engine.rs, read on 2026-10-28; the token limit was 500,000 until muxcode 1.0.12. An issue run that reaches the token or time limit pauses in place; the 40-step cap still ends it.
  • Limits by repository size: allowance in muxcode’s workflow/engine.rs, sized once from the untouched tree’s file count, from muxcode 1.0.21: 750,000 tokens and 60 minutes under 300 files, 1,125,000 and 90 under 1,000, and 3,000,000 and 180 at 1,000 or more. The large tier was 1,500,000 and 120 until commit 41c0fe92 of 3 November 2026, shipped in 1.0.22. Active time leaves out the project’s checks. Read at commit e8e813b2 on 2026-11-04.
  • Logic, UI or terminal: the kinds a contract may name, checked by muxcode 1.0.6’s workflow engine, read on 2026-10-07.
  • One retry for a failed gate or a reject: both go to the same retry, and a second failure on the route stops the run; muxcode 1.0.6’s workflow engine, read on 2026-10-07. Since muxcode 1.0.22, a judge’s reject after the retry pauses a run that is not an issue run, and Resume tries once more: retry and another_try in workflow/engine.rs at commit e8e813b2, read on 2026-11-04. A second failed gate, an issue run’s reject and a failed check on the combined change still stop it.
  • Lanes, 0.6, 0.85, 0.5 and 0.8: intake::lane and its cuts in muxcode 1.0.12 (CHECK_PROVES_AT, CONFINED_AT, SOLO_SUBTLE_BELOW, REVIEWED_AT), commit 844068b0, read on 2026-10-19.
  • 30-case holdout, no false solo, 9 of 10: lane-threshold-selection.json and lane.holdout.results.json in muxcode’s docs/benchmarks/2026-10-19-clef/; the cases were written by the authors of the questions.
  • 24 of 24, about 30% more tokens: single-vs-default.results.json, same folder: 46,943 against 36,036 mean billed tokens a run, on OpenAI models.
  • 16 of 19 and 10 of 19: Clef and Clef Flash on muxcode’s full calibration set, from muxcode 1.0.12’s changelog and all-hooks.clef.calibration.json.
  • 36 and 34 of 36: from the changelog of 2026-09-24, with live Jev and without; not re-run here.