@gtrabanco/pi-agentic-workflow 0.37.0 → 5.0.0-canary.20261102.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +2 -2
  2. package/dist/extension/factory.d.ts +3 -6
  3. package/dist/extension/factory.js +1 -2
  4. package/dist/extension/index.js +0 -8
  5. package/package.json +8 -7
  6. package/skills/audit-docs/SKILL.md +1 -1
  7. package/skills/audit-pr/SKILL.md +12 -1
  8. package/skills/discover-repository-state/SKILL.md +1 -1
  9. package/skills/execute-phase/SKILL.md +63 -8
  10. package/skills/execute-phase/references/PREFLIGHT.md +2 -2
  11. package/skills/fold-findings/SKILL.md +126 -8
  12. package/skills/fold-findings/references/FOLD_PROCESS.md +7 -1
  13. package/skills/init-workspace/SKILL.md +16 -9
  14. package/skills/init-workspace/references/BOOTSTRAP_WRITE.md +13 -7
  15. package/skills/init-workspace/references/UPGRADE.md +34 -14
  16. package/skills/log-session/SKILL.md +1 -1
  17. package/skills/orchestration-envelope/SKILL.md +1 -1
  18. package/skills/phase-contract/SKILL.md +2 -2
  19. package/skills/pre-execution-review/SKILL.md +1 -1
  20. package/skills/pre-execution-review/references/LEDGERS.md +1 -1
  21. package/skills/pre-execution-review/references/POLICY.md +2 -2
  22. package/skills/product-audit/SKILL.md +10 -2
  23. package/skills/product-audit/references/AUDIT_DIMENSIONS.md +36 -0
  24. package/skills/product-audit/references/AUDIT_PROCESS.md +9 -2
  25. package/skills/resolve-repository-state/SKILL.md +1 -1
  26. package/skills/review-a11y/SKILL.md +1 -1
  27. package/skills/review-brand/SKILL.md +1 -1
  28. package/skills/review-change/SKILL.md +18 -3
  29. package/skills/review-code/SKILL.md +44 -3
  30. package/skills/review-debt/SKILL.md +8 -2
  31. package/skills/review-design/SKILL.md +1 -1
  32. package/skills/review-implementation/SKILL.md +1 -1
  33. package/skills/review-implementation/references/CLASSIFY.md +25 -0
  34. package/skills/review-perf/SKILL.md +1 -1
  35. package/skills/review-security/SKILL.md +1 -1
  36. package/skills/review-seo/SKILL.md +1 -1
  37. package/skills/review-verify/SKILL.md +19 -2
  38. package/skills/triage-issue/SKILL.md +12 -3
  39. package/skills/triage-issue/references/LABELS.md +22 -0
  40. package/skills/unit-lane/SKILL.md +29 -10
  41. package/skills/unit-lane/references/DESIGN.md +55 -1
  42. package/skills/unit-lane/references/PLAN.md +29 -0
  43. package/skills/unit-lane/references/RELEASE.md +4 -4
  44. package/skills/verification-contract/SKILL.md +9 -1
  45. package/skills/workflow-status/SKILL.md +3 -3
  46. package/skills/workflow-status/references/SENSOR_CORE.md +4 -3
  47. package/dist/extension/merge-guard.d.ts +0 -38
  48. package/dist/extension/merge-guard.js +0 -53
package/README.md CHANGED
@@ -326,9 +326,9 @@ dialog.
326
326
 
327
327
  - Verified against the peer floor Pi 0.99.1 (2026-09-29) (`pi install`, package skills, friendly
328
328
  command registration, routed set/clear, settings console round-trip, `sendUserMessage`
329
- with prompt template expansion). Also verified against Pi 1.2.0 (2026-10-14) via a local
329
+ with prompt template expansion). Also verified against Pi 1.5.0 (2026-11-02) via a local
330
330
  two-leg `tsc --noEmit` run (legs `0.99.1` + `latest`, the `latest` leg resolving to pi
331
- 1.2.0; COMPAT-OK); continuously against the
331
+ 1.5.0; COMPAT-OK); continuously against the
332
332
  `latest` dist-tag by the `pi-compat-guard` PR gate (the leg is a moving tripwire,
333
333
  not a pinned version — a breaking release shows red here first).
334
334
  - The package declares Pi as a peer dependency; it bundles no copy of Pi.
@@ -2,7 +2,6 @@ import type { LoadedConfig } from "../config/load.js";
2
2
  import type { Catalogue } from "../routing/catalogue.js";
3
3
  import type { Router } from "../routing/dispatch.js";
4
4
  import { dirtyWorktreeWarning, receiptGuard } from "./receipt-guard.js";
5
- import { mergeGuard } from "./merge-guard.js";
6
5
  import type { ExtensionSurface, InvocationContext, ModelRef, RoutingControls } from "../routing/types.js";
7
6
  import type { HintStore } from "../routing/state.js";
8
7
  /**
@@ -55,14 +54,12 @@ export interface ExtensionHandle<M extends ModelRef = ModelRef> {
55
54
  catalogue: Catalogue;
56
55
  /**
57
56
  * The Pi-free predicates the adapter (`index.ts`) binds to Pi's lifecycle
58
- * events: the inline-receipt block guard, the merge guard (owner-only
59
- * merges, issue #278), and the dirty-worktree notice. They travel with the
60
- * handle so the entry stays a thin translation layer and the decisions are
61
- * unit-tested with no session (issues #182, #278).
57
+ * events: the inline-receipt block guard and the dirty-worktree notice. They
58
+ * travel with the handle so the entry stays a thin translation layer and the
59
+ * decisions are unit-tested with no session (issue #182).
62
60
  */
63
61
  guards: {
64
62
  receiptGuard: typeof receiptGuard;
65
- mergeGuard: typeof mergeGuard;
66
63
  dirtyWorktreeWarning: typeof dirtyWorktreeWarning;
67
64
  };
68
65
  }
@@ -2,7 +2,6 @@ import { loadConfig } from "../config/load.js";
2
2
  import { readCatalogue } from "../routing/catalogue.js";
3
3
  import { createRouter } from "../routing/dispatch.js";
4
4
  import { dirtyWorktreeWarning, receiptGuard } from "./receipt-guard.js";
5
- import { mergeGuard } from "./merge-guard.js";
6
5
  import { ADVANCE_COMMAND, SETTINGS_COMMAND, SETTINGS_COMMAND_ALIAS } from "../routing/types.js";
7
6
  import { registerAdvanceCommand } from "./conductor-command.js";
8
7
  import { createProfileStateStore, stateFilePath } from "../routing/state.js";
@@ -79,5 +78,5 @@ export function createExtension(deps) {
79
78
  description: "Show and configure per-command model routing",
80
79
  handler: settingsHandler,
81
80
  });
82
- return { router, catalogue, guards: { receiptGuard, mergeGuard, dirtyWorktreeWarning } };
81
+ return { router, catalogue, guards: { receiptGuard, dirtyWorktreeWarning } };
83
82
  }
@@ -296,16 +296,8 @@ export default function extension(pi) {
296
296
  // names the script that proves the receipt landed (issue #182). The guard
297
297
  // itself filters to `bash`, so every tool call is checked — nesting it under
298
298
  // one tool name would make the block unreachable for the calls it exists for.
299
- //
300
- // Merges are owner-only (issue #278): `gh pr merge`, the `gh api` merge
301
- // endpoints, and `git merge` are blocked before anything else runs — a
302
- // review waiver is not merge authorization. Read-only git (`merge-tree`,
303
- // `merge-base`) and rebases pass; the reason hands the PR URL to the owner.
304
299
  pi.on("tool_call", (event, ctx) => {
305
300
  const command = "command" in event.input && typeof event.input.command === "string" ? event.input.command : undefined;
306
- const merge = guards.mergeGuard({ toolName: event.toolName, command });
307
- if (merge.block)
308
- return merge;
309
301
  const receipt = guards.receiptGuard({ toolName: event.toolName, command });
310
302
  if (receipt.block)
311
303
  return receipt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtrabanco/pi-agentic-workflow",
3
- "version": "0.37.0",
3
+ "version": "5.0.0-canary.20261102.1",
4
4
  "description": "Pi package: canonical agentic-workflow skills, friendly slash commands, and per-command model routing.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -43,25 +43,26 @@
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsc",
46
+ "build:deps": "bun run --cwd ../agentic-workflow-schema build",
46
47
  "bundle:skills": "bun scripts/bundle-skills.mjs",
47
48
  "clean:skills": "bun scripts/bundle-skills.mjs --clean",
48
49
  "test": "bun run bundle:skills && tsc && bun test test/*.test.mjs",
49
50
  "test:node": "bun run bundle:skills && tsc && node --test test/*.test.mjs",
50
- "prepublishOnly": "bun run build && bun run bundle:skills && bun run test",
51
+ "prepublishOnly": "bun run build:deps && bun run build && bun run bundle:skills && bun run test",
51
52
  "postpack": "bun run clean:skills",
52
53
  "mutation": "bun run bundle:skills && bun scripts/mutation-check.mjs",
53
- "prepare": "bun run build && bun run bundle:skills"
54
+ "prepare": "bun run build:deps && bun run build && bun run bundle:skills"
54
55
  },
55
56
  "peerDependencies": {
56
57
  "@earendil-works/pi-coding-agent": ">=0.99.1",
57
58
  "@earendil-works/pi-tui": "*"
58
59
  },
59
60
  "dependencies": {
60
- "@gtrabanco/agentic-workflow": "0.5.0",
61
- "@gtrabanco/agentic-workflow-schema": "4.9.0"
61
+ "@gtrabanco/agentic-workflow": "5.0.0-canary.20261102.1",
62
+ "@gtrabanco/agentic-workflow-schema": "5.0.0-canary.20261102.1"
62
63
  },
63
64
  "devDependencies": {
64
- "@types/node": "24.13.3",
65
- "typescript": "6.0.3"
65
+ "@types/node": "26.6.6",
66
+ "typescript": "7"
66
67
  }
67
68
  }
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: audit-docs
3
3
  user-invocable: true
4
- version: 2.2.0
4
+ version: 4.10.0
5
5
  argument-hint: "[--fix]"
6
6
  author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
7
7
  license: MIT
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: audit-pr
3
3
  user-invocable: true
4
- version: 5.6.3
4
+ version: 4.10.0
5
5
  argument-hint: <pr-number> (optional — defaults to the current branch's PR)
6
6
  author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
7
7
  license: MIT
@@ -50,6 +50,12 @@ independently evaluates only the delivery gates below.
50
50
  this skill and cannot be inherited from docs or an earlier session
51
51
  ✓ No review pass was composed or reconstructed: a missing/stale receipt is a
52
52
  blocker, never a prompt to re-run review axes from this skill
53
+ ✓ **Every AC links a demonstration artifact (S3, S7).** Read the unit doc's
54
+ `## Acceptance criteria` (or `## Specs` S# + `## Acceptance criteria` in
55
+ the re-cut shape). For each AC, verify it links a demonstration:
56
+ a passing test with output, a UI capture, a reproduced command output.
57
+ An AC without a demonstration is a **BLOCKER** — the PR's body must render
58
+ it. A PR whose ACs lack demonstrations never reaches the merge gate.
53
59
  ✓ Closure integrity was evaluated and its result stated explicitly: pass /
54
60
  blocker / n-a (fix-governed PRs are always n-a; never skipped
55
61
  silently)
@@ -77,6 +83,11 @@ first on purpose).
77
83
  everything the SPEC promised is present, traceable, and green. A missing or stale
78
84
  receipt is a blocker routed back to `/review-change`, never re-litigated here.
79
85
 
86
+ **Cost-scaling invariant (S7).** Reviewers dig into code only when evidence is
87
+ absent or contradicts — so review cost scales with the change, not the project.
88
+ The non-technical approver (human layer) validates demonstrations; the merge
89
+ gate (technical layer) validates evidence linkage. Same evidence, two readings.
90
+
80
91
  ## Scope
81
92
 
82
93
  The whole pull request: the branch vs. the default base, **plus** its SPEC and
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: discover-repository-state
3
3
  user-invocable: true
4
- version: 1.2.2
4
+ version: 4.10.0
5
5
  description: >
6
6
  Discover repository evidence and write a frozen Normalized Repository State.
7
7
  Produces verified repository evidence and keeps facts, decisions, planned
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: execute-phase
3
3
  user-invocable: true
4
- version: 6.5.0
4
+ version: 4.10.0
5
5
  argument-hint: <NN-slug> [P<k>|step] [--max-attempts N] [--force]
6
6
  allowed-tools: [Bash, Read, Edit, Write, MultiEdit]
7
7
  author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
@@ -43,11 +43,16 @@ if bun is not installed) and the
43
43
  ✓ Unit doc read and step selected (explicit P<k> or first unfinished)
