hatch3r 2.1.0 → 2.2.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.
Files changed (103) hide show
  1. package/README.md +3 -3
  2. package/dist/cli/index.js +77 -19
  3. package/dist/content/agents/hatch3r-brownfield-spec.md +1 -1
  4. package/dist/content/agents/hatch3r-fixer.md +21 -8
  5. package/dist/content/agents/hatch3r-handoff-loader.md +7 -2
  6. package/dist/content/agents/hatch3r-handoff-preparer.md +5 -16
  7. package/dist/content/agents/hatch3r-implementer.md +29 -3
  8. package/dist/content/agents/hatch3r-maintainability.md +2 -0
  9. package/dist/content/agents/hatch3r-researcher.md +1 -1
  10. package/dist/content/agents/hatch3r-reviewer.md +21 -13
  11. package/dist/content/agents/hatch3r-ui.md +1 -1
  12. package/dist/content/agents/hatch3r-ux.md +1 -1
  13. package/dist/content/agents/shared/cq-specialist-roster.md +2 -2
  14. package/dist/content/agents/shared/efficiency-patterns.md +1 -1
  15. package/dist/content/agents/shared/quality-charter.md +6 -5
  16. package/dist/content/agents/shared/quality-specialist-frame.md +1 -1
  17. package/dist/content/agents/shared/severity-mapping.md +1 -1
  18. package/dist/content/agents/shared/triage-vocabulary.md +1 -1
  19. package/dist/content/agents/shared/user-content-templates.md +1 -1
  20. package/dist/content/agents/shared/user-question-protocol.md +4 -3
  21. package/dist/content/checks/code-quality.md +11 -0
  22. package/dist/content/checks/security.md +5 -0
  23. package/dist/content/checks/testing.md +2 -0
  24. package/dist/content/commands/board/pickup-delegation-multi.md +18 -8
  25. package/dist/content/commands/board/pickup-delegation.md +5 -4
  26. package/dist/content/commands/hatch3r-api-spec.md +5 -17
  27. package/dist/content/commands/hatch3r-auth-scaffold.md +7 -20
  28. package/dist/content/commands/hatch3r-benchmark.md +5 -17
  29. package/dist/content/commands/hatch3r-board-fill.md +6 -18
  30. package/dist/content/commands/hatch3r-board-pickup.md +8 -19
  31. package/dist/content/commands/hatch3r-bug-pipeline.md +4 -16
  32. package/dist/content/commands/hatch3r-bug-plan.md +5 -17
  33. package/dist/content/commands/hatch3r-codebase-map.md +5 -17
  34. package/dist/content/commands/hatch3r-create.md +5 -17
  35. package/dist/content/commands/hatch3r-debug.md +5 -17
  36. package/dist/content/commands/hatch3r-design-system-create.md +254 -0
  37. package/dist/content/commands/hatch3r-diagnose.md +10 -18
  38. package/dist/content/commands/hatch3r-feature-plan.md +5 -17
  39. package/dist/content/commands/hatch3r-handoff.md +5 -17
  40. package/dist/content/commands/hatch3r-healthcheck.md +5 -17
  41. package/dist/content/commands/hatch3r-incident-response.md +3 -15
  42. package/dist/content/commands/hatch3r-migration-plan.md +5 -17
  43. package/dist/content/commands/hatch3r-onboard.md +6 -18
  44. package/dist/content/commands/hatch3r-pack-install.md +6 -29
  45. package/dist/content/commands/hatch3r-pr-resolve.md +77 -79
  46. package/dist/content/commands/hatch3r-project-spec.md +5 -17
  47. package/dist/content/commands/hatch3r-quick-change.md +5 -17
  48. package/dist/content/commands/hatch3r-refactor-plan.md +5 -17
  49. package/dist/content/commands/hatch3r-release.md +6 -16
  50. package/dist/content/commands/hatch3r-revision.md +11 -23
  51. package/dist/content/commands/hatch3r-roadmap.md +5 -17
  52. package/dist/content/commands/hatch3r-security-audit.md +5 -17
  53. package/dist/content/commands/hatch3r-slo-scaffold.md +8 -20
  54. package/dist/content/commands/hatch3r-spec.md +11 -16
  55. package/dist/content/commands/hatch3r-test-plan.md +5 -17
  56. package/dist/content/commands/hatch3r-workflow.md +16 -26
  57. package/dist/content/commands/revision/revision-quality.md +6 -5
  58. package/dist/content/commands/shared/orchestration-frame.md +2 -2
  59. package/dist/content/rules/hatch3r-agent-orchestration-detail.md +2 -2
  60. package/dist/content/rules/hatch3r-agent-orchestration-detail.mdc +2 -2
  61. package/dist/content/rules/hatch3r-agent-orchestration.md +15 -15
  62. package/dist/content/rules/hatch3r-agent-orchestration.mdc +15 -15
  63. package/dist/content/rules/hatch3r-anti-duplication.md +15 -4
  64. package/dist/content/rules/hatch3r-anti-duplication.mdc +15 -4
  65. package/dist/content/rules/hatch3r-clarification-default.md +8 -7
  66. package/dist/content/rules/hatch3r-clarification-default.mdc +8 -7
  67. package/dist/content/rules/hatch3r-code-standards.md +1 -1
  68. package/dist/content/rules/hatch3r-code-standards.mdc +1 -1
  69. package/dist/content/rules/hatch3r-contract-census.md +160 -0
  70. package/dist/content/rules/hatch3r-contract-census.mdc +160 -0
  71. package/dist/content/rules/hatch3r-cost-visibility.md +11 -4
  72. package/dist/content/rules/hatch3r-cost-visibility.mdc +11 -4
  73. package/dist/content/rules/hatch3r-deep-context.md +1 -0
  74. package/dist/content/rules/hatch3r-deep-context.mdc +1 -0
  75. package/dist/content/rules/hatch3r-dynamic-stack-verification.md +114 -0
  76. package/dist/content/rules/hatch3r-dynamic-stack-verification.mdc +109 -0
  77. package/dist/content/rules/hatch3r-enhancability.md +1 -1
  78. package/dist/content/rules/hatch3r-enhancability.mdc +1 -1
  79. package/dist/content/rules/hatch3r-findings-ledger.md +129 -0
  80. package/dist/content/rules/hatch3r-findings-ledger.mdc +129 -0
  81. package/dist/content/rules/hatch3r-handoff-readiness.md +1 -1
  82. package/dist/content/rules/hatch3r-handoff-readiness.mdc +1 -1
  83. package/dist/content/rules/hatch3r-i18n.md +4 -0
  84. package/dist/content/rules/hatch3r-i18n.mdc +4 -0
  85. package/dist/content/rules/hatch3r-iteration-summary.md +47 -49
  86. package/dist/content/rules/hatch3r-iteration-summary.mdc +47 -49
  87. package/dist/content/rules/hatch3r-learning-system.md +6 -6
  88. package/dist/content/rules/hatch3r-learning-system.mdc +6 -6
  89. package/dist/content/rules/hatch3r-migrations.md +1 -1
  90. package/dist/content/rules/hatch3r-migrations.mdc +1 -1
  91. package/dist/content/rules/hatch3r-reviewer-calibration.md +2 -2
  92. package/dist/content/rules/hatch3r-reviewer-calibration.mdc +2 -2
  93. package/dist/content/rules/hatch3r-security-patterns.md +4 -0
  94. package/dist/content/rules/hatch3r-security-patterns.mdc +4 -0
  95. package/dist/content/rules/hatch3r-testing.md +14 -0
  96. package/dist/content/rules/hatch3r-testing.mdc +14 -0
  97. package/dist/content/rules/hatch3r-tool-currency.md +1 -1
  98. package/dist/content/rules/hatch3r-tool-currency.mdc +1 -1
  99. package/dist/content/skills/hatch3r-adhoc-orchestrate/SKILL.md +1 -1
  100. package/dist/content/skills/hatch3r-design-system-detect/SKILL.md +2 -0
  101. package/dist/content/skills/hatch3r-handoff-prepare/SKILL.md +4 -4
  102. package/dist/content/skills/hatch3r-report/SKILL.md +1 -1
  103. package/package.json +2 -2
@@ -28,7 +28,7 @@ Before any action, scan the user's request and provided context for unresolved q
28
28
  - Output format ambiguous — markdown vs GitHub issue vs Notion changes write path.
29
29
  - Team context dimensions in Step 1b unanswered — guide either includes the section or omits it; do not invent team norms.
30
30
 
31
- Acceptable to proceed without asking ONLY when scope is single-target, single-concern, and the brief alone is testable. Any residual ambiguity discovered mid-workflow invokes the same protocol. If a question goes unanswered, the gate never deadlocks: as the orchestrator, apply the declared `Default if no response:` option and log it in Iteration Summary §8; if a spawned sub-agent hits the trigger or no default line was emitted, return Status `BLOCKED_AMBIGUITY` with the rendered question rather than silent-picking — per `agents/shared/user-question-protocol.md` → Operationalising Default-if-no-Response.
31
+ Acceptable to proceed without asking ONLY when scope is single-target, single-concern, and the brief alone is testable. Any residual ambiguity discovered mid-workflow invokes the same protocol. If a question goes unanswered, the gate never deadlocks: as the orchestrator, apply the declared `Default if no response:` option and log it in the `Default applied:` exception line; if a spawned sub-agent hits the trigger or no default line was emitted, return Status `BLOCKED_AMBIGUITY` with the rendered question rather than silent-picking — per `agents/shared/user-question-protocol.md` → Operationalising Default-if-no-Response.
32
32
 
33
33
  ## Agent Pipeline
34
34
 
@@ -38,7 +38,7 @@ Acceptable to proceed without asking ONLY when scope is single-target, single-co
38
38
  | 2. Setup Verification | Orchestrator (inline) | No | Yes |
39
39
  | 3. Guide Generation | `hatch3r-docs-writer` | No | Yes |
40
40
 
41
- **Parallel-safety conditions** (per `rules/hatch3r-agent-orchestration.md` §Parallel Safety): every parallel fan-out above holds all three — read-only or disjoint writes, deterministic aggregation, no shared mutable state.
41
+ **Parallel-safety conditions** (per `rules/hatch3r-agent-orchestration.md` §Parallel Safety): every parallel fan-out above holds all three — read-only or disjoint writes (file- and contract-level), deterministic aggregation, no shared mutable state.
42
42
 
43
43
  # Onboarding Guide Generator — Tailored Developer Onboarding from Codebase Analysis to Ready-to-Work Guide
44
44
 
@@ -91,7 +91,7 @@ cost_estimate:
91
91
  estimated_duration_min: <int>
92
92
  ```
93
93
 
94
- Post-execution actuals + delta land in the iteration summary's Fan-out + Cost section per `rules/hatch3r-cost-visibility.md` Post-Execution Actuals. Token telemetry sources from `src/pipeline/observability.ts`.
94
+ Post-execution actuals + delta land in the Iteration Summary recap (cost facet; full blocks on the `Cost:` exception line beyond ±25%) per `rules/hatch3r-cost-visibility.md` Post-Execution Actuals. Token telemetry sources from `src/pipeline/observability.ts`.
95
95
 
96
96
  ### Effort Override (Decision 17)
97
97
 
@@ -336,30 +336,18 @@ onboard is long-running — a Tier 3 staff-level guide for a large monorepo fans
336
336
 
337
337
  ## Iteration Summary (mandatory output)
338
338
 
339
- Emit the canonical 9-section iteration summary per `rules/hatch3r-iteration-summary.md` as the final user-facing output. The validation gate at `.claude/rules/capability-lifecycle.md` blocks SUCCESS declarations without this block (CONSTITUTION §6 Decision 23).
340
-
341
- The 9 sections:
342
-
343
- 1. **Request** — verbatim restatement of the user's ask in one sentence.
344
- 2. **Fan-out + Cost** — `sub_agents_spawned: { count, rationale }` plus the `cost_estimate` / `cost_actuals` / `delta` blocks (see Cost Visibility below).
345
- 3. **Web Research** — every URL fetched with access date + trust tier per `agents/shared/rigor-contract.md` (0 acceptable when no research was needed).
346
- 4. **Files Mutated** — list with diff summary (lines added / removed / files created).
347
- 5. **Gates Passed / Failed** — explicit list per `.claude/rules/capability-lifecycle.md` Gate Checklist.
348
- 6. **Pillar Impact Attribution** — `progress_toward_pillar: <axis>.<pillar_id>+<delta>` per CONSTITUTION §6 Decision 17.
349
- 7. **Verification Commands** — exact commands run with exit codes plus key output lines (≤200 chars).
350
- 8. **Open Questions / Blockers** — explicit `None` if fully closed.
351
- 9. **Learnings Captured** — IDs of any learnings written to `.hatch3r/learnings/` this run per `rules/hatch3r-learning-system.md`.
339
+ Close the run with the recap-contract Iteration Summary per `rules/hatch3r-iteration-summary.md`: a 1–2 line recap (status, outcome, files · sub-agents · gates · cost delta) plus every exception line whose firing condition holds — silence asserts the default. Omitting the recap fails that rule's Validation Gate (CONSTITUTION §6 Decision 23, superseded in place 2026-07-06).
352
340
 
353
341
  ### Cost Visibility (Decision 24)
354
342
 
355
- > Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Cost Estimate for the 5-field `cost_estimate` schema and the post-execution `cost_actuals` + `delta` contract; both land in Section 2 above.
343
+ > Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Cost Estimate for the 5-field `cost_estimate` schema and the post-execution `cost_actuals` + `delta` contract; both land in the Iteration Summary recap (cost facet; full blocks on the `Cost:` exception line beyond ±25%) per `rules/hatch3r-cost-visibility.md`.
356
344
 
357
345
  ## Cost estimate (Decision 24)
358
346
 
359
347
  This command emits cost transparency per `rules/hatch3r-cost-visibility.md` and CONSTITUTION §6 Decision 24/29:
360
348
 
361
349
  - **Pre-execution `cost_estimate`** — emitted in Step 0.5 before the first researcher dispatch.
362
- - **Post-execution `cost_actuals` + `delta`** — appended to the iteration summary's Fan-out + Cost section per `rules/hatch3r-iteration-summary.md` §2.
350
+ - **Post-execution `cost_actuals` + `delta`** — appended to the Iteration Summary recap (cost facet; full blocks on the `Cost:` exception line beyond ±25%) per `rules/hatch3r-cost-visibility.md`.
363
351
 
364
352
  Per-tier `expected_sa_count` calibration (from frontmatter `sub_agents_spawned.count: 3` × tier heuristic in `rules/hatch3r-cost-visibility.md` Pre-Execution Estimate): Tier 1 ≈ 1 (codebase-overview researcher only); Tier 2 ≈ 3 (codebase-overview + architecture + conventions); Tier 3 = 3 at deep depth. Deltas beyond 25% absolute value carry `flagged_for_review: true`. Token telemetry sources from `src/pipeline/observability.ts`; estimation primitives from `src/pipeline/costEstimator.ts`.
365
353
 
@@ -171,39 +171,16 @@ Spawn `hatch3r-pack-installer` via the Task tool with `subagent_type: "generalPu
171
171
 
172
172
  ## Step 5: Iteration Summary
173
173
 
174
- Emit the canonical iteration summary per `rules/hatch3r-iteration-summary.md` as the final user-facing output. The validation gate at `.claude/rules/capability-lifecycle.md` blocks SUCCESS declarations without this block (CONSTITUTION §6 Decision 23).
174
+ Close the run with the recap-contract Iteration Summary per `rules/hatch3r-iteration-summary.md` as the final user-facing output: a 1–2 line recap (status, outcome, files · sub-agents · gates · cost delta) plus every exception line whose firing condition holds — silence asserts the default. Omitting the recap fails that rule's Validation Gate (CONSTITUTION §6 Decision 23, superseded in place 2026-07-06).
175
+
176
+ Worked example for this domain:
175
177
 
176
178
  ```markdown
177
179
  ## Iteration Summary
178
180
 
179
- **Status:** SUCCESS | PARTIAL | FAILED | BLOCKED
180
- **Outcome:** {one sentence e.g., "Installed @acme/hatch3r-react-pack@1.2.0; signature PASS, 0 scan hits, 4 files written."}
181
-
182
- **Done:**
183
- - Trust verification: hatch3r-security → {verdict}
184
- - Install: hatch3r-pack-installer → {COMPLETE | BLOCKED}
185
-
186
- **Not Done / Deferred / Unverified:**
187
- - (or: `None — pack installed and verified`)
188
-
189
- **Open Questions / Blockers:**
190
- - (or: `None`)
191
-
192
- **Confidence:** {high | medium | low} — {one-sentence basis from the install + verification verdicts}
193
-
194
- **Artifacts Touched:**
195
- | Path | Action | Notes |
196
- | ---- | ------ | ----- |
197
- | {adapter path} | created / merged | managed block |
198
-
199
- **Verifications Run:**
200
- | Check | Result |
201
- | ----- | ------ |
202
- | signature (npm audit signatures / cosign verify-blob) | pass |
203
- | body scan (scanForDeniedPatterns) | 0 hits |
204
- | hatch3r verify (post-apply drift) | 0 drift |
205
-
206
- **Suggested Next Action:** {one line — e.g., "Run /hatch3r-capability-discover to see the newly installed pack artifacts."}
181
+ **SUCCESS** Installed @acme/hatch3r-react-pack@1.2.0: signature PASS, 0 body-scan hits, post-apply hatch3r verify clean.
182
+ files 4 (+96/−0) · sa 2/2 · gates 3/3 · cost Δ+3% tok / Δ−12% min · tier 1
183
+ Next: run /hatch3r-capability-discover to see the newly installed pack artifacts.
207
184
  ```
208
185
 
209
186
  Status decision rules:
@@ -2,7 +2,7 @@
2
2
  id: hatch3r-pr-resolve
3
3
  type: command
4
4
  orchestrator: true
5
- agentPipeline: [hatch3r-implementer, hatch3r-lint-fixer, hatch3r-testability, hatch3r-reviewer, hatch3r-fixer, hatch3r-security, hatch3r-docs-writer, hatch3r-ui, hatch3r-performance]
5
+ agentPipeline: [hatch3r-implementer, hatch3r-lint-fixer, hatch3r-testability, hatch3r-reviewer, hatch3r-fixer, hatch3r-security, hatch3r-docs-writer, hatch3r-ui, hatch3r-ux, hatch3r-performance]
6
6
  description: "Read open PR comments, evaluate each against current code via the rigor contract, implement accepted findings, reply inline. Multi-platform."
7
7
  argument-hint: "[pr-number]"
8
8
  tags: [implementation, review, ctx:team-only]
@@ -14,8 +14,8 @@ efficiency_tier: standard
14
14
  triage_tiers: [1, 2, 3]
15
15
  supports_resume: true
16
16
  sub_agents_spawned:
17
- count: 9
18
- rationale: Per-PR fanout — implementer, lint-fixer, testability (CQ5, FIX NOW group, parallel), reviewer ↔ fixer review loop (max 3 iterations), then parallel Tier-3 final-quality specialists (security (CQ3), docs-writer, ui (CQ1), performance (CQ7)) per the Tier-3 specialist mandate. Cost-dominance per CONSTITUTION §2 P8 — token cost never serializes independent work.
17
+ count: 10
18
+ rationale: Per-PR fanout — implementer, lint-fixer, testability (CQ5, FIX NOW group, parallel), reviewer ↔ fixer review loop (max 3 iterations), then parallel Tier-3 final-quality specialists (security (CQ3), docs-writer, performance (CQ7), plus ui (CQ1) and ux (CQ2) as mandatory-on-match Tier 2/3 gates — a trigger-glob match requires a dedicated instance) per the Tier-3 specialist mandate. Cost-dominance per CONSTITUTION §2 P8 — token cost never serializes independent work.
19
19
  ---
20
20
 
21
21
  ## §0 Detect Ambiguity (P8 B1)
@@ -34,12 +34,13 @@ sub_agents_spawned:
34
34
  | 6. Fix implementation | `hatch3r-implementer`, `hatch3r-lint-fixer`, `hatch3r-testability` | Per finding group | When FIX NOW items exist |
35
35
  | 7a. Review loop | `hatch3r-reviewer` -> `hatch3r-fixer` (max 3 iterations) | No (sequential) | When code changed (Tier 2/3) |
36
36
  | 7b. Final quality — mandatory | `hatch3r-testability`, `hatch3r-security` | Yes | When code changed |
37
- | 7c. Final quality — conditional | `hatch3r-docs-writer`, `hatch3r-ui`, `hatch3r-performance`, `hatch3r-lint-fixer` | Yes | When triggered |
37
+ | 7c. Final quality — mandatory-on-match + conditional | `hatch3r-ui`, `hatch3r-ux` (mandatory-on-match); `hatch3r-docs-writer`, `hatch3r-performance`, `hatch3r-lint-fixer` (conditional) | Yes | When triggered (ui/ux non-skippable on trigger-glob match at Tier 2/3) |
38
38
  | 8. Post replies | Orchestrator (inline, platform CLI) | Per comment | Yes |
39
39
  | 9. Commit and push | Orchestrator (inline) | No | When code changed |
40
+ | 9.5. Re-poll gate | Orchestrator (inline) | No | When commit pushed |
40
41
  | 10. Iteration Summary | Orchestrator (inline) | No | Yes |
41
42
 
42
- **Parallel-safety conditions** (per `rules/hatch3r-agent-orchestration.md` §Parallel Safety): every parallel fan-out above holds all three — read-only or disjoint writes, deterministic aggregation, no shared mutable state.
43
+ **Parallel-safety conditions** (per `rules/hatch3r-agent-orchestration.md` §Parallel Safety): every parallel fan-out above holds all three — read-only or disjoint writes (file- and contract-level), deterministic aggregation, no shared mutable state.
43
44
 
44
45
  ---
45
46
 
@@ -85,8 +86,8 @@ If no `.hatch3r/hatch.json` exists, fall back to GitHub and proceed — the comm
85
86
 
86
87
  ## Token-Saving Directives
87
88
 
88
- 1. **One fetch per comment scope.** Issue exactly one paginated request per scope in Step 2; cache and reuse for Steps 3, 4, and 8.
89
- 2. **One diff computation.** Compute `git diff {defaultBranch}...HEAD` once in Step 1; reuse for Steps 4 (outdated detection) and 7 (review loop input).
89
+ 1. **One fetch per comment scope per round.** Issue exactly one paginated request per scope in Step 2; cache and reuse for Steps 3, 4, and 8. Step 9.5b poll attempts are the one sanctioned re-fetch path (max 5 per poll).
90
+ 2. **One diff computation per round.** Compute `git diff {defaultBranch}...HEAD` once in Step 1; reuse for Steps 4 (outdated detection) and 7 (review loop input). A Step 9.5 round re-entry refreshes it once against the new HEAD.
90
91
  3. **Targeted file reads.** In Step 4, read only the files referenced by a comment's `path`/`line` — not the full codebase.
91
92
  4. **No re-reading shared rules.** `scope: always` rules from `rules/` load once at session start; pass their content into sub-agent prompts (Step 6) rather than reloading.
92
93
  5. **Per-platform reference cache.** Load the matching `commands/board/shared-{platform}.md` once at run start (Shared Context). Step 8 reads templates from the cache, not from disk.
@@ -136,6 +137,11 @@ run_cache:
136
137
  reply_drafts: [{comment_id, body, endpoint}, ...]
137
138
  reply_post_results: [{comment_id, status: posted|failed, error?: <string>}, ...]
138
139
  deferred_findings: [<finding>, ...] # written to todo.md in Step 5c
140
+ ledger_file: <path of this run's findings-ledger JSONL> # .hatch3r/findings/<YYYY-MM-DD>-pr-resolve-<run8>.jsonl per rules/hatch3r-findings-ledger.md
141
+ round:
142
+ index: <int, 1-based> # initialized 1; incremented per Step 9.5 re-poll round
143
+ started_at: <iso> # run start; reset to now when a re-poll round begins (9.5b)
144
+ comments_per_round: [<int>, ...] # per-round comment count — [0] = Step 3 finding count, then 9.5b retained counts
139
145
  errors: [<error_record>, ...]
