pi-gauntlet 8.0.1 → 8.1.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 +12 -0
- package/README.md +6 -4
- package/agents/implementer.md +5 -2
- package/agents/loop-implementer.md +7 -5
- package/agents/plan-writer.md +3 -3
- package/agents/spec-council-member.md +1 -1
- package/bin/gauntlet-performance.mjs +10 -1
- package/bin/gauntlet-performance.test.mjs +85 -5
- package/bin/gauntlet-telemetry-seal.mjs +1 -1
- package/extensions/lib/plan-check.test.ts +4 -2
- package/extensions/lib/plan-check.ts +1 -1
- package/extensions/lib/telemetry-collect.test.ts +13 -6
- package/extensions/lib/telemetry-collect.ts +4 -3
- package/extensions/lib/telemetry-record.test.ts +14 -0
- package/extensions/lib/telemetry-record.ts +2 -2
- package/extensions/phase-tracker.test.ts +45 -0
- package/extensions/plan-tracker.test.ts +100 -1
- package/extensions/plan-tracker.ts +99 -3
- package/extensions/telemetry.test.ts +103 -0
- package/extensions/telemetry.ts +19 -6
- package/package.json +4 -3
- package/skills/brainstorming/reference/amendment-surface.md +3 -3
- package/skills/brainstorming/reference/spec-finalization.md +8 -5
- package/skills/forge-skill/SKILL.md +1 -1
- package/skills/gauntlet-handoff/SKILL.md +1 -1
- package/skills/gauntlet-resume/SKILL.md +4 -5
- package/skills/gauntlet-resume/reference/brief-contract.md +6 -6
- package/skills/gauntlet-resume/reference/reconstruction.md +28 -6
- package/skills/loop-implementation/SKILL.md +22 -27
- package/skills/loop-implementation/reference/coordinated-legs.md +4 -14
- package/skills/subagent-driven-development/SKILL.md +23 -8
- package/skills/subagent-driven-development/implementer-prompt.md +1 -1
- package/skills/subagent-driven-development/reference/dispatch-contract.md +3 -3
- package/skills/subagent-driven-development/reference/implement-amendments.md +3 -3
- package/skills/writing-plans/SKILL.md +5 -5
- package/skills/writing-plans/reference/plan-contract.md +1 -1
|
@@ -21,9 +21,11 @@ Keep the plan_check manifest, tracker state, skill resources read at their absol
|
|
|
21
21
|
|
|
22
22
|
Consume structured `status`, `verdict`, `maxSeverity`, `findingCount`, `findings`, `touchedTasks`, `trajectory`, `concerns`, `question` and `anchorUnreadable` first. Use a direct `read` with `limit: 300` only for unresolved `DONE_WITH_CONCERNS` concerns, `BLOCKED` / `NEEDS_CONTEXT` question evidence, or `FIX_FIRST` / `REJECT` findings needed for repair or a stop note. Read at most once per printed `report <path>` observation per wave; never paginate or use an offset past the bound. When the read does not reach the report's footer (its `Parallel-safe:` line; `TRAJECTORY:` on a re-review), re-dispatch the same wave-reviewer once with `Compact report: findings and footer only, at most 150 lines`. Read its saved report under the same bound; stop naming the oversized path on a second overflow. Never dispatch `scout`, `delegate` or another child to relay reports. Retain delegated source-fact lookup.
|
|
23
23
|
|
|
24
|
+
For a dispatched task missing structured result text, also admit capture reads from `<Artifacts>/structured-output/*/output.json`, one file per `read`, `limit: 300`, no offset or pagination, under [Chain stopped or failed](#chain-stopped-or-failed). Keep saved prose reports outside this exception.
|
|
25
|
+
|
|
24
26
|
Read [reference/dispatch-contract.md](./reference/dispatch-contract.md) now for schemas, anchored payloads and one-step carriers. Read [reference/implement-amendments.md](./reference/implement-amendments.md) now for delegated amendments.
|
|
25
27
|
|
|
26
|
-
Use primary shell coordination only: `rev-parse`, `status --porcelain`, `diff --stat`, `apply`, `reset --soft`, `add -A`, `commit`, `update-ref`, plus the marked preflight, repair-base and scratch-index recipes and scoped-command redirection. Prohibit content-loading `cat`, `sed -n`, `git show <path>`, `git diff` without `--stat`, and contextual `grep`/`rg` over source. Route source questions, provenance and human escalation wording through the answer/evidence carrier; stop on delegated failure.
|
|
28
|
+
Use primary shell coordination only: `rev-parse`, `status --porcelain`, `diff --stat`, `apply`, `reset --soft`, `add -A`, path-scoped `add -- <plan> <spec>` for committed-original entry, `commit`, `update-ref`, `ls <Artifacts>/structured-output/*/output.json` only for missing-result recovery and `test -s <patch>` only for patch admission, plus the marked preflight, repair-base and scratch-index recipes and scoped-command redirection. Prohibit content-loading `cat`, `sed -n`, `git show <path>`, `git diff` without `--stat`, and contextual `grep`/`rg` over source. Route source questions, provenance and human escalation wording through the answer/evidence carrier; stop on delegated failure; for an exhausted-escalation stop note, emit it in the parent turn from held observations with no further dispatch or shell command.
|
|
27
29
|
|
|
28
30
|
## Continuous Execution
|
|
29
31
|
|
|
@@ -40,7 +42,7 @@ Periodic "should I continue?" prompts add latency without adding safety. The pla
|
|
|
40
42
|
## Prerequisites
|
|
41
43
|
|
|
42
44
|
- The worktree path is known - from the `using-git-worktrees` Step 4 report in this session or the handoff brief's `worktree:` row - and is passed as the top-level dispatch `cwd`. If no worktree path exists, stop and invoke `/skill:using-git-worktrees` first - implementation never lands directly on `main`. The process cwd is the primary checkout; nothing here changes it.
|
|
43
|
-
- Approved plan or clear task scope
|
|
45
|
+
- Approved plan or clear task scope. Before the first wave, establish committed originals at home: run `git -C "<abs home worktree>" status --porcelain -- "<home-relative plan path>" "<home-relative spec path>"`. If nonempty, run `git -C "<abs home worktree>" add -- "<home-relative plan path>" "<home-relative spec path>"` and `git -C "<abs home worktree>" commit -m "plan: <spec title>" -- "<home-relative plan path>" "<home-relative spec path>"`. Stop on failure before dispatch; never stage unrelated source or use dirty retry text as a baseline.
|
|
44
46
|
- `plan_tracker` list initialized at writing-plans handoff with the full wave-ordered task list. Consume and preserve it on continuation; only direct recovery with no tracker initializes the full plan list once, before dispatch, and never over an existing list.
|
|
45
47
|
|
|
46
48
|
Call `plan_check({ planPath })` for the manifest; stop on FAIL; for `manifest-size`, emit a stop note asking for plan reduction. Consume each task's `files`, `tests`, `leg`, `mode`, heading and explicit `orchestrator`. Pass isolated implementers only their own task's `tests` as `SCOPED_TEST_COMMANDS`, or `none` when empty. Give in-place implementers, the integrated test gate and wave reviews the wave union of `tests`. Preserve each array element as one command without splitting or joining command strings. Children read Tests metadata themselves.
|
|
@@ -117,7 +119,7 @@ Run every plan task through this loop in a wave of N >= 1 tasks. Run waves in se
|
|
|
117
119
|
|
|
118
120
|
1. **Independence check.** Assert pairwise-disjoint manifest `files`: Test/Test is allowed, Test/Create, Test/Modify and Modify/Modify overlap. Split overlaps into singleton waves. Trust the plan for runtime-resource disjointness; capture `WAVE_BASE_SHA` with `git -C <worktree> rev-parse HEAD`, print `wave <w> base <sha>` and hold it.
|
|
119
121
|
2. **Dispatch.** One one-step chain whose single `parallel` step contains only implementers, one item per task: `subagent({ async: false, context: "fresh", cwd: <worktree>, chain: [{ parallel: [{ agent: "implementer", as: "impl_<n>", outputSchema: IMPLEMENTER_STATUS_SCHEMA, output: "<REPORT_DIR>/wave<w>-task<n>.md", outputMode: "file-only", task: ... }], worktree: true, concurrency: 4, stopOn: { path: "/status", in: ["BLOCKED", "NEEDS_CONTEXT", "DONE_WITH_CONCERNS"] } }] })`. Use step `stopOn` to expose `## Outputs` structured JSON in the tool-result text; top-level `tasks` has no item schema and is not used. For manifest `"mode":"in-place"`: `cwd` the branch checkout, no `worktree:`, the wave union as `SCOPED_TEST_COMMANDS`. Payload is `planPath`, task anchor, spec path, `Leg:` with additive `Rules:` per [Leg routing](#leg-routing), `SCOPED_TEST_COMMANDS` (the task's own `tests` for isolated waves), status protocol. Dispatch no reviewer step after the implementers.
|
|
120
|
-
3. **Read and integrate.** Read each child's structured output and report under the bound above; print `wave <w> task <n> <status> report <path> patch <path>`. Isolated waves: `DONE` / `DONE_WITH_CONCERNS`
|
|
122
|
+
3. **Read and integrate.** Read each child's structured output and report under the bound above; print `wave <w> task <n> <status> report <path> patch <path>`. Isolated waves: before integrating `DONE` / `DONE_WITH_CONCERNS`, require an `Artifacts:` patch path and a successful `test -s <patch>`. A missing or zero-byte initial patch takes the transition-table repair row; apply nothing and retain siblings. A nonempty patch -> `git -C <worktree> apply --index <patch>` in plan index order, print `wave <w> integrated task <n>`; a nonempty initial patch that fails to apply prints `wave <w> task <n> apply failed`, leaves every already-integrated sibling staged, and stops with a stop note listing which tasks are integrated and which failed - no automatic rebuild (the human may ask for one, which runs the rebuild recipe below). In-place waves: nothing to apply; the checkout already carries the work. `BLOCKED` / `NEEDS_CONTEXT` -> the takeable-decision ladder below.
|
|
121
123
|
4. **Test gate.** Run each manifest test for the wave union separately, logs to `gate-<i>.log`; print `wave <w> gate <i> exit <code>`. A red gate enters step 6 as a gate repair for every task whose `files` the failing test belongs to (the manifest's `tests` owner), before any review; the review in step 5 runs only on a green gate.
|
|
122
124
|
5. **Review.** One `wave-reviewer` dispatch per wave, doc-only waves included (`context: "fresh"`, `async: false`, read-only, one-step carrier with `WAVE_VERDICT_SCHEMA` and `stopOn: { path: "/verdict", in: ["FIX_FIRST", "REJECT"] }`), `cwd` the integrated tree after `git -C <worktree> add -A`, with `planPath`, the wave's task `anchors`, `Spec:` (absolute home spec), `Leg:` with additive `Rules:` per [Leg routing](#leg-routing), `BASE_SHA: <WAVE_BASE_SHA>`, `HEAD_SHA: WORKTREE`, and the wave union as `SCOPED_TEST_COMMANDS` (`none` for a doc-only wave, so the reviewer runs nothing and applies the clause table and documentation checks only). Record the review tree per `## Fix delta`; print `wave <w> review <k> verdict <value> report <path> tree <sha>`. `SHIP` -> step 7; `FIX_FIRST` -> step 6; `REJECT` -> hard stop with a stop note.
|
|
123
125
|
6. **Repair round.** Attribute each finding to a task: the task whose manifest `files` contain the finding's file, else the tasks in the structured `touchedTasks`; a finding with neither a file inside any wave task's `files` nor a `touchedTasks` owner stops with `Recommendation: spec/plan amendment` through [delegated amendments](./reference/implement-amendments.md) - findings are never dropped from a repair payload. For each attributed task, dispatch one `implementer` on the current tree with the findings block or gate log as its task text, the prior report path under `## Previous review report`, the task's anchors, and `SCOPED_TEST_COMMANDS` (isolated: the task's own `tests`; in-place: the wave union), through the one-step carrier with no `context: "fresh"` override and no prior-patch path:
|
|
@@ -152,7 +154,8 @@ The redirected `diff --binary --cached` writes a file and loads nothing into the
|
|
|
152
154
|
| Event | Counts for task n | Next operation |
|
|
153
155
|
|---|---|---|
|
|
154
156
|
| Red gate at step 4 or after a repair (any implementer status, including `DONE`) | +1 for each task owning a failing test | repair from the gate log; no review until green |
|
|
155
|
-
| Dispatch error, missing structured output after diagnosis says `repair`, or `BLOCKED` / `NEEDS_CONTEXT` answered by the ladder | +1 | re-dispatch the
|
|
157
|
+
| Dispatch error, missing structured output after diagnosis says `repair`, or `BLOCKED` / `NEEDS_CONTEXT` answered by the ladder | +1 | For a ladder-answered `NEEDS_CONTEXT` / `BLOCKED` whose prior attempt produced no edits, re-dispatch the retained original payload verbatim with the answer appended under `## Answer to your BLOCKED question` into the tree the original attempt ran in (owning checkout for in-place and sequential tasks); ask the human nothing, because every required field is already retained in that payload, and use the registered `RP_TREE` or repair-base recipe only for isolated waves whose integrated tree changed. For dispatch errors and diagnosed repairs, re-dispatch the identical payload with neutral facts appended under `## Diagnosis context` (the initial chain exposed no structured output for the task, the diagnosis decision, and which siblings are retained); attribute no verdict or question to the prior implementer run, and dispatch into the registered `RP_TREE` with `worktree: true` for isolated waves; with no registered `RP_TREE`, first run the repair-base recipe on the current integrated tree and dispatch from the resulting `RP_TREE` with `worktree: true`. In-place waves dispatch into the owning checkout without `worktree:`. Reuse a registered `RP_TREE`; never remove, re-snapshot or rebuild it on re-dispatch |
|
|
158
|
+
| Missing or zero-byte initial patch for `DONE` / `DONE_WITH_CONCERNS` | +1 | apply nothing, retain siblings, and start a repair round on the current tree with "your work produced no patch" appended |
|
|
156
159
|
| Repair delta or in-place repair leaves `diff --stat` empty (`DONE` with an unchanged tree) | +1 | no re-review of the unchanged tree; next repair resends the prior report path with "your fix changed no tracked file" |
|
|
157
160
|
| Repair delta fails `git apply --index` | +1 | rebuild |
|
|
158
161
|
| Review 1 `FIX_FIRST` (no `TRAJECTORY:` line) | +1 for each attributed task | repair |
|
|
@@ -196,7 +199,7 @@ subagent({ async: false, context: "fresh", cwd: "<owning checkout>",
|
|
|
196
199
|
})
|
|
197
200
|
```
|
|
198
201
|
|
|
199
|
-
Keep context/async/cwd invocation-level; worktree/concurrency/stopOn step-level; as/output/outputMode/outputSchema/task item-level. Never use top-level `tasks`. Consume fenced structured JSON in `## Outputs` / `## Stop` from result text,
|
|
202
|
+
Keep context/async/cwd invocation-level; worktree/concurrency/stopOn step-level; as/output/outputMode/outputSchema/task item-level. Never use top-level `tasks`. Consume fenced structured JSON in `## Outputs` / `## Stop` from result text; admit the identity-matched capture as the second source after result text under [Chain stopped or failed](#chain-stopped-or-failed), never details or saved prose verdicts. Obtain patches from `Artifacts:` at `<Artifacts dir>/worktree-diffs/step-0/task-<i>-implementer.patch` (zero-based wave position). Keep known report paths. Require accepted statuses and a nonempty patch before initial isolated integration per step 3; count empty repair deltas through the transition table.
|
|
200
203
|
|
|
201
204
|
Run this guard once per implement phase before the first wave. Stop on any error before dispatch; read the peer floor from the installed gauntlet package, not the consumer repository.
|
|
202
205
|
|
|
@@ -248,17 +251,29 @@ Create `REPORT_DIR` with `mktemp -d`. Forward predecessor status and report path
|
|
|
248
251
|
|
|
249
252
|
### Chain stopped or failed
|
|
250
253
|
|
|
251
|
-
Retain accepted siblings; never repeat the initial chain or rerun accepted tasks. Inspect failed tasks alongside `## Stop`; a matched stop precedes sibling-error checking.
|
|
254
|
+
Retain accepted siblings; never repeat the initial chain or rerun accepted tasks. Inspect failed tasks alongside `## Stop`; a matched stop precedes sibling-error checking. Reconcile every dispatched task without a structured result in `## Outputs` or `## Stop`, including successful siblings suppressed by a chain failure. Repair rounds use this same recovery.
|
|
255
|
+
|
|
256
|
+
List captures once with `ls <Artifacts>/structured-output/*/output.json`. Read each listed file once with `limit: 300`, no offset or pagination. Accept only a complete `{"status":"success","value":{...}}` envelope whose `value` satisfies `IMPLEMENTER_STATUS_SCHEMA`: an allowed `value.status`, `question` for `NEEDS_CONTEXT`, `concerns` for `DONE_WITH_CONCERNS`, and exactly one identity. Match `value.anchor` to the dispatched anchor verbatim, or `value.anchors` to the dispatched heading list as a set. Read only this run's artifacts.
|
|
257
|
+
|
|
258
|
+
| Capture result | Action |
|
|
259
|
+
|---|---|
|
|
260
|
+
| One valid matching capture | Route `value.status` through Implementer Status and the transition table as an observed result. Reconcile accepted `DONE` / `DONE_WITH_CONCERNS` siblings through step 3 in plan index order before handling unanswered tasks; send `NEEDS_CONTEXT` / `BLOCKED` to the takeable-decision ladder. For a batch identity, route once for every task in that batch. Print the existing `wave <w> task <n> <status> report <path> patch <path>` observation per task. |
|
|
261
|
+
| Two captures claim the same dispatched identity | Stop naming both paths; never guess. |
|
|
262
|
+
| No file, error envelope, missing value, malformed/rejected schema, stale or unmatched identity, or a read truncated before the closing brace | Treat the task's capture as absent; diagnose below. |
|
|
263
|
+
|
|
264
|
+
Only a task with no accepted capture takes delegated identity-matched artifact diagnosis, once. Dispatch one sequential chain step, never a `parallel` item, with `agent: "delegate"`, `DIAGNOSIS_SCHEMA` and `stopOn` on `/decision`; put the literal sentence `Do not edit any file.` on its own line in the task text. After `decision: repair`, use the ordinary one-step implementer carrier.
|
|
252
265
|
|
|
253
266
|
```ts
|
|
254
267
|
subagent({ async: false, context: "fresh", cwd: "<owning checkout>",
|
|
255
|
-
chain: [{ task:
|
|
268
|
+
chain: [{ agent: "delegate", task: `Diagnose <run/task identities>; Artifacts: <dir>; known reports: <paths>; session artifacts: <locations>.
|
|
269
|
+
Do not edit any file.
|
|
270
|
+
Return compact statuses and retry/repair/stop; never invent a verdict.`,
|
|
256
271
|
output: "<REPORT_DIR>/wave<w>-diagnosis.md", outputMode: "file-only", outputSchema: DIAGNOSIS_SCHEMA,
|
|
257
272
|
stopOn: { path: "/decision", in: ["retry", "repair", "stop"] } }]
|
|
258
273
|
})
|
|
259
274
|
```
|
|
260
275
|
|
|
261
|
-
|
|
276
|
+
Keep this a sequential step, not a parallel item. Let the child alone inspect identity-matched session failure artifacts, not empty parallel-0 directories; diagnosis is not a saved-report relay. Route diagnosis JSON through the transition table. Missing/ambiguous artifacts or delegated failure stop; never recursively diagnose. An implementer anchor failure takes the failed-attempt path; reviewer anchorUnreadable hard-stops.
|
|
262
277
|
|
|
263
278
|
### Recovery
|
|
264
279
|
|
|
@@ -38,7 +38,7 @@ Dispatch a subagent with this prompt:
|
|
|
38
38
|
BLOCKED: Cannot complete the task.
|
|
39
39
|
NEEDS_CONTEXT: Need information not provided.
|
|
40
40
|
|
|
41
|
-
Keep the report layout and emit structured output matching the persona contract and report status. On an unreadable plan/anchor report BLOCKED with anchorUnreadable and the required Reasoning line.
|
|
41
|
+
Keep the report layout and emit structured output matching the persona contract and report status, copying exactly the dispatched anchor or anchors in every status. On an unreadable plan/anchor report BLOCKED with that identity, anchorUnreadable and the required Reasoning line; follow the persona's blocked-message rule.
|
|
42
42
|
|
|
43
43
|
Conduct (TDD scenarios, test economy, scope discipline, escalation, report shape) is your persona; this prompt carries only the task and its test scope.
|
|
44
44
|
```
|
|
@@ -7,7 +7,7 @@ Read these schemas and carrier rules before the first implement dispatch. Keep t
|
|
|
7
7
|
Mirror each child's saved report, not an independent verdict calculation. Bound implementer reasoning to one sentence and 300 characters; keep concerns and evidence entries one line each, questions explicit, and delegated answers one paragraph. Preserve `parallelSafe` as the `Parallel-safe:` line verbatim and `trajectory.line` as the `TRAJECTORY:` line verbatim. Use `measured` only for values an explicit `orchestrator` instruction consumes.
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
const IMPLEMENTER_STATUS_SCHEMA = {"type":"object","required":["status","reasoning"],"additionalProperties":false,"properties":{"status":{"type":"string","enum":["DONE","DONE_WITH_CONCERNS","NEEDS_CONTEXT","BLOCKED"]},"reasoning":{"type":"string","maxLength":300},"concerns":{"type":"array","items":{"type":"string"}},"question":{"type":"string"},"anchorUnreadable":{"type":"string"},"measured":{"type":"object"}},"allOf":[{"if":{"properties":{"status":{"const":"DONE_WITH_CONCERNS"}}},"then":{"required":["concerns"]}},{"if":{"properties":{"status":{"const":"NEEDS_CONTEXT"}}},"then":{"required":["question"]}}]};
|
|
10
|
+
const IMPLEMENTER_STATUS_SCHEMA = {"type":"object","required":["status","reasoning"],"additionalProperties":false,"properties":{"status":{"type":"string","enum":["DONE","DONE_WITH_CONCERNS","NEEDS_CONTEXT","BLOCKED"]},"reasoning":{"type":"string","maxLength":300},"anchor":{"type":"string"},"anchors":{"type":"array","items":{"type":"string"}},"concerns":{"type":"array","items":{"type":"string"}},"question":{"type":"string"},"anchorUnreadable":{"type":"string"},"measured":{"type":"object"}},"oneOf":[{"required":["anchor"]},{"required":["anchors"]}],"allOf":[{"if":{"properties":{"status":{"const":"DONE_WITH_CONCERNS"}}},"then":{"required":["concerns"]}},{"if":{"properties":{"status":{"const":"NEEDS_CONTEXT"}}},"then":{"required":["question"]}}]};
|
|
11
11
|
const WAVE_VERDICT_SCHEMA = {"type":"object","required":["verdict","reasoning","findingCount","findings"],"additionalProperties":false,"properties":{"reasoning":{"type":"string"},"findingCount":{"type":"integer","minimum":0},"parallelSafe":{"type":"string"},"touchedTasks":{"type":"array","items":{"type":"integer"}},"trajectory":{"type":"object","required":["verdict","line"],"additionalProperties":false,"properties":{"verdict":{"type":"string","enum":["CONVERGING","DIVERGING","STAGNANT"]},"line":{"type":"string"}}},"anchorUnreadable":{"type":"string"},"verdict":{"type":"string","enum":["SHIP","FIX_FIRST","REJECT"]},"maxSeverity":{"type":"string","enum":["Critical","Moderate","Minor"]},"findings":{"type":"object","required":["critical","moderate","minor"],"additionalProperties":false,"properties":{"critical":{"type":"integer","minimum":0},"moderate":{"type":"integer","minimum":0},"minor":{"type":"integer","minimum":0}}},"clauses":{"type":"array","items":{"type":"object","required":["clause","status","evidence"],"additionalProperties":false,"properties":{"clause":{"type":"string"},"status":{"type":"string","enum":["met","unmet","out-of-scope"]},"evidence":{"type":"string"}}}}}};
|
|
12
12
|
const ANSWER_SCHEMA = {"type":"object","required":["answer","evidence"],"additionalProperties":false,"properties":{"answer":{"type":"string"},"evidence":{"type":"array","items":{"type":"string"}}}};
|
|
13
13
|
const DIAGNOSIS_SCHEMA = {"type":"object","required":["tasks","decision","diagnostic"],"additionalProperties":false,"properties":{"tasks":{"type":"array","items":{"type":"object","required":["task","status","reportPath","diagnostic"],"additionalProperties":false,"properties":{"task":{"type":"integer"},"status":{"type":"string"},"reportPath":{"type":"string"},"patchPath":{"type":"string"},"diagnostic":{"type":"string"}}}},"decision":{"type":"string","enum":["retry","repair","stop"]},"diagnostic":{"type":"string"}}};
|
|
@@ -15,7 +15,7 @@ const PREPARE_SCHEMA = {"type":"object","required":["items","redraws"],"addition
|
|
|
15
15
|
const APPLY_SCHEMA = {"type":"object","required":["amendedSections","tasksAdded","tasksAnchorChanged","tasksRemoved","passed"],"additionalProperties":false,"properties":{"amendedSections":{"type":"array","items":{"type":"string"}},"tasksAdded":{"type":"array","items":{"type":"integer"}},"tasksAnchorChanged":{"type":"array","items":{"type":"integer"}},"tasksRemoved":{"type":"array","items":{"type":"integer"}},"passed":{"type":"boolean"},"failLines":{"type":"array","items":{"type":"string"}}}};
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Keep `APPLY_SCHEMA` unchanged. Interpret `tasksAnchorChanged` as semantic obligation or work changes against the original anchored obligation text, task bodies and Tests, not line offsets or meaning-preserving rewording; reopen completed tasks only for those semantic changes.
|
|
18
|
+
Keep `APPLY_SCHEMA` unchanged. Interpret `tasksAnchorChanged` as semantic obligation or work changes against the original anchored obligation text, task bodies and Tests, not line offsets or meaning-preserving rewording; reopen completed tasks only for those semantic changes. Derive that inventory from both committed home plan/spec originals through home-relative `git -C "<abs home worktree>" show HEAD:<path>` before edits and on idempotent retry; use previousApplyReport for prior findings only, never baseline copies. Recover a suppressed apply result from the sole capture under the existing bound, requiring a success envelope satisfying unchanged APPLY_SCHEMA; stop on zero/two files or malformed output. Route only the exact `baseline read failed: git -C ` prefix to a quoted immediate stop; every other false result keeps the one fresh retry.
|
|
19
19
|
|
|
20
20
|
## One-step carrier
|
|
21
21
|
|
|
@@ -35,6 +35,6 @@ For answer/evidence, preparation and apply results, retain their approved schema
|
|
|
35
35
|
|
|
36
36
|
## Anchored payload
|
|
37
37
|
|
|
38
|
-
Pass `planPath: <absolute plan path>`, `anchor: "### Task N:"` or `anchors: [<exact prefixes>]`, and `Spec: <absolute authoritative home spec path>` to every implementer and wave-reviewer. `### Task 4:` never matches `### Task 40:`; end each selected section at `^#{2,3}\s`. Children read the union of selected sections, `Spec:`, `Files:`, `Tests:`, `Rules:` and `Leg:` themselves. Combine task Rules with that leg's Rules in home `## Legs`; absent Leg uses the first `### Leg:`. Resolve rules in the owning checkout. Pass isolated implementers only their own task's manifest `tests` as `SCOPED_TEST_COMMANDS`, or `none` when empty, including isolated repairs. Give the integrated gate, in-place repairs and wave reviews the wave union; give initial in-place implementers that union too. Preserve command strings verbatim; keep dispatch-supplied commands independent of the Tests metadata children read.
|
|
38
|
+
Pass `planPath: <absolute plan path>`, `anchor: "### Task N:"` or `anchors: [<exact prefixes>]`, and `Spec: <absolute authoritative home spec path>` to every implementer and wave-reviewer. `### Task 4:` never matches `### Task 40:`; end each selected section at `^#{2,3}\s`. Require implementer returns to copy exactly one dispatched identity field (`anchor` or `anchors`) in every status, including unreadable anchors. Children read the union of selected sections, `Spec:`, `Files:`, `Tests:`, `Rules:` and `Leg:` themselves. Combine task Rules with that leg's Rules in home `## Legs`; absent Leg uses the first `### Leg:`. Resolve rules in the owning checkout. Pass isolated implementers only their own task's manifest `tests` as `SCOPED_TEST_COMMANDS`, or `none` when empty, including isolated repairs. Give the integrated gate, in-place repairs and wave reviews the wave union; give initial in-place implementers that union too. Preserve command strings verbatim; keep dispatch-supplied commands independent of the Tests metadata children read.
|
|
39
39
|
|
|
40
40
|
Forward dependent context as the prior status line plus report path. Put the saved prior report path under `## Previous review report (re-review trigger)`; require the child to read it and apply the existing trajectory block. Read report findings only under the bounded direct-read rule in SKILL.md; never dispatch a child to relay reports. Keep binary delta bytes child-owned.
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Read [amendment-surface.md](../../brainstorming/reference/amendment-surface.md) for the existing gate and Standing grants. Apply this delegation only during implement; keep the planning caller unchanged. Use the one-step carrier and schemas in [dispatch-contract.md](dispatch-contract.md) for every child, with saved output, file-only, fresh context and foreground execution.
|
|
4
4
|
|
|
5
5
|
1. Dispatch `plan-writer` with `Amend-prepare:`, the five absolute paths (worktree, approved spec, plan, plan skill and plan contract) and the evidence already in context: plan_check FAIL lines, structured concerns/question or measured baseline rows. Include the literal sentence `Do not edit any file.` in the `Amend-prepare:` task text. Preparation writes nothing. Require `{ items: [{ evidence, recommended: "accept" | "alt-<n>", location: "<spec section>", edit: string }], redraws: [{ location: "<spec section>", reason: string (max 300 characters) }] }`; keep each edit one paragraph. Keep the existing menu spelling `alt-n` for a named alternative; encode the selected number as `alt-<n>` in JSON. Require both items and redraws arrays, including empty arrays; put redraws only in redraws, never items. Fail malformed preparation output.
|
|
6
|
-
2. Inspect structured redraws first. A nonempty array holds the whole batch at the redraw gate before grant evaluation or applying any sibling item, for redraw-only and mixed batches alike. Never open the preparation report to discover redraws. With no redraws, delegate reading the current `Amend-grant:` and Value decoding through the answer/evidence carrier. Preserve the surface's grant predicate: malformed -> stop and quote; absent, none or no permission -> the existing human menu and escalation gate. Stop on changed problem statement or a component added, removed or re-bounded.
|
|
7
|
-
3. With amend permission, apply the recommended choice without reviewer, menu or confirmation turns; pass granted items verbatim to `plan-writer` under `Amend-apply:` plus the existing `Amend:` entry and parent-supplied `In-flight:` paths from `status --porcelain`, including staged in-place repair deliverables. Preserve Baseline ownership, protected-path and dirty-baseline exits; delegate attribution reads and human wording instead of loading documents in the primary. Authorize only the named spec sections and local patches to affected task entries, coverage and shifted anchors; preserve unaffected ids, titles, wave order, state and evidence. Use the implement-only historical Baseline policy, not wholesale regeneration. Admit declared in-flight repairs, including staged source, for maintenance requiring no execution; preserve staged repairs rather than committing, restoring or discarding them merely to plan. For necessary runs require an identified execution tree and nonzero executed-test count; stop on unidentified dirt, contamination or moved test revision.
|
|
8
|
-
4. Consume the unchanged apply result `{ amendedSections: string[], tasksAdded: number[], tasksAnchorChanged: number[], tasksRemoved: number[], passed: boolean, failLines?: string[] }`.
|
|
6
|
+
2. Inspect structured redraws first. A nonempty array holds the whole batch at the redraw gate before grant evaluation or applying any sibling item, for redraw-only and mixed batches alike. A nonempty `redraws` array stops before prescribing or templating any further plan-writer dispatch in any mode: prepare, apply or revalidation. Never open the preparation report to discover redraws. With no redraws, delegate reading the current `Amend-grant:` and Value decoding through the answer/evidence carrier. Preserve the surface's grant predicate: malformed -> stop and quote; absent, none or no permission -> the existing human menu and escalation gate. Stop on changed problem statement or a component added, removed or re-bounded.
|
|
7
|
+
3. With amend permission, apply the recommended choice without reviewer, menu or confirmation turns; pass granted items verbatim to `plan-writer` under `Amend-apply:` plus the existing `Amend:` entry and parent-supplied `In-flight:` paths from `status --porcelain`, including staged in-place repair deliverables. Preserve Baseline ownership, protected-path and dirty-baseline exits; delegate attribution reads and human wording instead of loading documents in the primary. Authorize only the named spec sections and local patches to affected task entries, coverage and shifted anchors; preserve unaffected ids, titles, wave order, state and evidence. Use the implement-only historical Baseline policy, not wholesale regeneration. Admit declared in-flight repairs, including staged source, for maintenance requiring no execution; preserve staged repairs rather than committing, restoring or discarding them merely to plan. For necessary runs require an identified execution tree and nonzero executed-test count; stop on unidentified dirt, contamination or moved test revision. Require both committed home plan/spec originals to be read through home-relative `git -C "<abs home worktree>" show HEAD:<path>` before any edit. Compare task numbers, titles, anchors, wave positions, anchored obligations, bodies and Tests against those originals, not dirty retry content; preserve semantic-only tasksAnchorChanged. Add no sidecar or report-carried inventory.
|
|
8
|
+
4. Consume the unchanged apply result `{ amendedSections: string[], tasksAdded: number[], tasksAnchorChanged: number[], tasksRemoved: number[], passed: boolean, failLines?: string[] }`. With no printed structured result, read the sole capture at `<Artifacts>/structured-output/*/output.json` for this one-task dispatch using the existing `read` bound `limit: 300`, no offset or pagination. Require a success envelope whose value satisfies unchanged `APPLY_SCHEMA`; zero or two files stops naming paths, and malformed output stops. Route captured `passed`/`failLines` exactly like printed JSON; never recover from prose. Only a failLines entry beginning exactly `baseline read failed: git -C ` stops immediately without retry, quoting the failed command and stderr in the stop note. For every other `passed: false`, retry once in a fresh child with failLines as the rule and `previousApplyReport` set to the first apply report path for prior findings only. Require rereading both committed home plan/spec originals, idempotent granted edits without duplicates, and deltas against those originals. Escalate a second failure; never repeat granted edits blindly.
|
|
9
9
|
Match retained failures by failing command, assertion or path plus corresponding repair evidence, never task membership. Preserve failed revision/output and resolving evidence; route outstanding repairs to their existing task gate loop and keep unrelated regressions substantive blockers. Decode the standing grant at each batch boundary. Repeated authorized intermediate evidence is neither new consent nor a refresh trigger; keep budget-only, malformed-grant and redraw stops and the existing funding unchanged.
|
|
10
10
|
|
|
11
11
|
5. After child success, run parent `plan_check({ planPath })`. Reconcile only after parent PASS: replace the manifest; use tracker update and `add` for tasksAdded, reopen completed tasksAnchorChanged as `in_progress`, and handle tasksRemoved through the surface's existing path. Print `amended the spec: <title> - <what>` from structured item location/edit observations, and make the existing single `amend:` audit commit. Keep the parent from opening spec, plan or reports. Persist measured values from explicit orchestrator instructions through this same path.
|
|
@@ -36,7 +36,7 @@ If no spec exists, recommend `/skill:brainstorming` and await the user's explici
|
|
|
36
36
|
- Dispatch `plan-writer` to write the plan to the sibling `plans/` dir of the spec: yes; the main loop never writes it
|
|
37
37
|
- Edit or create any other files: no
|
|
38
38
|
- Write implementation code: never inside this skill. After Self-Review + `phase_tracker` complete, auto-invoke `/skill:subagent-driven-development` to execute.
|
|
39
|
-
-
|
|
39
|
+
- Commit the plan on the worktree branch (same branch as the spec) at Execution Handoff; never land it on `main`.
|
|
40
40
|
- Edit the approved spec: only via brainstorming's [Amending an approved spec](../brainstorming/SKILL.md#amending-an-approved-spec)
|
|
41
41
|
|
|
42
42
|
## Scope Check
|
|
@@ -294,11 +294,11 @@ If a decision is genuinely open, put it in an explicit **Open Questions** sectio
|
|
|
294
294
|
|
|
295
295
|
The plan-writer runs Baseline, the deterministic checker, then the judgment checks before replying.
|
|
296
296
|
|
|
297
|
-
- **Implement-local Baseline (`Amend-apply:` only).** Use this branch instead of ordinary Baseline steps 1-4 during implement; keep initial planning and ordinary Findings/Amend below unchanged. Write `**Baseline policy:** implement-local` only in this mode. Preserve original per-leg declarations and valid unchanged command bullets at their measured revisions, including derived-pass, skipped and artifact suffixes; perform no endpoint-tree equivalence or rerun-all sweep.
|
|
297
|
+
- **Implement-local Baseline (`Amend-apply:` only).** Use this branch instead of ordinary Baseline steps 1-4 during implement; keep initial planning and ordinary Findings/Amend below unchanged. Write `**Baseline policy:** implement-local` only in this mode. Preserve original per-leg declarations and valid unchanged command bullets at their measured revisions, including derived-pass, skipped and artifact suffixes; perform no endpoint-tree equivalence or rerun-all sweep. Read both committed home plan/spec originals before editing using the two home-relative HEAD reads in plan-writer's `Amend-apply:`; use the committed plan for historical evidence. For retained skipped evidence whose anchors now exist, copy its exact leg, command and bullet value into the existing provenance note as `Baseline provenance: retained <leg or home> | <exact command> | <exact baseline value>`; require matching evidence in the committed plan original, never invent a skip or execution.
|
|
298
298
|
1. Inventory status using ordinary step 1 before maintenance and before/after each run. Admit only explicit parent `In-flight:` paths, spec/plan and eligible recorded artifacts. Unknown dirty paths block. With no test execution needed, preserve declared staged repairs without committing, restoring or discarding them.
|
|
299
299
|
2. Run only changed/added commands or missing/invalid evidence, exact or documented derived scoped commands by the ordinary selector procedure. Count already-created anchors as existing; create new skipped evidence only when all anchors are truly absent at the execution revision. Retained historical skips describe their recorded revision, not current existence.
|
|
300
300
|
3. Require an identified execution tree: current or retained implementation with revision and admitted changes identified, or an existing parent-owned committed snapshot. Never label a dirty run as clean HEAD. Stop on unidentified trees; create no snapshot, source edit or restoration yourself. Record leg, checkout, revision, admitted changes, exact/derived command, exit and nonzero executed-test count in the existing provenance and saved report. Exit 0 with zero tests fails. Apply ordinary contamination/artifact rules, stop on unknown dirty paths or moved test revision, and retain failed revision/output plus subsequent resolving evidence.
|
|
301
|
-
4. Match retained failures by failing command, assertion or path plus corresponding repair evidence, never task membership. Return outstanding repairs to the existing task gate loop; keep unrelated regressions substantive blockers. Preserve failure history in the report while removing only resolved Open Questions rows. Keep parent stamp, integrated gate, review and final verification mandatory. Explicit `Findings: rerun baseline` overrides this branch: execute all commands, remove the implement-local header and restore ordinary uniform evidence; preserve
|
|
301
|
+
4. Match retained failures by failing command, assertion or path plus corresponding repair evidence, never task membership. Return outstanding repairs to the existing task gate loop; keep unrelated regressions substantive blockers. Preserve failure history in the report while removing only resolved Open Questions rows. Keep parent stamp, integrated gate, review and final verification mandatory. Explicit `Findings: rerun baseline` overrides this branch: execute all commands, remove the implement-local header and restore ordinary uniform evidence; preserve prior failure findings in the report.
|
|
302
302
|
- **Baseline.** Execute the numbered procedure below for task `Tests:` commands only; leave header `**Verification:**` to verify. Never author baseline evidence without execution or a recorded tree-equivalence.
|
|
303
303
|
1. Read provenance: `BASE=$(git -C "<abs worktree path>" rev-parse --short HEAD)` and `git -C "<abs worktree path>" status --porcelain --untracked-files=all`. Match every `XY <path>` entry (including `??`) against the worktree-relative plan and spec paths, plus only the parent-supplied `In-flight:` paths on an `Amend:` re-dispatch; never infer that set. Also allow untracked paths already recorded in existing baseline bullets' ` - artifacts:` suffixes in the plan at the plan path, excluding every plan `Create:` or `Test:` path. Keep those suffixes on retained bullets. Any other entry blocks all commands: collect `- Baseline: worktree dirty on <BASE>: <paths>`. Allowed in-flight paths outside the spec and plan directories are source edits: collect `- Baseline: in-flight source edits on <BASE>: <paths>` and run nothing. Allow doc-only workflow edits. For plain jj (no `.git`, VCS kind `jj`), use `BASE=$(jj -R "<abs worktree path>" log -r @- --no-graph -T 'commit_id.short()')` and `jj -R "<abs worktree path>" diff --summary`; classify one-letter status and relative paths identically (`A` includes new files). Never revert or clean anything. Record a short baseline provenance note with the initial per-file inventory, BASE, and which exact paths were admitted before running commands; retain it even when a later run is contaminated or blocked.
|
|
304
304
|
2. On Findings/Amend, before any command runs, use step 1's BASE and prove endpoint-tree equivalence once per distinct recorded SHA in the plan. Derive `<spec dir>` and `<plan dir>` as the worktree-relative directories of the dispatched spec and plan paths. Run `git -C "<abs worktree path>" diff --quiet <recorded> <BASE> -- . ':!<spec dir>/' ':!<plan dir>/'`; only exit 0 proves equivalence. Keep the trailing `/` directory boundaries. For plain jj, run `jj -R "<abs worktree path>" diff --from <recorded> --to <BASE> --summary`: require exit 0 and empty stdout after dropping entries whose paths all lie under `<spec dir>/` or `<plan dir>/`. Reject entries that do not parse as `<status> <path>`; exclude stderr from filtered evidence. Prove every recorded SHA before rewriting any bullet; retention is all-or-nothing.
|
|
@@ -327,7 +327,7 @@ The plan-writer runs Baseline, the deterministic checker, then the judgment chec
|
|
|
327
327
|
- Under each contamination/global row indent `blocked: Task M `<command>`` for every command it blocked. Keep failure output verbatim, including `TODO` or `etc.` inside valid continuation fences; only those evidence fences are exempt from placeholder scanning.
|
|
328
328
|
|
|
329
329
|
With substantive rows remaining reply `OPEN QUESTIONS <abs plan path>` immediately; do not spend repair rounds on them.
|
|
330
|
-
- **Implement-local patch (`Amend-apply:` only).**
|
|
330
|
+
- **Implement-local patch (`Amend-apply:` only).** Derive original task numbers, titles, anchors, anchored obligation text, task bodies, Tests and wave positions from both committed home plan/spec originals using home-relative HEAD reads before any edit and on every retry. Use `previousApplyReport` for prior findings only, not baseline copies. Patch affected entries, coverage and shifted anchors only, preserving unaffected text, state and evidence. Compare semantic obligations/work, ignoring line shifts and meaning-preserving rewording; return no completed task in `tasksAnchorChanged` for a pure offset move. Keep full-file write mechanics, idempotent retry, write-free failed original reads and parent stamping.
|
|
331
331
|
- **Deterministic checker.** Run `plan_check({ planPath: "<abs plan path>" })` on the saved plan. Repair every `baseline-line` finding (missing, malformed, misplaced, invalid skipped/pass via or differing SHAs) and substantive baseline `open-questions` finding only through Baseline, never by authoring `pass`/`skipped` evidence or deleting/rewording a row. Normalize `## Open Questions malformed` into `- ` rows without changing substantive text. Fix every other finding yourself and rerun. With substantive rows remaining, reply `OPEN QUESTIONS <abs plan path>` without a passing check. Apply the 3-round budget only to ordinary findings: convert a finding surviving 3 rounds to an Open Questions row and stop. A child pass validates; the parent's call writes the execution stamp. Omit an empty questions section and reply `PLAN WRITTEN <abs plan path>` after all checks pass. Findings are defined in [reference/plan-contract.md](reference/plan-contract.md).
|
|
332
332
|
- **Contract decisions.** For every task crossing a boundary the spec leaves unsettled (a host-forwarded value, a caller's error type), derive the decision from code, the harness contract, or a sibling task. State `Decision: <what> - <caller/contract/sibling task cited>` in the task text. Ask only when the spec is silent or wrong and no source settles it; put that unresolved contract in Open Questions. Add no per-task `Decisions:` field.
|
|
333
333
|
- **Code-vs-anchor sanity.** For each task-owned requirement row, re-read the anchored spec lines and confirm the owner tasks' bodies do what they say - mechanism present, not just the quoted literal. For each `Verification` row, confirm the header command exercises the anchored requirement. Fix the task, don't annotate.
|
|
@@ -353,7 +353,7 @@ Fix what this review finds before handoff.
|
|
|
353
353
|
|
|
354
354
|
## Execution Handoff
|
|
355
355
|
|
|
356
|
-
After the parent `plan_check` passes and the plan has been read once (`## Author the plan` step 7), mark the planning phase complete
|
|
356
|
+
After the parent `plan_check` passes and the plan has been read once (`## Author the plan` step 7), check the plan-scoped status on the home worktree branch: `git -C "<abs home worktree>" status --porcelain -- "<home-relative plan path>"`. On empty output, skip staging and commit. On nonempty output, stage and commit only the home-relative plan: `git -C "<abs home worktree>" add -- "<home-relative plan path>"` then `git -C "<abs home worktree>" commit -m "plan: <spec title>" -- "<home-relative plan path>"`. Stop on any status, staging or commit failure; never stage unrelated source. Then mark the planning phase complete and initialize `plan_tracker` once with every plan task in wave order. Name each entry `W<k>: <title>` using its containing wave and task title. This is the execution list: do not initialize it again on continuation.
|
|
357
357
|
|
|
358
358
|
```
|
|
359
359
|
phase_tracker({ action: "complete", phase: "plan" })
|
|
@@ -44,7 +44,7 @@ Commands are written repo-relative and run in the worktree via `(cd "<abs worktr
|
|
|
44
44
|
|
|
45
45
|
Write the optional header `**Baseline policy:** implement-local` only from implement-phase `Amend-apply:`. Reject duplicate, misplaced, empty or unknown policy values. Absence preserves ordinary uniform-SHA checks. In local mode retain one valid original `Baseline <repo>: <sha>` declaration per admitted leg; allow genuinely evidenced mixed per-command revisions within that leg without implying freshness at current HEAD. Keep syntax, adjacency, leg ownership and anchor checks unchanged.
|
|
46
46
|
|
|
47
|
-
Count an existing Test path still declared Create as existing for new derived evidence; create new skipped evidence only for truly absent all-created anchors. Retain historical skipped evidence even when its anchors now exist only with matching original evidence in the
|
|
47
|
+
Count an existing Test path still declared Create as existing for new derived evidence; create new skipped evidence only for truly absent all-created anchors. Retain historical skipped evidence even when its anchors now exist only with matching original evidence in the committed plan from the committed home plan/spec originals and existing provenance note: `Baseline provenance: retained <leg or home> | <exact command> | <exact baseline value>`. The value is the whole text after `- baseline: `, including suffixes. The checker matches this note by leg, exact command and value; the writer owns validating the historical observation against the committed plan original, reread via `git -C "<abs home worktree>" show HEAD:<home-relative plan path>` before edits and on every retry; use previousApplyReport for prior findings only. Preserve pass-via and artifact suffixes byte-identically on retention. Explicit full refresh executes all commands and restores ordinary uniform evidence; never infer mode from mixed SHAs.
|
|
48
48
|
|
|
49
49
|
## Open Questions (`open-questions`)
|
|
50
50
|
|