@jesdi/skills 0.0.76 → 0.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +5 -0
  2. package/package.json +2 -1
  3. package/skills/implement-spec/ARCHITECTURE.md +102 -54
  4. package/skills/implement-spec/README.md +53 -51
  5. package/skills/implement-spec/SKILL.md +5 -6
  6. package/skills/implement-spec/driver.py +67 -153
  7. package/skills/implement-spec/driver_agents.py +75 -25
  8. package/skills/implement-spec/driver_decisions.py +92 -199
  9. package/skills/implement-spec/driver_dispute.py +189 -0
  10. package/skills/implement-spec/driver_final.py +196 -97
  11. package/skills/implement-spec/driver_fixloop.py +102 -192
  12. package/skills/implement-spec/driver_legacy.py +73 -5
  13. package/skills/implement-spec/driver_locked.py +186 -0
  14. package/skills/implement-spec/driver_merge.py +3 -48
  15. package/skills/implement-spec/driver_report.py +84 -64
  16. package/skills/implement-spec/driver_review.py +12 -119
  17. package/skills/implement-spec/driver_run.py +167 -130
  18. package/skills/implement-spec/driver_state.py +11 -9
  19. package/skills/implement-spec/models.json +0 -2
  20. package/skills/implement-spec/prompts/arbitration.md +34 -0
  21. package/skills/implement-spec/prompts/conflict.md +1 -0
  22. package/skills/implement-spec/prompts/correction.md +7 -4
  23. package/skills/implement-spec/prompts/elsewhere.md +6 -0
  24. package/skills/implement-spec/prompts/final-fixer.md +1 -1
  25. package/skills/implement-spec/prompts/final-lens.md +40 -0
  26. package/skills/implement-spec/prompts/final-reviewer.md +7 -7
  27. package/skills/implement-spec/prompts/fixer.md +2 -2
  28. package/skills/implement-spec/prompts/implementer.md +1 -1
  29. package/skills/implement-spec/prompts/lens-copy.md +1 -0
  30. package/skills/implement-spec/prompts/lens-correctness.md +8 -0
  31. package/skills/implement-spec/prompts/lens-spec.md +2 -0
  32. package/skills/implement-spec/prompts/lens-structure.md +2 -0
  33. package/skills/implement-spec/prompts/rebase-conflict.md +1 -0
  34. package/skills/implement-spec/prompts/rereview.md +0 -1
  35. package/skills/implement-spec/prompts/rerun.md +1 -1
  36. package/skills/implement-spec/prompts/reviewer.md +3 -6
  37. package/skills/implement-spec/prompts/ruled.md +3 -0
  38. package/skills/implement-spec/prompts/test-writer.md +4 -5
  39. package/skills/implement-spec/tests/test_agents.py +23 -22
  40. package/skills/implement-spec/tests/test_amendments.py +6 -48
  41. package/skills/implement-spec/tests/test_arbitration.py +314 -0
  42. package/skills/implement-spec/tests/test_cli.py +3 -3
  43. package/skills/implement-spec/tests/test_decisions.py +251 -374
  44. package/skills/implement-spec/tests/test_driver.py +22 -50
  45. package/skills/implement-spec/tests/test_final.py +45 -77
  46. package/skills/implement-spec/tests/test_fixloop.py +400 -633
  47. package/skills/implement-spec/tests/test_landing.py +23 -126
  48. package/skills/implement-spec/tests/test_lenses.py +217 -0
  49. package/skills/implement-spec/tests/test_merge.py +0 -43
  50. package/skills/implement-spec/tests/test_models.py +50 -1
  51. package/skills/implement-spec/tests/test_report.py +9 -23
  52. package/skills/implement-spec/tests/test_review.py +15 -153
  53. package/skills/implement-spec/tests/test_review_page.py +7 -3
  54. package/skills/implement-spec/tests/test_scoped.py +125 -0
  55. package/skills/implement-spec/tests/test_state.py +8 -3
  56. package/skills/implement-spec/tests/test_stops.py +43 -61
  57. package/skills/implement-spec/tests/test_tidy.py +77 -98
  58. package/skills/implement-spec/tests/test_walk.py +7 -6
  59. package/skills/review-page/SKILL.md +1 -1
  60. package/skills/test-prune/SKILL.md +10 -4
  61. package/skills/test-prune/prune.py +5 -4
  62. package/skills/test-prune/prune_repo.py +5 -0
  63. package/skills/test-prune/prune_strengthen.py +36 -5
  64. package/skills/test-prune/tests/test_prune_strengthen.py +144 -0
  65. package/skills/to-tickets/SKILL.md +1 -1
  66. package/skills-manifest.json +9 -9
  67. package/skills/implement-spec/prompts/corrected.md +0 -3
  68. package/skills/implement-spec/prompts/correctness.md +0 -42
  69. package/skills/implement-spec/prompts/final-scoped.md +0 -1
  70. package/skills/implement-spec/prompts/full-review.md +0 -2
  71. package/skills/implement-spec/prompts/overruled.md +0 -7
  72. package/skills/implement-spec/prompts/rejected.md +0 -1
  73. package/skills/implement-spec/prompts/restored-red.md +0 -3
  74. package/skills/implement-spec/prompts/restored.md +0 -3
  75. package/skills/implement-spec/prompts/stands.md +0 -2
@@ -16,8 +16,10 @@ Before any agent starts, the driver checks these. Each failed check prints one l
16
16
 
17
17
  - `.agent/` is gitignored and the worktree has no uncommitted change.
18
18
  - Each ticket file `NN-name.md` has a title, a **Blocked by** line and a **Seam** line, and the graph has no cycle (`driver_tickets.py`). A ticket needs one criterion or more, unless its Seam is `none — refactor`. A ticket needs a **Touches** line when the set has more than one ticket. The [to-tickets skill](../to-tickets/SKILL.md) has the line format.
19
- - Each model entry is valid, and the CLI of the first entry of each role is on PATH. For the correctness role, the entry is the first of its list on another provider than the first implementer entry: that list must have such an entry, and its CLI must be on PATH. This applies to every run, also when no ticket has a **Risk** line.
20
- - The `review-diff` skill is installed next to this one: the final review of every run reads it, and the correctness prompt carries its `correctness.md`, so the pass needs no read of a file that git ignores.
19
+ - The `--models` file names only roles of the skill's `models.json`. A `correctness` or `explorer` key is a role that was removed: the error says so, and that the key should be deleted from the file.
20
+ - Each model entry is valid, and the CLI of the first entry of each role is on PATH.
21
+ - The `final-reviewer` list has an entry on another provider than the first `implementer` entry: the correctness lens of the final review and the scoped review run on it. The error names the list and the implementer entry.
22
+ - The `review-diff` skill is installed next to this one, with its `spec.md` and `correctness.md`, and the `deep-quality-review` skill is next to this one, in `${CLAUDE_CONFIG_DIR:-~/.claude}/skills` or in `~/.agents/skills`: the lenses of the final review follow them. One error per lens names its skill and its missing file.
21
23
  - With `--push`, `--unattended` or `--base`, the repository has an `origin` remote.
22
24
  - Each model that the run can use answers one short test prompt (the preflight). A model that fails gives one line with its error. `--dry-run` skips the preflight.
23
25
 
@@ -25,14 +27,14 @@ A run that stopped is continued with the same command. `state.json` is the only
25
27
 
26
28
  One driver runs on a PR branch at a time. The driver holds a kernel file lock on `implement-spec/<key>.lock` in the git common directory (`git rev-parse --git-common-dir`) for the whole run. `<key>` is the PR branch as one name component: `%` becomes `%25` and `/` becomes `%2F`, so `feat/x` gives `feat%2Fx`. Each worktree of the repository shares that directory, so a second driver on the same PR branch, in the same worktree or in another one, ends with exit 3 and names the lock file. Drivers on different PR branches run at the same time: each ticket branch is `ticket/<key>/<NN>` and the recovery ref is `refs/implement-spec/<key>/recovery`, so two runs share no ref. Git refs are a tree, and one component per PR branch keeps the refs of one run from being a folder of the refs of another. The file is not in a worktree, so `git status` never shows it. The lock ends with its process, so a driver that was killed leaves no lock behind. `--dry-run` takes no lock. A wrong call in a worktree that has no `.agent/implement/` takes no lock and makes no file; where an earlier run left that folder, the driver takes the lock first, then makes the checks.