140
146
  ```
141
147
 
@@ -143,7 +149,7 @@ run_cache:
143
149
 
144
150
  ## Workflow
145
151
 
146
- Execute these steps in order. **Do not skip any step.** The only ASK gate is Step 5; after the user accepts triage, run autonomously through Step 10.
152
+ Execute these steps in order. **Do not skip any step.** Two ASK gate classes bound the run: Step 5 (triage routing, once per round) and Step 9.5 (re-poll consent, after each push). After the user accepts triage, each round runs autonomously through Step 9; Step 9.5 bounds the loop; Step 10 closes the run.
147
153
 
148
154
  ---
149
155
 
@@ -163,14 +169,14 @@ Before the Step 5 ASK gate (the only mutation gate, after which fan-out begins i
163
169
 
164
170
  ```yaml
165
171
  cost_estimate:
166
- expected_sa_count: <tier → Tier 1 ~1, Tier 2 ~4, Tier 3 up to 9; 0 when no unresolved comments>
172
+ expected_sa_count: <tier → Tier 1 ~1, Tier 2 ~4, Tier 3 up to 10; 0 when no unresolved comments>
167
173
  estimated_input_tokens_static_frame: <int>
168
174
  estimated_web_research_queries: <int>
169
175
  triage_tier: light | standard | deep
170
176
  estimated_duration_min: <int>
171
177
  ```
172
178
 
173
- Post-execution actuals + delta land in the Step 10 Resolution Summary's Fan-out + Cost section per `rules/hatch3r-cost-visibility.md` Post-Execution Actuals. Token telemetry sources from `src/pipeline/observability.ts`.
179
+ Post-execution actuals + delta land in the Iteration Summary recap (cost facet; full blocks on the `Cost:` exception line beyond ±25%) per `rules/hatch3r-cost-visibility.md` Post-Execution Actuals. Token telemetry sources from `src/pipeline/observability.ts`.
174
180
 
175
181
  ### Effort Override (Decision 17)
176
182
 
@@ -373,7 +379,7 @@ After Step 4 completes, recompute Step 0's tier using the now-known severities.
373
379
 
374
380
  ## Step 5: Triage Routing + ASK Checkpoint (only mutation gate)
375
381
 
376
- **Tier-3 specialist mandate (P8 B2).** For Tier 3 PRs (6+ findings OR any Critical severity), the post-fix specialist pass (`hatch3r-testability`, `hatch3r-security`, `hatch3r-docs-writer`) MUST run in parallel. Specialists may NOT be deferred via "Needs your call" for cost reasons. Cost-dominance principle applies: token cost of specialist sub-agents is dominated by the quality gain of catching defects pre-merge.
382
+ **Tier-3 specialist mandate (P8 B2).** For Tier 3 PRs (6+ findings OR any Critical severity), the post-fix specialist pass (`hatch3r-testability`, `hatch3r-security`, `hatch3r-docs-writer`) MUST run in parallel. A triggered mandatory-on-match specialist (`hatch3r-ui` CQ1 / `hatch3r-ux` CQ2) joins the pass as its own dedicated instance whenever the round's diff matches its trigger row (Step 7c). Specialists may NOT be deferred via "Needs your call" for cost reasons. Cost-dominance principle applies: token cost of specialist sub-agents is dominated by the quality gain of catching defects pre-merge.
377
383
 
378
384
  #### 5a. Apply Routing Heuristics
379
385
 
@@ -428,9 +434,9 @@ Tier: 2 (standard pipeline)
428
434
  Total: {N} comments • {fix_now_n} fix now • {decline_n} decline • {clarify_n} clarify • {needs_call_n} need your call • {defer_n} defer
429
435
  ```
430
436
 
431
- #### 5c. ASK (only gate)
437
+ #### 5c. ASK (triage gate, once per round)
432
438
 
433
- > Found {N} comments on PR #{pr_number}. Evaluation done. Review the suggested routing. Adjustments:
439
+ > Found {N} comments on PR #{pr_number} (round {round.index}). Evaluation done. Review the suggested routing. Adjustments:
434
440
  > - `accept` — proceed with suggested routing
435
441
  > - `fix N` — promote a Decline/Clarify/NeedsCall item to FIX NOW
436
442
  > - `decline N` — demote a FIX NOW item to DECLINE
@@ -443,7 +449,7 @@ Total: {N} comments • {fix_now_n} fix now • {decline_n} decline • {clarify
443
449
 
444
450
  If the user attempts to defer a Critical finding, execute the Critical Deferral Protocol from `commands/hatch3r-revision.md` §5b Routing ASK → Critical Deferral Protocol: structured warning + required written rationale + `Critical-deferred` tag in todo.md + flag for elevated visibility in the next board-fill.
445
451
 
446
- After the user accepts, the run is autonomous until Step 10.
452
+ After the user accepts, the round is autonomous through Step 9; Step 9.5 then gates any further round.
447
453
 
448
454
  #### 5d. File Deferred Findings to todo.md
449
455
 
@@ -452,11 +458,11 @@ If any findings route to DEFER, append a single epic-context block to `todo.md`:
452
458
  ```markdown
453
459
  # Follow-ups from PR #{pr_number} pr-resolve ({date})
454
460
  # Epic: group all items below into one epic during board-fill
455
- - {comment author}: {finding description} (severity: {severity}, file: {file:line})
461
+ - {comment author}: {finding description} (severity: {severity}, file: {file:line}) [ledger: {finding_id}]
456
462
  - ...
457
463
  ```
458
464
 
459
- Cache the deferred list. Reply templates in Step 8 reference todo.md for these items.
465
+ Cache the deferred list. For each DEFER item, also append a `deferred` ledger row whose `closure_ref` is the item's todo.md anchor (`rules/hatch3r-findings-ledger.md`). Reply templates in Step 8 reference todo.md for these items.
460
466
 
461
467
  ---
462
468
 
@@ -509,12 +515,12 @@ If any gate fails, identify failures and either fix inline (single-line lint/typ
509
515
 
510
516
  #### 7b. Review Loop (Tier 2/3 only; Tier 1 skips)
511
517
 
512
- Spawn `hatch3r-reviewer` -> `hatch3r-fixer` per `commands/revision/revision-quality.md` Stage 1 (max 3 iterations, oscillation detection, confidence decay). The reviewer prompt MUST include:
518
+ Spawn `hatch3r-reviewer` -> `hatch3r-fixer` per `commands/revision/revision-quality.md` Stage 1 (max 3 iterations, oscillation detection, confidence decay) — append the W1 write-ahead rows before the fixer dispatch and the W2 disposition rows after the re-review (`rules/hatch3r-findings-ledger.md` → Write Points). The reviewer prompt MUST include:
513
519
  - The cached diff from Step 1e.
514
520
  - All `scope: always` rule directives.
515
521
  - Iteration number and prior findings.
516
522
  - The Confidence expression requirement (verbatim).
517
- - **Cross-PR Findings block (D13-SA13.1-F08).** Before the first reviewer spawn, scan `.hatch3r/review-findings/` (skip silently if the directory is absent) for entries whose `applies-to` glob matches any file in the cached diff; pass the 5 most-recent matches (by `created` descending) into the reviewer prompt as a `## Cross-PR Findings` block of `{id, applies-to, severity, pr, verdict, summary}` rows. The reviewer (which declares `consults_cross_pr_findings: true`) weighs these as prior organisational memory per its Cross-PR Finding Memory section. After the loop terminates clean, append one `.hatch3r/review-findings/<id>.md` entry per Critical/Warning finding resolved this run (atomic write via `src/merge/safeWrite.ts`), so the next PR on the same files inherits the memory.
523
+ - **Cross-PR Findings block (D13-SA13.1-F08).** Before the first reviewer spawn, scan `.hatch3r/review-findings/` (skip silently if the directory is absent) for entries whose `applies-to` glob matches any file in the cached diff; pass the 5 most-recent matches (by `created` descending) into the reviewer prompt as a `## Cross-PR Findings` block of `{id, applies-to, severity, pr, verdict, summary}` rows. The reviewer (which declares `consults_cross_pr_findings: true`) weighs these as prior organisational memory per its Cross-PR Finding Memory section. After the loop terminates clean, append one `.hatch3r/review-findings/<id>.md` entry per Critical/Warning finding resolved this run (atomic write via `src/merge/safeWrite.ts`), so the next PR on the same files inherits the memory — derive the entry from the ledger fold and cite its `finding_id` (`rules/hatch3r-findings-ledger.md` → Store Boundaries).
518
524
 
519
525
  The reviewer's output MUST include a top-level `confidence: high | medium | low` so the gate evaluates pass/second_pass/escalate per `src/pipeline/reviewLoop.ts` semantics.
520
526
 
@@ -528,9 +534,12 @@ After 7b is clean:
528
534
  - `hatch3r-testability` (CQ5) — verify tests for changed code paths meet the mandate map / coverage floor.
529
535
  - `hatch3r-security` (CQ3) — security review of all changes.
530
536
 
537
+ **Mandatory-on-match (Tier 2/3):** when the round's diff matches a specialist's trigger row in the Phase 4 Specialist Trigger Table (`rules/hatch3r-agent-orchestration.md`), a dedicated instance MUST spawn — never merged into another spawn. Skipping a triggered one at Tier 2/3 is a gate failure.
538
+ - `hatch3r-ui` (CQ1) — UI component / theme / token files in the diff (`*.{tsx,jsx,vue,svelte}`, `tailwind.config.*`, design-token registries).
539
+ - `hatch3r-ux` (CQ2) — flow / modal / route-transition / error-state files in the diff; microcopy or i18n strings changed.
540
+
531
541
  **Conditional:**
532
542
  - `hatch3r-docs-writer` — when fixes touched public APIs, architectural patterns, or user-facing behavior.
533
- - `hatch3r-ui` (CQ1) — when the diff includes UI component or style files.
534
543
  - `hatch3r-performance` (CQ7) — when the diff includes hot-path changes (DB queries, API handlers, render loops).
535
544
  - `hatch3r-lint-fixer` — when residual lint/type errors surfaced after Step 6.
536
545
 
@@ -547,7 +556,7 @@ For every finding in `run_cache.triage_decisions` (including DECLINE and DEFER b
547
556
  | Decision | Template |
548
557
  |----------|----------|
549
558
  | FIX NOW — implemented | `Implemented in {commit_sha}: {one-line summary}. Confidence: {high|medium}.` |
550
- | FIX NOW — failed (BLOCKED / PARTIAL) | `Attempted but blocked: {reason from sub-agent}. Surfaced as follow-up in todo.md.` |
559
+ | FIX NOW — failed (BLOCKED / PARTIAL) | `Attempted but blocked: {reason}. Tracked as {finding_id} in the findings ledger; follow-up in todo.md.` |
551
560
  | DECLINE — outdated | `The code at this location has changed since this comment; the original concern no longer applies. Current behavior: {one-line summary}.` |
552
561
  | DECLINE — disagree | `Considered, declining because: {reasoning from evaluation.causal_chain}. Counter-argument considered: {evaluation.counter_argument}. Happy to revisit if context differs.` |
553
562
  | DECLINE — already done | `Already addressed in {commit_sha}: {one-line summary}.` |
@@ -625,48 +634,48 @@ If `run_cache.fix_results.files_changed` is empty (every comment was DECLINE / D
625
634
 
626
635
  ---
627
636
 
628
- ## Step 10: Resolution Summary
637
+ ## Step 9.5: Re-Poll Gate (ask each round)
629
638
 
630
- Emit the canonical Iteration Summary block from `rules/hatch3r-iteration-summary.md`. Use the exact field names and the closed Status enum.
639
+ Runs after every Step 9 push. Skipped when Step 9 was skipped — no new HEAD means AI review tools have nothing new to review. Round state lives in `run_cache.round` and persists to the checkpoint (`roundIndex`, `roundStartedAt`).
631
640
 
632
- ```markdown
633
- ## Iteration Summary
641
+ #### 9.5a. ASK (re-poll consent)
634
642
 
635
- **Status:** SUCCESS | PARTIAL | FAILED | BLOCKED
636
- **Outcome:** {one sentence — e.g., "Resolved 8 of 10 comments on PR #142; 2 deferred; replies posted."}
643
+ > Pushed {sha} to PR #{N} (round {round.index}). AI review tools (CodeRabbit, Copilot code review, etc.) may post new comments on the new HEAD within a few minutes. Poll for comments created after {round.started_at} and resolve them in another round? (poll / done)
637
644
 
638
- **Done:**
639
- - {comment_id} @{author}: FIX NOW implemented in {commit_sha}
640
- - {comment_id} @{author}: DECLINE (outdated) → reply posted
641
- - ...
645
+ - `done` → proceed to Step 10.
646
+ - `poll`run 9.5b.
647
+
648
+ #### 9.5b. Poll
649
+
650
+ Re-issue the Step 2 fetch (all scopes) every 60s, max 5 attempts (~300s budget). Retain only comments where ALL three hold:
651
+
652
+ 1. `created_at > round.started_at`.
653
+ 2. `comment_id` absent from checkpoint `postedCommentIds` — already-replied threads are never re-processed.
654
+ 3. Thread not resolved (the guardrail 9 filter).
655
+
656
+ **New comments retained:** increment `round.index`, reset `round.started_at` to now, append the retained count to `round.comments_per_round`, refresh the Step 1e diff against the new HEAD, and re-enter at Step 2 scoped to the retained set. The round runs Steps 2–9 in full — normalize, evaluate, Step 5 triage ASK, fix, verify, reply, commit + push — then returns to 9.5a.
657
+
658
+ **Zero retained after 5 attempts:** report "No new comments after 300s." and re-ask 9.5a (keep polling / done).
659
+
660
+ There is no automatic round cap — the 9.5a ASK is the bound; every round is user-approved.
642
661
 
643
- **Not Done / Deferred / Unverified:**
644
- - {comment_id} @{author}: DEFER → tracked in todo.md
645
- - {comment_id}: reply post failed (Azure REST 429); manual follow-up needed
646
- - (or: `None — full scope completed`)
647
-
648
- **Open Questions / Blockers:**
649
- - {comment_id} @{author}: NEEDS_CLARIFICATION awaiting reviewer response
650
- - (or: `None`)
651
-
652
- **Confidence:** {high | medium | low} — {one-sentence basis from sub-agent outputs and reviewer verdict}
653
-
654
- **Artifacts Touched:**
655
- | Path | Action | Notes |
656
- | ---- | ------ | ----- |
657
- | {file} | modified | {one line} |
658
-
659
- **Verifications Run:**
660
- | Check | Result |
661
- | ----- | ------ |
662
- | lint | pass |
663
- | typecheck | pass |
664
- | tests | pass ({n} passed) |
665
- | reviewer/fixer loop | clean after {n} iteration(s) |
666
- | hatch3r-security | pass |
667
- | hatch3r-testability | pass — added {n} test(s) |
668
-
669
- **Suggested Next Action:** {one line — e.g., "Wait for reviewer response on the 2 NEEDS_CLARIFICATION items, then re-run /hatch3r-pr-resolve."}
662
+ ---
663
+
664
+ ## Step 10: Resolution Summary
665
+
666
+ Reconcile the findings ledger to the run-exit invariant (W3, `rules/hatch3r-findings-ledger.md`): zero rows may fold `pending`/`in-fix`; open Critical/Warning force an ASK; unattended runs record them as `escalated` and exit PARTIAL.
667
+
668
+ Close the run with the recap-contract Iteration Summary per `rules/hatch3r-iteration-summary.md` — a 1–2 line recap plus every exception line whose firing condition holds, using the closed Status enum. Disposition mapping: DEFER dispositions land on the `Not done:` line; NEEDS_CLARIFICATION items land on the `Blockers:` line. Recap facets include `rounds {n}` (from `round.index`); when rounds > 1, a `Rounds:` exception line enumerates per-round counts sourced from `round.comments_per_round`. Worked example:
669
+
670
+ ```markdown
671
+ ## Iteration Summary
672
+ **PARTIAL** — Resolved 11 of 13 comments on PR #142 across 2 rounds; replies posted; commits pushed.
673
+ files 6 (+184/−42) · sa 7/10 · gates 6/6 · cost Δ−12% tok / Δ+8% min · tier 2 · rounds 2
674
+ Rounds: r1 10 comments (8 fixed) · r2 3 comments (3 fixed)
675
+ Not done: c-214 @maya DEFER deferred: tracked in todo.md for /hatch3r-board-fill
676
+ Blockers: c-207 @jordan NEEDS_CLARIFICATION awaiting reviewer response
677
+ Confidence: medium — reviewer loop clean after 1 round; 2 comments unresolved. The fix required one round of corrections, which is normal for moderately complex changes. A brief human review is recommended.
678
+ Next: re-run /hatch3r-pr-resolve when the reviewer answers c-207.
670
679
  ```
671
680
 
672
681
  Status decision rules:
@@ -679,9 +688,9 @@ Status decision rules:
679
688
 
680
689
  ## Resumability (Decision 27/30)
681
690
 
682
- pr-resolve is long-running — a Tier 3 PR with many open comments runs identity resolution (Step 1), full-platform comment fetch (Step 2), normalization + rigor-contract evaluation (Steps 3–4), the only mutation-gate ASK (Step 5), parallel-per-finding fix implementation (Step 6), the reviewer ↔ fixer review loop + Phase 4 specialist batch (Step 7), per-comment platform-API replies (Step 8), and commit + push (Step 9). Per hatch3r's workspace-checkpointed resumability contract, checkpoint progress so an interrupted run re-enters at the last completed step rather than re-fetching comments, re-evaluating findings, or re-posting platform-API replies that already shipped.
691
+ pr-resolve is long-running — a Tier 3 PR with many open comments runs identity resolution (Step 1), full-platform comment fetch (Step 2), normalization + rigor-contract evaluation (Steps 3–4), the only mutation-gate ASK (Step 5), parallel-per-finding fix implementation (Step 6), the reviewer ↔ fixer review loop + Phase 4 specialist batch (Step 7), per-comment platform-API replies (Step 8), commit + push (Step 9), and the Step 9.5 re-poll gate, which can add further full rounds. Per hatch3r's workspace-checkpointed resumability contract, checkpoint progress so an interrupted run re-enters at the last completed step rather than re-fetching comments, re-evaluating findings, or re-posting platform-API replies that already shipped.
683
692
 
684
- > Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Checkpoint Contract. Per-command slots: workspace `.pr-resolve-workspace/`; step range the Step 0 → Step 10 progression; `wave` = per-finding fix-batch index in Step 6 and review-loop iteration index in Step 7a; snapshot/rollback paths pre-commit working-tree state and the per-comment reply attempt log. Write points: after Step 1 PR identity resolves, after Step 2 comment fetch locks the normalizedFindings input, after Step 3 normalization, after Step 4 rigor-contract evaluation, after the Step 5 ASK checkpoint (only mutation gate — confirmed routing decisions persist so resume does not re-prompt), after each Step 6 per-finding implementer/lint-fixer/testability batch returns, after each Step 7a review-loop iteration, after each Step 7b–7c specialist batch returns, after each Step 8 platform-API reply records its commentId in `postedCommentIds` (the resume path skips replies with an entry there — no double-posts), and after Step 9 commit + push.
693
+ > Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Checkpoint Contract. Per-command slots: workspace `.pr-resolve-workspace/`; step range Step 0 → Step 10 with a Step 9.5 loop-back to Step 2; `wave` = per-finding fix-batch index in Step 6 and review-loop iteration index in Step 7a; snapshot/rollback paths pre-commit working-tree state and the per-comment reply attempt log; checkpoint meta gains `roundIndex` + `roundStartedAt`. Write points: after Step 1 PR identity resolves, after Step 2 comment fetch locks the normalizedFindings input, after Step 3 normalization, after Step 4 rigor-contract evaluation, after the Step 5 ASK checkpoint (only mutation gate — confirmed routing decisions persist so resume does not re-prompt), after each Step 6 per-finding implementer/lint-fixer/testability batch returns, after each Step 7a review-loop iteration, after each Step 7b–7c specialist batch returns, after each Step 8 platform-API reply records its commentId in `postedCommentIds` (the resume path skips replies with an entry there — no double-posts), after Step 9 commit + push, and after each Step 9.5 decision (round counter + `roundStartedAt` persist; the `postedCommentIds` filter carries across rounds).
685
694
 
686
695
  ---
687
696
 
@@ -695,32 +704,20 @@ pr-resolve is long-running — a Tier 3 PR with many open comments runs identity
695
704
 
696
705
  ## Iteration Summary (mandatory output)
697
706
 
698
- Emit the canonical 9-section iteration summary per `rules/hatch3r-iteration-summary.md` as the final user-facing output (the Step 10 Resolution Summary block above adapts these sections to the PR-resolution domainboth the Step 10 block and the 9-section canonical contract apply). The validation gate at `.claude/rules/capability-lifecycle.md` blocks SUCCESS declarations without this block (CONSTITUTION §6 Decision 23).
699
-
700
- The 9 sections:
701
-
702
- 1. **Request** — verbatim restatement of the user's ask in one sentence.
703
- 2. **Fan-out + Cost** — `sub_agents_spawned: { count, rationale }` plus the `cost_estimate` / `cost_actuals` / `delta` blocks (see Cost Visibility below).
704
- 3. **Web Research** — every URL fetched with access date + trust tier per `agents/shared/rigor-contract.md` (0 acceptable when no research was needed).
705
- 4. **Files Mutated** — list with diff summary (lines added / removed / files created).
706
- 5. **Gates Passed / Failed** — explicit list per `.claude/rules/capability-lifecycle.md` Gate Checklist.
707
- 6. **Pillar Impact Attribution** — `progress_toward_pillar: <axis>.<pillar_id>+<delta>` per CONSTITUTION §6 Decision 17.
708
- 7. **Verification Commands** — exact commands run with exit codes plus key output lines (≤200 chars).
709
- 8. **Open Questions / Blockers** — explicit `None` if fully closed.
710
- 9. **Learnings Captured** — IDs of any learnings written to `.hatch3r/learnings/` this run per `rules/hatch3r-learning-system.md`.
707
+ Close the run with the recap-contract Iteration Summary per `rules/hatch3r-iteration-summary.md`: a 1–2 line recap (status, outcome, files · sub-agents · gates · cost delta) plus every exception line whose firing condition holds silence asserts the default. Omitting the recap fails that rule's Validation Gate (CONSTITUTION §6 Decision 23, superseded in place 2026-07-06). (The Step 10 block above is the domain rendering; the recap closes the run.)
711
708
 
712
709
  ### Cost Visibility (Decision 24)
713
710
 
714
- > Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Cost Estimate for the 5-field `cost_estimate` schema and the post-execution `cost_actuals` + `delta` contract; both land in Section 2 above.
711
+ > Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Cost Estimate for the 5-field `cost_estimate` schema and the post-execution `cost_actuals` + `delta` contract; both land in the Iteration Summary recap (cost facet; full blocks on the `Cost:` exception line beyond ±25%) per `rules/hatch3r-cost-visibility.md`.
715
712
 
716
713
  ## Cost estimate (Decision 24)
717
714
 
718
715
  This command emits cost transparency per `rules/hatch3r-cost-visibility.md` and CONSTITUTION §6 Decision 24/29:
719
716
 
720
- - **Pre-execution `cost_estimate`** — emitted in Step 0.5 before the Step 5 ASK gate (the only mutation gate; fan-out begins in Step 6).
721
- - **Post-execution `cost_actuals` + `delta`** — appended to the Step 10 Resolution Summary's Fan-out + Cost section per `rules/hatch3r-iteration-summary.md` §2.
717
+ - **Pre-execution `cost_estimate`** — emitted in Step 0.5 before the Step 5 ASK gate (the only mutation gate; fan-out begins in Step 6). Each Step 9.5 re-poll round re-emits it before that round's Step 5 ASK — re-entry passes through Step 4e → Step 5, so the per-round estimate fires on the same path.
718
+ - **Post-execution `cost_actuals` + `delta`** — appended to the Iteration Summary recap (cost facet; full blocks on the `Cost:` exception line beyond ±25%) per `rules/hatch3r-cost-visibility.md`.
722
719
 
723
- Per-tier `expected_sa_count` calibration (from frontmatter `sub_agents_spawned.count: 9` × tier heuristic in `rules/hatch3r-cost-visibility.md` Pre-Execution Estimate): Tier 1 ≈ 1 (one specialist, no review loop); Tier 2 ≈ 4 (FIX NOW fix group + review loop); Tier 3 up to 9 (full pipeline including the parallel Tier-3 final-quality specialist mandate). A no-comment short-circuit (Step 2d) emits `actual_sa_count: 0`. Deltas beyond 25% absolute value carry `flagged_for_review: true`. Token telemetry sources from `src/pipeline/observability.ts`; estimation primitives from `src/pipeline/costEstimator.ts`.
720
+ Per-tier `expected_sa_count` calibration (from frontmatter `sub_agents_spawned.count: 10` × tier heuristic in `rules/hatch3r-cost-visibility.md` Pre-Execution Estimate): Tier 1 ≈ 1 (one specialist, no review loop); Tier 2 ≈ 4 (FIX NOW fix group + review loop); Tier 3 up to 10 (full pipeline including the parallel Tier-3 final-quality specialist mandate and both mandatory-on-match specialists when triggered). A no-comment short-circuit (Step 2d) emits `actual_sa_count: 0`. Deltas beyond 25% absolute value carry `flagged_for_review: true`. Token telemetry sources from `src/pipeline/observability.ts`; estimation primitives from `src/pipeline/costEstimator.ts`.
724
721
 
725
722
  ---
726
723
 
@@ -738,21 +735,22 @@ Per-tier `expected_sa_count` calibration (from frontmatter `sub_agents_spawned.c
738
735
  | Review loop hits 3 iterations with findings remaining | ASK the user per `commands/revision/revision-quality.md` §Stage 1 Review Loop step 3 (3-iteration ASK). |
739
736
  | Quality gate fails 2 retries (Step 7a) | Record in `run_cache.errors`; Step 10 `Status: PARTIAL`. |
740
737
  | `git push` rejected (e.g., upstream changed mid-run) | Halt at Step 9 with: "Remote branch changed during run. Run `git pull --rebase`, resolve conflicts, then re-run /hatch3r-pr-resolve to repost any failed replies." |
738
+ | Step 9.5 poll budget exhausted (5 × 60s) with zero new comments | Report "No new comments after 300s."; re-ask 9.5a (keep polling / done). |
741
739
  | GraphQL `reviewThreads` query fails (GitHub resolution state) | Fall back to evaluating every inline comment (no resolution filter); record a Low-confidence note in `run_cache.errors`. |
742
740
 
743
741
  ---
744
742
 
745
743
  ## Guardrails
746
744
 
747
- 1. **One ASK gate.** Step 5 is the only user-facing checkpoint. After `accept`, the run proceeds through Steps 6–10 without further prompting (per user decision).
745
+ 1. **Two ASK gate classes.** Step 5 (triage routing, once per round) and Step 9.5 (re-poll consent, after each push) are the only user-facing checkpoints. Within a round, after `accept` Steps 6–9 run without further prompting (per user decision).
748
746
  2. **No thread closure.** Never mark a thread resolved (`isResolved: true`, Azure `status: fixed`, GitLab `resolved: true`). Thread resolution is reviewer-owned semantics.
749
747
  3. **No review verdicts.** Never approve, dismiss, or request changes on a PR review. Reply-only.
750
748
  4. **No labels or status checks.** PR labels and status checks are out of scope (handled by `hatch3r-board-fill` and CI integrations).
751
- 5. **No cross-PR work.** One PR per invocation. The `<pr-number>` argument is bound to a single PR.
749
+ 5. **No cross-PR work.** One PR per invocation. The `<pr-number>` argument is bound to a single PR. Step 9.5 rounds iterate on the same PR only — a re-poll never widens scope to another PR.
752
750
  6. **No base-branch push.** Step 9 pushes only to `pr.headRefName`. Refuse if the current branch differs.
753
751
  7. **Reply body hygiene.** Strip internal paths (`/Users/`, `/home/`, `.audit-workspace/`, `.hatch3r/`). Truncate over 60000 bytes.
754
752
  8. **Bot-comment parity.** Per user decision, comments from bot accounts are evaluated under the same rigor contract as human comments — no special-case skipping or downgrading.
755
- 9. **Skip resolved by default.** Step 2 filters resolved threads (`isResolved` for GitHub, `status: fixed/closed` for Azure, `resolved: true` for GitLab) unless a future flag explicitly opts in.
753
+ 9. **Skip resolved by default.** Step 2 filters resolved threads (`isResolved` for GitHub, `status: fixed/closed` for Azure, `resolved: true` for GitLab) unless a future flag explicitly opts in. Re-poll rounds (Step 9.5b) additionally exclude comments whose `comment_id` is in checkpoint `postedCommentIds`.
756
754
  10. **Confidence propagation.** Every reply body, every triage row, every Step 10 verdict carries a confidence rating from the upstream sub-agent or evaluation. Dropping the signal is a gate failure.
757
755
 
758
756
  ## References
@@ -33,7 +33,7 @@ Take a project idea or vision and produce complete project documentation across
33
33
  | 2. Document Generation | `hatch3r-docs-writer` (parallel: business spec, technical spec, ADRs) | Yes | Yes |
34
34
  | 3. AGENTS.md | `hatch3r-docs-writer` (AGENTS.md generation/rework) | No | Yes |
35
35
 
36
- **Parallel-safety conditions** (per `rules/hatch3r-agent-orchestration.md` §Parallel Safety): every parallel fan-out above holds all three — read-only or disjoint writes, deterministic aggregation, no shared mutable state.
36
+ **Parallel-safety conditions** (per `rules/hatch3r-agent-orchestration.md` §Parallel Safety): every parallel fan-out above holds all three — read-only or disjoint writes (file- and contract-level), deterministic aggregation, no shared mutable state.
37
37
 
38
38
  ---
39
39
 
@@ -82,7 +82,7 @@ cost_estimate:
82
82
  estimated_duration_min: <int>
83
83
  ```
84
84
 
85
- Post-execution actuals + delta land in the iteration summary's Fan-out + Cost section per `rules/hatch3r-cost-visibility.md` Post-Execution Actuals. Token telemetry sources from `src/pipeline/observability.ts`.
85
+ Post-execution actuals + delta land in the Iteration Summary recap (cost facet; full blocks on the `Cost:` exception line beyond ±25%) per `rules/hatch3r-cost-visibility.md` Post-Execution Actuals. Token telemetry sources from `src/pipeline/observability.ts`.
86
86
 
87
87
  ### Effort Override (Decision 17)
88
88
 
@@ -1236,30 +1236,18 @@ project-spec is long-running — a Tier 3 enterprise-scale greenfield fans out s
1236
1236
 
1237
1237
  ## Iteration Summary (mandatory output)
1238
1238
 
1239
- Emit the canonical 9-section iteration summary per `rules/hatch3r-iteration-summary.md` as the final user-facing output. The validation gate at `.claude/rules/capability-lifecycle.md` blocks SUCCESS declarations without this block (CONSTITUTION §6 Decision 23).
1240
-
1241
- The 9 sections:
1242
-
1243
- 1. **Request** — verbatim restatement of the user's ask in one sentence.
1244
- 2. **Fan-out + Cost** — `sub_agents_spawned: { count, rationale }` plus the `cost_estimate` / `cost_actuals` / `delta` blocks (see Cost Visibility below).
1245
- 3. **Web Research** — every URL fetched with access date + trust tier per `agents/shared/rigor-contract.md` (0 acceptable when no research was needed).
1246
- 4. **Files Mutated** — list with diff summary (lines added / removed / files created).
1247
- 5. **Gates Passed / Failed** — explicit list per `.claude/rules/capability-lifecycle.md` Gate Checklist.
1248
- 6. **Pillar Impact Attribution** — `progress_toward_pillar: <axis>.<pillar_id>+<delta>` per CONSTITUTION §6 Decision 17.
1249
- 7. **Verification Commands** — exact commands run with exit codes plus key output lines (≤200 chars).
1250
- 8. **Open Questions / Blockers** — explicit `None` if fully closed.
1251
- 9. **Learnings Captured** — IDs of any learnings written to `.hatch3r/learnings/` this run per `rules/hatch3r-learning-system.md`.
1239
+ Close the run with the recap-contract Iteration Summary per `rules/hatch3r-iteration-summary.md`: a 1–2 line recap (status, outcome, files · sub-agents · gates · cost delta) plus every exception line whose firing condition holds — silence asserts the default. Omitting the recap fails that rule's Validation Gate (CONSTITUTION §6 Decision 23, superseded in place 2026-07-06).
1252
1240
 
1253
1241
  ### Cost Visibility (Decision 24)
1254
1242
 
1255
- > Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Cost Estimate for the 5-field `cost_estimate` schema and the post-execution `cost_actuals` + `delta` contract; both land in Section 2 above.
1243
+ > Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Cost Estimate for the 5-field `cost_estimate` schema and the post-execution `cost_actuals` + `delta` contract; both land in the Iteration Summary recap (cost facet; full blocks on the `Cost:` exception line beyond ±25%) per `rules/hatch3r-cost-visibility.md`.
1256
1244
 
1257
1245
  ## Cost estimate (Decision 24)
1258
1246
 
1259
1247
  This command emits cost transparency per `rules/hatch3r-cost-visibility.md` and CONSTITUTION §6 Decision 24/29:
1260
1248
 
1261
1249
  - **Pre-execution `cost_estimate`** — emitted in Step 0.5 before the first researcher dispatch.
1262
- - **Post-execution `cost_actuals` + `delta`** — appended to the iteration summary's Fan-out + Cost section per `rules/hatch3r-iteration-summary.md` §2.
1250
+ - **Post-execution `cost_actuals` + `delta`** — appended to the Iteration Summary recap (cost facet; full blocks on the `Cost:` exception line beyond ±25%) per `rules/hatch3r-cost-visibility.md`.
1263
1251
 
1264
1252
  Per-tier `expected_sa_count` calibration (from frontmatter `sub_agents_spawned.count: 7` × tier heuristic in `rules/hatch3r-cost-visibility.md` Pre-Execution Estimate): Tier 1 ≈ 3-4 (reduced researcher set, no production-blueprint); Tier 2/3 spawn up to 7 parallel researchers plus the production-blueprint sub-agent. Deltas beyond 25% absolute value carry `flagged_for_review: true`. Token telemetry sources from `src/pipeline/observability.ts`; estimation primitives from `src/pipeline/costEstimator.ts`.
1265
1253
 
@@ -30,7 +30,7 @@ Before any action, scan the user's change description for unresolved questions i
30
30
  | 4a. Review Loop | `hatch3r-reviewer` -> `hatch3r-fixer` (max 3 iterations) | No (sequential) | Nontrivial only |
31
31
  | 4b. Final Quality | `hatch3r-testability` + `hatch3r-security` | Yes | Nontrivial code changes |
32
32
 
33
- **Parallel-safety conditions** (per `rules/hatch3r-agent-orchestration.md` §Parallel Safety): every parallel fan-out above holds all three — read-only or disjoint writes, deterministic aggregation, no shared mutable state.
33
+ **Parallel-safety conditions** (per `rules/hatch3r-agent-orchestration.md` §Parallel Safety): every parallel fan-out above holds all three — read-only or disjoint writes (file- and contract-level), deterministic aggregation, no shared mutable state.
34
34
 
35
35
  ## Browser Automation
36
36
 
@@ -114,7 +114,7 @@ cost_estimate:
114
114
  estimated_duration_min: <int>
115
115
  ```
116
116
 
117
- Post-execution actuals + delta land in the Step 8 summary's Fan-out + Cost section per `rules/hatch3r-cost-visibility.md` Post-Execution Actuals. Token telemetry sources from `src/pipeline/observability.ts`.
117
+ Post-execution actuals + delta land in the Iteration Summary recap (cost facet; full blocks on the `Cost:` exception line beyond ±25%) per `rules/hatch3r-cost-visibility.md` Post-Execution Actuals. Token telemetry sources from `src/pipeline/observability.ts`.
118
118
 
119
119
  ### Effort Override (Decision 17)
120
120
 
@@ -444,30 +444,18 @@ quick-change runs adaptive ceremony — trivial items execute inline with no che
444
444
 
445
445
  ## Iteration Summary (mandatory output)
446
446
 
447
- Emit the canonical 9-section iteration summary per `rules/hatch3r-iteration-summary.md` as the final user-facing output (the Step 8 Summary above is the quick-change-specific rendering both the Step 8 block and the 9-section canonical contract apply). The validation gate at `.claude/rules/capability-lifecycle.md` blocks SUCCESS declarations without this block (CONSTITUTION §6 Decision 23).
448
-
449
- The 9 sections:
450
-
451
- 1. **Request** — verbatim restatement of the user's ask in one sentence.
452
- 2. **Fan-out + Cost** — `sub_agents_spawned: { count, rationale }` plus the `cost_estimate` / `cost_actuals` / `delta` blocks (see Cost Visibility below).
453
- 3. **Web Research** — every URL fetched with access date + trust tier per `agents/shared/rigor-contract.md` (0 acceptable when no research was needed).
454
- 4. **Files Mutated** — list with diff summary (lines added / removed / files created).
455
- 5. **Gates Passed / Failed** — explicit list per `.claude/rules/capability-lifecycle.md` Gate Checklist.
456
- 6. **Pillar Impact Attribution** — `progress_toward_pillar: <axis>.<pillar_id>+<delta>` per CONSTITUTION §6 Decision 17.
457
- 7. **Verification Commands** — exact commands run with exit codes plus key output lines (≤200 chars).
458
- 8. **Open Questions / Blockers** — explicit `None` if fully closed.
459
- 9. **Learnings Captured** — IDs of any learnings written to `.hatch3r/learnings/` this run per `rules/hatch3r-learning-system.md`.
447
+ Close the run with the recap-contract Iteration Summary per `rules/hatch3r-iteration-summary.md`: a 1–2 line recap (status, outcome, files · sub-agents · gates · cost delta) plus every exception line whose firing condition holds silence asserts the default. Omitting the recap fails that rule's Validation Gate (CONSTITUTION §6 Decision 23, superseded in place 2026-07-06). (The Step 8 block above is the domain rendering; the recap closes the run.)
460
448
 
461
449
  ### Cost Visibility (Decision 24)
462
450
 
463
- > Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Cost Estimate for the 5-field `cost_estimate` schema and the post-execution `cost_actuals` + `delta` contract; both land in Section 2 above.
451
+ > Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Cost Estimate for the 5-field `cost_estimate` schema and the post-execution `cost_actuals` + `delta` contract; both land in the Iteration Summary recap (cost facet; full blocks on the `Cost:` exception line beyond ±25%) per `rules/hatch3r-cost-visibility.md`.
464
452
 
465
453
  ## Cost estimate (Decision 24)
466
454
 
467
455
  This command emits cost transparency per `rules/hatch3r-cost-visibility.md` and CONSTITUTION §6 Decision 24/29:
468
456
 
469
457
  - **Pre-execution `cost_estimate`** — emitted in the Pre-Execution Cost Preview above before the first sub-agent dispatch.
470
- - **Post-execution `cost_actuals` + `delta`** — appended to the Step 8 summary's Fan-out + Cost section per `rules/hatch3r-iteration-summary.md` §2.
458
+ - **Post-execution `cost_actuals` + `delta`** — appended to the Iteration Summary recap (cost facet; full blocks on the `Cost:` exception line beyond ±25%) per `rules/hatch3r-cost-visibility.md`.
471
459
 
472
460
  Per-tier `expected_sa_count` calibration (from frontmatter `sub_agents_spawned.count: 13` × tier heuristic in `rules/hatch3r-cost-visibility.md` Pre-Execution Estimate): Tier 1 trivial inline ≈ 0 (no sub-agent); Tier 2 ≈ 3 (researcher + implementer + reviewer, plus lint-fixer/fixer/testability/security when triggered); up to 13 when the conditional CQ vector specialists fire per their trigger conditions. Deltas beyond 25% absolute value carry `flagged_for_review: true`. Token telemetry sources from `src/pipeline/observability.ts`; estimation primitives from `src/pipeline/costEstimator.ts`.
473
461