pi-gauntlet 8.2.1 → 8.4.0
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/CHANGELOG.md +8 -0
- package/README.md +5 -5
- package/agents/loop-implementer.md +19 -4
- package/bin/gauntlet-performance.mjs +477 -64
- package/bin/gauntlet-performance.test.mjs +27 -27
- package/bin/gauntlet-spec-index.mjs +290 -47
- package/bin/gauntlet-spec-index.test.mjs +42 -18
- package/bin/gauntlet-telemetry-seal.mjs +220 -77
- package/bin/gauntlet-telemetry-seal.test.mjs +222 -457
- package/extensions/lib/gauntlet-settings.test.ts +12 -14
- package/extensions/lib/gauntlet-settings.ts +7 -16
- package/extensions/lib/plan-check.test.ts +10 -0
- package/extensions/lib/plan-check.ts +2 -2
- package/extensions/lib/telemetry-branch.test.ts +102 -0
- package/extensions/lib/telemetry-branch.ts +145 -0
- package/extensions/lib/telemetry-diff.test.ts +2 -2
- package/extensions/lib/telemetry-diff.ts +1 -1
- package/extensions/lib/telemetry-leg.ts +163 -0
- package/extensions/lib/telemetry-record.ts +2 -0
- package/extensions/lib/vcs.ts +6 -23
- package/extensions/telemetry-leg-failures.test.ts +138 -0
- package/extensions/telemetry-leg-fields.test.ts +130 -0
- package/extensions/telemetry-leg-no-write.test.ts +90 -0
- package/extensions/telemetry-leg-rounds.test.ts +157 -0
- package/extensions/telemetry-leg-trackers.test.ts +114 -0
- package/extensions/telemetry-leg.test.ts +151 -0
- package/extensions/telemetry-settlement-contract.test.ts +67 -0
- package/extensions/telemetry.test.ts +44 -27
- package/extensions/telemetry.ts +68 -48
- package/extensions/test-support/git-env.mjs +13 -0
- package/package.json +1 -1
- package/skills/brainstorming/SKILL.md +3 -1
- package/skills/check-delivery/SKILL.md +2 -0
- package/skills/finishing-a-development-branch/SKILL.md +13 -13
- package/skills/finishing-a-development-branch/reference/verification-set.md +2 -2
- package/skills/gatekeep-pr/reference/batch.md +3 -1
- package/skills/gatekeep-pr/reference/cleanup.md +1 -1
- package/skills/gatekeep-pr/reference/post-selection-loop.md +7 -1
- package/skills/gauntlet-resume/reference/reconstruction.md +6 -6
- package/skills/gauntlet-resume/reference/seed.md +1 -6
- package/skills/loop-implementation/SKILL.md +40 -21
- package/skills/loop-implementation/reference/action-spend.md +10 -0
- package/skills/loop-implementation/reference/coordinated-legs.md +5 -5
- package/skills/loop-implementation/reference/interrupted-recovery.md +10 -0
- package/skills/loop-implementation/reference/unreachable-returns.md +13 -0
- package/skills/shape-ticket/SKILL.md +1 -1
- package/skills/shape-ticket/reference/repo-audit.md +2 -2
- package/skills/verification-before-completion/reference/conformance-check.md +1 -1
|
@@ -18,7 +18,7 @@ Run this driver in the main session. Carry the absolute implementation worktree
|
|
|
18
18
|
| Otherwise overrides has `## verification-before-completion` | Use its exactly one backticked command; zero or several is a configuration error. |
|
|
19
19
|
| Neither section supplies a command | Discover the project's test entrypoint from its actual manifest/build instructions; print discovery as source. Stop on an unresolved or ambiguous entrypoint. |
|
|
20
20
|
|
|
21
|
-
At seed and at an authorized restore, before entering the dispatch loop, read the spec in full. Decode `**Amend-grant:**` through [amendment-surface Value decoding](../brainstorming/reference/amendment-surface.md). Capture the decoded grant, ordered leg membership, each leg's absolute checkout paths and combined spec/task Rules for dispatch and handoff; use home for zero or one leg. At an authorized fresh-session restore, resolve `gauntlet_setting({ key: "loopEngine" })` exactly once at this boundary and hold `escalateAfter` for the run; share that read with reconstruction's Shared allowance boundary, including legacy allowance migration. With an unavailable tool, stop before dispatch with `cannot resolve escalation threshold: settings tool unavailable (loopEngine.escalateAfter)`; never supply an in-loop default.
|
|
21
|
+
At seed and at an authorized restore, before entering the dispatch loop, read the spec in full. Decode `**Amend-grant:**` through [amendment-surface Value decoding](../brainstorming/reference/amendment-surface.md). Capture the decoded grant, row dispositions, ordered leg membership, each leg's absolute checkout paths and combined spec/task Rules for dispatch and handoff; use home for zero or one leg. At an authorized fresh-session restore, resolve `gauntlet_setting({ key: "loopEngine" })` exactly once at this boundary and hold `escalateAfter` for the run; share that read with reconstruction's Shared allowance boundary, including legacy allowance migration. With an unavailable tool, stop before dispatch with `cannot resolve escalation threshold: settings tool unavailable (loopEngine.escalateAfter)`; never supply an in-loop default.
|
|
22
22
|
|
|
23
23
|
At seed and at an authorized restore, when the held membership has more than one leg, read `reference/coordinated-legs.md` IN FULL now with read at its absolute path; stop on an unreadable reference naming its path, never reconstruct it. On fresh entry apply its `## Entry` section at step 4 instead of the home-only skeleton below, using step 4's resolved allowance seed value. On a restore apply its `## Resume` section before the dirty-tree stop and before any pending recovery. Keep legacy and single-member ledger bytes unchanged, with no coordinated metadata.
|
|
24
24
|
|
|
@@ -44,34 +44,38 @@ allowance: <n>
|
|
|
44
44
|
Use the actual repo-relative spec path alone in the Spec header. Read base with `git -C "<worktree>" rev-parse HEAD`. Index every spec AC in order, including nested disposition lines without treating them as extra ACs; keep row text only in the spec. Initialize explicit/absent `in-scope` and `venue:` rows `open`, attempts 0, evidence empty. Initialize only `deviates:`, `deferred:`, `elsewhere:` rows `cut`, attempts 0, disposition text as evidence. Write `allowance:` immediately after `iterations: 0` using step 4's seed value; never scale it by row count or seed dispatches: 24 non-cut rows at default 4 yield allowance 4. All-cut ledgers keep the same allowance and exit through rule 1 without a seed dispatch. Later cuts, reopens and requirement-preserving amendments leave allowance unchanged; redraw deletes the ledger and reseeds it. Serialize evidence in one physical table cell, result lines separated by semicolons, pipes escaped, plain text without angle markup.
|
|
45
45
|
5. Call `plan_check({ planPath: <ledger path> })`. Stop with findings as a configuration error. Commit the stamped skeleton as `loop: seed ledger`; call `phase_tracker({ action: "start", phase: "implement" })`, then `plan_tracker({ action: "refresh", path: <absolute ledger path> })`, including all-cut ledgers with no seed dispatch.
|
|
46
46
|
|
|
47
|
-
For resume, use the admitted ledger, its base and verification command, and durable iterations and allowance instead of overwriting it. Skip Entry step 1's allowance seeding for an admitted ledger; the allowance setting applies only to fresh seeding, and the restore boundary resolves `escalateAfter` once. Apply `/skill:gauntlet-resume` pending recovery and its `loop: migrate allowance` step before refresh and any unresolved dirty-tree stop. Render rows, allowance and decision history;
|
|
47
|
+
For resume, use the admitted ledger, its base and verification command, and durable iterations and allowance instead of overwriting it. Skip Entry step 1's allowance seeding for an admitted ledger; the allowance setting applies only to fresh seeding, and the restore boundary resolves `escalateAfter` once. Apply `/skill:gauntlet-resume` pending recovery and its `loop: migrate allowance` step before refresh and any unresolved dirty-tree stop. Render rows, allowance and decision history; route a recovered pending tuple through reconstruction's pending recovery and ## Interrupted recovery before any unresolved dirty-tree stop.
|
|
48
48
|
|
|
49
49
|
## Driver holds
|
|
50
50
|
|
|
51
|
-
After seeding, restrict driver reads during implement to the ledger (including saved or committed ledger snapshots), the child's return file (one file reference), git boundary commands (`status --porcelain`, `rev-list --count`, `rev-parse`, `show -s --format=%b` for commit bodies), skill resources at their absolute paths and the overrides file. Keep rows by status, iterations, allowance, the last decision, the decoded amendment grant and each leg's checkout path for dispatch, handoff and stops. Use Entry's captured grant and membership throughout the loop.
|
|
51
|
+
After seeding, restrict driver reads during implement to the ledger (including saved or committed ledger snapshots), the child's return file (one file reference), git boundary commands (`status --porcelain`, `rev-list --count`, `rev-parse`, `show -s --format=%b` for commit bodies, `log --format=%s <base>..HEAD` for repair counts), retained dispatch/write provenance, the child's jobs file, OS process start identity and command, `ps -o pgid= -p <pid>`, `kill`, skill resources at their absolute paths and the overrides file. Keep rows by status, iterations, allowance, the last decision, the decoded amendment grant and each leg's checkout path for dispatch, handoff and stops. Use Entry's captured grant, row dispositions and membership throughout the loop.
|
|
52
52
|
|
|
53
|
-
Never read the spec, source files, test output or logs inside the implement loop. Never diagnose a failure's cause; carry the child's evidence into the next dispatch or human stop. The only log-read exception is the last 20 lines at the human stop in After the loop step 1. Leave spec reads for seed, authorized restore and the amendment action below, outside the loop.
|
|
53
|
+
Never read the spec, source files, test output or logs inside the implement loop. Never diagnose a failure's cause; carry the child's evidence into the next dispatch or human stop. Inside the implement loop, end a turn only with a stop header from ## Human stop; follow every intermediate report with the next ordered-table action in the same turn. The only log-read exception is the last 20 lines at the human stop in After the loop step 1. Leave spec reads for seed, authorized restore and the amendment action below, outside the loop.
|
|
54
54
|
|
|
55
55
|
## Before each dispatch
|
|
56
56
|
|
|
57
57
|
When the held membership has more than one leg, read `reference/coordinated-legs.md` IN FULL now with read at its absolute path; stop on an unreadable reference naming its path, never reconstruct it. Apply its `## Resume`, `## Targeting and dispatch`, `## Companion return validation`, `### Companion commit admission` and `## Amendments` sections together with this driver; never apply `## Entry` here.
|
|
58
58
|
|
|
59
|
+
Read [action-spend durability](reference/action-spend.md) in full now; carry retained repair accounting into this dispatch, including seed and companions.
|
|
60
|
+
|
|
59
61
|
Read the ledger and require its `checks:` line per ## Gate set.
|
|
60
62
|
|
|
61
|
-
Read the ledger and require `allowance:` and no `cap:` before the ordered table, including for seed and completed ledgers; otherwise stop with `ledger has no allowance: line - resume through /skill:gauntlet-resume`. Keep `iterations:` as a dispatch counter only; it bounds nothing. Count empty child commits and validation misses only after the latest `loop: retry row <n>`
|
|
63
|
+
Read the ledger and require `allowance:` and no `cap:` before the ordered table, including for seed and completed ledgers; otherwise stop with `ledger has no allowance: line - resume through /skill:gauntlet-resume`. Keep `iterations:` as a dispatch counter only; it bounds nothing. Count each row's empty child commits and validation misses only after the latest of `loop: retry row <n>` for that row, `loop: amend`, or any `loop: cut row <n>`; an admitted amendment starts new windows for every row because it changed what rows are measured against. Raising allowance resets neither window. Recover both windows from branch history on resume. Preserve every row's attempts and spent escalation. Before the ordered table, route each admitted failed target through ## Unreachable returns once at admission (including companions), or on resume when admitted but not yet routed; follow that reference's answered-stop rule after human decisions. Apply this ordered table, starting here after each return or human decision:
|
|
62
64
|
|
|
63
65
|
| Order | Observed state | Action |
|
|
64
66
|
|---|---|---|
|
|
65
67
|
| 1 | No `open` or `failed` row | Refresh; require implement complete; continue at ## After the loop step 0. All-cut and baseline-complete ledgers exit here. |
|
|
66
68
|
| 2 | Unresolved row attempts >= effective allowance | Human stop under approval option 4 and option 5 alike. Exempt `done` and `cut`. |
|
|
67
|
-
| 3 | Last two child row commits
|
|
69
|
+
| 3 | Last two child row commits for the same row changed no file outside the ledger and no row status, or two consecutive validation misses on that row | Set the hint for that row: `the last two attempts changed nothing outside the ledger` for empty-child stagnation, or `two returns broke the contract: <concrete miss from the last repair evidence>` for validation misses; continue to rule 4. |
|
|
68
70
|
| 4 | Dispatch allowed | Select target by the priority below, then apply the escalation threshold check. |
|
|
69
71
|
|
|
72
|
+
Count two consecutive child `loop: row <n> ...` commits for the same row for empty-child stagnation; commits for different rows never pair. Exclude seed and parent commits from this count. A decision alone is not progress. A pending human `retry <n> | <hint>` for that row wins over the fixed hint. Attach a rule-3 hint only to its row; a cut row or a different selected target carries none. Pass the selected row's hint in the existing `hint:` task field.
|
|
73
|
+
|
|
70
74
|
When a refresh leaves implement active at rule 1, take the matching human stop; never start verify. Before evaluating rule 2, compute each row's effective allowance as the ledger's `allowance:` plus the count of that row's `row <n> retry | ... | allowed attempts <m>` lines in `## Decisions`. Count each retry once; the stored `<m>` is historical, not an absolute override. Ignore every other decision and grant in this arithmetic. Use the same rule for every coordinated entry, regardless of leg. With allowance 4 and two retries, a row has effective allowance 6 even if the historical `<m>` values are 5 and 99; raising the shared header to 7 makes it 9, while an unretried row gets 7. After migration, a row already at or above its effective allowance is exhausted. Never reset or reduce attempts.
|
|
71
75
|
|
|
72
|
-
Use the held decoded amendment grant for amendment choices only; ignore its waves-only budget token, retaining no amend permission for a budget-only value. Never consult this value for row escalation. Apply
|
|
76
|
+
Use the held decoded amendment grant for amendment choices only; ignore its waves-only budget token, retaining no amend permission for a budget-only value. Never consult this value for row escalation. Apply rule 2 before rule 3; a rule-3 hint dispatches through rule 4. Preserve `STAGNANT`, `REJECT` and closureReview boundaries; After the loop step 3 funds conformance rounds from the allowance.
|
|
73
77
|
|
|
74
|
-
Select `seed` until a validated `loop: seed evidence` commit with its `row 0 done` decision survives on the branch, independently of `iterations`;
|
|
78
|
+
Select `seed` until a validated `loop: seed evidence` commit with its `row 0 done` decision survives on the branch, independently of `iterations`; before any seed dispatch apply ## Validate the return's seed count instead of rule 3's row windows. Otherwise select the still-unresolved human retry target, then the still-failed row named by the previous decision, then first failed row, then first open row. Read seed survival from the ledger at HEAD and the matching validated commit, not from evidence completeness. Never re-seed a validated partial seed to fill empty evidence cells. Use the latest admitted return's target decision for targeting and the child's `previous decision:` input, never an extra's line; skip allowance-grant and legacy grant history while retaining the entire Decisions section. Durable status beats a decision's suggestion. Keep the retry hint only for its target.
|
|
75
79
|
|
|
76
80
|
For a numbered target with no durable `row <n> escalated` decision, compute `threshold = min(escalateAfter, effective allowance - 1)` from the held `escalateAfter` and the row's effective allowance. When the row's pre-dispatch attempts >= threshold, make this dispatch the escalated round: resolve `gauntlet_setting({ key: "escalationLoop" })` under approval option 4 and option 5 alike. Use the returned non-empty `implModel` string, including the resolver's main-loop model fallback when the setting is unset or malformed. With the settings tool unavailable or `implModel` undefined (neither a configured model nor a main-loop model), stop before dispatch with `Problem: escalationLoop.implModel unavailable`; write no escalation decision and leave attempts unchanged. Never substitute a default-model attempt for that stop.
|
|
77
81
|
|
|
@@ -79,7 +83,7 @@ With the resolved model, append `row <n> escalated | implModel round | allowed a
|
|
|
79
83
|
|
|
80
84
|
## Dispatch
|
|
81
85
|
|
|
82
|
-
For home dispatch, record `HEAD_BEFORE`, save the ledger before the iterations bump and tuple write, and retain the current `iterations:` count as i. Send `iteration: i` using the current pre-bump `iterations:` count and write `iterations: i + 1` before dispatch; admission requires the child commit body to carry `i + 1`, read from the bumped ledger header. State that difference when rendering a dispatch or admission: the task line carries the pre-bump count by design, the body line and `ITERATION` carry the consumed count `i + 1`, and the two never compare to each other. Record the dispatch identity separately and write `pending: <row or seed> | <repo> | <HEAD sha>` using `home` for zero or one spec leg, the actual member identifier for coordinated runs, and the selected checkout's HEAD. Persist the consumed count and tuple before every home or companion dispatch; then refresh. Commit nothing extra. Create a unique absolute output path with `mktemp` outside the repository. Dispatch exactly one foreground child in the main implementation worktree, not a nested worktree:
|
|
86
|
+
For home dispatch, record `HEAD_BEFORE`, save the ledger before the iterations bump and tuple write, and retain the current `iterations:` count as i. Retain dispatch/write provenance and background-launch records for ## Interrupted recovery; a clean boundary and one child alone never establish exclusive ownership. Send `iteration: i` using the current pre-bump `iterations:` count and write `iterations: i + 1` before dispatch; admission requires the child commit body to carry `i + 1`, read from the bumped ledger header. State that difference when rendering a dispatch or admission: the task line carries the pre-bump count by design, the body line and `ITERATION` carry the consumed count `i + 1`, and the two never compare to each other. Record the dispatch identity separately and write `pending: <row or seed> | <repo> | <HEAD sha>` using `home` for zero or one spec leg, the actual member identifier for coordinated runs, and the selected checkout's HEAD. Persist the consumed count and tuple before every home or companion dispatch; then refresh. Commit nothing extra. Create a unique absolute output path with `mktemp` outside the repository. Dispatch exactly one foreground child in the main implementation worktree, not a nested worktree:
|
|
83
87
|
|
|
84
88
|
```text
|
|
85
89
|
subagent({ agent: "loop-implementer", context: "fresh", async: false,
|
|
@@ -91,33 +95,45 @@ subagent({ agent: "loop-implementer", context: "fresh", async: false,
|
|
|
91
95
|
|
|
92
96
|
For `target: seed`, explicitly instruct the child to apply its seed contract even when iteration is greater than 0; carry that instruction in the existing `hint` field. Keep the actual consumed pre-bump count in `iteration`.
|
|
93
97
|
|
|
94
|
-
Omit the model override except on an escalated round (`model: <implModel>`); let the persona override or parent inheritance resolve it. Carry effects only: one file-reference return, one ledger read, git boundary checks. Never read a child transcript or carry reasoning history.
|
|
98
|
+
Omit the model override except on an escalated round (`model: <implModel>`); let the persona override or parent inheritance resolve it. Carry effects only: one file-reference return, one ledger read, git boundary checks. Never read a child transcript or carry reasoning history. Route a dispatch error or non-DONE return, including a silence kill, through ## Interrupted recovery. An async handle still stops; never poll or join it. Redispatch only through the ordered table after completed recovery.
|
|
95
99
|
|
|
96
100
|
## Validate the return
|
|
97
101
|
|
|
102
|
+
Read [action-spend durability](reference/action-spend.md) in full now; preserve action records through admission and every validation-miss repair below.
|
|
103
|
+
|
|
98
104
|
For home returns, apply the following boundary and table. Never project terminal child results before clean/exactly-one-commit admission.
|
|
99
|
-
1. Require empty `git -C "<worktree>" status --porcelain` and exactly 1 from `git -C "<worktree>" rev-list HEAD_BEFORE..HEAD --count`.
|
|
105
|
+
1. Require a DONE return, empty `git -C "<worktree>" status --porcelain` and exactly 1 from `git -C "<worktree>" rev-list HEAD_BEFORE..HEAD --count`. Route dispatch errors, non-DONE, killed, dirty and zero/multiple-commit returns through ## Interrupted recovery, not result admission. Read the ledger from HEAD only after this boundary passes.
|
|
100
106
|
2. Validate by dispatched `target`, not iteration number, against the saved copy using this table. Require the commit body's first two lines to match the exact dispatched `pending:` tuple and consumed `iteration:` (saved iterations +1), using the persona's home attribution contract for row and seed alike. Admit only `iterations` +1 and removal of the dispatched `pending:` line; reject every other header change, including allowance. Preserve row identifiers and prior decisions.
|
|
101
107
|
|
|
102
108
|
| Target | Required changes | Miss |
|
|
103
109
|
|---|---|---|
|
|
104
|
-
| Seed | Require bounded nonempty evidence on at least one non-cut row; admit a subset or all rows. All attempts stay 0; only `open` -> `done` status transitions; keep unreached rows unchanged, including open rows with empty evidence, and preserve cut rows. Require exactly one new `row 0 done | seeded <k> rows, closed <m> on baseline | <first row to take>` decision, counting only rows given evidence in this return and their proven baseline closures. Partial and complete baseline closure both pass. Never `failed`. | Seed repair below;
|
|
110
|
+
| Seed | Require bounded nonempty evidence on at least one non-cut row; admit a subset or all rows. All attempts stay 0; only `open` -> `done` status transitions; keep unreached rows unchanged, including open rows with empty evidence, and preserve cut rows. Require exactly one new `row 0 done | seeded <k> rows, closed <m> on baseline | <first row to take>` decision, counting only rows given evidence in this return and their proven baseline closures. Partial and complete baseline closure both pass. Never `failed`. | Seed repair below; redispatch seed while its repair count is below allowance. |
|
|
105
111
|
| Ordinary | Require the target row's mutable cells to change: status `done` or `failed`, attempts +1, nonempty bounded evidence. Admit zero or more other rows in the same leg changing `open` -> `done`, each with nonempty bounded evidence and attempts unchanged. Require set equality between changed rows and rows with exactly one new decision line, target first, each matching its row and status. Keep every other row, header and prior decision unchanged apart from the dispatch header changes in step 2. | Parent repair below. |
|
|
106
112
|
| Seed or ordinary | No committed tuple remains. | A retained committed tuple is a validation miss for the dispatched target after boundary admission, not a boundary rejection. |
|
|
107
113
|
|
|
108
114
|
Require each ordinary decision to match `^row <that row> <that status> \| .{1,200} \| .{1,200}$`; an old conforming line is not a new line. Require check name plus at most three result lines in evidence, serialized with semicolons and escaped pipes as in the persona; add no command-format check. Reject a `failed` extra, a foreign-leg extra, a changed `cut` or `done` row, extra attempts changes, empty evidence on a changed row, or a missing, duplicate, malformed or unmatched decision. Admit an evidenced `done` extra beside a `failed` target. Never police worker ordering or execute a check after a return; leave regressions to verify step 1's gate set. Keep the child subject `loop: row <target n> <status>`; declare extras only in the ledger diff and their decision lines.
|
|
109
115
|
|
|
110
|
-
On a seed miss after clean/exactly-one-commit admission, restore every non-cut row, headers (including the saved allowance) and decisions from the saved copy; preserve cut rows and retain the incremented iterations. Clear `pending:`, commit parent `loop: repair seed
|
|
116
|
+
On a seed miss after clean/exactly-one-commit admission, restore every non-cut row, headers (including the saved allowance) and decisions from the saved copy; preserve cut rows and retain the incremented iterations. Clear `pending:`, commit parent `loop: repair seed` with `seed miss: <concrete miss>` in the body, then refresh and apply the seed count below. A validated seed resets the validation-miss window, so ordinary dispatch starts clean. Exclude seed repairs from rule 3's row windows.
|
|
117
|
+
|
|
118
|
+
Count seed attempts as `loop: repair seed` commits since ledger base, including interrupted and validation-miss repairs; for coordinated runs count home repair markers only. Dispatch seed while this count is below the ledger allowance, with the seed-contract instruction and `seed miss: <concrete miss>` or `seed interrupted: <reason>` in `hint:`, and `previous decision: none`. Recover the count and reason from branch history on resume. At allowance render `Stopped on seed` with `seed: <k> of <allowance>` and the retry/`rows +N` menu; only a raised allowance permits more seed repairs, and a numbered retry never erases this count. Keep row attempts at 0.
|
|
119
|
+
|
|
120
|
+
On an ordinary miss restore every non-target row, headers (including the saved allowance) and prior decisions from the saved copy, retaining the incremented iterations. Set the target `failed`, attempts = saved attempts +1, evidence = `iteration <i>: <concrete miss>`. Clear `pending:`, remove malformed appended decisions and commit `loop: repair row <n>`, then refresh. Set previous decision to `none`; on an admitted ordinary return use the target's new conforming line, never the last extra's. Two consecutive validation misses on a row set its rule-3 hint. A conforming return resets the consecutive-miss count; parent repair commits do not count toward child-only empty stagnation.
|
|
121
|
+
|
|
122
|
+
## Unreachable returns
|
|
123
|
+
|
|
124
|
+
Read [unreachable-returns](reference/unreachable-returns.md) in full now with read at its absolute path; apply its evidence routing before returning to the ordered table.
|
|
125
|
+
|
|
126
|
+
## Interrupted recovery
|
|
111
127
|
|
|
112
|
-
|
|
128
|
+
Read [interrupted recovery](reference/interrupted-recovery.md) in full now; apply its numbered procedure before redispatch.
|
|
113
129
|
|
|
114
130
|
## Human stop
|
|
115
131
|
|
|
116
132
|
Read and apply [menu-layout](../brainstorming/reference/menu-layout.md). Start the message with `gauntlet: question` at every human stop, including the discard/reset authorization ask for a dirty or commit-boundary return. Put it alone on the first output line, followed by a newline before the stop text, without a driver-state preamble, wrapper or code fence. These decisions are neither done nor stuck outcomes.
|
|
117
133
|
|
|
118
|
-
Implement-phase stops only: leave implement active and use the row offers below. For verify stops use the menus in After the loop, retaining verify active. Use one screen of plain words: `Stopped on row <n>` for row failures, or the concrete boundary/verification header. `Problem:` quotes the evidence cell and last decision line verbatim; attribute any spec/code contradiction, failing assertion/output or missing capability to that evidence, without investigating it. At every human stop, including allowance,
|
|
134
|
+
Implement-phase stops only: leave implement active and use the row offers below. For verify stops use the menus in After the loop, retaining verify active. Use one screen of plain words: `Stopped on row <n>` for row failures, or the concrete boundary/verification header. `Problem:` quotes the evidence cell and last decision line verbatim; attribute any spec/code contradiction, failing assertion/output or missing capability to that evidence, without investigating it. At every human stop, including allowance, missing-model, dirty-tree, commit-boundary, interrupted-dispatch and exit-verification stops, list every `open` or `failed` row after the header as `row <n>: <attempts> of <effective allowance>`, then print `Preserve every row's attempts.` Compute each denominator from the ledger using Before each dispatch; keep retry increments in `## Decisions`, never a new table column. Use restored pre-dispatch row cells at rejected-return stops, not unadmitted child results. With no open or failed rows, omit row lines but retain the preservation sentence. Name `escalated round spent` when applicable; omit round history and reasoning traces.
|
|
119
135
|
|
|
120
|
-
Offer retry and `rows +N` only at row stops (allowance
|
|
136
|
+
For stops not handled by ## Unreachable returns: Offer retry and `rows +N` only at row stops (allowance or missing-model) or seed exhaustion, alongside Amend and Stop. The recovery-incomplete stop keeps discard authorization only, never budget offers; the verify-step-1 verification-failure stop keeps amend/stop only. A budget increase never bypasses those gates.
|
|
121
137
|
|
|
122
138
|
| Human choice | Durable action |
|
|
123
139
|
|---|---|
|
|
@@ -126,11 +142,11 @@ Offer retry and `rows +N` only at row stops (allowance, stagnation or missing-mo
|
|
|
126
142
|
| Amend | Follow `/skill:brainstorming` amendment surface; cut only through an approved disposition amendment. Reconcile ledger and spec in one commit. |
|
|
127
143
|
| Stop | Keep phase implement and preserve branch state. |
|
|
128
144
|
|
|
129
|
-
Serialize the bare decision as `rows +50 |` with an empty words cell. Raising allowance resets neither window (empty-child or validation-miss); exclude `loop: raise allowance` from child-commit counting.
|
|
145
|
+
Serialize the bare decision as `rows +50 |` with an empty words cell. Raising allowance resets neither window (empty-child or validation-miss); exclude `loop: raise allowance` from child-commit counting. Use Before each dispatch's window rule for retry and admitted amendments.
|
|
130
146
|
|
|
131
|
-
|
|
147
|
+
Recover interrupted returns through ## Interrupted recovery before dispatch. At recovery incomplete, ask for explicit discard authorization naming the unresolved ownership or cleanup; a budget reply authorizes no discard. Preserve spent escalation and the consumed dispatch count through recovery: iterations = restored HEAD's value +1, before the next normal bump. Recover from disk/branch, never repeat iteration 0.
|
|
132
148
|
|
|
133
|
-
Outside the dispatch loop, perform authorized amendment actions under the amendment surface's own reads. After the amendment commit, re-decode the grant and refresh the held membership, checkout paths and Rules from the updated spec before returning to the loop; apply this to funding and standing-grant amendments too. Leave the `**Amend-grant:**` header grammar unchanged.
|
|
149
|
+
Outside the dispatch loop, perform authorized amendment actions under the amendment surface's own reads. After the amendment commit, re-decode the grant and refresh the held row dispositions, membership, checkout paths and Rules from the updated spec before returning to the loop; apply this to funding and standing-grant amendments too. Leave the `**Amend-grant:**` header grammar unchanged.
|
|
134
150
|
|
|
135
151
|
Retry, cut, amend, raise-allowance and escalate commits never clear the tuple. For ledger amendments use its line-1 discriminant: no plan writer or plan_check; refresh after the amendment commit. Approved deviates/deferred/elsewhere becomes `cut` with disposition evidence; requirement-preserving amendments leave rows unchanged; a re-bounded done row becomes `open` with `reopened by amendment`. Preserve attempts, iterations and allowance. Commit spec + ledger as `loop: cut row <n>` or `loop: amend`. Option 4 stops for amendments, option 5 auto-applies amends, redraw always stops and deletes the ledger with the plan. Cut only through the amendment surface, including its standing-grant section 5.
|
|
136
152
|
|
|
@@ -154,10 +170,13 @@ For coordinated runs, route each verification and review below to every leg with
|
|
|
154
170
|
|
|
155
171
|
0. Call `phase_tracker({ action: "start", phase: "verify" })`. Mint `LOG_DIR=$(mktemp -d)` once for this verify session; a resumed session mints a new one at its first gate-set site.
|
|
156
172
|
1. Run the gate set per ## Gate set. Require every pair to pass. Commit verification-produced tracked changes, including gate-produced changes. Any repair invalidates that run: apply the rerun scope below before the next gate. No task reopen/update is awaited.
|
|
157
|
-
|
|
158
|
-
|
|
173
|
+
Count `repairs` as home `loop: repair verification` commits since ledger base, plus one for a `pending: verify` tuple with no admitted repair commit. Use the shared ledger allowance, with no per-row retry increments. Recover this count from branch history and disk on every resume; match marker bodies to pending tuples to avoid counting one dispatch twice. Recover an outstanding tuple before any new gate run or dispatch, including the last reserved repair at allowance.
|
|
174
|
+
On failure automatically repair while `repairs < allowance` under approval option 4 and option 5 alike; never consult amend permission or gate on iterations. Keep verify active and implement complete. Resolve `gauntlet_setting({ key: "escalationLoop" })`; require its non-empty `implModel`, including the resolver's main-loop fallback. Missing settings/model stops with `Problem: escalationLoop.implModel unavailable`, without a bump or marker. Save the home ledger and home/failing-leg HEADs, retain dispatch/write and background-launch provenance, then bump iterations once and write `pending: verify | <repo> | <HEAD>` on disk before dispatch, using the failing leg's identity (single-leg `home`) and HEAD. Treat only that bump/tuple as expected home dirt. Dispatch exactly one `implementer` with `model: <implModel>`, `context: "fresh"`, `async: false`, failing checkout cwd and Rules, absolute spec path, failing command, checkout, exit code and log path, never pasted output. Pass the exact pending tuple and consumed `iteration:` for the first two commit-body lines, plus the failing leg's base and pre-bump iteration for jobs-file identity. Require retained launch/no-launch evidence and the jobs records in ## Interrupted recovery. Apply [action-spend durability](reference/action-spend.md) to this repair and inject the persona's step-5 action authorization/accounting contract, including pre-launch reservations, without its row mutation protocol; require action-spend records after tuple/iteration in the repair commit body. Include this blocking-call contract in the repair task: bound every blocking command with `timeout -k 30 <n>`, n <= 600; background and poll longer work. Read [loop-implementer's Evidence command](../../agents/loop-implementer.md#evidence-command) and copy its first three paragraphs verbatim into that task, omitting its row/seed ledger protocol. The repair child reads the log to derive the files to touch; for a stale selector restore the test or its name, never ledger evidence.
|
|
175
|
+
Require DONE, a clean failing checkout and exactly one commit after HEAD_BEFORE, matching the task's tuple/iteration attribution. Require all ledger rows unchanged, preserving attempts, mapping, allowance and prior decisions. The home child's sole commit includes the already-bumped ledger with pending retained; a companion child commits its leg only, leaving home HEAD and expected dirt unchanged. Remove `pending:` only in the parent repair marker: commit `loop: repair verification` in home with the consumed iteration and exact tuple in its body, recording the admitted child SHA. Refresh after admission. On killed, error, non-DONE, dirty, zero/multiple-commit or invalid repair returns, apply ## Interrupted recovery steps 1-3 to the failing checkout, not its numbered-row/seed budget or step 4. Preserve the saved row cells and already-consumed iteration; after owned jobs exit and the boundary is clean, clear pending in an empty `loop: repair verification` marker (no repair code), with tuple, iteration and interruption reason in its body. For companions require unchanged home HEAD and expected-only dirt, and write the marker only in home. On missing provenance, ambiguous attribution/before-image or failed cleanup, retain state at the recovery-incomplete stop; the pending reservation remains consumed. On resume, admit a matching clean single repair commit or recover the interrupted return by this same path without another bump; an already admitted matching marker needs no second marker.
|
|
176
|
+
Rerun the failing checkout's gate pairs once using ## Gate set's log redirection and fail-fast rule after each admitted or recovered repair. After that rerun passes, run the original fail-fast run's still-unexecuted pairs from other checkouts in ledger order before recording verified HEAD. On resume run the complete gate set in a fresh session LOG_DIR. A new failure in any leg returns to the repair-count check; do not reopen rows or reset the count. Never spend verify-phase credits. On failure at `repairs >= allowance`, render `Stopped: verification failed with every row closed` with `repairs: <k> of <allowance>` and `Problem:` naming `gate <i> exit <code> <log path>` and quoting at most the last 20 lines with `tail -n 20`; this human-stop excerpt is the driver's only log read. Keep verify active and implement complete; offer amend or stop only, no `Retry with hint` or `rows +N`. Use the same restricted menu for missing capabilities. On success record verified HEAD and clean status for every leg.
|
|
159
177
|
2. Dispatch foreground whole-diff `wave-reviewer` per `/skill:requesting-code-review`, from ledger base through committed HEAD, with `SCOPED_TEST_COMMANDS: none`. Apply its fix rounds. Rerun the complete gate set after every fix round before re-review/next gate. Carry final SHIP Minor lines verbatim as `whole-diff minors:`, or `whole-diff minors: none`.
|
|
160
178
|
3. Run happy path per the fully read reference when overrides has `## Happy path` or the diff selects a row; use the diff-derived row, not a plan header. Pass summary and outcome to the separate fresh `conformance-reviewer`, along with spec path, verbatim original prompt and full diff. Use spec AC rows against the ledger as the checklist. Follow the reference's partition, concern decomposition, fix rounds and Convergence with the gate set replacing plan Verification at every test site per the reference's ledger-subject override. Use normal conformance Gn tasks on the same tracker and keep durable Gn identities in reports. Rerun the complete gate set after repairs. Resolve closureReview settings and reviewer dispatch per the reference. Reviews happen only after complete implement; none inside the iteration loop.
|
|
179
|
+
When the conformance fix-round cap blocks (`<used> fix round(s) used against a cap of <cap>`) or the reference's step 6 asks at its cap, read `<used>` from that text. Under amend permission with `<used>` below the ledger allowance: when the block is live, call `phase_tracker({ action: "grant_fix_rounds", rounds: <allowance - used>, reason: "<Amend-grant sentence verbatim>" })`, print `funded <allowance - used> conformance rounds under the grant`, and continue the fix loop; when `closureReview.enforce` is false, continue without a call. With `<used>` at or above the allowance, an error reply, or no amend permission, take the reference's step-6 stop. Never call the tool as a probe or store a grant counter; never count rounds yourself. The next block's `<used>` includes granted rounds, so a second block at the allowance stops; a resumed run with unspent credits continues without a block or another grant. Leave the cap and settings unchanged.
|
|
161
180
|
On an approved re-bound (`reopened by amendment`), refresh and stop with `Stopped: row <n> reopened by amendment during verify`; offer authorize the row's return to ledger implementation or stop. On approval apply the normal Before each dispatch boundaries, then Dispatch, Validate the return and refresh with verify still active and no phase reset; close on disk and rerun step 1 before continuing verify. Keep completion blocked until closure; never substitute a tracker write for the ledger return.
|
|
162
181
|
4. Complete verify only on current CONFORMS or valid carried-open deferred inventory per the reference. A started positive-cap fix loop blocking/failing/exhausting with an open fix gap stops, never completes verify. Summarize rows closed, iterations consumed, files changed, test counts and review verdict. Emit exact `## Closure / conformance` schema from the reference: `status: CONFORMS (0 open)` or `status: GAPS (N open)`, then `audited-base: <full HEAD SHA>`, happy-path exactly when run, Deferred/deviates per spec exactly when applicable, all gap/concern fields unchanged, auto-applied fix commits index and whole-diff minors. Read its whole-diff-minors companion when directed. Never rename fields.
|
|
163
182
|
5. Immediately invoke `/skill:finishing-a-development-branch <abs worktree path>`. Its menu is the human gate; do not add a ready-to-finish prompt.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Action-spend durability
|
|
2
|
+
|
|
3
|
+
Read this contract before admitting a return or restoring any saved ledger, including seed, row, companion and verification repairs. Keep action accounting separate from row attempts and repair allowances.
|
|
4
|
+
|
|
5
|
+
1. Before deleting a jobs file, resetting a checkout or restoring ledger decisions, retain every `ran <action> (<k> of <bound>)` and `bound spent: <action> (<k> of <bound>)` record from the child's jobs file, returned evidence/decisions and attributable ledger or commit body. Read only those permitted boundary artifacts, never a transcript or log. Treat action-record lines in the jobs file as accounting, not process entries; apply process ownership checks only to pid records. Require a pre-launch spend reservation, confirmed execution record or affirmative retained evidence that no paid/external action launched. With uncertain execution and no attributable reservation, stop at recovery incomplete with `action execution uncertain`; preserve state rather than infer an unspent bound from missing decision text.
|
|
6
|
+
2. Before admitting a successful row or seed return, require every reserved spend to survive in its ledger evidence/decisions (or companion result cells). Before replacing an evidence cell, require the child to repeat each carried `ran <action> (<k> of <bound>)` and `bound spent: <action> (<k> of <bound>)` record verbatim in its own decision sentence before any new spend, including records from a successful seed. Treat a dropped record as a validation miss even when the replacement check passes. For verification repairs, require the records after tuple/iteration in the attributed child commit body instead, leaving row cells unchanged; copy them into the home repair marker. A reservation without a confirmed `ran` record stays conservatively spent. A missing spend record is a validation miss, not permission to erase it. Retain the action records until admission or a durable repair marker; only then delete the jobs file after process cleanup.
|
|
7
|
+
3. For every interrupted or validation-miss repair, copy all retained action records into the parent repair commit body before clearing the pending tuple or discarding child output. Include them in a numbered target's evidence cell after the interruption/miss reason, within the existing result-line bound; the commit body retains the complete accounting. For seed preserve the saved row cells and fixed seed decision contract; keep action accounting in the `loop: repair seed` commit body. For verification retain it in the `loop: repair verification` marker. Keep prior decisions intact and add no decision kind or ledger header.
|
|
8
|
+
4. Carry these repair commit bodies as spend history on every later dispatch and authorized restore, including companion dispatches: inject home repair action records in the existing hint when the child cannot read home history. Count the highest recorded k for each action across decisions, evidence and repair bodies; identical copies are one spend. Preserve this history through retry, amendment and finish.
|
|
9
|
+
|
|
10
|
+
For a capture that succeeds before an interrupted seed, preserve `ran capture (1 of 1)` in the seed repair commit body even when reset removes its fixture and ledger changes. The next child counts that spend and records `bound spent: capture 1 of 1`, never another capture. Preserve a lone pre-launch reservation conservatively in the same way.
|
|
@@ -6,7 +6,7 @@ At seed, read `## Legs` with [the scope grammar](../../brainstorming/reference/l
|
|
|
6
6
|
|
|
7
7
|
Retain the home skeleton's `**Spec:**`, `verification:`, `checks: commands`, `iterations:`, `allowance:` and `## Decisions` fields and its `plan_check`/commit admission. Use the driver's gate set grouped by `## Leg mapping` for verification; keep the home verification header as the CI command.
|
|
8
8
|
|
|
9
|
-
For coordinated exit, apply the driver's `## Gate set` and `## After the loop` step 1 in verify, routing each pair through its mapped checkout.
|
|
9
|
+
For coordinated exit, apply the driver's `## Gate set` and `## After the loop` step 1 in verify, routing each pair through its mapped checkout. Count home `loop: repair verification` markers against the driver's shared allowance across failing legs. Success only after every leg passes; retain each verified HEAD and clean status.
|
|
10
10
|
|
|
11
11
|
Assign numeric entries in original AC order, then membership order for shared ACs, independent of scope-list order. Leave spec rows untouched and copy each cut disposition to every expanded entry. Keep the four-column table and add `## Leg mapping` with `row | ac | leg`, one mapping per entry exactly once. Reject duplicate/missing mappings. Keep `base:` as home base; record one actual `base repo-a: <sha>` / `seeded repo-a: no` pair per member, including home. Resolve bases with each member's `git -C`, not home HEAD.
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ Use the same allowance seed value and source echo as the home driver's Entry ste
|
|
|
14
14
|
|
|
15
15
|
## Resume
|
|
16
16
|
|
|
17
|
-
Use the held membership and checkout paths captured by the driver's Entry at seed or authorized restore. Recover pending companion work before generic dirty checks and before any new dispatch. Read the durable home ledger's `pending:` tuple and consumed iteration, selected companion HEAD and saved pre-dispatch state. Reconstruct the pre-dispatch ledger from home `HEAD:<ledger path>` on resume and admit only the expected on-disk iterations bump and tuple against it. Admit only the known iterations bump and exact pending tuple as pre-dispatch dirt; stop on other dirt. Reapply companion return validation below only when exactly one new commit after the recorded HEAD matches attribution. Apply the home-ledger commit without another attempt or iteration bump, clear pending and retain prior decisions.
|
|
17
|
+
Use the held membership and checkout paths captured by the driver's Entry at seed or authorized restore. Route `pending: verify` through the driver's After the loop step 1 before the row/seed admission below. Recover pending companion work before generic dirty checks and before any new dispatch. Read the durable home ledger's `pending:` tuple and consumed iteration, selected companion HEAD and saved pre-dispatch state. Reconstruct the pre-dispatch ledger from home `HEAD:<ledger path>` on resume and admit only the expected on-disk iterations bump and tuple against it. Admit only the known iterations bump and exact pending tuple as pre-dispatch dirt; stop on other dirt. Reapply companion return validation below only when exactly one new commit after the recorded HEAD matches attribution. Apply the home-ledger commit without another attempt or iteration bump, clear pending and retain prior decisions. Route interrupted boundaries (dirty, zero/multiple commits, dispatch error or non-DONE) through ## Companion return validation's ownership-fenced recovery; keep unrelated movement and attribution mismatch as state-preserving stops; route post-boundary result-validation misses through ordinary `loop: repair row <n>` or seed `loop: repair seed` repair below, clear `pending:` and preserve the consumed iteration. After a successful parent commit no pending tuple remains, so a subsequent resume cannot duplicate the update.
|
|
18
18
|
|
|
19
19
|
## Targeting and dispatch
|
|
20
20
|
|
|
@@ -24,15 +24,15 @@ For coordinated dispatch, capture home and selected leg heads and save a pre-dis
|
|
|
24
24
|
|
|
25
25
|
## Companion return validation
|
|
26
26
|
|
|
27
|
-
For a companion, validate from its commit, not the reply. Require a clean companion and exactly one commit after pending HEAD; require unchanged home HEAD and no home edits except the expected persisted bump/tuple. Match subject `loop: row <n> <status>` or `loop: seed evidence`, exact pending tuple and consumed `iteration:` in the body. Parse four-column row lines followed by decision lines. For ordinary returns require the target (`done` or `failed`, attempts +1) plus zero or more same-leg `open` -> `done` extras with attempts unchanged. Require nonempty bounded evidence and exactly one matching bounded decision for each changed row, target decision first, under the driver's `## Validate the return` table; admit extras beside a failed target without policing worker order or adding a command-format check. For seed require all and only that leg's non-cut rows, at least one with evidence, and one bounded seed decision; admit unchanged open rows with empty evidence. Reject a wrong target, foreign entry, changed cut/done extra, header changes, fabricated counts, malformed evidence or unmatched/duplicate rows or decisions. Validate seed counts against nonempty evidence cells and baseline closures; require zero attempts and set only this leg's seeded value to `yes` after the complete row set validates. Route seed validation misses after boundary admission through the driver's seed repair
|
|
27
|
+
For a companion, validate from its commit, not the reply. Require a clean companion and exactly one commit after pending HEAD; require unchanged home HEAD and no home edits except the expected persisted bump/tuple. Match subject `loop: row <n> <status>` or `loop: seed evidence`, exact pending tuple and consumed `iteration:` in the body. Parse four-column row lines followed by decision lines. For ordinary returns require the target (`done` or `failed`, attempts +1) plus zero or more same-leg `open` -> `done` extras with attempts unchanged. Require nonempty bounded evidence and exactly one matching bounded decision for each changed row, target decision first, under the driver's `## Validate the return` table; admit extras beside a failed target without policing worker order or adding a command-format check. For seed require all and only that leg's non-cut rows, at least one with evidence, and one bounded seed decision; admit unchanged open rows with empty evidence. Reject a wrong target, foreign entry, changed cut/done extra, header changes, fabricated counts, malformed evidence or unmatched/duplicate rows or decisions. Validate seed counts against nonempty evidence cells and baseline closures; require zero attempts and set only this leg's seeded value to `yes` after the complete row set validates. Route seed validation misses after boundary admission through the driver's seed repair count: commit `loop: repair seed` in home with the concrete miss in the body, write no returned rows or decisions, clear `pending:`, leave this leg's seeded value `no` and preserve foreign state. Retain consumed iterations and saved allowance; apply the driver's seed count and hint rule to retry this leg below allowance or stop at allowance. A validated seed resets the validation-miss window. Route ordinary validation misses after boundary admission through the driver's ordinary repair: set only the target `failed` with attempts +1 and `iteration <i>: <miss>` evidence, append its repair decision, clear `pending:` and commit `loop: repair row <n>` in home. Preserve every non-target row and prior decision from the saved copy, consumed iterations and saved allowance; count the miss in the existing two-miss window.
|
|
28
28
|
|
|
29
|
-
After validation write every admitted row and append every validated decision to the home ledger, record companion SHA in evidence, and remove `pending:` in one home-ledger commit. Use the target's decision as the next dispatch's `previous decision:`, never an extra's. Preserve every other row, header and prior decision. That home-ledger commit (`loop: record <repo> row <n>`) is a parent commit, not a child `loop: row ...` commit: it never counts toward child-only empty-commit stagnation; only the companion's own commits are counted at the boundary. For rejected
|
|
29
|
+
After validation write every admitted row and append every validated decision to the home ledger, record companion SHA in evidence, and remove `pending:` in one home-ledger commit. Use the target's decision as the next dispatch's `previous decision:`, never an extra's. Preserve every other row, header and prior decision. That home-ledger commit (`loop: record <repo> row <n>`) is a parent commit, not a child `loop: row ...` commit: it never counts toward child-only empty-commit stagnation; only the companion's own commits are counted at the boundary. For rejected results apply the post-boundary repair above. For interrupted boundaries, apply the driver's ## Interrupted recovery immediately and on resume: require unchanged home HEAD and expected-only bump/tuple dirt, exclusive companion checkout/write provenance, accounted-for writers and matching jobs-file process identity before signaling or reset. Reset only the selected companion to its `HEAD_BEFORE`, using its base/iteration jobs file; require confirmed job exits and clean/zero-commit observations. Restore the saved home ledger with consumed iterations, preserve foreign rows, mappings, bases and seeded flags, clear pending and commit `loop: repair row <n>` or `loop: repair seed` only in home. Increment only the numbered target's attempts once; seed leaves rows unchanged. Refresh and return to the driver's ordered table or seed count without double counting. Missing provenance, missing before-image, unexpected home changes, unresolved cleanup or ambiguous attribution stops with state preserved, not a reset based on commit timing. Recover from boundary evidence, never trusted reply text.
|
|
30
30
|
|
|
31
31
|
For coordinated home returns apply it only to home entries/seeded state, preserving foreign entries, mappings and bases.
|
|
32
32
|
|
|
33
33
|
### Companion commit admission
|
|
34
34
|
|
|
35
|
-
Require the unchanged home HEAD and expected-only home dirt boundary above, then run this read-only admission recipe on both immediate returns and pending recovery. Set `CHECKOUT` to the companion root, `PENDING` to the exact persisted tuple including `pending:`, `ITERATION` to the consumed count and `SAVED_LEDGER` to the durable home ledger after the iterations bump and pending write, including on recovery. Use the pre-dispatch snapshot only for the expected-dirt comparison.
|
|
35
|
+
Require the unchanged home HEAD and expected-only home dirt boundary above, then run this read-only admission recipe on both immediate returns and pending recovery. Set `CHECKOUT` to the companion root, `PENDING` to the exact persisted tuple including `pending:`, `ITERATION` to the consumed count and `SAVED_LEDGER` to the durable home ledger after the iterations bump and pending write, including on recovery. Use the pre-dispatch snapshot only for the expected-dirt comparison. Classify boundary failures before running this recipe: route dirty/zero/multiple-commit interrupted returns through the ownership-fenced recovery above; preserve pending and stop on unrelated movement or attribution mismatch. On a seed validation miss after the boundary passes apply the seed repair above. On an ordinary validation miss after the boundary passes apply ordinary repair above, not the boundary stop. On success use the emitted object for the single parent ledger commit described above; never treat it as permission for another dispatch.
|
|
36
36
|
|
|
37
37
|
<!-- companion-return-shell -->
|
|
38
38
|
```bash
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Interrupted recovery
|
|
2
|
+
|
|
3
|
+
Treat dispatch error, non-DONE, silence kill, dirty tree and zero/multiple commits as interrupted returns. Use the saved pre-dispatch ledger and checkout `HEAD_BEFORE`; on resume use the tuple's HEAD and its ledger before-image (the saved home HEAD for a companion). Keep an unrecoverable before-image or ambiguous attribution at the recovery stop with state preserved. Apply this procedure under options 4 and 5 alike, only below the numbered target's effective allowance or the seed repair-count allowance; at exhaustion take rule 2 or the seed stop without another dispatch.
|
|
4
|
+
|
|
5
|
+
1. Establish exclusive checkout provenance before destructive recovery. Require retained dispatch and write provenance identifying every changed path and commit as this child's output, with every writer accounted for and quiescent except owned jobs to terminate below. A clean `HEAD_BEFORE`, one dispatched child, path substrings and commit timing prove no ownership. Missing provenance, concurrent or unattributed writes take the recovery-incomplete stop with all changes preserved; do not reset or clean. Read and apply [action-spend durability](action-spend.md) before any restoration or deletion; retain confirmed executions and conservative reservations for the repair body, including seed.
|
|
6
|
+
2. Read `${TMPDIR:-/tmp}/loop-<base SHA>-<iteration i>.jobs`: process lines are `<pid> <process-start-identity> <command>`, with OS-observed start identity captured at launch, not record-write time; preserve action-record lines under action-spend durability. Treat an absent or empty file as no jobs only with retained evidence that the child launched no background work. For each live pid require matching start identity and command plus `ps -o pgid= -p <pid>` equal to pid; a replacement group leader is not owned. Recheck all three immediately before signaling. Unavailable identity or mismatch stops without signaling. For a confirmed owned group send `kill -TERM -- -<pid>`, wait at most 10 s, use `kill -KILL -- -<pid>` for a surviving group after another identity recheck, then require `kill -0 <pid>` to fail. An already exited job needs affirmative exit evidence, not an unavailable identity mistaken for exit. Signal neither the driver's shells nor unrecorded processes. Print `terminated <k> child jobs` when k > 0; delete the jobs file only after every listed job is confirmed exited and action accounting is durable in the admitted result or repair commit body.
|
|
7
|
+
3. After exclusive provenance and job exit are both established and action accounting is retained, use the driver's shell: `git -C "<worktree>" reset --hard HEAD_BEFORE`, then `git -C "<worktree>" clean -fd` (leave ignored files alone). Require empty `git -C "<worktree>" status --porcelain` and 0 from `git -C "<worktree>" rev-list HEAD_BEFORE..HEAD --count`.
|
|
8
|
+
4. Write the ledger from the saved copy with `iterations:` = saved +1 and no `pending:`. For a numbered target set only that row `failed`, attempts = saved attempts +1, evidence `iteration <i>: interrupted - <reason>` plus retained action records; preserve every other row and all prior decisions, including spent escalation. Use `killed after silence`, `dispatch error: <text>`, `dirty tree`, `<k> commits` or `non-DONE` as the concrete reason. Commit `loop: repair row <n>` with retained action records in its body, refresh and return to the ordered table; rule 2 stops a repaired row at allowance. For seed leave every row cell and decision unchanged, commit `loop: repair seed` with `seed interrupted: <reason>` and retained action records in the body, refresh and apply the seed count in ## Validate the return. Never append a fabricated child decision.
|
|
9
|
+
|
|
10
|
+
On unresolved provenance, action accounting or cleanup render `Stopped: iteration <i> recovery incomplete - <what>` with the discard-authorization menu below. Name the observed failure, such as `checkout ownership unproven`, `action execution uncertain`, `background launch history unavailable`, `job <pid> not owned`, `job <pid> still running` or `tree dirty after reset`. Preserve remaining changes, pending identity and consumed iteration; consume no attempt and make no repair commit. Project saved pre-dispatch row cells at this stop without overwriting unadmitted work. For a companion apply [coordinated recovery](coordinated-legs.md#companion-return-validation) to its checkout and write the repair only in home.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Unreachable returns
|
|
2
|
+
|
|
3
|
+
Key routing to the admitted return, not unchanged evidence. Keep an unanswered stop pending, including on resume. Treat a human retry, `rows +N`, an applied amendment answering the stop, or an applied cut as answering that return. Recover answered state on resume from the existing retry, raise-allowance and amendment decisions/commits after that admission; add no routing marker. Continue at the ordered table without re-firing its marker, even while the failed row's evidence is unchanged. Route a newly admitted failed return independently, even with identical evidence. Keep action counts and authorization bounds unchanged by retry or `rows +N`; only an approved amendment can raise an action's bound.
|
|
4
|
+
|
|
5
|
+
Inspect only the target's first result segment after the check name in its admitted evidence cell; split on unescaped semicolons and trim whitespace. Never inspect later result segments, other rows or a rejected return. Leave malformed markers on the ordinary failed-attempt path.
|
|
6
|
+
|
|
7
|
+
| First result segment | Action |
|
|
8
|
+
|---|---|
|
|
9
|
+
| Matches `^bound spent: .+$` | Render `Stopped on row <n>` per the driver's Human stop under options 4 and 5 alike, with the ordinary row menu (retry, `rows +N`, Amend, Stop) and `Recommendation: none - named action bound spent`; never cut or redispatch automatically, including for a `venue:` row. |
|
|
10
|
+
| Matches `^unreachable: .+ - .+$` | Keep `venue:` rows on the ordinary failed-attempt path with their held disposition unchanged. For other rows, take the amendment action below before another dispatch. |
|
|
11
|
+
| Neither | Return to the ordered table. |
|
|
12
|
+
|
|
13
|
+
Leave diagnosis to the child. Form one amend item outside the dispatch loop through [amendment-surface](../../brainstorming/reference/amendment-surface.md), using the captured `<what>` and `<where>` from `unreachable: <what> - <where>` as evidence. Recommend disposition `deviates: unreachable in this checkout - <what>; proof at <where>` and an `## Out of scope` entry `<row text, first 60 chars> - unreachable in this checkout - <what>`; never convert the disposition to `venue:`, even for a production proof location. Reuse the surface's batch preparation, grant decoding and section 5 audit/ledger aftermath, including its redraw and repeated-evidence stops. Without amend permission take its human batch before any write or dispatch. Under amend permission apply the item: set the ledger row `cut` with the disposition as evidence in the surface's single `loop: cut row <n>` commit, and print `amended the spec: row <n> - unreachable in this checkout - <what>`. Preserve attempts, iterations, allowance and spent escalation. Refresh held state through the driver's Human stop amendment return and continue the ordered table in the same turn. Carry the cut on After the loop's `Deferred/deviates per spec:` line. For companions use the held mapping and coordinated amendment rules; the home spec/ledger own the cut.
|
|
@@ -112,7 +112,7 @@ See Roast below. Surface source-gap findings at step 8; never apply them by inve
|
|
|
112
112
|
|
|
113
113
|
### 8 - Confirmation gate
|
|
114
114
|
|
|
115
|
-
Finish initial preparation and roasts for all eligible tickets before the first gate. Present only the current ticket in ref order: decline skips it; revision rechecks and re-presents its exact diff; approval completes step 9 before the next ticket prints. Never treat a reply as approval of an unseen ticket. Present stopped tickets' draft/report at their turn with no approval option; preserve a split's N-body subset-selection gate. End with
|
|
115
|
+
Finish initial preparation and roasts for all eligible tickets before the first gate. Present only the current ticket in ref order: decline skips it; revision rechecks and re-presents its exact diff; approval completes step 9 before the next ticket prints. Never treat a reply as approval of an unseen ticket. Present stopped tickets' draft/report at their turn with no approval option; preserve a split's N-body subset-selection gate. End with the settlement and per-ref rows from `reference/repo-audit.md` after the selected writes finish, including singleton creates.
|
|
116
116
|
|
|
117
117
|
Present, per proposed issue:
|
|
118
118
|
|
|
@@ -206,6 +206,6 @@ Stop on the first nonzero exit without retry or fallback body write. Report the
|
|
|
206
206
|
|
|
207
207
|
Drop runs nothing and ends `<drafted title>: dropped`; create anyway files only the displayed premise-rewritten body with its contradiction in the premise report. Preserve headless stops and split subset selection.
|
|
208
208
|
|
|
209
|
-
Apply a reply only to the current ticket: decline skips it; revision rechecks and re-presents it; approval runs step 9's re-fetch, comparison, and body-then-comment write before the next gate. Treat another ticket's reply as no approval for an unseen diff. Give stopped tickets a hard-stop report without an approval number. Retain the N-body subset-selection gate for a split within one ticket. On an ended run, start the message with one batch settlement line: `gauntlet: done <counters>`. Start the message with `gauntlet: stuck` followed on that line by the dynamic counters instead when any `close-failed`, `close-by-hand`, or `unfetched` count is nonzero. Emit nonzero counters only, comma-joined without spaces, in this fixed order: `written,closed,declined,dropped,no-op,stopped,unfetched,close-failed,close-by-hand`; format each as `<key>=<count>`. Start the message with `gauntlet: done written=1` for an ended singleton whose only outcome is one written ticket; use the same counters rule for every singleton, including `gauntlet: done stopped=1`. Count an integrity stop left without recovery values as `stopped`, not declined; human decline and drop are not failures. While a hard-stop recovery question remains active, emit `gauntlet: question` and no settlement line. Keep ended stopped items settled, without reopening questions or offering new writes.
|
|
209
|
+
Apply a reply only to the current ticket: decline skips it; revision rechecks and re-presents it; approval runs step 9's re-fetch, comparison, and body-then-comment write before the next gate. Treat another ticket's reply as no approval for an unseen diff. Give stopped tickets a hard-stop report without an approval number. Retain the N-body subset-selection gate for a split within one ticket. On an ended run, after every selected write and follow-on step finishes, start the final message with one batch settlement line: `gauntlet: done <counters>`. Start the message with `gauntlet: stuck` followed on that line by the dynamic counters instead when any `close-failed`, `close-by-hand`, or `unfetched` count is nonzero. Emit nonzero counters only, comma-joined without spaces, in this fixed order: `written,closed,declined,dropped,no-op,stopped,unfetched,close-failed,close-by-hand`; format each as `<key>=<count>`. Start the message with `gauntlet: done written=1` for an ended singleton whose only outcome is one written ticket; use the same counters rule for every singleton, including `gauntlet: done stopped=1`. Count an integrity stop left without recovery values as `stopped`, not declined; human decline and drop are not failures. While a hard-stop recovery question remains active, emit `gauntlet: question` and no settlement line. Keep ended stopped items settled, without reopening questions or offering new writes.
|
|
210
210
|
|
|
211
|
-
|
|
211
|
+
Print one plain line per item below the settlement line, in roster order, including singletons: `<ref>: <outcome>`. Use the actual ref returned by the write for a successful create or enrichment; use the drafted title only for a dropped or declined create with no ticket. Keep the outcome exactly one of `written`, `closed`, `close failed (<operation>: <reason>)`, `close by hand`, `dropped`, `declined`, `stopped`, `no-op`, `unfetched`; put other explanations on separate lines. Render rows without bullets, code fences or emphasis.
|
|
@@ -182,7 +182,7 @@ Per round:
|
|
|
182
182
|
that omits `model:` when `closureReview.model` is set, and warns (non-blocking)
|
|
183
183
|
on one whose model differs. Mark every `Gn` the re-audit reports `DELIVERED`
|
|
184
184
|
`complete`; open ones stay `in_progress`.
|
|
185
|
-
6. **Converge or continue**: verdict `CONFORMS`
|
|
185
|
+
6. **Converge or continue**: verdict `CONFORMS` -> Convergence below. Under the loop engine with amend permission, apply the loop driver's After the loop step 3 funding up to the ledger allowance before this ask; ask the human only when it declines. Start the message with `gauntlet: gate=verification-before-completion/step-6` alone on the first output line, followed by a newline before the human escalation text, including Convergence cap exhaustion. Read and apply [menu-layout](../../brainstorming/reference/menu-layout.md); ask for explicit funding of additional rounds. Emit this proactively, independent of any runtime guard error. Keep verification incomplete; emit no done or stuck line here or at intermediate closure. Open gaps
|
|
186
186
|
within the cap → re-partition (per the rule above) and start the next
|
|
187
187
|
round. Cap (`gauntlet_setting({ key: "closureReview" }).maxFixRounds`,
|
|
188
188
|
default `5`, floors negatives at `0`, normalizes missing or non-integer values to `5`) reached
|