Skip to content

Phase driver: run-phase.py runs each phase; implement-in-phases uses it (0.13.0) - #11

Merged
bryanwieg merged 15 commits into
mainfrom
phase-driver-run
Nov 24, 2026
Merged

bryanwieg merged 15 commits into
mainfrom
phase-driver-run

Conversation

@bryanwieg

@bryanwieg bryanwieg commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Second of two pull requests for the phase-driver plan (phases 04–06). Stacked on #10: the base is phase-driver; merge #10 first, then this one retargets to main.

What changes

  • scripts/run-phase.py, the phase driver. It runs one phase end to end: revise (when the phase has not started), start, each stage through route, can-try, claude-build.sh, record and commit with the retry ladder, the reviser when a ladder is used up or a builder stops, the phase review, a fix build for each fix/remove finding, finish, and a report with the stage-stats table. It exits 0 when the phase is built, 10 on a halt and 2 on bad usage. A halt is written into phase.json's record as {step, stage, reason, detail, next}, from 14 reasons, each with a fixed next. A rerun clears the halt and resumes from the records.
  • Models get packets, not JSON. plan-check.py PLAN_DIR --packet NN.n renders one stage's brief, plus the phase's role, why, how, before, after and test budget, into the builder's prompt. A fix build gets its finding as text. The reviser and the reviewer still write JSON, checked against the schemas.
  • The schemas leave nothing untyped. record.halt, record.built, the run records, the attempt usage fields and the revision hashes are now typed. validate accepts type lists and a schema as additionalProperties.
  • The driver guards the plan. A model call that changes a record is undone and halts. A build that edits or adds plan files is rejected. An accepted attempt whose commit fails is rejected before the halt. A rerun on a phase that is already built changes nothing.
  • The skill runs the driver. implement-in-phases/SKILL.md runs it and answers each halt from a table; build-guide.md describes what the driver does; stage-builder.md ends with a Result: line and has a fix section; model-selection.md describes the driver's loop. Version 0.13.0.

Validation

  • Tests: tests/test_run_phase.py drives the real script with a fake claude (tests/fake-claude.sh). It covers a full build, revise then halt, resume after a halt, a refused commit, files added to the plan, and a rerun on a built phase. The suite has 140 tests and passes.
  • 06.2, lower models ($0.70): the p2-multistep eval task, as a one-stage plan, on Opus and Haiku only. The driver exited 0 with no halt, and the eval's hidden check passes.
  • 06.3, real routing ($3.60, $2.55 of it Fable low): a one-stage plan that rewrites model-selection.md. It exercised premium routing, the reviser, a review finding fixed by the driver itself, two plan-gap halts answered as SKILL.md says, and a reopened stage rebuilt on a new revision. Its output is commit 1ef34a1.
  • Stall watchdog: claude-build.sh stops a call after CLAUDE_BUILD_STALL seconds (default 900) without output and exits 7; the driver undoes the call's edits and runs it once more, and a second stall halts stalled. The session clears a build-error itself when it can.
  • Details: both runs are written up in structured-implementation-notes.md.

Open question

SKILL.md lets the session clear a build-error halt itself when the detail shows how, such as a transient service error. The 06.1 brief had listed build-error among the halts that ask the user. It is left as built, pending a decision.

🤖 Generated with Claude Code

bryanwieg and others added 15 commits November 24, 2026 15:03
Stage: 04.2
Plan: docs/plans/phase-driver/04-driver-contracts.md
Tier: middle+
Tool: claude-code
Model: fable
Effort: low
Attempt: 1
Tokens: 593553
Cost: 1.89
Tool-Calls: unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stage: 04.1
Plan: docs/plans/phase-driver/04-driver-contracts.md
Tier: middle+
Tool: claude-code
Model: fable
Effort: low
Attempt: 1
Tokens: 249278
Cost: 0.62
Tool-Calls: unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stage: 04.3
Plan: docs/plans/phase-driver/04-driver-contracts.md
Tier: middle+
Tool: claude-code
Model: fable
Effort: low
Attempt: 1
Tokens: 683598
Cost: 1.71
Tool-Calls: unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes-Stage: 04.2
Plan: docs/plans/phase-driver/04-driver-contracts.md
Tier: middle+
Tool: claude-code
Model: opus
Effort: high
Attempt: 1
Tokens: 317203
Cost: 0.33
Tool-Calls: unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes-Stage: 04.1
Plan: docs/plans/phase-driver/04-driver-contracts.md
Tier: middle+
Tool: claude-code
Model: opus
Effort: high
Attempt: 1
Tokens: 103541
Cost: 0.18
Tool-Calls: unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stage: 05.1
Plan: docs/plans/phase-driver/05-driver-internals.md
Tier: middle+
Tool: claude-code
Model: fable
Effort: low
Attempt: 1
Tokens: 600562
Cost: 2.19
Tool-Calls: unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stage: 05.2
Plan: docs/plans/phase-driver/05-driver-internals.md
Tier: middle+
Tool: claude-code
Model: fable
Effort: low
Attempt: 1
Tokens: 444750
Cost: 1.74
Tool-Calls: unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes-Stage: 05.1
Plan: docs/plans/phase-driver/05-driver-internals.md
Tier: middle+
Tool: claude-code
Model: opus
Effort: high
Attempt: 1
Tokens: 546893
Cost: 0.54
Tool-Calls: unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes-Stage: 05.2
Plan: docs/plans/phase-driver/05-driver-internals.md
Tier: middle+
Tool: claude-code
Model: opus
Effort: high
Attempt: 1
Tokens: 170708
Cost: 0.29
Tool-Calls: unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stage: 06.1
Plan: docs/plans/phase-driver/06-cutover.md
Tier: middle+
Tool: claude-code
Model: fable
Effort: low
Attempt: 1
Tokens: 532945
Cost: 1.52
Tool-Calls: unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stage: 06.2
Plan: docs/plans/phase-driver/06-cutover.md
Tier: middle+
Tool: claude-code
Model: orchestrator
Effort: default
Attempt: 1
Tokens: unknown
Cost: unknown
Tool-Calls: unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Built by run-phase.py in the 06.3 trial run: one stage on Opus high, two
fix builds (a review finding, then revision 3 after a plan-gap halt),
revise and two reviews on Fable low. Adds a guide test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stage: 06.3
Plan: docs/plans/phase-driver/06-cutover.md
Tier: middle+
Tool: claude-code
Model: orchestrator
Effort: default
Attempt: 1
Tokens: unknown
Cost: unknown
Tool-Calls: unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude-build.sh stops a call that writes no stream line for
CLAUDE_BUILD_STALL seconds (default 900; the longest silence in 39
recorded runs was 130 s) and exits 7. run-phase.py undoes the stalled
call's edits and runs it once more; a second stall halts `stalled`.
SKILL.md: the session clears a build-error's cause itself and asks the
user only when it cannot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryanwieg
bryanwieg changed the base branch from phase-driver to main November 24, 2026 15:13
@bryanwieg
bryanwieg merged commit 54782d2 into main Nov 24, 2026
1 check passed
@bryanwieg
bryanwieg deleted the phase-driver-run branch November 24, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant