@jesdi/skills 0.0.98 → 0.0.100
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.
- package/package.json +1 -1
- package/skills/implement-spec/ARCHITECTURE.md +10 -5
- package/skills/implement-spec/README.md +44 -17
- package/skills/implement-spec/SKILL.md +4 -2
- package/skills/implement-spec/driver.py +166 -40
- package/skills/implement-spec/driver_agents.py +26 -8
- package/skills/implement-spec/driver_arbiter.py +89 -0
- package/skills/implement-spec/driver_decisions.py +212 -39
- package/skills/implement-spec/driver_dispute.py +1 -1
- package/skills/implement-spec/driver_final.py +255 -186
- package/skills/implement-spec/driver_final_gate.py +1 -1
- package/skills/implement-spec/driver_legacy.py +15 -2
- package/skills/implement-spec/driver_overturn.py +106 -0
- package/skills/implement-spec/driver_pr.py +277 -0
- package/skills/implement-spec/driver_report.py +24 -6
- package/skills/implement-spec/driver_review.py +10 -4
- package/skills/implement-spec/driver_run.py +38 -15
- package/skills/implement-spec/driver_slots.py +33 -0
- package/skills/implement-spec/driver_state.py +29 -15
- package/skills/implement-spec/driver_summary.py +11 -4
- package/skills/implement-spec/models.json +2 -1
- package/skills/implement-spec/prompts/arbiter.md +38 -0
- package/skills/implement-spec/prompts/conflict.md +1 -1
- package/skills/implement-spec/prompts/pr-body.md +1 -1
- package/skills/implement-spec/recovery.md +4 -4
- package/skills/implement-spec/tests/conftest.py +3 -0
- package/skills/implement-spec/tests/test_arbiter.py +208 -0
- package/skills/implement-spec/tests/test_arbitration.py +1 -1
- package/skills/implement-spec/tests/test_cli.py +1 -1
- package/skills/implement-spec/tests/test_decisions.py +31 -7
- package/skills/implement-spec/tests/test_driver.py +10 -2
- package/skills/implement-spec/tests/test_final.py +34 -9
- package/skills/implement-spec/tests/test_fixloop.py +2 -2
- package/skills/implement-spec/tests/test_leave_out.py +203 -0
- package/skills/implement-spec/tests/test_legacy.py +25 -0
- package/skills/implement-spec/tests/test_lenses.py +6 -4
- package/skills/implement-spec/tests/test_overturn.py +362 -0
- package/skills/implement-spec/tests/test_report.py +1 -1
- package/skills/implement-spec/tests/test_scoped.py +18 -15
- package/skills/implement-spec/tests/test_ship_draft.py +203 -0
- package/skills/implement-spec/tests/test_slots.py +29 -0
- package/skills/implement-spec/tests/test_state.py +4 -2
- package/skills/implement-spec/tests/test_stops.py +21 -5
- package/skills/implement-spec/tests/test_tidy.py +7 -5
- package/skills-manifest.json +3 -3
package/package.json
CHANGED
|
@@ -14,7 +14,9 @@ A comment in the code is for a line that looks wrong or removable without it.
|
|
|
14
14
|
| `driver_run.py` | `Run` (what all ticket threads share), one agent with its one rerun, the gate call, the ledger, `Blocked` |
|
|
15
15
|
| `driver_fixloop.py` | A gated ticket tip in, a reviewed tip out: review, test-writer correction, fix rounds |
|
|
16
16
|
| `driver_dispute.py` | A disputed locked test: the arbitration, its correction, the once-per-test record, `spec-ambiguous` |
|
|
17
|
-
| `
|
|
17
|
+
| `driver_arbiter.py` | The arbiter agent that rules on the open questions the driver's retries leave (`driver_decisions.arbitrated`), in a checkout of its own |
|
|
18
|
+
| `driver_final.py` | The end of run: tidy, rebase, gate, final review, one fix batch, push; a ticket that lands after the tidy (`replay`, `landed_after_tidy`) |
|
|
19
|
+
| `driver_pr.py` | The PR: its body (the pr-writer's part and the facts), its opening, once, and the body written again while it is open |
|
|
18
20
|
| `driver_tickets.py`, `driver_graph.py` | Ticket files in, tickets or errors out; which tickets can start now |
|
|
19
21
|
| `driver_agents.py` | Model entries, the CLI command of each provider, prompt templates, the blocking launch |
|
|
20
22
|
| `driver_report.py` | Validation of one agent report against its schema, git and the agent's log |
|
|
@@ -26,7 +28,8 @@ A comment in the code is for a line that looks wrong or removable without it.
|
|
|
26
28
|
| `driver_state.py` | `state.json` (the resume contract) and the kernel lock |
|
|
27
29
|
| `driver_names.py` | The names of one run: its ticket branches, its recovery ref and its lock file |
|
|
28
30
|
| `driver_legacy.py` | The take-over of a run that an older driver started; delete it when no such run is left |
|
|
29
|
-
| `driver_decisions.py`, `driver_answers.py`, `driver_review_page.py` | Operator questions, their answers, the page that shows them |
|
|
31
|
+
| `driver_decisions.py`, `driver_answers.py`, `driver_review_page.py` | Operator questions, their answers, the page that shows them; who took a ruling (`ruled_by`); the tickets left out of the run (`left_out`) |
|
|
32
|
+
| `driver_overturn.py` | Which overturn of a ruling of the driver or the arbiter takes effect (`--answer` on an answered question) |
|
|
30
33
|
| `driver_tidy.py`, `driver_summary.py` | The history with one commit per ticket; `summary.md` |
|
|
31
34
|
|
|
32
35
|
`driver.py`, `driver_fixloop.py`, `driver_dispute.py` and `driver_final.py` decide what comes next. The other modules do one thing
|
|
@@ -35,8 +38,9 @@ and do not know about the run, except `driver_run.py`, which the deciding module
|
|
|
35
38
|
## Conventions
|
|
36
39
|
|
|
37
40
|
- **A step that cannot go on raises `Blocked`.** The message says why. `with during("the merge"):` puts the step
|
|
38
|
-
in front. Only
|
|
39
|
-
`driver_final.run` (the end of run becomes BLOCKED)
|
|
41
|
+
in front. Only three places catch it for good: `driver._run_ticket` (the ticket becomes BLOCKED),
|
|
42
|
+
`driver_final.run` (the end of run becomes BLOCKED) and `driver_arbiter.rule` (the operator answers the questions
|
|
43
|
+
the arbiter could not rule on). Another `except Blocked` only cleans up and raises again.
|
|
40
44
|
- **A CLI that fails with no report raises `Halted`**, not `Blocked`: the setup of the run is wrong, not the
|
|
41
45
|
ticket. `driver._run_ticket` and `driver._work` catch it: the run starts no other agent and ends with exit 4,
|
|
42
46
|
and the ticket keeps its phase for the next run. A cleanup of an `except Blocked` that leaves git as it was (an
|
|
@@ -105,6 +109,7 @@ and do not know about the run, except `driver_run.py`, which the deciding module
|
|
|
105
109
|
that origin has is never rewritten. `refs/implement-spec/<key>/recovery` holds the tip before the rewrite.
|
|
106
110
|
- A rewrite never changes a file: the driver compares trees (`driver_tidy.same_tree`) before it moves the branch.
|
|
107
111
|
- The push sends the reviewed commit, not the branch name, with no force. It refuses a commit that `origin` lacks with no good signature (when `commit.gpgsign` is on) or with a `Co-authored-by` trailer (`driver_merge.unpushable`).
|
|
112
|
+
- A `ship-draft` answer, the operator's or the driver's, is recorded once where answers are settled (`driver._settle` adds `driver_final.ship_record` to the fields of the end-of-run record): `run.final.ship` holds the gated tip and the stops, each with the role of its question. The review loop, the push, the body and the draft reason read that record, never the questions again; the push refuses when the branch moved from the recorded tip. The driver's own policy for an end-of-run stop is `driver_final.draft_ruling`: no `ship-draft` while a critical or must-fix finding is open that no operator ruling ships.
|
|
108
113
|
|
|
109
114
|
### Work is never dropped
|
|
110
115
|
|
|
@@ -164,7 +169,7 @@ and do not know about the run, except `driver_run.py`, which the deciding module
|
|
|
164
169
|
lists have one: it is a preference, not a check. When the config has none, or the preflight
|
|
165
170
|
(`driver_agents.preflight`) leaves none because each such entry failed it, the lens falls back to the
|
|
166
171
|
`final-reviewer` entries that are left. The ledger says so, and the
|
|
167
|
-
PR body's Review coverage (`
|
|
172
|
+
PR body's Review coverage (`driver_pr._review_providers`) names the entries each review ran on, read from
|
|
168
173
|
`run.agents`, so a fallback that a later invocation undid is not claimed. `driver_final._run_lenses` runs them at the same time in slot 1 inside one
|
|
169
174
|
`Run.read_only`, so a lens that changes the slot makes all three run again. A lens that stops or is rejected
|
|
170
175
|
twice stops the round only after every lens has ended, with one `final-ticket-blocked` question for each such lens
|
|
@@ -40,8 +40,10 @@ A driver before this change named the ticket branches `ticket/<NN>` and the reco
|
|
|
40
40
|
| `--parallel N` | The number of tickets in flight at once. Default: 2. |
|
|
41
41
|
| `--prepare COMMAND` | A shell command that the driver runs once in each new slot 2..N, in `.agent/worktrees/slot-K/`. Use it to install or link the dependencies. |
|
|
42
42
|
| `--timeout ROLE=MINUTES` | The timeout of one role. Repeatable. The rerun after a timeout gets twice the time. |
|
|
43
|
-
| `--answer QUESTION=OPTION` | The answer to one open question. Repeatable. The driver writes it to `.agent/implement-answers.json`. |
|
|
43
|
+
| `--answer QUESTION=OPTION` | The answer to one open question. Repeatable. The driver writes it to `.agent/implement-answers.json`. On a question the driver or the arbiter answered, it overturns that ruling: see "Overturn a ruling". |
|
|
44
44
|
| `--retries N` | The stops of one ticket, or of the end of run, that the driver answers itself with the recommended option before it asks the operator. Default: `IMPLEMENT_SPEC_RETRIES`, else 2. `0` asks at the first stop. See "The driver rules first". |
|
|
45
|
+
| `--must-fix-retries N` | The more fix batches, beyond `--retries`, that the driver runs itself while a critical or must-fix finding is open (a `finding-must-fix` question), before it asks the operator. Only the stops with such a question count. Default: `IMPLEMENT_SPEC_MUST_FIX_RETRIES`, else 2. See "The driver rules first". |
|
|
46
|
+
| `--ask`, `--no-ask` | Once the driver's retries are spent, ask the operator instead of the arbiter agent, and instead of the `ship-draft` or `leave-out` of the driver. Default: on with `IMPLEMENT_SPEC_ASK=1`, else off. See "The driver rules first". |
|
|
45
47
|
| `--unattended` | Print no question. Write `--stage-json` for the dispatcher, and push without `--push` when the final review has passed. |
|
|
46
48
|
| `--stage-json FILE` | With `--unattended`: the file that says how the run ended. |
|
|
47
49
|
| `--push` | Local mode: when the final review has passed, push the PR branch and open the PR. Without it nothing is pushed. |
|
|
@@ -51,7 +53,7 @@ A driver before this change named the ticket branches `ticket/<NN>` and the reco
|
|
|
51
53
|
| `--only ROLE` | Test only. Run one role (`test-writer`, `implementer` or `reviewer`) on the first ticket, with no gate and no merge. |
|
|
52
54
|
| `--help`, `-h` | Print the flags and exit. |
|
|
53
55
|
|
|
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.
|
|
56
|
+
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, arbiter 30.
|
|
55
57
|
|
|
56
58
|
`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.
|
|
57
59
|
|
|
@@ -59,9 +61,9 @@ Default timeouts in minutes: test-writer 30, implementer 90, reviewer 45, fixer
|
|
|
59
61
|
|
|
60
62
|
| Code | Meaning |
|
|
61
63
|
|---|---|
|
|
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. |
|
|
63
|
-
| 1 | A ticket is BLOCKED, or the end of run is BLOCKED. The other tickets ran as far as they could. |
|
|
64
|
-
| 2 | Parked: a question of kind `spec-ambiguous`
|
|
64
|
+
| 0 | Done: every ticket is merged, or left out by a `leave-out` ruling, and no question is open. Also the end of a valid `--dry-run`. In local mode without `--push`, nothing is pushed. |
|
|
65
|
+
| 1 | A ticket is BLOCKED and not left out, or the end of run is BLOCKED. The other tickets ran as far as they could. |
|
|
66
|
+
| 2 | Parked: a question of kind `spec-ambiguous` or `ticket-blocked` of a ticket that no one ruled on (`--ask`, an arbiter that failed, or a `leave-out` that would leave out every ticket), or one of kind `ticket-blocked` of the end of run after the driver's own retries are spent (`--retries`) with `--ask` or with no full gate run on the branch tip (a failed rebase conflict agent), or one of kind `finding-open` that the arbiter did not rule on (`--ask`, or an arbiter that failed), or one of kind `finding-must-fix` after the driver's own fix batches are spent (`--retries` and `--must-fix-retries`). Exit 2 wins over exit 1. |
|
|
65
67
|
| 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. |
|
|
66
68
|
| 4 | Stopped: the CLI of an agent failed and wrote no report (for example, the account cannot use the model, or its usage ran out). The agent gets no rerun on another entry: the driver starts no other agent and lets the running agents end. No ticket is BLOCKED by it: fix the CLI, or move the role to another entry in a provider config file (see Models), then run the same command again to resume. The preflight of that run skips an entry that still fails. |
|
|
67
69
|
| 130 | The operator interrupted the run. The driver stops each agent. The work stays in the slots for the next run. |
|
|
@@ -72,7 +74,7 @@ With `--unattended`, the `--stage-json` file holds `{"stage": "implement", "stat
|
|
|
72
74
|
|---|---|---|
|
|
73
75
|
| 2 | `awaiting-review` | `artifact` (the review page), `open_questions` (a count) |
|
|
74
76
|
| 1 | `blocked` | `blocked` (ticket numbers, and `final` for the end of run) |
|
|
75
|
-
| 0, pushed | `done` |
|
|
77
|
+
| 0, pushed | `done` | `draft` (the PR opened as draft, as it does with a ticket left out), `decisions` (the questions the driver or the arbiter ruled on) |
|
|
76
78
|
|
|
77
79
|
## Layout
|
|
78
80
|
|
|
@@ -84,13 +86,13 @@ Everything is under `.agent/`, which is never committed.
|
|
|
84
86
|
| `<git common directory>/implement-spec/<key>.lock` | An empty file, not in the worktree. The driver that runs holds a kernel file lock on it (`driver_state.py` `lock`). Do not remove it during a run. |
|
|
85
87
|
| `<git common directory>/implement-spec-worktrees.lock` | Shared by driver processes for `worktree`, `checkout`, `switch` and `branch` commands, so a checkout never reads another driver's half-written registration. Held only during that Git command, never during preparation, agents or gates. Git commands outside the driver do not participate. |
|
|
86
88
|
| `.agent/implement/ledger.md` | One plain sentence for each event. Only the driver writes it, and it reads no fact from it. |
|
|
87
|
-
| `.agent/implement/summary.md` | The result in sentences, and the measurement table: fast gates and full gates, agents, wall time, fix rounds, human stops, the stops the driver ruled on, cost. Then `Driver decisions, taken without the operator:` with
|
|
89
|
+
| `.agent/implement/summary.md` | The result in sentences, and the measurement table: fast gates and full gates, agents, wall time, fix rounds, human stops, the stops the driver ruled on, cost. Then `Driver decisions, taken without the operator:` with the question id and the ruling sentence of each question the driver or the arbiter answered; an overturned one shows the operator's ruling that overturns it. |
|
|
88
90
|
| `.agent/implement/decisions.json` | The open questions and their `revision`. Written only after a stop. |
|
|
89
91
|
| `.agent/implement/<NN>/` | One folder for each ticket. |
|
|
90
92
|
| `.agent/implement/<NN>/<role>-<K>.json`, `.log`, `.prompt.md` | The report, the log and the prompt of one agent. K is the fix round. |
|
|
91
93
|
| `.agent/implement/<NN>/gate-<tier>-<sha7>.log` | One gate record, `<tier>` is `fast` or `full`: start, tier, commit, status, command, output, exit, the state after the command, end. A command that a signal ended, with the tree clean and HEAD unmoved, did not judge the commit: the driver runs it once more, that run overwrites the record, and the ledger says the gate was killed by the signal and runs again. A signal ended the command when its exit is negative, or when it is 128+N for N in SIGHUP (1), SIGINT (2), SIGKILL (9) or SIGTERM (15): the gate runs in `/bin/sh -c`, and a shell that does not exec the command, as Ubuntu's dash does not, outlives its killed child and exits with 128+N. Any other exit, 142 (128+SIGALRM) among them, is a red record with no second run. A second signal leaves the record red. |
|
|
92
94
|
| `.agent/implement/<NN>/findings-<K>.json` | The merged findings of the review after fix round K, or the red fast gate of round K. |
|
|
93
|
-
| `.agent/implement/final/` | The same files for the end of run,
|
|
95
|
+
| `.agent/implement/final/` | The same files for the end of run, `pr-writer-body.md` (the pr-writer's body) and `pr-body.md`: that body, then the facts of the run. |
|
|
94
96
|
| `.agent/implement/pycache/` | Compiled Python of the gate, kept out of the slots. |
|
|
95
97
|
| `.agent/implement-review.html` | The page with the open questions. |
|
|
96
98
|
| `.agent/implement-answers.json` | The answers: `{"v": 1, "stage": "implement", "submitted": …, "revision": …, "answers": {…}}`. |
|
|
@@ -149,14 +151,14 @@ The full integration gate has its own final repair allowance (see End of run); i
|
|
|
149
151
|
|
|
150
152
|
### End of run
|
|
151
153
|
|
|
152
|
-
The end of run starts only when every ticket is merged and every slot is idle. Its agents work in slot 1.
|
|
154
|
+
The end of run starts only when every ticket is merged and every slot is idle. Its agents work in slot 1. A ticket left out by a `leave-out` ruling does not count, nor any ticket it blocks: the end of run ships the merged tickets, and the PR opens as draft. Its ticket map, and the ledger line of the PR, name the tickets left out.
|
|
153
155
|
|
|
154
156
|
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.
|
|
155
157
|
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; the integrated tip gets the full gate in the next step. 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.
|
|
156
158
|
3. **Full gate.** A red result saves the exact gate log and sends one repair batch to the final fixer (`prompts/final-gate-fixer.md`). An evidenced no-op is allowed when no code change is needed: it consumes the same repair attempt and reruns the full gate on the unchanged tip. Its commits are attributed to tickets and obey the same locked-file checks as final-review fixes. The driver reruns the full gate on the repaired tip. A second red result asks `final-ticket-blocked` with `retry` or `edit`; retry grants one further repair batch using the saved log. This allowance is independent of completed-ticket rounds and final-review rounds. Only a green integrated tip starts 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, or on the first `final-reviewer` entry when there is none. 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.
|
|
157
159
|
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 when the lists have one. 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.
|
|
158
|
-
5. Each
|
|
159
|
-
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
|
|
160
|
+
5. Each important finding the scoped review leaves open asks one `final-finding-open-<n>` question, and each critical or must-fix one a `final-finding-must-fix-<n>` question, all in one stop; nothing is pushed while one is open. `retry` runs one more fix batch and one more scoped review on the open findings that no answer ships with; `accept` and `follow-up` ship the PR with the finding: as draft when the arbiter ruled it, ready for review when the operator did. A finding once shipped asks no question again in the run, unless the driver or the arbiter shipped it and a later scoped review rates it critical or must-fix: only the operator's answer ships such a finding, so it asks `finding-must-fix`. There is no third review unless a `retry` asks for one.
|
|
161
|
+
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`: as draft when a finding that an agent's ruling shipped is open, ready for review otherwise (the operator's own `accept` or `follow-up` keeps it ready), and the ledger says why. After a `ship-draft` ruling it pushes instead the branch tip that a full gate ran on, green or red, as draft; the review coverage of the body names the commits after the reviewed tip that no review covered. The ruling, the operator's or the driver's, records that tip and the stops once (`run.final.ship`), and the push reads only that record: a run stopped between the ruling and the push pushes the recorded tip, and refuses, pushing nothing, when the branch moved from it. Once the pr-writer's body is valid and before it opens the PR, it files each finding answered `follow-up` as an issue with `gh issue create`, and the PR body's rulings and `summary.md` link the issue. The issue body carries a marker of the run and the question; a run that stopped before it kept the URL finds the issue by that marker instead of filing it twice. A local run without `--push` files nothing. 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`.
|
|
160
162
|
|
|
161
163
|
History rules:
|
|
162
164
|
|
|
@@ -196,7 +198,7 @@ A file that does not exist is skipped. An error in one of them names the file, a
|
|
|
196
198
|
| `anthropic` | `claude -p` | low, medium, high, xhigh, max |
|
|
197
199
|
| `openai` | `codex exec --json` | minimal, low, medium, high, xhigh |
|
|
198
200
|
|
|
199
|
-
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.
|
|
201
|
+
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 `arbiter` list holds the most capable model of each provider; the arbiter runs on its first entry on another provider than the first `implementer` entry. 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.
|
|
200
202
|
|
|
201
203
|
A `codex` agent of a role that commits (test-writer, implementer, fixer, conflict) runs with `--sandbox danger-full-access`: `workspace-write` keeps `.git` read-only, even with the git directory as an `--add-dir` or a `sandbox_workspace_write.writable_roots` entry (Codex 0.166.0), so `git commit` fails there. A read-only role runs with `--sandbox read-only`. So any role can run on either provider. Another provider than the first `implementer` entry for the correctness lens and the scoped review is a preference: a config whose `final-reviewer` list has no such entry runs, with one ledger sentence, and the PR body's Review coverage flags each review on a provider that also wrote code.
|
|
202
204
|
|
|
@@ -208,7 +210,7 @@ The defaults need both `claude` and `codex` on PATH. The `openai` defaults name
|
|
|
208
210
|
|
|
209
211
|
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.
|
|
210
212
|
|
|
211
|
-
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.
|
|
213
|
+
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, arbiter) 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.
|
|
212
214
|
|
|
213
215
|
| Role | Template | More fields | Checks after the schema |
|
|
214
216
|
|---|---|---|---|
|
|
@@ -220,6 +222,7 @@ Every report has `status` (`DONE`, `DONE_WITH_CONCERNS`, `NEEDS_CONTEXT`, `BLOCK
|
|
|
220
222
|
| final-spec, final-correctness, final-structure | `prompts/final-lens.md`, with the lines of `prompts/lens-<source>.md` | `findings` | None. |
|
|
221
223
|
| final-reviewer (the scoped review) | `prompts/final-reviewer.md` | `findings`, `resolved_must_fix` | None. |
|
|
222
224
|
| pr-writer | `prompts/pr-writer.md` | `body` | None. |
|
|
225
|
+
| arbiter | `prompts/arbiter.md` | `rulings` (`question`, `ruling`: `accept` or `follow-up`, `reason`, `cost`) | One ruling for each open question, its id as the list gives it. |
|
|
223
226
|
| 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. |
|
|
224
227
|
| conflict | `prompts/conflict.md`, `prompts/rebase-conflict.md` | none | With DONE: one commit or more. No locked file may change. |
|
|
225
228
|
|
|
@@ -229,21 +232,45 @@ For each role that commits, every commit in `commits` must be new since the role
|
|
|
229
232
|
|
|
230
233
|
### The driver rules first
|
|
231
234
|
|
|
232
|
-
A stop whose question recommends `retry` does not park the run. The driver answers it with `retry`, the one option it may take itself, writes the same `Ruling:` sentence an operator's answer writes, ending in `Ruled by the driver, not the operator.`, and goes on in the same process, as the next invocation would after `--answer`. Today that is `retry` for `ticket-blocked`; `spec-ambiguous` recommends no option
|
|
235
|
+
A stop whose question recommends `retry` does not park the run, and neither does an open final finding once the retries are spent. The driver answers it with `retry`, the one option it may take itself, writes the same `Ruling:` sentence an operator's answer writes, ending in `Ruled by the driver, not the operator.`, and goes on in the same process, as the next invocation would after `--answer`. Today that is `retry` for `ticket-blocked`; `spec-ambiguous` recommends no option. The driver rules on at most `--retries` stops (default 2) of one ticket, and as many of the end of run. Once they are spent, a stop of a ticket does not park, unless `--ask`: the driver answers it `leave-out`. The ticket is left out of the run, with each ticket it blocks, and the merged tickets go on to the end of run and a draft PR, with exit 0. A `spec-ambiguous` question goes to the arbiter first, which rules `keep-test` or `correct-test` (never `edit-spec`) on at most `--retries` stops of one ticket; the next one leaves the ticket out. A `leave-out` that would leave out every ticket is not taken, so that stop still asks. The uncommitted work a left-out ticket left in its slot is saved as `.agent/implement/<NN>/left-out.patch`, or `left-out-2.patch` and on when one is there already, written whole before the slot is reset (`git apply` puts it back on the ticket branch, which stays), and the slot goes back to the other tickets with a clean tree. The arbiter runs in a checkout of its own, `.agent/worktrees/arbiter`, on the PR tip, which the driver makes for it and removes after it through Git alone, so a locked worktree or a directory that is no worktree there stops the arbiter and loses nothing: slot 1 may hold a stopped ticket's work. Once they are spent, an end-of-run `ticket-blocked` stop (an end-of-run agent that failed twice, or a full gate still red after its repair) does not park either, unless `--ask`: the driver answers it `ship-draft` when a full gate ran on the branch tip and no critical or must-fix finding is open that no ruling of the operator ships, and the run ends with exit 0 and a draft PR, which no agent merges. A failed rebase conflict agent leaves no such tip, so it still asks, and so does a stop while such a finding is open, including one whose fix batch landed but no later review verified (the last settled review's findings file holds it) and, before any review settled, one in a lens report already accepted or a must-fix finding carried from a ticket; the operator may still answer `ship-draft`. The next stop of that ticket asks the operator, with exit 2; but a `finding-open` question goes to the **arbiter** (`prompts/arbiter.md`), unless `--ask`. A critical or must-fix finding asks `finding-must-fix` instead, which never goes to the arbiter: no agent ships it. The driver answers it `retry` at `--retries` plus `--must-fix-retries` stops of the end of run (default 2 and 2), counting only the stops with a `finding-must-fix` question, then asks the operator, the only one who may ship it; in the same stop the arbiter still rules on the `finding-open` questions. The arbiter is one read-only agent on the first `arbiter` entry on another provider than the first `implementer` entry (else the first `arbiter` entry). It reads each finding's evidence and the ledger and rules `accept` or `follow-up`, or on a `spec-ambiguous` question `keep-test` or `correct-test`, with a reason and the cost if it is wrong; either ruling opens the PR as draft; its ruling ends in `Ruled by the arbiter, not the operator: <reason>. Cost if wrong: <cost>.` An arbiter whose rerun fails too leaves the questions to the operator, with a ledger line. `edit` is not an option of `finding-open`: editing the spec is what the operator does after the run. The operator reads the rulings of the driver and the arbiter where the run ends: in `summary.md` under `Driver decisions, taken without the operator:` and in the PR body with the other rulings, and may overturn any of them after the run (see "Overturn a ruling"). On the box, 23 answers of 23 were `retry` and each waited hours for the operator (jesdi/agent-ops retro, 2026-11-14).
|
|
233
236
|
|
|
234
237
|
A question is a bounded choice for the operator. `driver_decisions.py` `KINDS` holds each kind with its fixed sentences.
|
|
235
238
|
|
|
236
239
|
| Kind | Question id | Asked when | Run exit | Options |
|
|
237
240
|
|---|---|---|---|---|
|
|
238
|
-
| `spec-ambiguous` | `<NN>-spec-ambiguous-<n>` | A second dispute on a locked test that the reviewer ruled on in the ticket, or a second correction needed for a locked test of the ticket (a `test-wrong` ruling or a review finding on a test corrected before); or a dispute or a review correction after the ticket's locked tests were settled 3 times. Another test of the same file, or another missing test that a review finding asks for, is no second correction. 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 later findings with the same key are closed: on that test, a `fixture` finding on that file that names no test, or the same missing test. `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`. |
|
|
239
|
-
| `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 did too (the same model for a timeout or moved branch, the next entry otherwise); or
|
|
241
|
+
| `spec-ambiguous` | `<NN>-spec-ambiguous-<n>` | A second dispute on a locked test that the reviewer ruled on in the ticket, or a second correction needed for a locked test of the ticket (a `test-wrong` ruling or a review finding on a test corrected before); or a dispute or a review correction after the ticket's locked tests were settled 3 times. Another test of the same file, or another missing test that a review finding asks for, is no second correction. 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 later findings with the same key are closed: on that test, a `fixture` finding on that file that names no test, or the same missing test. `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. `leave-out`: the ticket is left out of the run, with each ticket it blocks; the merged tickets get the end of run and a draft PR that names them. The driver takes it once the arbiter ruled on `--retries` stops of the ticket. `edit-spec`: the ticket stays BLOCKED, with the ruling in the ledger. None of them changes the ticket's `disputes` or `corrected`. |
|
|
242
|
+
| `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 did too (the same model for a timeout or moved branch, the next entry otherwise); or the integration gate stays red after its repair. The subject names the role and the reason, or the gate. | 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. `ship-draft` (end of run only): the driver pushes the branch tip that a full gate ran on, green or red, and opens the PR as draft, naming the stop in the ledger and the PR body; the end of run reviews and repairs no more. With no full gate run on the tip (a failed rebase conflict agent) the answer is refused with exit 3 and the question stays open. When the pr-writer is the stop (the question's `role`), the body is the facts of the driver alone. `leave-out` (a ticket only): as for `spec-ambiguous`; the driver takes it once its retries are spent. `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. |
|
|
243
|
+
| `finding-open` | `final-finding-open-<n>` | An important finding is open after the scoped review of the final fix batch: one question per finding, the subject is the finding as `<title> (<file>)`, with no line, so a fix batch that moves it does not ask again; the evidence is its findings file. | 2 | `retry` (recommended): one more fix batch and scoped review. `accept`: the PR ships with the finding open, listed in its rulings: as draft when the arbiter ruled it, ready for review when the operator did. `follow-up`: as `accept`, and the driver files the finding as an issue before it opens the PR. |
|
|
244
|
+
| `finding-must-fix` | `final-finding-must-fix-<n>` | As `finding-open`, for a critical finding or a must-fix one. The arbiter never rules on it. A run of an older driver that asked `finding-open` on such a finding gets the question as this kind, with its id. | 2 | `retry` (recommended): as for `finding-open`. `accept` and `follow-up`: as for `finding-open`, and only the operator may take them. |
|
|
240
245
|
|
|
241
|
-
|
|
246
|
+
An older run may hold an open `final-ticket-blocked-<n>` question on a finding: it keeps its `retry` and `edit`.
|
|
242
247
|
|
|
243
248
|
`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.
|
|
244
249
|
|
|
245
250
|
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.
|
|
246
251
|
|
|
252
|
+
### Overturn a ruling
|
|
253
|
+
|
|
254
|
+
After a run, `--answer <question id>=<other option>` on a question the driver or the arbiter answered overturns that ruling. Only such a ruling is overturned: an answer of the operator is final. The new ruling ends in `It overturns the ruling <option> of the driver.` (or `of the arbiter.`); it goes to the ledger, the PR body and the `Overturned by the operator:` list of `summary.md`, below the `Driver decisions` list, which no longer holds it. It takes effect as an answer to that question would, from where the run is now:
|
|
255
|
+
|
|
256
|
+
- `accept` or `follow-up` to `retry`: one more fix batch and scoped review on the finding, when the last review leaves it open. No agent ships a `finding-must-fix` finding, so the only ruling of one to overturn is the driver's `retry`, which is refused below: an overturn never makes an agent ship it.
|
|
257
|
+
- `accept` to `follow-up`: the driver files the issue; once the PR is open, at the next push. `follow-up` to `accept` keeps an issue filed already. The ship is the operator's now: a PR not open yet opens ready for review, unless a left-out ticket or a `ship-draft` ruling makes it a draft.
|
|
258
|
+
- `leave-out` to `retry`, `keep-test` or `correct-test`: the ticket runs again, and each ticket it blocks after it. After the rewrite of the end of run, its own work (from where its branch leaves the history before the rewrite to its tip) is replayed onto the PR tip as one commit, as the tidy makes one, before it lands, so no commit of the history before the rewrite comes back. A replay that conflicts is open in its slot as a cherry-pick for the conflict agent of the ticket; when that agent stops, the slot goes back to the ticket's tip and its `retry` runs the agent again. A run stopped in a replay replays again from the ticket's tip: its work stays. The full gate and the scoped review cover the tip it lands, even when a `ship-draft` ruling shipped the tip before it, and the final fixers keep every ticket's locked files as that tip has them. It starts from its ticket branch; the uncommitted work it left stays in its `left-out.patch`.
|
|
259
|
+
- `ship-draft` to `retry`: the end of run goes on from its stop: the gate repair, the stopped agent and the review it skipped.
|
|
260
|
+
|
|
261
|
+
The work lands on top of the PR branch, so the push needs no force. An open PR keeps its URL and its draft state: mark it ready for review yourself. Its body is written again with `gh pr edit --body-file` when it changed: the facts of the run (the ticket map, the left-out tickets, the rulings, the coverage), and the pr-writer's part too once a ticket landed after the tidy; else that part stays as it was. `pr-body.md` holds the body GitHub has: a failed edit is made again by the next run. Exit 3, before any agent, refuses an overturn that cannot take effect, and says why:
|
|
262
|
+
|
|
263
|
+
- the PR is merged or closed (`gh pr view --json state`): the work goes onto an open PR only;
|
|
264
|
+
- the question was answered by the operator;
|
|
265
|
+
- the ruling was `retry` or `correct-test`: its work ran, and an overturn undoes no work;
|
|
266
|
+
- the new option is `edit` or `edit-spec`: edit the spec or the ticket, then overturn to an option that runs the work again;
|
|
267
|
+
- a later stop of the same ticket, or of the end of run, followed it: only the newest stop is overturned;
|
|
268
|
+
- the ticket merged since;
|
|
269
|
+
- a `retry` of a finding that the last review leaves closed;
|
|
270
|
+
- a `ship-draft` of a failed pr-writer once the PR is open: edit its body on GitHub.
|
|
271
|
+
|
|
272
|
+
A run that resumes the work of an overturn asks gh again before it pushes or edits the body: a merged or closed PR blocks it, and nothing goes out.
|
|
273
|
+
|
|
247
274
|
For an older questionless BLOCKED record, see [operator recovery](recovery.md). Recovery requires an explicit verified checkpoint; starting this version never guesses one.
|
|
248
275
|
|
|
249
276
|
## The non-negotiable checks
|
|
@@ -20,12 +20,14 @@ has passed. The review rounds adapt superpowers' subagent-driven-development
|
|
|
20
20
|
(obra/superpowers, MIT).
|
|
21
21
|
-->
|
|
22
22
|
|
|
23
|
-
Run the driver. It makes every choice of the run
|
|
23
|
+
Run the driver. It makes every choice of the run: it answers its own `retry` questions, and its arbiter agent rules on the final findings its retries leave open. You start it and relay its result and its decisions.
|
|
24
24
|
|
|
25
25
|
1. In the PR worktree, run `sh <skill-dir>/run.sh` with the flags the operator gave, unchanged. `<skill-dir>` is the directory of this file. The driver needs `--gate`, `--fast-gate` and `--spec`: ask the operator for a flag that is missing. A run can take hours: run the command in the background and wait for it to exit.
|
|
26
|
-
2. When it exits, relay `.agent/implement/summary.md`, with its `Driver decisions` list whole, and the exit code: 0 is done, 1 is a BLOCKED ticket, 2 is parked on questions, 3 is invalid input, 4 is stopped by a CLI failure (after the fix, the same command resumes). Relay the lines the driver printed after the summary too. With exit 0 and a PR URL such as `https://github.com/jesdi/demo/pull/61`, tell the operator to start the babysitter: run `/babysit-pr https://github.com/jesdi/demo/pull/61`.
|
|
26
|
+
2. When it exits, relay `.agent/implement/summary.md`, with its `Driver decisions` list whole, and the exit code: 0 is done, 1 is a BLOCKED ticket, 2 is parked on questions, 3 is invalid input, 4 is stopped by a CLI failure (after the fix, the same command resumes). Relay the lines the driver printed after the summary too. With exit 0 and a PR URL such as `https://github.com/jesdi/demo/pull/61`, tell the operator to start the babysitter: run `/babysit-pr https://github.com/jesdi/demo/pull/61`. When the driver opened the PR as a draft, say so and why: no agent merges a draft, so it waits for the operator's review.
|
|
27
27
|
3. With exit 2, and with exit 1 when the driver printed questions, show the operator those questions. When the operator answers, run the same command again with one `--answer <question id>=<option id>` for each answer.
|
|
28
28
|
|
|
29
|
+
4. To overturn a ruling of the driver or the arbiter from the `Driver decisions` list, the operator gives its question id and another option: run the same command again with `--answer <question id>=<option id>`. The driver says why when it refuses one (exit 3).
|
|
30
|
+
|
|
29
31
|
Answer no question the driver left open: it has spent its own retries on it. Do not edit `.agent/implement/`, the code or the branches during a run.
|
|
30
32
|
|
|
31
33
|
[README.md](README.md) has each flag, the exit codes, the files of a run and the method.
|