44
44
  ✓ Step executed and committed (one commit per step, conventional format)
45
45
  ✓ Evidence rows updated (command → exit/digest → output → verified-by)
46
+ — each row carries the command, observed output (reproduced, not typed by
47
+ hand), and the verifying-by credit. (S5 — claim-evidence loop: mandatory
48
+ reproduction, loop-until-green inside the same turn)
46
49
  ✓ Progress log updated with a dated `YYYY-MM-DD HH:MM` entry that names the
47
50
  phase id (what, commit, next)
48
51
  ✓ Memory boundary ran — the phase's outcome saved under `unit/<NN-slug>/doc`,
49
52
  or the mirror marked pending when the layer is degraded
50
53
  ✓ Diff guard passed (on implement steps) — see `diff-guard` in PREFLIGHT.md
54
+ ✓ Self-audit box (S9 d): every claim the persist introduces was re-derived
55
+ with pasted output before the commit lands.
51
56
  ✓ → Next: block printed as the absolute last output
52
57
  ```
53
58
 
@@ -133,14 +138,51 @@ work. For `implement` steps: write tests-first where they pay (core/domain,
133
138
  orchestration — record the failing red run's command, exit, and failing test
134
139
  names before implementation), then green. UI/adapter glue may test after.
135
140
 
136
- ### 5. Post-step
141
+ ### 5. Claim-evidence loop (S5 — before post-step)
142
+
143
+ Before running post-step, verify every claim the step's repair introduces. This
144
+ is the repairer-owned verification that prevents the unit 79 F50-class failure
145
+ (closed gate-green with an unreproduced figure "170" without re-deriving via
146
+ `git diff --numstat`).
147
+
148
+ 1. **Claim ledger.** Enumerate every claim: each new figure, cross-reference,
149
+ "X is now Y"; in code: each behavior the step declares.
150
+ 2. **Mandatory reproduction.** Re-derive the figure with the command, resolve
151
+ the reference with grep, reproduce the behavior. Paste command + observed
152
+ output into the claim table — never type the expected result by hand.
153
+ 3. **Loop until green.** red → repair → re-run, *inside the same turn*, until
154
+ every claim verifies.
155
+ 4. **Admission rule.** If no command can verify the sentence, it is not a
156
+ claim, it is an opinion, and it does not get written.
157
+
158
+ Output:
159
+
160
+ ```
161
+ | claim | command | output | status |
162
+ |---|---|---|---|
163
+ | <claim> | `<command>` | `<observed output>` | ✓ |
164
+ ```
165
+
166
+ The row shape is published grammar (`evidence-row@1` in
167
+ `@gtrabanco/agentic-workflow-schema`), so a row missing its command, its
168
+ observed output or a ✓/✗ verdict is a shape violation rather than a style nit.
169
+
170
+ **Bounded checkpoint (S13/S14).** The claim-evidence loop is only paid if it is
171
+ cheap: `node scripts/test-route.mjs --check <changed path>` names the minimal
172
+ suite a path needs, so an intermediate verification costs seconds instead of the
173
+ full gate. An unmatched path answers `route: full-suite` — never fewer tests —
174
+ and the full gate stays what the merge gate and CI run.
175
+
176
+ ### 6. Post-step
137
177
 
138
178
  1. **Diff guard** (implement steps only): run `bun scripts/diff-guard.mjs --base
