Skip to content

Level 4: You Write the Specs

Level 4 on the autonomy ladder is the spec manager: the developer writes the specification and the stop condition, the agent runs for hours, and the human checks whether the tests pass rather than reading every diff. The tools for it are plan mode, /goal and /loop, hooks that enforce checks, test-driven runs, and compound engineering that feeds each run’s lessons back into the repository.

The spec is three sentences, the run is twelve hours, and the difference between a good morning and a wasted day is one line: what “done” means. Shapiro’s description of this rung (The Five Levels, January 2026) is deliberately unglamorous — you “write a spec”, then “leave for 12 hours, and check to see if the tests pass”.

Four artefacts exist before the agent starts, and none of them is the code.

A spec that states the outcome, the constraints and what is out of scope. A plan the agent produced and you read — plan mode’s entire job, and the cheapest review you will ever do. A stop condition a machine can evaluate. And an oracle: the tests, types and checks that decide whether the condition holds. The oracle is the part teams skip, and it is the part that makes leaving safe.

The route into it is the one you already run at Level 2, extended: a product brief becomes a plan, the plan becomes a task list, and the task list becomes the run. Cursor’s PRD workflow and plan mode cover both halves.

Goal-directed runs in Claude Code, Codex and Cursor

Section titled “Goal-directed runs in Claude Code, Codex and Cursor”

Checked against the vendors’ documentation on 28 August 2026.

CapabilityClaude CodeCodexCursor
A goal that ends the run/goal/goal/goal, since 19 August 2026
A prompt on a cadence/loopAbsent from the command list/loop bundled skill since Cursor 3.5 (20 May 2026)
Written guidance on framing the objectiveNot documented as of 2026-08-28Long-running workNot documented as of 2026-08-28

Claude Code. “Set a completion condition with /goal and Claude keeps working until it’s met, a model judges it impossible, or an error you have to fix clears the goal.” The evaluation is separate from the work: “After each turn, a small fast model checks whether the condition holds.” The condition can be up to 4,000 characters, and one goal is active per session. /loop is the cadence counterpart — “run prompts repeatedly, poll for status, or set one-time reminders within a Claude Code session” — with a self-paced delay between one minute and one hour when you omit the interval, and recurring tasks expiring seven days after creation.

Codex. /goal is in the developer commands, documented as “Set, edit, pause, resume, view, or clear a task goal.” Its Long-running work page is the only vendor guidance on writing the objective itself: “Write a goal that lets ChatGPT verify its own progress. Include three things when they apply: Outcome, Constraints, Verification.” There is no /loop.

Cursor. /goal arrived in the 19 August 2026 changelog and is documented as “Give the agent a long-lived objective to work towards until it’s fully complete. Rolling out.” /loop is not in the CLI slash-command reference, but it ships as a bundled skill since Cursor 3.5 (20 May 2026).

Two corrections for anyone working from older material: Codex does document /goal, and /loop exists in Claude Code and, as a bundled skill, in Cursor — Codex has none. Full walkthroughs live in the /goal command and the /loop command.

The five rules a stop condition has to satisfy

Section titled “The five rules a stop condition has to satisfy”
  1. One objective, one finish line. Two goals in one run give the checker two finish lines and it will thrash between them. Split them into two runs.
  2. The condition is a command. “Looks good” is not checkable; npm test exiting 0 is. Hand over the exact commands that prove progress.
  3. Name what to read first. The plan, the docs, one already-correct example. An agent that has to guess the target wanders.
  4. Ask for a checkpoint every round. A one-line progress log gives you somewhere to interrupt and makes a twelve-hour run auditable afterwards.
  5. Bound the blast radius, tests included. State what is out of scope and what must never be touched. A loop with no boundary will refactor your auth layer to make a test pass.

Hooks are the deterministic backpressure, and all three tools have them. Claude Code’s “run shell commands automatically when Claude Code edits files, finishes tasks, or needs input”; Codex’s “run scripts or MCP tools during the agentic loop”; Cursor’s “run before or after defined stages of the agent loop and can observe, block, or modify behavior”. A Stop hook that refuses to finish while the test suite is red converts your intention into a rule the run cannot talk its way past. Start with hooks in Claude Code.

Tests written before the run are the only part of the oracle the agent did not author. That is the whole argument for test-driven development with agents at this level: not purity, provenance.

Compound engineering is what stops every run starting from zero. Each finished run leaves behind a rule, a check or a skill, so the next one begins further along; the loop, the plugin, the evidence covers the mechanics, superpowers packages a disciplined version of it, and grill me is the alignment pass to run before a long job, not after.

When a twelve-hour run comes back green and wrong

Section titled “When a twelve-hour run comes back green and wrong”

The agent edited the oracle. If the tests live in the repository and the run may edit them, the condition is a suggestion. Name the test files as untouchable, or keep the decisive check outside the diff — in CI, in a separate package, in a command the run cannot rewrite.

Long horizons degrade. SlopCodeBench, published March 2026, put 15 coding agents through 36 problems and 196 checkpoints of iteratively extending their own work: “no agent fully solves any problem end-to-end, and the best agent passes 14.8% of checkpoints”, with degradation measured as structural erosion and verbosity. A twelve-hour run is a long horizon. Checkpoints exist so you can find where it turned.

The budget goes before the goal does. An unreachable condition burns a quota in one sitting. Give the run a round count and an instruction to report rather than continue.

The run never started. In Claude Code, /goal is implemented as a session-scoped Stop hook, so it is unavailable when hooks are disabled by settings. The command says so rather than failing silently — read the message before assuming the feature is broken.

Green is not correct. The tests passing means the tests passed. Spot-check the diff on the classes of change where a passing suite has never been sufficient: schema, auth, pricing, anything a customer can see.