Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ae57d33
Plan: structured implement-in-phases (build-check.py, schemas, step g…
bryanwieg Nov 24, 2026
1ca84f4
01.1 Revision and review schemas
bryanwieg Nov 24, 2026
590b5d0
01.2 build-check.py interface with mock bodies
bryanwieg Nov 24, 2026
4d47781
01.3 Outcome tests, expected to fail
bryanwieg Nov 24, 2026
e85b855
Phase 01 built: status and notes
bryanwieg Nov 24, 2026
17fa13b
02.1 Start, record, can-try and spend
bryanwieg Nov 24, 2026
274d1c5
02.2 Commit, reject and finish
bryanwieg Nov 24, 2026
49e9260
03.1 Thin SKILL.md and step guides
bryanwieg Nov 24, 2026
a04b186
03.3 Notes, driver todo, README and version
bryanwieg Nov 24, 2026
064c397
CI: run the phased-delivery tests on pull requests
bryanwieg Nov 24, 2026
4312f37
Fix 02.1 review findings: renames, attempt numbers, paths, script errors
bryanwieg Nov 24, 2026
1e03273
Fix 02.2 review findings: one-line reasons, status after fixes, finis…
bryanwieg Nov 24, 2026
e6cc370
Phase 02 built: status, review and notes
bryanwieg Nov 24, 2026
8555603
03.2 Phase reviewer with closed finding types
bryanwieg Nov 24, 2026
80c28e7
03.4 Paid end-to-end run on p2-multistep
bryanwieg Nov 24, 2026
c9c27fd
Fix 03.2 review finding: plan-directory edits recorded in the Notes a…
bryanwieg Nov 24, 2026
d1ca4e9
Fix 03.1 review finding: record phase-level fixes against the stage t…
bryanwieg Nov 24, 2026
cb5dd40
Fix 03.4: list can-try and headless dispatch as not exercised
bryanwieg Nov 24, 2026
89aed44
Phase 03 built: status, review and notes
bryanwieg Nov 24, 2026
92c53d5
Work report for the implement-structured plan
bryanwieg Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Tests

# Run the phased-delivery plugin's test suite on every pull request and on
# pushes to main. The tests use only the Python standard library, git and
# POSIX sh; external CLIs (claude, codex) are stubbed.

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
pytest:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: python -m pip install pytest
- run: python -m pytest -q -p no:cacheprovider plugins/phased-delivery/tests
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@ is reported. The plan reviewer reports only a closed list of finding types.
It uses only the Python standard library; without Python, the planner writes
the phase files directly and checks by reading.

### Build checks

implement-in-phases follows the same pattern. Revising a phase ends in
`.build/NN-revision.json` (each stage's files, check commands and scores),
and `plugins/phased-delivery/scripts/build-check.py` does the bookkeeping:
it gates each build (no changed file outside the stage, every check
passes), refuses a model and thinking level already tried for the stage,
sums the premium spend for routing, and makes each stage, fix and phase
commit with its trailers. A ledger in `.build/` keeps every attempt, so a
resumed session picks up where it stopped. The phase reviewer writes
`.build/NN-review.json` with a closed list of finding types. SKILL.md is a
short outline; each step's directions are in its own guide.

Some tools, Codex among them, let subagents use a different model only when the
user asks. To allow it, add to the project's `AGENTS.md` or `CLAUDE.md`:

Expand Down Expand Up @@ -194,7 +207,7 @@ start (the ai-coding sandbox already sets it).

### Tracking which model did what

implement-in-phases commits each stage on its own, with trailers for the
implement-in-phases commits each stage on its own (`build-check.py commit`), with trailers for the
stage, plan, tier, model, effort, attempt, token count and cost, and gives later
fixes to a stage their own commits marked `Fixes-Stage:`. When the plan is
done, it writes `work-report.md` in the plan directory: per model and
Expand Down
189 changes: 189 additions & 0 deletions docs/plans/implement-structured/01-contracts.md

Large diffs are not rendered by default.

149 changes: 149 additions & 0 deletions docs/plans/implement-structured/02-internals.md

Large diffs are not rendered by default.

224 changes: 224 additions & 0 deletions docs/plans/implement-structured/03-cutover.md

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions docs/plans/implement-structured/design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Structured implementation: design

Agreed with the user on 2026-11-23. The plan in this folder builds it.

## Goal

implement-in-phases follows the architecture plan-in-phases now has: a
short SKILL.md that sends each step to its own guide, JSON written against
schemas where a step's result is read by something else, a script that
decides everything that needs no judgment, and a review limited to a
closed list of finding types. The LLM still orchestrates the phase.

## What stays the same

The routing, budget, retry ladder, premium spend limit, Codex rules,
commit trailers and work report keep their current meaning. They move from
SKILL.md into guides or into the script, not into new rules. The trailer
format is unchanged, so `stage-stats.sh` needs no change.

## Revision

Revising a phase against the repository ends in a revision JSON for the
phase, written against a schema: for each stage, the files it may change,
the check commands that show its "Done when", and its re-scored measures;
the verdict on each open assumption; and the adjustments made. The script
reads the revision JSON, not the phase file's prose, so plans written in
older layouts work too.

## Check gate

After each build, the script checks the stage: no file outside the stage's
files changed (edits present before the phase do not count), and every
check command passes. A failing check counts as a failed "Done when": the
stage goes to `route --up` as today. The orchestrator cannot accept a
stage past a failing check; it may still reject one that passes.

## Bookkeeping

The script owns the per-phase ledger: each attempt's tool, model, effort,
exit status, tokens, cost and check result. From it the script refuses a
pair already tried for the stage, reports the premium spend for
`route --premium-spent`, makes each stage commit (staging only the stage's
files, with the trailers from the ledger), and updates the phase file's
stage table and status line. The orchestrator no longer writes trailers
or sums spend by hand.

## Review

The phase reviewer reports only these finding types, each with file, line
and evidence: untraced change, check on internal data, bug or contract
mismatch, unmet "Done when" or "After", missing or wrong test, broken
assumption, project rule broken, and unneeded code (code nothing calls, a
wrapper or option no brief asks for, or duplicated logic). The open-ended
"a simpler structure exists" check is dropped. Findings are written as
JSON against a schema, each with its action: remove, fix, plan gap or
question.

## Validation

Offline tests run the script against temporary git repositories with no
model calls. One paid end-to-end run of the new skill on the builder eval
task `p2-multistep` (Opus, medium thinking, with a ceiling of about $8: the session capped at $2.40 plus the stage and review caps route prints; agreed with the user 2026-11-24) checks
that an agent follows the split guides; it runs only after the user
confirms its cost.

## Later

A driver script that owns the whole loop and calls `claude -p` for each
step (the draft on the `plan-phase-driver` branch) is recorded as a todo
for later investigation, not built here.
14 changes: 14 additions & 0 deletions docs/plans/implement-structured/models-available.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"tool": "claude-code",
"tool_version": "2.1.330",
"looked_up_from": "Agent tool parameter description (model and effort enums), 2026-11-23",
"subagent_model_choice": "allowed",
"opted_in": true,
"opt_in_where": "phased-delivery skills set model and effort per models.md",
"models": [
{"id": "fable", "efforts": ["low", "medium", "high", "xhigh", "max"]},
{"id": "opus", "efforts": ["low", "medium", "high", "xhigh", "max"]},
{"id": "sonnet", "efforts": ["low", "medium", "high", "xhigh", "max"]},
{"id": "haiku", "efforts": ["low", "medium", "high", "xhigh", "max"]}
]
}
46 changes: 46 additions & 0 deletions docs/plans/implement-structured/models.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Models

Generated by `scripts/select-models.py` from `models-available.json` and
the plugin's `model-profiles.json`; rerun it rather than editing this file.

Looked up: claude-code 2.1.330, from Agent tool parameter description (model and effort enums), 2026-11-23
Profiles: 438ab73a830ba4736e7ab9e51196e3b2c0ccfdc3ce65c2a7889d70081e9d9749 (data checked 2026-11-21); Data: Artificial Analysis (https://artificialanalysis.ai)
Subagent model choice: allowed
Score: intelligence; cost: run_cost_usd; best score 61.8; floors: top 97%, middle 85%, small 50%; cheaper within 3 points wins

| Tier | Model | Effort | Score | Cost | Report row |
| --- | --- | --- | --- | --- | --- |
| small | haiku | xhigh | 34.6 | 192.70 | Claude Haiku 5.5 (Xhigh) |
| middle | opus | high | 51.8 | 2715.98 | Claude Opus 5.5 (High, Default Fallback) |
| middle+ | fable | low | 53.9 | 2861.78 | Claude Fable 5.2 (Low, Default Fallback) |
| top | fable | high | 61.8 | 7105.77 | Claude Fable 5.2 (High, Default Fallback) |

Matches (tool model -> report model):
- fable -> Claude Fable 5.2 (alias: newest release containing the name)
- opus -> Claude Opus 5.5 (alias: newest release containing the name)
- sonnet -> Claude Sonnet 5.5 (alias: newest release containing the name)
- haiku -> Claude Haiku 5.5 (alias: newest release containing the name)

Candidates considered:
- fable at high: score 61.8, cost 7105.77
- fable at medium: score 56.4, cost 3359.66
- fable at low: score 53.9, cost 2861.78
- opus at high: score 51.8, cost 2715.98
- opus at medium: score 48.2, cost 2031.27
- sonnet at high: score 41.5, cost 1268.30
- opus at low: score 34.8, cost 979.66
- haiku at xhigh: score 34.6, cost 192.70
- sonnet at medium: score 30.8, cost 679.16
- haiku at high: score 29.9, cost 121.41
- sonnet at low: score 25.6, cost 499.20
- haiku at medium: score 24.6, cost 72.70
- haiku at low: score 18.6, cost 39.60

Excluded:
- fable at max: denied: above this model's high ceiling
- fable at xhigh: denied: above this model's high ceiling
- opus at max: denied: above this model's high ceiling
- opus at xhigh: denied: above this model's high ceiling
- sonnet at max: denied: above this model's high ceiling
- sonnet at xhigh: denied: above this model's high ceiling
- haiku at max: denied: above this model's xhigh ceiling
32 changes: 32 additions & 0 deletions docs/plans/implement-structured/work-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Work report: implement-structured

## Work by model

Range `ae57d33..HEAD`: 9 accepted stages, 5 later fixes.

| Model | Effort | Tool | Stages | First try | Clean | Failed tries | Fixes needed | Tokens spent | Wasted | Per stage |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| orchestrator | default | claude-code | 9 | 9/9 | 4/9 | 0 | 5 | 0 (+14 unknown) | 0 | n/a |
| **All** | | | 9 | 9/9 | 4/9 | 0 | 5 | 0 (+14 unknown) | 0 | |

### Reruns

None.

### Fixes after acceptance

- 03.4 (built by orchestrator default): Fix 03.4: list can-try and headless dispatch as not exercised; by orchestrator default, unknown tokens [cb5dd40]
- 03.1 (built by orchestrator default): Fix 03.1 review finding: record phase-level fixes against the stage they change; by orchestrator default, unknown tokens [d1ca4e9]
- 03.2 (built by orchestrator default): Fix 03.2 review finding: plan-directory edits recorded in the Notes are traced; by orchestrator default, unknown tokens [c9c27fd]
- 02.2 (built by orchestrator default): Fix 02.2 review findings: one-line reasons, status after fixes, finish rows and last commit; by orchestrator default, unknown tokens [1e03273]
- 02.1 (built by orchestrator default): Fix 02.1 review findings: renames, attempt numbers, paths, script errors; by orchestrator default, unknown tokens [4312f37]

## Reading

- **Effectiveness:** every one of the 9 stages was built by the orchestrator in the session and accepted first try, but only 4 of 9 are clean. The 5 fixes came from the two phase reviews. In phase 02 they were edge cases the briefs named only loosely: renames, a second fix of a stage, multi-line reasons, stages committed out of order, and a plan directory at the repository root. In phase 03 the cause was wording that conflicted between two guides. Nothing here judges a routed model, because none was dispatched.
- **Cost:** no token counts. The stages ran inside this session, which reports no per-stage usage. The paid costs were the review subagents (in-session, unreported) and the validation run in 03.4 ($0.84).
- **Candidates:** there's no evidence to change any tier's candidate: no stage went to a routed builder.

## Unknown token counts

All 14 commits (9 stages, 5 fixes) say `Tokens: unknown`, because they were built in the orchestrator session, which has no per-stage usage report.
2 changes: 1 addition & 1 deletion plugins/phased-delivery/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phased-delivery",
"version": "0.10.0",
"version": "0.11.0",
"description": "Plan work as self-contained phases, then implement it phase by phase.",
"author": {
"name": "Bryan"
Expand Down
Loading
Loading