139
179
  <last-step-commit> --unit <unit>` — paste the block verbatim. **BREACH → STOP**
140
180
  (re-triage or record exception). Anti-gaming: **NEVER shrink a diff by deleting
141
181
  comments, blank lines, docs or tests.**
142
182
  2. **Evidence rows**: one row per AC satisfied — `| AC | command | exit/digest |
143
- output (≤2 lines) | verified-by |`. Append to the Evidence section.
183
+ output (≤2 lines, reproduced via command, not typed by hand) | verified-by |`
184
+ — append to the Evidence section. The evidence row is a *reproduced receipt*,
185
+ not an assertion (S5: mandatory reproduction extends to doc artifacts).
144
186
  3. **Progress log**: append a dated entry —
145
187
  `YYYY-MM-DD HH:MM — <what was done> → <commit sha> — next: <what is next>`.
146
188
  4. **Memory boundary** — this step is a phase transition. Follow
@@ -153,7 +195,7 @@ names before implementation), then green. UI/adapter glue may test after.
153
195
  5. **Commit**: `git add <changed files>` then `git commit -m "<type>(<scope>):
154
196
  <step-summary>"` — run it, paste the SHA.
155
197
 
156
- ### 6. Red gate (repair loop)
198
+ ### 7. Red gate (repair loop)
157
199
 
158
200
  After each step: run the project's verification gate (type-check + tests + build).
159
201
 
@@ -173,7 +215,7 @@ After each step: run the project's verification gate (type-check + tests + build
173
215
  · continue atomically → /execute-phase <unit> <P<k>>
174
216
  ```
175
217
 
176
- ### 7. Whole-unit mode
218
+ ### 8. Whole-unit mode
177
219
 
178
220
  When invoked as `<NN-slug>` with no step: loop all remaining steps, one commit
179
221
  each. This is an **explicit operator choice only** — the lane's hand-offs
@@ -185,8 +227,8 @@ the full accumulated diff. On gate red at any step: repair that step (up to
185
227
  `--max-attempts`), then continue the loop. The close-out is part of the last
186
228
  step's completion: open the PR on `main` with `Closes #N`, write `- PR: <url>`