27
29
 
28
- A driver before this change named the ticket branches `ticket/<NN>` and the recovery ref `refs/implement/recovery`. An older driver holds `implement-spec.lock` in the git common directory alone for its whole run. Each newer driver also holds that file, shared, for its whole run: newer drivers do not stop each other, but while an older driver runs in the repository, a newer one ends with exit 3 and names that lock, and while a newer one runs, no older driver starts. A run that the newer driver started has `schema` 2 in `state.json`. When the newer driver resumes a run with no `schema`, it renames each `ticket/<NN>` that holds the start commit of the run and the tip that the run recorded, and moves `refs/implement/recovery` when it holds the recovery point of the run. It writes one ledger sentence for each, and then `schema`. A ref that git cannot rename ends the run with exit 3 and git's error, and nothing is lost.
30
+ A driver before this change named the ticket branches `ticket/<NN>` and the recovery ref `refs/implement/recovery`. An older driver holds `implement-spec.lock` in the git common directory alone for its whole run. Each newer driver also holds that file, shared, for its whole run: newer drivers do not stop each other, but while an older driver runs in the repository, a newer one ends with exit 3 and names that lock, and while a newer one runs, no older driver starts. A run that a newer driver started has a `schema` in `state.json`. When the newer driver resumes a run with no `schema`, it renames each `ticket/<NN>` that holds the start commit of the run and the tip that the run recorded, and moves `refs/implement/recovery` when it holds the recovery point of the run. It writes one ledger sentence for each, and then `schema`. A ref that git cannot rename ends the run with exit 3 and git's error, and nothing is lost.
29
31
 
30
32
  ## Flags
31
33
 
32
34
  | Flag | Meaning |
33
35
  |---|---|
34
36
  | `--gate COMMAND` | Required. The full gate: the whole check command of the repository, as one shell line. The driver runs it on each commit that would land on the PR branch and at the end of the run, with `IMPLEMENT_SPEC_BASE` set to the PR branch and no `IMPLEMENT_SPEC_LOCKED`. No agent is told this command. |
35
- | `--fast-gate COMMAND` | Required. The fast gate: the ticket's locked tests, lint and types, as one shell line. The driver runs it on each candidate (the tip an implementer, a fixer or a test-writer correction made) before its review, with `IMPLEMENT_SPEC_BASE` set to the PR branch and `IMPLEMENT_SPEC_LOCKED` set to the space-separated locked file paths it checks: for a candidate, the ticket's locked files; for the restore commit before a test-writer correction, the ticket's locked files plus each restored file. A merged ticket's locked files are not in a candidate's list. A green record is settled per tier and commit, whatever the list was: a commit is fast gated in one context. The implementer, the fixers and the final fixer run it on their own work: their prompts name this command and the same locked list, and for the final fixer the list is every merged ticket's locked files. No agent prompt names the `--gate` command. What it checks is the operator's choice. |
37
+ | `--fast-gate COMMAND` | Required. The fast gate: the ticket's locked tests, lint and types, as one shell line. The driver runs it on each candidate (the tip an implementer, a fixer or a test-writer correction made) before its review, with `IMPLEMENT_SPEC_BASE` set to the PR branch and `IMPLEMENT_SPEC_LOCKED` set to the space-separated locked file paths it checks: the ticket's locked files. Another ticket's locked files are not in a candidate's list. A green record is settled per tier and commit, whatever the list was: a commit is fast gated in one context. The implementer, the fixers and the final fixer run it on their own work: their prompts name this command and the same locked list, and for the final fixer the list is every merged ticket's locked files. No agent prompt names the `--gate` command. What it checks is the operator's choice. |
36
38
  | `--spec FILE` | Required without `--dry-run`. The spec file the prompts point at. Its first heading is the PR title. |
37
39
  | `--tickets DIR` | The directory of the ticket files. Default: `.agent/tickets`. |
38
40
  | `--models FILE` | A JSON file with one ordered list of `provider/model@effort` for each role. A role in this file replaces the list of that role in `models.json`. |
@@ -46,10 +48,10 @@ A driver before this change named the ticket branches `ticket/<NN>` and the reco
46
48
  | `--base BRANCH` | The branch of `origin` that the end of run rebases onto and that the PR goes into. Default: the default branch of `origin`. |
47
49
  | `--dry-run` | Validate, print `max frontier width: N`, change nothing. |
48
50
  | `--runner SCRIPT` | Test only. The driver calls `<script> <role> <prompt> <report>` in the slot, in place of the CLI. |
49
- | `--only ROLE` | Test only. Run one role (`test-writer`, `implementer`, `reviewer` or `correctness`) on the first ticket, with no gate and no merge. |
51
+ | `--only ROLE` | Test only. Run one role (`test-writer`, `implementer` or `reviewer`) on the first ticket, with no gate and no merge. |
50
52
  | `--help`, `-h` | Print the flags and exit. |
51
53
 
52
- Default timeouts in minutes: explorer 30, test-writer 30, implementer 90, reviewer 45, correctness 30, fixer 60, final-reviewer 60, conflict 30, pr-writer 20.
54
+ Default timeouts in minutes: test-writer 30, implementer 90, reviewer 45, fixer 60, final-reviewer 60, final-spec 60, final-correctness 60, final-structure 60, conflict 30, pr-writer 20.
53
55
 
54
56
  `run.sh` downloads `uv`, Python 3.13 and `jsonschema` once into `~/.cache/implement-spec`. `IMPLEMENT_SPEC_CACHE_DIR` moves that cache. `IMPLEMENT_SPEC_OFFLINE=1` forbids the download. `run.sh` supports macOS and Linux only, on x86_64 or ARM64, and needs `curl`, `tar` and `sha256sum` or `shasum` for the first download.
55
57
 
@@ -59,8 +61,8 @@ Default timeouts in minutes: explorer 30, test-writer 30, implementer 90, review
59
61
  |---|---|
60
62
  | 0 | Done: every ticket is merged and no question is open. Also the end of a valid `--dry-run`. In local mode without `--push`, nothing is pushed. |
61
63
  | 1 | A ticket is BLOCKED, or the end of run is BLOCKED. The other tickets ran as far as they could. |
62
- | 2 | Parked: a question of kind `locked-test`, `locked-test-again`, `review-stopped`, `review-rejected`, `implementer-stopped`, `fixer-stopped`, `merged-locked-file` or `final-finding` is open. Exit 2 wins over exit 1. |
63
- | 3 | Invalid input or a failed precondition: a usage error, a ticket error, a model error, an uncommitted change, a slot that cannot be made, another driver that runs on the same PR branch. No agent starts. The one exception: a review page that cannot be written gives exit 3 at the end of a run, after agents ran. |
64
+ | 2 | Parked: a question of kind `spec-ambiguous` or `ticket-blocked` is open. Exit 2 wins over exit 1. |
65
+ | 3 | Invalid input or a failed precondition: a usage error, a ticket error, a model error, an uncommitted change, a slot that cannot be made, another driver that runs on the same PR branch, an open question of a kind this driver no longer has (see "Resume"). No agent starts. The one exception: a review page that cannot be written gives exit 3 at the end of a run, after agents ran. |
64
66
  | 4 | Stopped: the CLI of an agent failed two times and wrote no report (for example, the account cannot use the model). The driver starts no other agent and lets the running agents end. No ticket is BLOCKED by it: fix the CLI or the model entry, then run the same command again to resume. |
65
67
  | 130 | The operator interrupted the run. The driver stops each agent. The work stays in the slots for the next run. |
66
68
 
@@ -99,51 +101,58 @@ Everything is under `.agent/`, which is never committed.
99
101
 
100
102
  A ticket is ready when each ticket in its **Blocked by** line is merged and no running ticket touches the same place. The places are the backticked entries of the **Touches** lines: `file` or `file: function`. Two entries are the same place when they name the same file and the same function, or when one of them names the whole file. Each ready ticket takes the lowest free slot.
101
103
 
102
- 1. **test-writer** (`prompts/test-writer.md`). It writes one black-box test for each criterion through the Seam and commits them red. Those files are locked. Its prompt names the locked tests of merged tickets: each fixture must set up the precondition of its scenario under the spec rules and those tests. When the ticket must change one of those files, the test-writer changes it and lists it in `locked`. A ticket with Seam `none — refactor` has no test-writer.
104
+ 1. **test-writer** (`prompts/test-writer.md`). It writes one black-box test for each criterion through the Seam and commits them red. Those files are locked. Its prompt names the locked tests of other tickets, merged or not: each fixture must set up the precondition of its scenario under the spec rules and those tests. When the ticket must change one of those files, the test-writer changes it and lists it in `locked`: it is the one role that may change a locked file. A ticket with Seam `none — refactor` has no test-writer.
103
105
  2. **implementer** (`prompts/implementer.md`). It starts from that commit and makes the locked tests green. It makes the fast gate (`--fast-gate`, with the ticket's locked files in `IMPLEMENT_SPEC_LOCKED`) green on its final commit before it reports DONE or DONE_WITH_CONCERNS.
104
106
  3. **Fast gate.** The driver runs `--fast-gate` on the ticket tip. No full gate runs on a candidate.
105
- 4. **Review.** The driver compares each locked file of the ticket with the test-writer commit. A file that differs is a critical finding `locked file changed: <path>`. A locked file of a merged ticket that the ticket changed since its merge base with the PR branch is a critical `fixture` finding `the ticket changed the locked file of a merged ticket: <path>`, so it goes to a correction (see **Before a correction**). Then the **reviewer** (`prompts/reviewer.md`) runs, and for a ticket with a **Risk** line the **correctness** pass (`prompts/correctness.md`) runs at the same time in the same slot. A read-only role (reviewer, correctness, final-reviewer, pr-writer) leaves its slot and the git config as it found them: all worktrees share one config, and one key written there, such as a `core.worktree` on a temp directory, breaks git in each of them. To run a check off the slot, a reviewer reads the driver's gate record or makes its own `git worktree add --detach` copy and removes it. After read-only roles, the driver checks the slot and the keys of the shared config (`git rev-parse --git-common-dir`, then `config`) against what they were before. One change does not count: a new `branch.<name>` section with only `remote` on a configured remote and `merge` on `refs/heads/...`, which another session's `git worktree add -b` writes while a review runs. When the slot or another key changed, the driver restores the slot and only the changed keys, so other sessions' writes stay; when git cannot write them back (a held `config.lock`, a valueless key), the whole file goes back, and when that fails too the ticket is blocked, writes `a read-only role broke its rule: ...` to the ledger, and runs the review one more time; a second change blocks the ticket.
107
+ 4. **Review.** The **reviewer** (`prompts/reviewer.md`) runs, the one agent of a ticket review. Its prompt holds the diff of each locked file of another ticket that the ticket's test-writer changed (`prompts/elsewhere.md`), to judge against the spec: a change that the spec does not support is a `fixture` finding. Its prompt carries the ticket's **Risk** line as one more criterion, or says that the ticket names no risk: a risk that the diff does not handle is a finding with basis `criterion`, under the same round and cap rules as any unmet criterion. A read-only role (reviewer, final-reviewer, the three lenses of the final review, pr-writer) leaves its slot and the git config as it found them: all worktrees share one config, and one key written there, such as a `core.worktree` on a temp directory, breaks git in each of them. To run a check off the slot, a reviewer reads the driver's gate record or makes its own `git worktree add --detach` copy and removes it. After a read-only role, the driver checks the slot and the keys of the shared config (`git rev-parse --git-common-dir`, then `config`) against what they were before. One change does not count: a new `branch.<name>` section with only `remote` on a configured remote and `merge` on `refs/heads/...`, which another session's `git worktree add -b` writes while a review runs. When the slot or another key changed, the driver restores the slot and only the changed keys, so other sessions' writes stay; when git cannot write them back (a held `config.lock`, a valueless key), the whole file goes back, and when that fails too the ticket is blocked, writes `a read-only role broke its rule: ...` to the ledger, and runs the review one more time; a second change blocks the ticket.
106
108
 
107
- The ticket reviewers put unmet criteria and merged-ticket regressions in `findings`; other observations go to final review. A re-review repeats its own open findings and can add regressions caused by the fix. Newly noticed issues outside that scope are deferred. The driver stores deferred observations in `observations-<round>.json` and gives them to the final reviewer.
109
+ The ticket reviewer puts unmet criteria and merged-ticket regressions in `findings`; other observations go to final review. A re-review repeats its own open findings and can add regressions caused by the fix. Newly noticed issues outside that scope are deferred. The driver stores deferred observations in `observations-<round>.json` and gives them to each lens of the final review.
108
110
  5. **Merge.** The driver merges the reviewed tip into the PR branch with git plumbing, then deletes the ticket branch. A conflict goes to the **conflict** agent (`prompts/conflict.md`) once. Its resolution may change no locked file of the ticket. A second conflict blocks the ticket. Before the PR branch moves, the driver runs the full gate (`--gate`) on the exact commit that would land: the ticket tip of a fast-forward, or the merge commit. A green fast record never counts for it.
109
- **The landing check.** Merges are serial. Before the PR branch moves, the driver compares the tree that is about to land (the ticket tip of a fast-forward, or the merge commit) with the PR tip: each locked file of each merged ticket must be the same tree entry in both: the same blob with the same mode, so a file that became a symlink is a difference. A file that only one of them has is a difference. A file that the landing ticket lists in its own `locked` is not checked: the test-writer of a later ticket can add a test to a file that an earlier ticket locked, and must list that file. A test-writer report that changes such a file and does not list it is rejected, with the usual one rerun. The review finds such a change first; the landing check catches a change that no review saw, for example of a ticket that merged after the last review. A difference refuses the landing: the ticket is BLOCKED with `locked file changed: <path>` in the ledger and a `merged-locked-file` question for each path, the PR branch does not move, and no fix round runs. `restore` puts the file back to the version of the PR branch in a commit of the driver on the ticket branch, and `adopt` adds the file to the ticket's `locked`; then the landing runs again with its gate. When that gate is red, the driver takes the restore commit back and asks again without the option that was tried. The PR branch moves only from the tip that the check read; when another hand moved the branch in between, the driver makes the merge, the check and the gate again, one time. Only that case starts the landing again: a refused landing blocks the ticket. A red full gate at landing is a gate finding inside the two rounds (see Findings and fix rounds); after `restore` or `adopt` rulings it asks again, as above. The second try runs no conflict agent, so a conflict there blocks the ticket, and so does a branch that moved again.
110
- **Before a correction.** A test-writer that corrects locked tests (after `overrule-test`, or for a `fixture` finding or a `test` finding on a locked file) starts from the locked versions: the driver puts back each locked file of the ticket and each locked file of a merged ticket that the ticket changed, commits them in one commit of its own, and the ledger names each file. A file of a merged ticket goes back to the version of the PR branch. The commit keeps the tree of the next fixer and of the gate clean, whatever files the correction commits. The correction's prompt names the restored files: when a test in one of them fails only because the ticket changed an interface that the test uses, the correction updates the file to the new interface, keeps what each test asserts, and lists the file in `locked`. Each correction also gets `prompts/corrected.md`: when it adds a requirement, it updates each shared fake or fixture that other locked tests use, runs each whole locked file and each locked test of merged tickets, and names each red test in `concerns`.
111
- **The gate of the restore.** In the fix loop, the tip before the restore has a green gate, so the driver runs the fast gate (never the full gate) on the restore commit, with the restored files in `IMPLEMENT_SPEC_LOCKED`, and does not leave the question to the correction. A red gate means that a restored file fails with the ticket's code: the correction gets the gate record (`prompts/restored-red.md`), and a DONE correction must list a restored file in `locked`; else it reports BLOCKED with `locked test contradicts spec:`. A green gate with only driver findings to correct closes them with the restore: no test-writer runs. After `overrule-test` the driver does not gate the restore, because the tip before it has no green gate; a change that the next implementer makes to a merged ticket's file is a finding of the next review.
111
+ **The landing.** Merges are serial. The PR branch moves only from the tip that the merge was made on; when another hand moved the branch in between, the driver makes the merge and the gate again, one time. A red full gate at landing is a gate finding inside the two rounds (see Findings and fix rounds). The second try runs no conflict agent, so a conflict there blocks the ticket, and so does a branch that moved again. Before the full gate, the commit that would land must leave every other ticket's locked file as the PR tip has it, but those the ticket lists in its own `locked`: a changed file, or a git error, blocks the ticket with one `ticket-blocked` question naming it, and the PR branch does not move. Its `retry` runs the implementer again from the ticket tip, whose locked-file check names the file until the ticket branch leaves it as the merge base has it. So a ticket's edit of a test file that another ticket locked later cannot land unseen.
112
+ **The locked-file check.** After the implementer, a fixer and the conflict agent report (DONE, BLOCKED or NEEDS_CONTEXT), the driver diffs the locked files: the ticket's own against its last test-writer commit, every other ticket's whose test-writer has run, merged or not, against the merge base of the ticket branch and the PR tip. Another ticket's file as the PR tip has it is no change; the ticket's own file is no change when it is the clean three-way merge (`git merge-file`) of its test-writer's version and the PR tip's, from their merge base, so a conflict merge can take in another ticket's listed change and keeps the test-writer's tests, and neither a conflict agent nor an implementer can put the file back to the PR tip's version. A changed locked file rejects the report with `locked file changed: <path>`, so the role runs once more on its next entry and then asks `ticket-blocked`. The baseline does not move with a rerun or a `retry`, so a breach left on the tip is found again. A test-writer correction (`prompts/correction.md`: after a `test-wrong` ruling, after `correct-test`, or for a `fixture` finding or a `test` finding on a locked file) changes only the files that it lists in `locked`. When it adds a requirement, it updates each shared fake or fixture that other locked tests use, runs each whole locked file and each locked test of merged tickets, and names each red test in `concerns`.
112
113
 
113
114
  Rules for each agent:
114
115
 
115
116
  - A call blocks until the agent ends. The driver does not poll.
116
117
  - An agent stops only the processes it started and their child processes, by PID, and never kills a process it did not start, nor uses `pkill`, `killall` or a `kill` by name or pattern: other slots and sessions share the machine. A process it did not start that blocks it goes into its concerns.
117
- - An agent gets one rerun: after a rejected report, after a timeout, or after it left the ticket branch. The rerun prompt is the first prompt plus the reason.
118
- - A report with status `BLOCKED` or `NEEDS_CONTEXT` blocks the ticket. From the reviewer or the correctness pass, it also asks a `review-stopped` question, and a report of theirs that the driver rejects two times asks a `review-rejected` question; from the implementer or a fixer, a `locked-test` question when a concern starts with `locked test contradicts spec:`, else an `implementer-stopped` or `fixer-stopped` question. Nothing left to change is no stop: the implementer and the fixer report it as DONE with no commit.
118
+ - An agent gets one rerun: after a rejected report, after a timeout, or after it left the ticket branch. The rerun prompt is the first prompt plus the reason. A ticket agent (test-writer, implementer, reviewer, fixer, conflict) whose report is rejected, or that reports `BLOCKED` or `NEEDS_CONTEXT`, reruns on the next entry of its model list, wrapping to the first (a list of one entry reruns on that entry); the reason is the driver's error or the agent's concerns. An agent of the end of run (a lens, the scoped final-reviewer, the final fixer, the rebase conflict agent, the pr-writer) does the same; the correctness lens and the scoped review rerun only on `final-reviewer` entries on another provider than the first `implementer` entry. After a timeout or a moved branch, the rerun is on the same entry.
119
+ - A ticket agent whose rerun stops or is rejected too blocks the ticket with a `ticket-blocked` question; an agent of the end of run blocks the end of run with a `final-ticket-blocked-<n>` question. An implementer or a fixer that disputes a locked test (see Disputed locked tests) gets no rerun: the reviewer arbitrates. Nothing left to change is no stop: the implementer and the fixer report it as DONE with no commit.
119
120
  - A BLOCKED ticket stops the tickets that it blocks. All other tickets run on.
120
121
 
121
122
  ### Findings and fix rounds
122
123
 
123
124
  | Finding | What the driver does |
124
125
  |---|---|
125
- | kind `fixture`, any severity; kind `test`, `critical` or `important`, on a locked file of the ticket; or any kind, `critical` or `important`, on a locked file of a merged ticket | One test-writer correction, outside the fix rounds. The fixer may not edit a locked file, so a fix round cannot close a `test` finding there. Only a correction may change a locked file of a merged ticket, and it lists the file in `locked`: a ticket whose Touches line names such a file gets its change this way, where a fixer's change would be put back (issue #116). The corrected files are the new locked versions, and the next review is a full review. A finding that the correction reports in `not_addressed` (it needs a production change first) becomes a finding of kind `code`, with the reason as its evidence, and goes to a fix round at once; the ledger says it was not corrected. A finding of this kind that is open in the review after the correction, or a correction that the driver rejects, blocks the ticket with a `locked-test-again` question. No correction runs after round 2. |
126
+ | kind `fixture`, any severity; kind `test`, `critical` or `important`, on a locked file of the ticket; or any kind, `critical` or `important`, on a locked file of another ticket | One test-writer correction, outside the fix rounds. The fixer may not edit a locked file, so a fix round cannot close a `test` finding there. Only a test-writer may change a locked file of another ticket, and it lists the file in `locked`: a ticket whose Touches line names such a file gets its change this way, where a fixer's change would be rejected (issue #116). The corrected files are the new locked versions, and the next review is a full review. A finding that the correction reports in `not_addressed` (it needs a production change first) becomes a finding of kind `code`, with the reason as its evidence, and goes to a fix round at once; the ledger says it was not corrected. A locked file is corrected at most once per ticket, by a review finding or after a `test-wrong` ruling: a finding that needs a second correction of it asks `spec-ambiguous`, with the finding as the second reading. A correction that is rejected twice asks `ticket-blocked`, whose `retry` reviews the tip again. No correction runs after round 2. |
126
127
  | `critical` or `important` | One fix round. |
127
- | `minor` | It stays in the ledger and in the findings file. The final reviewer gets the list. |
128
+ | `minor` | It stays in the ledger and in the findings file. Each lens of the final review gets the list. |
128
129
 
129
- A fix round has three steps: the **fixer** (`prompts/fixer.md`) makes the fast gate green on its final commit, as the implementer does; the driver runs the fast gate on the new tip; a re-review reads the range of the fix. A mutation proof is repeated only when the fix changed its production line. A fixer whose findings need no change, for example because a test-writer correction before it already resolved them, makes no commit and gives in `concerns` a reason for each finding; the round still counts, and the re-review of the same tip checks each reason.
130
+ ### Disputed locked tests
130
131
 
131
- A red fast gate on the commit of the implementer or of a fixer is a critical finding with source `gate`, titled `the fast gate is red on <sha7>`. Its file is the gate record, and the record holds the output. No review runs on that tip, and the next round starts: a red gate on the commit of the implementer starts round 1. The review after that round covers each fix since the last review and repeats each proof that one of them made due. A red fast gate after round 2 or on a test-writer correction blocks the ticket.
132
+ An implementer or a fixer that finds a locked test contradicting the spec or the ticket commits its work and reports BLOCKED with one concern per test: `locked test contradicts spec: <locked file>::<test>: <evidence>`. The driver rejects a dispute that names no locked file of the ticket (a path that ends the locked path counts, so `test_csv.py` names `tests/test_csv.py`) or that leaves uncommitted changes; the role then reruns on its next entry, as after any rejection.
133
+
134
+ The **arbitration** is the reviewer on its entry with `prompts/arbitration.md`: the ticket, the spec, the disputed tests and the dispute report. It is read-only, counts as a `reviewer` agent in `summary.md`, and is not a fix round. Its report `arbitration-<n>.json` gives per disputed test the `requirement` it checks, a `ruling` and a `reason`. On `test-wrong`, one test-writer correction (`correction-<n>.json`) runs with the ruling as a finding of kind `ruling` (`ruled-<n>.json`), then the role that disputed runs again on the corrected tests: the implementer, or the fixer of the same round. On `code-wrong`, that role runs again with the ruling in its prompt (`prompts/ruled.md`) and makes the test green. The review after a correction is a full review.
135
+
136
+ A locked file is arbitrated once and corrected once per ticket, keyed by the file, so a renamed or parametrized test of a ruled file is the same test. `state.json` keeps the ruling in the ticket's `disputes` and the correction in its `corrected`; no answer changes them. A second dispute on a ruled file, or a `test-wrong` ruling on a file corrected before, asks one `spec-ambiguous` question naming the test, the requirement and the two readings.
137
+
138
+ A fix round has three steps: the **fixer** (`prompts/fixer.md`) makes the fast gate green on its final commit, as the implementer does; the driver runs the fast gate on the new tip; a re-review reads the range of the fix. A fixer whose findings need no change, for example because a test-writer correction before it already resolved them, makes no commit and gives in `concerns` a reason for each finding; the round still counts, and the re-review of the same tip checks each reason.
139
+
140
+ A red fast gate on the commit of the implementer or of a fixer is a critical finding with source `gate`, titled `the fast gate is red on <sha7>`. Its file is the gate record, and the record holds the output. No review runs on that tip, and the next round starts: a red gate on the commit of the implementer starts round 1. The review after that round covers each fix since the last review. A red fast gate after round 2 or on a test-writer correction blocks the ticket.
132
141
 
133
142
  A red full gate on the commit that would land is a gate finding too, inside the same two rounds. The PR branch does not move and the merge lock is released. Before round 2, the driver adds a critical finding with source `gate`, titled `the full gate is red on <sha7>`, to the findings file of the last review, its file the full record, and the next round starts: the fixer (with `prompts/landing-red.md`) works on the ticket branch, its commit gets the fast gate and a re-review of the fix, and the landing runs a new full gate on the new commit that would land. When the red commit is a merge commit, the fixer's prompt also names that merge commit (`prompts/landing-merge.md`), so it can merge the PR branch to reproduce the failure. After round 2 a red full gate at landing blocks the ticket, with no third round.
134
143
 
135
144
  - Round 1 runs on the first entry of the implementer list; round 2 runs on the second. Both entries are required.
136
- - After round 2, a red gate or an unmet ticket criterion blocks the ticket and its dependents. Independent tickets continue. When the gate is green and criteria are met, other open findings move to the final must-fix list; the ticket can merge. A tip that changes a locked file of a merged ticket still gets a `merged-locked-file` question at its landing.
145
+ - After round 2, a red gate or an unmet ticket criterion blocks the ticket and its dependents. Independent tickets continue. When the gate is green and criteria are met, other open findings move to the final must-fix list; the ticket can merge.
137
146
 
138
147
  ### End of run
139
148
 
140
149
  The end of run starts only when every ticket is merged and every slot is idle. Its agents work in slot 1.
141
150
 
142
151
  1. **Tidy.** The driver saves the PR tip in `refs/implement-spec/<key>/recovery`. It then makes one commit for each ticket, in merge order, named `feat(NN): <title>`. Each commit holds the tests, the implementation and the fixes of its ticket. The tree of the new tip must equal the tree of the old tip, or the branch stays as it was.
143
- 2. **Rebase** onto the fetched tip of the `--base` branch, or without it of the default branch of `origin`. A conflict goes to the conflict agent (`prompts/rebase-conflict.md`) once, and the rebased tip gets the full gate.
144
- 3. **Full gate**, then the **final-reviewer** (`prompts/final-reviewer.md`) on the whole range, with the method of the `review-diff` skill. It reads the driver's full gate record of the reviewed tip as the gate of that method and runs no gate itself. It gets ticket observations, minor findings, the must-fix list and the rulings of the operator.
145
- 4. **Fix batch.** Critical and important findings, including every must-fix item, go to one fixer (`prompts/final-fixer.md`), which makes the fast gate green on its final commit, with every merged ticket's locked files in `IMPLEMENT_SPEC_LOCKED`. The driver names each of its commits `fix(NN): …` from the ticket in the report. Then the full gate, then one scoped review of those commits. The driver runs no fast gate at the end of the run.
146
- 5. Other findings open after the second review become questions of kind `final-finding`; unresolved must-fix items keep the run blocked. There is no third review.
152
+ 2. **Rebase** onto the fetched tip of the `--base` branch, or without it of the default branch of `origin`. A conflict goes to the conflict agent (`prompts/rebase-conflict.md`) once, and the rebased tip gets the full gate. When the agent leaves the rebase open with no conflict, the driver goes on with it, then checks the rebased tip, in place of the commits the report names: a report whose rebased tip changes a locked file of any ticket from the recovery point is rejected, and the rerun fixes that tip with `git commit --amend`. When git cannot go on at the stop the agent resolved (a resolved file it did not stage), the report is rejected with git's error and the agent reruns. A second conflict leaves the branch at its recovery point.
153
+ 3. **Full gate**, then the **final review**: three agents at the same time in slot 1, one for each lens of the `review-diff` method, on the whole range, each with the one lens prompt `prompts/final-lens.md` and its own method lines in it. `final-spec` follows review-diff's `spec.md` with the run's spec; `final-correctness` has review-diff's `correctness.md` inlined, reads files from git at the reviewed tip and runs no tests; `final-structure` follows the `deep-quality-review` skill. `final-spec` and `final-structure` run on the first `final-reviewer` entry, `final-correctness` on the first `final-reviewer` entry on another provider than the first `implementer` entry. Each reads the driver's full gate record of the reviewed tip as its gate evidence and runs no gate. Each gets ticket observations, minor findings, the must-fix list and the rulings of the operator, writes its own report and never sees another's. The driver merges their findings into one `findings-0.json`: each finding has a `source` (`spec`, `correctness` or `structure`), and two findings with the same file, line and title are one, the more severe one, or on a tie the earlier one in the order spec, correctness, structure. The ledger line of each finding names its source. A lens that stops or is rejected runs once more on the next entry; when the rerun stops or is rejected too, the round stops once the other lenses have ended, no fix batch runs, and the end of run asks `final-ticket-blocked-<n>`. The driver keeps each accepted lens report with the tip it covers (`run.final.lenses`): the next review of that tip runs only the lenses with no kept report, and a review of another tip runs all three. A lens that changes the slot makes all three run again.
154
+ 4. **Fix batch.** Critical and important findings, including every must-fix item, go to one fixer (`prompts/final-fixer.md`), which makes the fast gate green on its final commit, with every merged ticket's locked files in `IMPLEMENT_SPEC_LOCKED`. A report whose commits change a locked file of any ticket from the tidied tip is rejected naming the file, so the fixer runs once more on its next `fixer` entry. The driver names each of its commits `fix(NN): …` from the ticket in the report. Then the full gate, then one scoped review of those commits: the **final-reviewer** (`prompts/final-reviewer.md`), one agent on the entry of `final-correctness`, so on another provider than the first `implementer` entry. It reads the merged findings, checks that each critical and important one is fixed and that the fix commits break nothing else, and lists each must-fix item it verified in `resolved_must_fix`; a must-fix item it leaves out stays open. The driver runs no fast gate at the end of the run.
155
+ 5. Each critical or important finding the scoped review leaves open, a must-fix item too, asks one `final-ticket-blocked-<n>` question, and nothing is pushed while one is open. `retry` runs one more fix batch and one more scoped review on the open findings; `edit` keeps the end of run BLOCKED. There is no third review unless the operator answers `retry`.
147
156
  6. **Push.** With `--push` or `--unattended`, the driver pushes the reviewed tip once, with no force, and opens the PR into the branch of step 2 with `gh`, ready for review. The **pr-writer** (`prompts/pr-writer.md`) writes the body with the method of the `pr` skill; the driver puts the facts of the run after it: the ticket-to-commit map, the fix commits, the rulings and the review coverage (`prompts/pr-body.md`). The body carries the merge-risk block of the `pr-risk` skill under `## Merge Danger`, above the facts; the driver validates it, runs the pr-writer once more with the errors when it is invalid, and blocks the run, opening no PR, when the second body is invalid too. A push stops before any agent when no `pr` skill or no `pr-risk` skill is next to this skill, in `${CLAUDE_CONFIG_DIR:-~/.claude}/skills` or in `~/.agents/skills`. Without them it prints the two tips and the command to run again with `--push`.
148
157
 
149
158
  History rules:
@@ -160,6 +169,8 @@ A repository with no `origin` remote skips only step 2 and step 6. The tidied co
160
169
  - A green gate record is settled per tier and commit. The driver never runs the same tier again on that commit, and a green fast record never stands in for a full one. A `state.json` before `schema` 3 has one untiered list of green commits and one gate count: every gate then was the full gate, so the resume makes them the full tier.
161
170
  - A ticket whose recorded tip is not on its branch goes back to `implement`, from the test-writer commit. A merged ticket whose tip is not in the PR branch does the same.
162
171
  - A red full gate at landing moves the ticket to `fix`, advances its round and records the red commit in `landing`, in one write of `state.json`. A resumed run starts that round's fixer and does not gate the red commit again; the fixer's report clears `landing`.
172
+ - A `state.json` before `schema` 4 can hold questions of kinds this driver no longer has (`finding`, `locked-test`, `locked-test-again`, `review-stopped`, `review-rejected`, `implementer-stopped`, `fixer-stopped`, `merged-locked-file`, `final-finding`). An open one ends the run with exit 3 before any agent, naming each such question: answer it with the driver version that asked it, or start the run again. An answered one keeps the ruling sentence the older driver wrote, in the ledger and in the PR body (`driver_legacy.py` keeps those sentences; only a kind or an answer it does not know gets `Ruling: <NN> <kind> (<answer>): <subject>.`). Every answered question keeps its ruling sentence in `state.json`.
173
+ - A run of an older driver that stopped after its first final review round goes on to its fix batch and the scoped review with its `findings-0.json`, whose findings have no `source`; the findings of the scoped review have the source `final-reviewer`. A run that stopped inside that round runs the three lenses.
163
174
  - A slot with the uncommitted work of an interrupted role stays as it is. The role runs there again and is told so.
164
175
 
165
176
  ## Models
@@ -171,7 +182,7 @@ A repository with no `origin` remote skips only step 2 and step 6. The tidied co
171
182
  | `anthropic` | `claude -p` | low, medium, high, xhigh, max |
172
183
  | `openai` | `codex exec` | minimal, low, medium, high, xhigh |
173
184
 
174
- The driver uses the first entry of a role. The fixer of a ticket runs on the `implementer` list; the `fixer` list is only for the fix batch of the final review. Round 2 uses the second implementer entry, which the model list must supply. The correctness pass takes the first correctness entry of another provider than the first implementer entry. The reviewer never does the correctness pass: when the list has no such entry, or the CLI of that entry is not on PATH, the run ends with exit 3 before any agent. The `explorer` list is read and checked, but the driver starts no explorer.
185
+ The driver uses the first entry of a role; the rerun of an agent that stopped or was rejected uses the next entry (round 2's fixer wraps to the first `implementer` entry). The fixer of a ticket runs on the `implementer` list; the `fixer` list is only for the fix batch of the final review. Round 2 uses the second implementer entry, which the model list must supply. The three lenses of the final review have no list of their own: they run on `final-reviewer` entries, and a `--models` file that names a lens is refused as an unknown role.
175
186
 
176
187
  The defaults need both `claude` and `codex` on PATH. The `openai` defaults name the full Codex model names (`gpt-6-astra`, `gpt-6.1-sol`), because a Codex CLI that is signed in with a ChatGPT account does not accept the short aliases. Read "Known limits" before you use them as they are.
177
188
 
@@ -179,16 +190,17 @@ The defaults need both `claude` and `codex` on PATH. The `openai` defaults name
179
190
 
180
191
  Each agent writes one JSON report. The schema of a role is the `json` block of its prompt template, so the agent reads the text that the driver enforces. `driver_report.py` `validate` checks the report against the schema, against git and against the log of the agent. A field that the schema does not name is ignored.
181
192
 
182
- Every report has `status` (`DONE`, `DONE_WITH_CONCERNS`, `NEEDS_CONTEXT`, `BLOCKED`), `files` and `concerns`. A role that commits also has `commits`. A read-only role (reviewer, correctness, final-reviewer, pr-writer) has none: a reviewer reads `commits` as the commits it reviews, and the driver would refuse each of them as not new. The driver checks instead that a read-only role leaves its slot on the tip it got, with a clean tree.
193
+ Every report has `status` (`DONE`, `DONE_WITH_CONCERNS`, `NEEDS_CONTEXT`, `BLOCKED`), `files` and `concerns`. A role that commits also has `commits`. A read-only role (reviewer, final-reviewer, the three lenses, pr-writer) has none: a reviewer reads `commits` as the commits it reviews, and the driver would refuse each of them as not new. The driver checks instead that a read-only role leaves its slot on the tip it got, with a clean tree.
183
194
 
184
195
  | Role | Template | More fields | Checks after the schema |
185
196
  |---|---|---|---|
186
- | test-writer | `prompts/test-writer.md` | `locked` (test file paths), `red` (`test`, `line`), optional `fixtures` (each locked file that holds no test, as a fake `gh`) | The driver reads a test node id `<file>::<test>` in `locked` as its file. Each fixture is in `locked`; the ticket record keeps it a fixture until a later correction lists the file again. With DONE: one commit, one locked file and one red line or more. A correction's test can be green on the implementer's code, so its red line comes from a production edit that the correction makes and reverts. No locked path contains whitespace, since `IMPLEMENT_SPEC_LOCKED` separates the paths by spaces. Each locked path is in a commit that the role made and is a file at the tip: a correction that deletes a locked file leaves it out of `locked`. Each `line` is in the log. A locked file of a merged ticket that the role changed is in `locked`. A correction (after `overrule-test`, or for a review finding) changes only the files that it lists in `locked` and the files that the driver restored before it. When the gate is red on the restore commit, a DONE correction lists a restored file in `locked`. Each `not_addressed[].finding` is the title of a finding of the correction, or after `overrule-test` an overruled concern as its prompt lists it (the driver logs its reason, and the implementer runs again); a DONE correction with each of its findings there needs no commit. |
187
- | implementer | `prompts/implementer.md` | `green` | With DONE and no commit: no new commit on the branch, no uncommitted change, and a concern that says why the start needs no change. The driver then gates and reviews the start commit. |
188
- | reviewer | `prompts/reviewer.md` | `findings` (`severity`, `file`, `line`, `title`, `evidence`, `kind`), `mutations` (`test`, `file`, `line`, `red`) | In a full review (one with no fix range: round 1, and the review after a test-writer correction): `mutations` is required, with a proof for each locked test file (`test` is `<locked file>::<test name>`). A locked fixture needs no proof: it holds no test that a proof could name, and the locked-file check protects it. Neither does a locked file that is not at the reviewed tip. Each `red` is in the log. |
189
- | correctness | `prompts/correctness.md` | the same as the reviewer | `mutations` is optional. |
197
+ | test-writer | `prompts/test-writer.md` | `locked` (test file paths), `red` (`test`, `line`) | The driver reads a test node id `<file>::<test>` in `locked` as its file. With DONE: one commit, one locked file and one red line or more. A correction's test can be green on the implementer's code, so its red line comes from a production edit that the correction makes and reverts. No locked path contains whitespace, since `IMPLEMENT_SPEC_LOCKED` separates the paths by spaces. Each locked path is in a commit that the role made and is a file at the tip: a correction that deletes a locked file leaves it out of `locked`. Each `line` is in the log. A locked file of another ticket whose test-writer has run, merged or not, that the role changed is in `locked`. A correction changes only the files that it lists in `locked`. Each `not_addressed[].finding` is the title of a finding of the correction (the driver logs its reason); a DONE correction with each of its findings there needs no commit. |
198
+ | implementer | `prompts/implementer.md` | `green` | With DONE and no commit: no new commit on the branch, no uncommitted change, and a concern that says why the start needs no change. The driver then gates and reviews the start commit. With BLOCKED, a dispute names a locked file of the ticket and leaves no uncommitted change (also for the fixer). |
199
+ | reviewer | `prompts/reviewer.md` | `findings` (`severity`, `file`, `line`, `title`, `evidence`, `kind`) | None. |
200
+ | reviewer, arbitrating | `prompts/arbitration.md` | `rulings` (`test`, `requirement`, `ruling`: `test-wrong` or `code-wrong`, `reason`) | One ruling for each disputed test, its id as the dispute gives it. |
190
201
  | fixer | `prompts/fixer.md` | `green`, `ticket` | With DONE and no commit: no new commit on the branch, no uncommitted change, a gate that is green on the start, and a concern that names each finding of the round. |
191
- | final-reviewer | `prompts/final-reviewer.md` | `findings` | None. |
202
+ | final-spec, final-correctness, final-structure | `prompts/final-lens.md`, with the lines of `prompts/lens-<source>.md` | `findings` | None. |
203
+ | final-reviewer (the scoped review) | `prompts/final-reviewer.md` | `findings`, `resolved_must_fix` | None. |
192
204
  | pr-writer | `prompts/pr-writer.md` | `body` | None. |
193
205
  | fixer of the final review | `prompts/final-fixer.md` | `green`; `commits` is a list of (`sha`, `ticket`) | Each new commit on the branch is in `commits`, with a ticket of the run. |
194
206
  | conflict | `prompts/conflict.md`, `prompts/rebase-conflict.md` | none | With DONE: one commit or more. No locked file may change. |
@@ -201,36 +213,26 @@ A question is a bounded choice for the operator. `driver_decisions.py` `KINDS` h
201
213
 
202
214
  | Kind | Question id | Asked when | Run exit | Options |
203
215
  |---|---|---|---|---|
204
- | `locked-test` | `<NN>-locked-test-<n>` | An implementer or a fixer reports BLOCKED with a concern that starts with `locked test contradicts spec:`. Asked again on the same test, from the same report, when the driver refuses the report of the correction after `overrule-test` and its rerun, or the correction reports BLOCKED. | 2 | `overrule-test`: the test-writer corrects the test from that report, then the implementer runs again, and the fix rounds count from 0: the corrected tests are a new contract. `overrule-implementer` (recommended): the implementer runs again. |
205
- | `finding` | `<NN>-finding-<n>` | Existing runs created under the earlier four-round policy can still contain this question; the two-round policy creates no new ones. | 1 | `accept`: close the finding. `split` (recommended) and `redesign`: keep the ticket BLOCKED. |
206
- | `locked-test-again` | `<NN>-locked-test-again-<n>` | A finding for a test-writer correction is open in the review right after a correction, or the driver rejects the correction's report (for example, it changes a file that it does not list in `locked`). One question for each finding. | 2 | `correct-again` (recommended): the ticket resumes from the review, and that review's findings get one more correction. `accept`: no more correction runs for the ticket, its locked tests stay as they are, and the ticket goes on to its fix rounds with its other findings; a changed locked file is still restored. `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. After two `correct-again` stops on a ticket, its next question offers only `accept` (recommended) and `redesign`, so a test-writer and a reviewer that never agree cannot loop. |
207
- | `review-stopped` | `<NN>-review-stopped-<n>` | The reviewer or the correctness pass reports `BLOCKED` or `NEEDS_CONTEXT`. One question for each agent that stopped. | 2 | `retry` (recommended): the ticket resumes from the review, and each agent of the review runs again. `accept`: the same, and for the rest of the ticket a `BLOCKED` or `NEEDS_CONTEXT` report of that agent does not stop it: the review goes on with that report's findings and those of the other reports. `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. |
208
- | `review-rejected` | `<NN>-review-rejected-<n>` | The driver rejects the report of the reviewer or the correctness pass, and the report of its rerun too (for example, no mutation proof for a locked test file). One question for each agent. | 2 | `retry` (recommended): the ticket resumes from the review, each agent of the review runs again, and the first prompt of the rejected agent says why the driver rejected it. `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. |
209
- | `implementer-stopped` | `<NN>-implementer-stopped-<n>` | The implementer reports `BLOCKED` or `NEEDS_CONTEXT`, and no concern starts with `locked test contradicts spec:`. | 2 | `retry` (recommended): the implementer runs again from the tip it left. `accept-tip`: the driver gates and reviews that tip, and the fix rounds close what the review finds. `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. |
210
- | `fixer-stopped` | `<NN>-fixer-stopped-<n>` | A fixer reports `BLOCKED` or `NEEDS_CONTEXT`, and no concern starts with `locked test contradicts spec:`. | 2 | `retry` (recommended): the round that stopped does not count; the driver gates and reviews the tip the fixer left, and a fixer runs that round again on the review's findings. `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. |
211
- | `merged-locked-file` | `<NN>-merged-locked-file-<n>` | The landing check refuses the landing: the tree that would land changes this locked file of a merged ticket. One question for each file. | 2 | `restore` (recommended): the driver puts the file back to the version of the PR branch in a commit of its own on the ticket branch, and the ticket resumes from its landing. `adopt`: the ticket adds the file to its `locked`, so its change lands, and resumes from its landing. `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. When the merge gate is red after `restore` or `adopt`, the driver takes the restore commit back and asks again, without the option that was tried. |
212
- | `final-finding` | `final-finding-<n>` | A finding is open after the second round of the final review. | 2 | `fix` (recommended): the finding stays open and nothing is pushed. `accept`: close the finding. |
216
+ | `spec-ambiguous` | `<NN>-spec-ambiguous-<n>` | A second dispute on a locked file that the reviewer ruled on in the ticket, or a second correction needed for a locked file of the ticket (a `test-wrong` ruling or a review finding on a file corrected before). The subject names the test, the requirement and the two readings; the evidence is `spec-ambiguous-<n>.json`. | 2 | No option is recommended. `keep-test`: the role that disputed runs again against the test; after a review finding, the ticket resumes from the review and findings on that file are closed. `correct-test`: one more correction, to the second reading, then the role that disputed runs again (the fixer of the same round after the review of its round); after a review finding, the review runs again. `edit-spec`: the ticket stays BLOCKED, with the ruling in the ledger. None of them changes the ticket's `disputes` or `corrected`. |
217
+ | `ticket-blocked` | `<NN>-ticket-blocked-<n>`, `final-ticket-blocked-<n>` | A ticket agent (test-writer, implementer, reviewer, fixer, conflict) or an agent of the end of run stopped with `BLOCKED` or `NEEDS_CONTEXT` or was rejected, and its rerun on the next entry of its list did too; or a finding is open after the scoped review of the final fix batch (one question per finding). The subject names the role and the reason, or the finding. | 2 | `retry` (recommended): the role runs again on its first entry from the tip the ticket left, with its one rerun; for a fixer, the round that stopped does not count: the driver gates and reviews the tip, and a fixer runs that round again on the review's findings. An arbitration or a correction runs for another role, so its work is not kept: after a dispute, the role that disputed runs again from the tip before them; after a review correction, the driver reviews that tip again. For the end of run, the stopped agent runs again from where the end of run is; for an open finding, one more fix batch and scoped review run. `edit`: the ticket, or the end of run, stays BLOCKED, with the ruling in the ledger, so the spec or the ticket can be edited. |
218
+
219
+ `final-finding` (fix or accept a finding open after the second round of the final review) became a `ticket-blocked` question of the end of run, id `final-ticket-blocked-<n>`: whether one more batch runs is the operator's call, and nothing ships with an open finding, so there is no `accept`.
213
220
 
214
221
  `n` counts the questions of that ticket and kind in the run, so an id is never used twice. An open question of a ticket that has merged is dropped, with a ledger line: it leaves `decisions.json` and parks no run.
215
222
 
216
223
  Answer with `--answer <question id>=<option id>` on the next run, or through the page, which gives `.agent/implement-answers.json`. An answers file counts only when it is submitted and its `revision` equals the `revision` of `decisions.json`. The driver ignores any other file or answer and says so in the ledger. Each answer becomes one `Ruling:` sentence in the ledger.
217
224
 
218
- ## The five non-negotiable checks
225
+ ## The non-negotiable checks
219
226
 
220
227
  | Check | Where it lives |
221
228
  |---|---|
222
- | Locked tests with a demonstrated red | `driver_report.py` `_proof_errors`: each red line of the test-writer report must be in its log. `driver_review.py` `locked_findings`: a locked file of the ticket that differs from the test-writer commit is a critical finding, before each review. `driver_review.py` `merged_changes`: a locked file of a merged ticket that the ticket changed is a critical `fixture` finding, before each review. `driver_merge.py` `refused`, called from `driver.py` `_checked_landing` under the merge lock: a locked file of a merged ticket that differs between the PR tip and the tree that is about to land refuses the landing with a `merged-locked-file` question, so a later ticket changes the locked test of an earlier one only by the operator's `adopt`. `driver_report.py` `_merged_errors` rejects a test-writer report that changes such a file and does not list it. |
223
- | One mutation proof for each locked test | `prompts/full-review.md`, the note of each full review, names the locked test files that need a proof: each locked file that is not a fixture. `driver_report.py` `_locked_errors` and `_proof_errors` reject a full review with no proof for a locked test file, or with a red line that is not in the log. `driver_review.py` `follow` finds the proofs that a fix makes due again. |
224
- | One independent correctness pass for each risky ticket | `driver_fixloop.py` `_review` adds the pass for a ticket with a **Risk** line. `driver_agents.py` `correctness_entry` picks the entry of another provider, and `load_models` stops the run when there is none or its CLI is not on PATH. |
225
- | One fast gate for each candidate | `driver_gate.py` `run`, called from `driver_run.py` `Run.gate` with the tier: one record for each tier and commit the driver is about to trust. Green is exit 0 on a tree that is clean before and after, with HEAD not moved. `driver_fixloop.py` `_gate` fast-gates each candidate. |
226
- | Post-merge check on the PR branch | `driver.py` `_checked_landing`: the full gate runs on the commit that would land, a fast-forward as well as a merge commit, before the PR branch moves to it. `driver_final.py` `_review_until_reviewed` runs the full gate again after the tidy and after the fix batch. |
227
-
228
- The driver enforces the mutation proof for each locked test file, not for each locked test.
229
+ | Demonstrated red plus green for locked tests | `driver_report.py` `_red_errors`: each red line of a test-writer report (and of a correction) must be in its log. `driver_gate.py` `run`, called from `driver_run.py` `Run.gate` and `driver_fixloop.py` `_gate`: the fast gate gets the ticket's locked files in `IMPLEMENT_SPEC_LOCKED` and must be green on the candidate before its review. |
230
+ | Locked files changed only by the test-writer | `driver_locked.py` `errors`, one diff check after the implementer, a fixer, the ticket conflict agent, the final fixer and the rebase conflict agent report (the baseline from `for_ticket`, or at the end of run `for_end_of_run`): the ticket's own locked files against its last test-writer commit, every other ticket's against the merge base of the branch and the PR tip, at the end of run every ticket's against the tidied tip (for the rebase conflict agent, the recovery point). A changed file rejects the report. `driver.py` `_refuse_breach` (with `driver_locked.py` `landing_errors`), under the merge lock: the commit that would land against every other ticket's locked files as the PR tip has it; a changed file blocks the ticket with one `ticket-blocked` question. `driver_locked.py` `_unlisted_errors`: a test-writer that changes another ticket's locked file must list it in `locked`, and the reviewer gets its diff (`prompts/elsewhere.md`) to judge against the spec. |
231
+ | The full gate at landing and at the end of run | `driver.py` `_checked_landing`: the full gate runs on the commit that would land, a fast-forward as well as a merge commit, before the PR branch moves to it. `driver_final.py` `_review_until_reviewed` runs it after the tidy and after each fix batch. |
232
+ | The ticket reviewer and the final correctness lens (and the scoped review) on another provider than the implementer | `models.json`: the `reviewer` list starts on another provider than the `implementer` list, which a `--models` file can change. `driver_agents.py` `other_provider_entries`: the correctness lens and the scoped review run and rerun only on `final-reviewer` entries of another provider than the first `implementer` entry; `load_models` refuses a list with no such entry before any agent, and the preflight checks that entry. |
229
233
 
230
234
  ## Known limits
231
235
 
232
236
  - **A `codex` agent cannot commit.** A role that commits (test-writer, implementer, fixer, conflict) on an `openai` entry runs with `--sandbox workspace-write`, and that sandbox cannot run `git commit`. If a custom `--models` file assigns such an entry to a committing role, replace it with an entry whose CLI can commit in the ticket worktree.
233
- - **A `codex` reviewer cannot make a mutation proof.** A reviewer on an `openai` entry runs with `--sandbox read-only` and cannot make the temporary edit. The default `models.json` has such an entry first for the reviewer, and each full review needs the proofs. What to do: give a `--models` file whose reviewer list starts with an `anthropic` entry.
234
- - **The correctness pass reads a tree that the reviewer changes.** The two agents share one slot, and the reviewer makes temporary edits. `prompts/correctness.md` tells the pass to read from git at the reviewed commit and to run no tests. It reads only the spec, the ticket and the findings file from the working tree, because git can lack them: `.agent/` is ignored. That rule is the only guard: the driver cannot enforce it, so a pass that ignores it can report a false finding and start a fix round. What to do: when a correctness finding looks wrong, compare it with `git show <reviewed commit>:<file>` before you rule on it.
235
237
  - **A ticket that is not merged stops the end of run.** While one ticket is BLOCKED, there is no tidy and no final review of the merged tickets.
236
238
  - **A published PR branch keeps its history.** See "End of run".
@@ -11,12 +11,11 @@ Changes: the method is carried by a deterministic driver (run.sh, driver*.py), n
11
11
  this session; this file only starts the driver. The method text is in the prompt
12
12
  templates (prompts/*.md) and in README.md. The driver keeps what this fork added
13
13
  to upstream: a model list per role; a context-isolated test-writer that commits
14
- locked acceptance tests at the ticket's Seam; a review before each merge with a
15
- mutation proof per locked test file; at most 2 fix rounds with escalation at round 2;
16
- a correctness pass on another provider for a ticket with a Risk line; one gate
17
- record per trusted commit, run by the driver; tickets that touch the same function
18
- run in sequence; a gate on each merge commit; one commit per ticket before the
19
- final review; no push and no PR until every ticket is merged and the final review
14
+ locked acceptance tests at the ticket's Seam; a review before each merge by one
15
+ reviewer, with the ticket's Risk line as one more criterion; at most 2 fix rounds
16
+ with escalation at round 2; one gate record per trusted commit, run by the driver;
17
+ tickets that touch the same function run in sequence; a gate on each merge commit; one commit per ticket before the
18
+ final review; a final review by the three lenses of review-diff, with correctness on another provider; no push and no PR until every ticket is merged and the final review
20
19
  has passed. The review rounds adapt superpowers' subagent-driven-development
21
20
  (obra/superpowers, MIT).
22
21
  -->