187
229
  into References, and settle the index row with `agentic-workflow roadmap
188
- <index> rowUpsert '<json>'` (`docs/features/ROADMAP.md`; a fix unit edits its
189
- `docs/fix/README.md` status cell — no `NN` column, no `rowUpsert`).
230
+ <index> rowUpsert '<json>'` (`docs/ROADMAP.md`; a fix unit edits its row in that
231
+ document's `## Fixes` table — no `NN` column, no `rowUpsert`).
190
232
  `bun scripts/roadmap-settle.mjs` exits 0 (#316).
191
233
  Terminal:
192
234
 
@@ -200,7 +242,7 @@ PR: <url>
200
242
  · merge gate after REVIEW-PASS → /audit-pr
201
243
  ```
202
244
 
203
- ### 8. Descope guard
245
+ ### 9. Descope guard
204
246
 
205
247
  Before creating **any** issue while executing: classify with the descope test.
206
248
  A descope (moving an acceptance criterion or task out of scope) requires
@@ -221,6 +263,11 @@ These files must be loaded when their topic is active:
221
263
 
222
264
  ## Guardrails
223
265
 
266
+ - The all-stages no-assumption rule binds every step here — **ask-don't-infer**,
267
+ owner `skills/unit-lane/references/DESIGN.md` (`ask-dont-infer@1`): an
268
+ expectation the tree, the docs, or a prior owner decision does not evidence
269
+ is asked, never invented.
270
+
224
271
  **Allowed:**
225
272
  - Only the triaged steps listed by the unit doc's Evidence header
226
273
  - Changes scoped to the acceptance criteria and step tasks
@@ -235,6 +282,14 @@ These files must be loaded when their topic is active:
235
282
  keep assertions at least as strong.
236
283
  - Never execute a step the triage skipped — the catalog is authoritative.
237
284
  - Never edit the unit doc's Acceptance criteria (that is re-triage with user consent).
285
+ - Never write to `docs/LOGS.md` (S9 4b): LOGS.md must be pure code output —
286
+ no model writes it. The interim rule (until feature 41's
287
+ `autoLogSession: mechanical`) is append-only: a wrong past line gets a *new
288
+ correcting line*, never an edit. Machine-authored git-facts entries also
289
+ kill the "hand-tallied figure" class.
290
+ - Self-audit box (S9 d): before committing, re-derive every claim the step's
291
+ persist introduces with pasted output. The turn does not end with unreproduced
292
+ claims.
238
293
  - Never expand scope beyond what Non-goals define — findings discovered during
239
294
  implementation never widen the unit.
240
295
  - Never invent an acceptance criterion — ask the user with concrete options.
@@ -69,8 +69,8 @@ appending to the unit doc's Evidence section.
69
69
 
70
70
  ### Own-status precondition (runs after the dependency closure is met, still before any edit)
71
71
 
72
- Read the unit doc's status from the roadmap (the five-state machine —
73
- `docs/features/ROADMAP.md` → Status legend):
72
+ Read the unit doc's status from the location index (the five-state machine —
73
+ `docs/ROADMAP.md` → Status legend):
74
74
 
75
75
  1. **`idea`** (or no triage block in the unit doc) → STOP, before any edit:
76
76
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: fold-findings
3
3
  user-invocable: true
4
- version: 1.11.0
4
+ version: 4.10.0
5
5
  argument-hint: [finding-id …]
6
6
  author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
7
7
  license: MIT
@@ -34,6 +34,18 @@ skill fixes each root cause, never relabeling, deferring, or weakening its check
34
34
  ✓ 5. The closing `Folded: n/m · Disputed: k · Blocked: j[ · Replan: r]` tally
35
35
  and outcome-branched `→ Next:` block are printed as the ABSOLUTE last output.
36
36
  Every affected finding ID is named in that block, joined with ` + `.
37
+ ✓ 6. Claim-evidence loop ran: before committing, every claim the repair
38
+ introduces was reproduced with the command and observed output pasted
39
+ into the claim table (`claim | command | output | status`). Loop ran until
40
+ green inside the same turn. (S5)
41
+ ✓ 7. Class escalation checked: ≥ 2 folded rows sharing mechanism+axis
42
+ were escalated to one class-level fix-now finding. (S1)
43
+ ✓ 8. Evidence-bound check: every finding citation was verified — the cited
44
+ file:line exists and the snippet matches the working tree verbatim. (S10)
45
+ ✓ 9. Reviewer anti-invention check: new findings are grounded in
46
+ provably-changed bytes (git-computed) or a mis-run cited check. (S10)
47
+ ✓ 10. Net narration diff ≤ 0 per fold: lines deleted, not moved. (S10)
48
+ ✓ 11. Closure status printed: `closure: complete | open(n)`. (S4)
37
49
  ```
38
50
 
39
51
  Any unchecked box means the turn is not done.
@@ -73,8 +85,22 @@ Per Workflow conventions, read:
73
85
  2. Queue the carrier's open rows — a legacy `folded: no` row, a migrated row of
74
86
  `## Findings` (all of them are open); explicit IDs restrict the queue and leave
75
87
  other rows untouched. Group by root cause, verifier and rollback boundary.
76
- 3. The project's verification gate and forge CLI (use the declared forge).
77
- 4. Whether the branch has an open PR; this decides immediate push after commit.
88
+ 3. **Class escalation (S1).** After grouping: ≥ 2 folded rows sharing
89
+ mechanism+axis ⇒ one class-level fix-now finding whose repair targets the
90
+ *mechanism*, not a repeated instance. The two-cycle cap then means what it
91
+ was built to mean: a class the loop refuses to repair is a planning defect,
92
+ not more folds. Document the escalation as `F<next> (class: <mechanism>,
93
+ replaces F<a> + F<b> + …)` in the ledger.
94
+ 4. **Evidence-bound check (S10, from #218).** Before processing, verify every
95
+ finding's citation: the cited `file:line` exists and the snippet matches the
96
+ working tree verbatim. Wrong-citation and position-drift findings are
97
+ discarded mechanically — `refuted` with evidence, no cycle consumed.
98
+ 5. **Reviewer anti-invention check (S10, from #205).** Any new finding surfaced
99
+ during fold must be grounded in **provably-changed bytes** (git-computed) or
100
+ a **mis-run cited check** (the cited validator's own output contradicts it).
101
+ A finding without changed-bytes grounding is a report-note, never fix-now.
102
+ 6. The project's verification gate and forge CLI (use the declared forge).
103
+ 7. Whether the branch has an open PR; this decides immediate push after commit.
78
104
 
79
105
  ## Progressive loading — fold queue
80
106
 
@@ -87,6 +113,58 @@ code or the ledger:
87
113
  Both are normative and one hop from this file. Missing resource → stop; never
88
114
  infer a classification or fold procedure.
89
115
 
116
+ ## Claim-evidence loop (S5 — mandatory before commit)
117
+
118
+ Before committing the fold fix, run the claim-evidence loop. This is not optional;
119
+ a turn that writes without verifying its own claims is the exact failure class
120
+ that produced unit 79's F49→F50→F51.
121
+
122
+ 1. **Claim ledger.** Enumerate every claim the repair introduces: each new
123
+ figure, cross-reference, "X is now Y"; in code: each behavior the fix
124
+ declares. Write one row per claim.
125
+ 2. **Mandatory reproduction.** Every claim is executed, never asserted:
126
+ re-derive the figure with the command, resolve the reference with grep,
127
+ reproduce the behavior. Paste command + observed output into the claim
128
+ table — never type the expected result by hand.
129
+ 3. **Loop until green.** red → repair → re-run, *inside the same turn*, until
130
+ every claim in the closure set verifies. The repairer's turn does not end
131
+ with unreproduced claims.
132
+ 4. **Admission rule.** If no command can verify the sentence, it is not a
133
+ claim, it is an opinion, and it does not get written. This extends the
134
+ repo's own tests-first rule to documentation artifacts.
135
+
136
+ Output the claim table as:
137
+
138
+ ```
139
+ ## Claim-evidence table
140
+ | claim | command | output | status |
141
+ |---|---|---|---|
142
+ | <claim text> | `<command>` | `<observed output>` | ✓ |```
143
+
144
+ All rows must have `status: ✓`. A `status: ✗` row means the turn is not done
145
+ — repair and re-run the claim.
146
+
147
+ The row shape is published grammar, not convention (`evidence-row@1` in
148
+ `@gtrabanco/agentic-workflow-schema`: `EVIDENCE_ROW_COLUMNS`,
149
+ `EVIDENCE_ROW_VERDICTS`, `validateEvidenceRow`). A row whose claim is empty, whose
150
+ command or output is not a backticked command/observation, or whose verdict is
151
+ outside `✓ | ✗` is a shape violation — prose in the command cell is refused
152
+ exactly like an empty one, because a typed expectation is the defect the shape
153
+ exists to stop.
154
+
155
+ ## Closure status (S4, S11)
156
+
157
+ At the end of the fold, print the closure status:
158
+
159
+ ```
160
+ closure: complete | open(n)
161
+ ```
162
+
163
+ - `complete` — all findings in the queue are resolved (folded, refuted, disputed, or replanned).
164
+ - `open(n)` — n findings remain open (blockers that need user input). Print the count and the blocker IDs.
165
+
166
+ Cycle-count stops being the health metric; closure is the invariant.
167
+
90
168
  ## Report — return exactly this structure (fixed output contract)
91
169
 
92
170
  Per finding, in processing order:
@@ -152,6 +230,10 @@ table: [`FOLD_PROCESS.md`](references/FOLD_PROCESS.md) §Batch classification.
152
230
 
153
231
  ## Guardrails
154
232
 
233
+ - The all-stages no-assumption rule binds fold work — **ask-don't-infer**, owner
234
+ `skills/unit-lane/references/DESIGN.md` (`ask-dont-infer@1`): a repair the
235
+ evidence does not settle is researched and asked about, never assumed.
236
+
155
237
  Scope is the ledger (or explicit ID subset); unlisted discoveries are proposals
156
238
  for user triage. Batch only when one root-cause correction, validator set and
157
239
  rollback boundary own the rows: one commit/push, individual ticks/lines. Split
@@ -193,6 +275,36 @@ every declared grep and fails closed with `sweep-mismatch`, naming
193
275
  `file:line`, the regex and the observed count. A fold that changes such a
194
276
  surface and emits no declaration is a `workflow` finding at review.
195
277
 
278
+ **Re-review skip default inversion (S9, feature 30).** The `RE-REVIEW-OPTIONAL/SKIPPED`
279
+ branch shipped in feature 30 was never exercised once (11 cycles on docs-only
280
+ changes). Fix: for docs-only batches with a green sweep declaration
281
+ (#315's claim kind), **skip becomes the machine-decided default** — re-review
282
+ requires recorded justification. Why safe *now*: the residual risk the default
283
+ hedged (stale survivors) becomes a pre-commit failure once #315's sweep kind
284
+ exists. The decision moves from human inertia (always yes) to machine rule
285
+ (batch class + sweep green ⇒ skip).
286
+
287
+ **Net narration diff ≤ 0 (S10 1).** Each fold must strictly decrease the defect
288
+ surface. Add a computed check: the net narration diff per fold must be ≤ 0 —
289
+ lines deleted, not moved. Measured by `git diff --numstat` over the fold's
290
+ commit. This is the arithmetic that makes #307's "deterministic gates converge"
291
+ possible.
292
+
293
+ **Defect identity: mechanism, not file:line (S4).** Defect identity in the ledger
294
+ moves from `file:line` to the *mechanism* (the site stays as evidence). When
295
+ folding, group by mechanism+axis, not by file:line+axis. The same bug surfacing
296
+ as F49, then F50, then F51 costs a full review cycle each time when grouped by
297
+ file:line; grouped by mechanism, one class escalation fixes all three.
298
+
299
+ **Per-file review state (S10 6, from #218; shipped as S16).** `review-state.json`
300
+ per unit, single writer = `scripts/review-state.mjs`, model passes read-only: each
301
+ file in the affecting-path inventory ends a cycle `reviewed@<sha>` or
302
+ `skipped@<sha>` with a concrete reason; skips auto-invalidate when a later diff
303
+ touches the file; coverage closure `inventory − reviewed − skipped = 0` is a
304
+ mechanical receipt check. Run `node scripts/review-state.mjs check --unit <slug>`
305
+ and paste the block — `closure: complete` exits 0, `closure: open(n)` exits 1 and
306
+ is a blocker, never a note.
307
+
196
308
  ## Portability (agents other than Claude Code)
197
309
 
198
310
  Use explicit fallbacks when a primitive is absent: open named `SKILL.md` files in
@@ -251,8 +363,9 @@ decision to skip.
251
363
  |---|---|---|
252
364
  | freeze-batch (≥ 1 product-owned row) | `PRODUCT-ROUTE` | `/unit-lane <slug>` (feature) or `/unit-lane --fix <n>` (fix) when the router concludes `product` — the lane repairs the half through its `design` step, its `review` step re-judges it; the conclusion printed by `bun scripts/unit-route.mjs <unit>` (node fallback if bun is not installed; discovery step the fold already ran) |
253
365
  | freeze-batch (≥ 1 replan-class row) | `REPLAN-ROUTE` | `/unit-lane <slug>` (feature) or `/unit-lane --fix <n>` (fix) when the router concludes `replan` — user confirms, the lane's `plan` step appends the phases and its `review` step gates, then `/execute-phase` on this unit; on `route: decision` stop and surface the decision to the user — the conclusion printed by `bun scripts/unit-route.mjs <unit>` (node fallback if bun is not installed; discovery step the fold already ran) |
254
- | `all-repair-in-place` + docs-only + no folded row severity `high` + prior consumer skip decision | `RE-REVIEW-SKIPPED` | skip — consumer has explicitly decided to skip the re-review |
255
- | `all-repair-in-place` + docs-only + no folded row severity `high` | `RE-REVIEW-OPTIONAL` | `/review-change` (default, delta mode) — or the consumer's recorded skip decision |
366
+ | `all-repair-in-place` + docs-only + green sweep declaration + no folded row severity `high` | `RE-REVIEW-SKIPPED` | skip — green sweep (#315) + docs-only ⇒ skip is default (S9); re-review requires recorded justification |
367
+ | `all-repair-in-place` + docs-only + no sweep declaration + no folded row severity `high` + prior consumer skip decision | `RE-REVIEW-SKIPPED` | skip — consumer has explicitly decided to skip the re-review |
368
+ | `all-repair-in-place` + docs-only + no sweep declaration + no folded row severity `high` | `RE-REVIEW-OPTIONAL` | `/review-change` (default, delta mode) — or the consumer's recorded skip decision |
256
369
  | empty batch (class `none`) | `RE-REVIEW-OPTIONAL` | `/review-change` by default — safe: the head is unchanged |
257
370
  | anything else (behavioral surface or any folded row `high`) | `RE-REVIEW-REQUIRED (delta)` | `/review-change` — delta mode mandatory default |
258
371
 
@@ -264,7 +377,12 @@ decision to skip.
264
377
  - **Frozen-severity-`high` override.** A folded row whose frozen severity is
265
378
  `high` forces `RE-REVIEW-REQUIRED (delta)` even on a docs-only diff. Frozen
266
379
  fields are never edited to reach a branch.
267
- - **SKIPPED requires prior consumer decision (E-D2).** `RE-REVIEW-SKIPPED`
268
- is printed only by a turn carrying an explicit prior consumer decision to
269
- skip. A turn with no recorded prior consumer decision prints
380
+ - **SKIPPED with sweep (S9).** `RE-REVIEW-SKIPPED` is printed when the batch
381
+ is docs-only + has a green sweep declaration (#315's claim kind), even
382
+ without a prior consumer decision. This is the default inversion: skip is
383
+ the machine-decided default for docs-only + sweep green. Prior consumer
384
+ decision is still accepted (backwards-compatible).
385
+ - **SKIPPED without sweep (E-D2).** `RE-REVIEW-SKIPPED` requires an explicit
386
+ prior consumer decision when the batch is docs-only but has no sweep
387
+ declaration. A turn with no recorded prior consumer decision prints
270
388
  `RE-REVIEW-OPTIONAL` + the re-review default, **never** `RE-REVIEW-SKIPPED`.
@@ -78,7 +78,7 @@ hard-wrapped across several lines, never joined into one prose line.
78
78
  ## REPAIR-RECEIPT — fixed printed block (verbatim copy)
79
79
 
80
80
  Printed after the per-finding table and tally, as part of the ABSOLUTE-last
81
- output together with the branching `→ Next:` block. Six fields, always
81
+ output together with the branching `→ Next:` block. Seven fields, always
82
82
  present:
83
83
 
84
84
  ```text
@@ -87,6 +87,12 @@ present:
87
87
  - Refuted/open: <F-ids joined ` + `, or `none`>
88
88
  - Gate: <command> → exit <n> at head <40-hex sha> · n/a when nothing was folded
89
89
  - Batch class: <all-repair-in-place | frozen (replan present) | frozen (product owner present) | none>
90
+ - Closure: <complete | open(n)> · open names the blocker ids
90
91
  - Fold diff: <shortstat from a real `git diff` run> · none when nothing was folded
91
92
  - Branch: <RE-REVIEW-REQUIRED (delta) | RE-REVIEW-OPTIONAL | RE-REVIEW-SKIPPED | REPLAN-ROUTE | PRODUCT-ROUTE>
92
93
  ```
94
+
95
+ The claim-evidence table the fold prints before this block (§ Claim-evidence
96
+ loop in SKILL.md) is what makes `Closure:` a receipt rather than a claim: a row
97
+ with `status: ✗` means the fold is not closed, and `Closure: complete` is only
98
+ printable once every row reads ✓.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: init-workspace
3
3
  user-invocable: true
4
- version: 4.3.0
4
+ version: 4.10.0
5
5
  argument-hint: <target-dir>
6
6
  author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
7
7
  license: MIT
@@ -65,7 +65,8 @@ Inspect the target dir (`[target-dir]`, default cwd) before touching anything:
65
65
  - An existing **agent guide** (`AGENTS.md`, or a legacy `CLAUDE.md`), `docs/`,
66
66
  `.github/`? If so, **do not clobber** — check first whether it's an
67
67
  **agentic-workflow scaffold** (marker: an agent guide present *and* either
68
- `docs/features/ROADMAP.md` or a `docs/workflow/` dir). If both markers are
68
+ `docs/ROADMAP.md` — or the pre-319 `docs/features/ROADMAP.md` — or a
69
+ `docs/workflow/` dir). If both markers are
69
70
  present, offer **upgrade** as the default action, alongside merge /
70
71
  adapt-in-place / abort — see **Upgrade mode** below. If an agent guide or
71
72
  `docs/` exists but the markers are absent (a foreign scaffold), stay in
@@ -166,11 +167,17 @@ loads exactly upgrade and skips bootstrap plus portability.
166
167
 
167
168
  ## Unit document conventions (the adaptive lane)
168
169
 
169
- The adaptive lane (feature 61) replaces the fixed pipeline with a single-unit-
170
- document model. Every NEW unit produces one `SPEC.md` under
171
- `docs/features/<NN>-<slug>/` with 14 sections: Objective, Why, User outcome, Acceptance criteria, Impact,
172
- Non-goals, Future cost, Applicable tests, Known pre-existing issues, Tasks,
173
- Evidence, Progress log, Next, References.
170
+ The adaptive lane replaces the fixed pipeline with a single-unit-document model.
171
+ Every NEW unit produces one `SPEC.md` under `docs/features/<NN>-<slug>/`, cut in
172
+ the **`spec-by-reference`** shape the template ships: `Specs` (numbered `S#`, each
173
+ quoting the requester's words verbatim), Impact, Non-goals, Future cost,
174
+ Applicable tests, Known pre-existing issues, `Tasks` (each bullet linked to the
175
+ `S#` it delivers), `Findings` (OPEN rows only), `Log` (append-only; `L1` is the
176
+ request verbatim), Next, References. A unit opened before this shape keeps the
177
+ legacy 14-section shape — Objective, Why, User outcome, Acceptance criteria,
178
+ Impact, Non-goals, Future cost, Applicable tests, Known pre-existing issues,
179
+ Tasks, Evidence, Progress log, Next, References — and is never rewritten to
180
+ migrate.
174
181
 
175
182
  Conventions written into the project's AGENTS.md:
176
183
 
@@ -188,8 +195,8 @@ Conventions written into the project's AGENTS.md:
188
195
 
189
196
  These are written by bootstrap (fresh) and upgrade mode (additive-only for pre-
190
197
  lane installs). A pre-lane project gets only: the lane conventions section in
191
- AGENTS.md, the unit doc template under `docs/features/_TEMPLATE/`, and the
192
- docs-map row for the unit doc.
198
+ AGENTS.md, the unit doc templates under `docs/features/_TEMPLATE/` and
199
+ `docs/fix/_TEMPLATE/`, and the docs-map rows for them.
193
200
 
194
201
  ## Normalized Repository State
195
202
 
@@ -4,10 +4,11 @@
4
4
  the documentation map rows, architecture); write the **adaptive lane
5
5
  conventions** (unit document, triage, catalog steps, guards, evidence rows,
6
6
  dated progress log, closed commit format `type(scope): description`); keep
7
- the `features/_TEMPLATE` + `ROADMAP`, the `fix/_TEMPLATE` + `README`, and
8
- the `.github/` templates; keep `.agentic-workflow/hooks/` and activate only
9
- the adapters explicitly accepted in the interview; prune unused doc folders
10
- and map rows. Leave honest placeholders where the user hasn't decided — never
7
+ the documentation templates it ships — `features/_TEMPLATE` beside
8
+ `features/ROADMAP.md`, and `fix/_TEMPLATE` beside `fix/README.md` — and the
9
+ `.github/` templates; keep `.agentic-workflow/hooks/` and activate only the
10
+ adapters explicitly accepted in the interview; prune unused doc folders and
11
+ map rows. Leave honest placeholders where the user hasn't decided — never
11
12
  invent values.
12
13
  5. **Seed Normalized Repository State.** Copy
13
14
  `template/docs/workflow/REPOSITORY_STATE.md` to
@@ -21,9 +22,14 @@
21
22
  optional: an absent document means no project invariants are declared, not
22
23
  that the scaffold failed. If retained, add its documentation-map row and
23
24
  name the project's explicit architectural-decision authority.
24
- 7. **Propagate the unit doc template.** Ensure
25
- `docs/features/_TEMPLATE/SPEC.md` exists with all 14 sections sections.
26
- This is the template used when creating new unit documents.
25
+ 7. **Propagate the unit doc templates.** Ensure both template folders exist and
26
+ are cut in the `spec-by-reference` shape the scaffold ships —
27
+ `docs/features/_TEMPLATE/SPEC.md` and `docs/fix/_TEMPLATE/SPEC.md` (`Specs`
28
+ with `S#` requirements, Impact, Non-goals, Future cost, Applicable tests,
29
+ Known pre-existing issues, `Tasks`, `Findings`, `Log`, Next, References).
30
+ These are the templates used when creating new unit documents; a unit opened
31
+ before this shape keeps the legacy 14-section shape and is never rewritten to
32
+ migrate.
27
33
  8. **Provision Serena — one consented question, then write.** Load
28
34
  [SERENA](SERENA.md) and ask its single consent question; one yes covers the
29
35
  tool install, the detected platform's MCP registration and the global trust