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.
- package/README.md +3 -3
- package/dist/cli/index.js +77 -19
- package/dist/content/agents/hatch3r-brownfield-spec.md +1 -1
- package/dist/content/agents/hatch3r-fixer.md +21 -8
- package/dist/content/agents/hatch3r-handoff-loader.md +7 -2
- package/dist/content/agents/hatch3r-handoff-preparer.md +5 -16
- package/dist/content/agents/hatch3r-implementer.md +29 -3
- package/dist/content/agents/hatch3r-maintainability.md +2 -0
- package/dist/content/agents/hatch3r-researcher.md +1 -1
- package/dist/content/agents/hatch3r-reviewer.md +21 -13
- package/dist/content/agents/hatch3r-ui.md +1 -1
- package/dist/content/agents/hatch3r-ux.md +1 -1
- package/dist/content/agents/shared/cq-specialist-roster.md +2 -2
- package/dist/content/agents/shared/efficiency-patterns.md +1 -1
- package/dist/content/agents/shared/quality-charter.md +6 -5
- package/dist/content/agents/shared/quality-specialist-frame.md +1 -1
- package/dist/content/agents/shared/severity-mapping.md +1 -1
- package/dist/content/agents/shared/triage-vocabulary.md +1 -1
- package/dist/content/agents/shared/user-content-templates.md +1 -1
- package/dist/content/agents/shared/user-question-protocol.md +4 -3
- package/dist/content/checks/code-quality.md +11 -0
- package/dist/content/checks/security.md +5 -0
- package/dist/content/checks/testing.md +2 -0
- package/dist/content/commands/board/pickup-delegation-multi.md +18 -8
- package/dist/content/commands/board/pickup-delegation.md +5 -4
- package/dist/content/commands/hatch3r-api-spec.md +5 -17
- package/dist/content/commands/hatch3r-auth-scaffold.md +7 -20
- package/dist/content/commands/hatch3r-benchmark.md +5 -17
- package/dist/content/commands/hatch3r-board-fill.md +6 -18
- package/dist/content/commands/hatch3r-board-pickup.md +8 -19
- package/dist/content/commands/hatch3r-bug-pipeline.md +4 -16
- package/dist/content/commands/hatch3r-bug-plan.md +5 -17
- package/dist/content/commands/hatch3r-codebase-map.md +5 -17
- package/dist/content/commands/hatch3r-create.md +5 -17
- package/dist/content/commands/hatch3r-debug.md +5 -17
- package/dist/content/commands/hatch3r-design-system-create.md +254 -0
- package/dist/content/commands/hatch3r-diagnose.md +10 -18
- package/dist/content/commands/hatch3r-feature-plan.md +5 -17
- package/dist/content/commands/hatch3r-handoff.md +5 -17
- package/dist/content/commands/hatch3r-healthcheck.md +5 -17
- package/dist/content/commands/hatch3r-incident-response.md +3 -15
- package/dist/content/commands/hatch3r-migration-plan.md +5 -17
- package/dist/content/commands/hatch3r-onboard.md +6 -18
- package/dist/content/commands/hatch3r-pack-install.md +6 -29
- package/dist/content/commands/hatch3r-pr-resolve.md +77 -79
- package/dist/content/commands/hatch3r-project-spec.md +5 -17
- package/dist/content/commands/hatch3r-quick-change.md +5 -17
- package/dist/content/commands/hatch3r-refactor-plan.md +5 -17
- package/dist/content/commands/hatch3r-release.md +6 -16
- package/dist/content/commands/hatch3r-revision.md +11 -23
- package/dist/content/commands/hatch3r-roadmap.md +5 -17
- package/dist/content/commands/hatch3r-security-audit.md +5 -17
- package/dist/content/commands/hatch3r-slo-scaffold.md +8 -20
- package/dist/content/commands/hatch3r-spec.md +11 -16
- package/dist/content/commands/hatch3r-test-plan.md +5 -17
- package/dist/content/commands/hatch3r-workflow.md +16 -26
- package/dist/content/commands/revision/revision-quality.md +6 -5
- package/dist/content/commands/shared/orchestration-frame.md +2 -2
- package/dist/content/rules/hatch3r-agent-orchestration-detail.md +2 -2
- package/dist/content/rules/hatch3r-agent-orchestration-detail.mdc +2 -2
- package/dist/content/rules/hatch3r-agent-orchestration.md +15 -15
- package/dist/content/rules/hatch3r-agent-orchestration.mdc +15 -15
- package/dist/content/rules/hatch3r-anti-duplication.md +15 -4
- package/dist/content/rules/hatch3r-anti-duplication.mdc +15 -4
- package/dist/content/rules/hatch3r-clarification-default.md +8 -7
- package/dist/content/rules/hatch3r-clarification-default.mdc +8 -7
- package/dist/content/rules/hatch3r-code-standards.md +1 -1
- package/dist/content/rules/hatch3r-code-standards.mdc +1 -1
- package/dist/content/rules/hatch3r-contract-census.md +160 -0
- package/dist/content/rules/hatch3r-contract-census.mdc +160 -0
- package/dist/content/rules/hatch3r-cost-visibility.md +11 -4
- package/dist/content/rules/hatch3r-cost-visibility.mdc +11 -4
- package/dist/content/rules/hatch3r-deep-context.md +1 -0
- package/dist/content/rules/hatch3r-deep-context.mdc +1 -0
- package/dist/content/rules/hatch3r-dynamic-stack-verification.md +114 -0
- package/dist/content/rules/hatch3r-dynamic-stack-verification.mdc +109 -0
- package/dist/content/rules/hatch3r-enhancability.md +1 -1
- package/dist/content/rules/hatch3r-enhancability.mdc +1 -1
- package/dist/content/rules/hatch3r-findings-ledger.md +129 -0
- package/dist/content/rules/hatch3r-findings-ledger.mdc +129 -0
- package/dist/content/rules/hatch3r-handoff-readiness.md +1 -1
- package/dist/content/rules/hatch3r-handoff-readiness.mdc +1 -1
- package/dist/content/rules/hatch3r-i18n.md +4 -0
- package/dist/content/rules/hatch3r-i18n.mdc +4 -0
- package/dist/content/rules/hatch3r-iteration-summary.md +47 -49
- package/dist/content/rules/hatch3r-iteration-summary.mdc +47 -49
- package/dist/content/rules/hatch3r-learning-system.md +6 -6
- package/dist/content/rules/hatch3r-learning-system.mdc +6 -6
- package/dist/content/rules/hatch3r-migrations.md +1 -1
- package/dist/content/rules/hatch3r-migrations.mdc +1 -1
- package/dist/content/rules/hatch3r-reviewer-calibration.md +2 -2
- package/dist/content/rules/hatch3r-reviewer-calibration.mdc +2 -2
- package/dist/content/rules/hatch3r-security-patterns.md +4 -0
- package/dist/content/rules/hatch3r-security-patterns.mdc +4 -0
- package/dist/content/rules/hatch3r-testing.md +14 -0
- package/dist/content/rules/hatch3r-testing.mdc +14 -0
- package/dist/content/rules/hatch3r-tool-currency.md +1 -1
- package/dist/content/rules/hatch3r-tool-currency.mdc +1 -1
- package/dist/content/skills/hatch3r-adhoc-orchestrate/SKILL.md +1 -1
- package/dist/content/skills/hatch3r-design-system-detect/SKILL.md +2 -0
- package/dist/content/skills/hatch3r-handoff-prepare/SKILL.md +4 -4
- package/dist/content/skills/hatch3r-report/SKILL.md +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: hatch3r-iteration-summary
|
|
3
3
|
type: rule
|
|
4
|
-
description:
|
|
4
|
+
description: Recap-contract iteration summary — every orchestrator command and meaningful skill run closes with a 1-2 line recap (status, outcome, files/sub-agents/gates/cost-delta telemetry) plus exception lines that fire only on non-default outcomes; silence asserts the default.
|
|
5
5
|
tags: [iteration, summary, telemetry, floor:content-quality]
|
|
6
6
|
precedence: high
|
|
7
7
|
scope: always
|
|
@@ -12,46 +12,56 @@ scope: always
|
|
|
12
12
|
|
|
13
13
|
## When Required
|
|
14
14
|
|
|
15
|
-
Every orchestrator command (`commands/hatch3r-*.md` with `orchestrator: true`) AND every meaningful skill run (`/h4tcher-*` or `/hatch3r-*` that mutates state) MUST
|
|
15
|
+
Every orchestrator command (`commands/hatch3r-*.md` with `orchestrator: true`) AND every meaningful skill run (`/h4tcher-*` or `/hatch3r-*` that mutates state) MUST close with the recap-contract Iteration Summary as the final user-facing output. The block opens with the literal heading `## Iteration Summary` — the stable extraction anchor for downstream consumers. Governance anchor: CONSTITUTION §6 Decision 23, superseded in place 2026-07-06 (the recap contract replaces the former sectioned template).
|
|
16
16
|
|
|
17
17
|
## Pre-Execution Cost Preview
|
|
18
18
|
|
|
19
|
-
Every orchestrator command MUST emit
|
|
19
|
+
Every orchestrator command MUST emit the pre-dispatch cost preview defined at `rules/hatch3r-cost-visibility.md` → Pre-Execution Estimate BEFORE its first sub-agent dispatch (Decision 24 at the user-facing surface). That rule owns the preview schema — do not restate it here. Commands wire the preview as an explicit pre-dispatch step (e.g., `commands/hatch3r-workflow.md` Step 0.5); the recap's cost facet closes the loop by reporting deltas against it.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
## The Recap
|
|
22
|
+
|
|
23
|
+
Under the `## Iteration Summary` heading, the body is a 1-2 line recap:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Line 1: **<SUCCESS|PARTIAL|FAILED|BLOCKED>** — <one outcome sentence naming the work object and end state>
|
|
27
|
+
Line 2: files <N> (+<added>/−<removed>) · sa <actual>/<expected> · gates <passed>/<run> · cost Δ<tok%>% tok / Δ<min%>% min · tier <1|2|3>
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Status enum reused from `agents/shared/quality-charter.md` §11. Facet order fixed (machine-parseable). `+<added>/−<removed>` are diff line totals (lines added/removed) across the changed files. `sa <actual>/<expected>` carries the fan-out count; **rationale stays a dispatch-time emission** per `rules/hatch3r-fan-out-discipline.md` (validate-fanout-emission unaffected). Merge condition: line 2 folds into line 1 parenthesized when ≥3 facets at rest (files 0, sa 0, gates 0); at-rest facets fold away except `files`, `sa`, and `tier` — e.g. `**SUCCESS** — Explained adapter precedence (read-only: files 0 · sa 0 · tier 1)`.
|
|
31
|
+
|
|
32
|
+
## Exception Lines
|
|
33
|
+
|
|
34
|
+
Below the recap, a line appears ONLY when its firing condition holds. An absent exception line is a positive claim of its Silent-when default — silence asserts the default. Each entry is a single line; `Cost:` is the one multi-line exception (its fenced YAML follows the line).
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
| Line | Format | Fires when | Gate preserved | Silent-when |
|
|
37
|
+
|---|---|---|---|---|
|
|
38
|
+
| Not done | `Not done: <item> [— deferred: <why> \| unverified: <what>]; …` | any scope item not done/deferred/unverified | charter honesty; handoff Work Remaining | full scope completed |
|
|
39
|
+
| Blockers | `Blockers: <blocker or open question>; …` | any open blocker | old §8; handoff Blockers | none open |
|
|
40
|
+
| Open findings | `Open findings: <finding_id> <sev> — <disposition>; …` | any findings-ledger row folds non-terminal, or terminal as `escalated`/`surfaced`, at recap time | findings-ledger run-exit invariant (`rules/hatch3r-findings-ledger.md`) | no ledger file for this run, or every row folds to done/deferred/declined/accepted-risk/already-resolved |
|
|
41
|
+
| Default applied | `Default applied: <question summary> → option <N> (<one-line reason>)` — format unchanged from the superseded template, one per default | ASK default exercised | **P8 B1** | no default taken |
|
|
42
|
+
| Gates failed | `Gates failed: <gate>: <one-line cause>; …` | recap gates shows failure | P1 actionability | all gates passed |
|
|
43
|
+
| Cost | `Cost: flagged_for_review: true` + fenced cost_actuals/delta YAML (the one multi-line exception) | any delta > 25% absolute | **Decision 24** / cost-visibility AC5 | deltas within ±25% (recap Δ facet suffices; telemetry persists regardless) |
|
|
44
|
+
| Confidence | `Confidence: <high\|medium\|low> — <basis>[. <D13 action string verbatim>]` | review loop ran OR confidence < high OR status ≠ SUCCESS | D13 mapping; reviewer-calibration; anti-inflation | SUCCESS + high + direct measurement + no loop |
|
|
45
|
+
| User-Accepted Bypass | `User-Accepted Bypass: yes — <verbatim reason ≤200 chars>` + JSONL append | accepted low-confidence PASS | D13 bypass record | no bypass |
|
|
46
|
+
| Learnings | `Learnings: consulted <ids> · surfaced <ids> · captured <ids>` (omit empty facets) | any facet non-empty | learning-system gates | no INDEX / zero matches / nothing captured |
|
|
47
|
+
| Tier | `formatTierUpgradeNote` output verbatim (one-liner, `src/pipeline/pipelineContext.ts:647-655`) | mid-run tier upgrade | D7-14 | no upgrade |
|
|
48
|
+
| Duplication | `Duplication: <n> match(es), closest <path>, overlap <none\|partial\|high>` or `Duplication: scan skipped (<reason>)` | scan matched OR skipped | anti-duplication silent-failure | scan ran clean |
|
|
49
|
+
| Next (optional, never gated) | `Next: <one-line suggested action>` | concrete next step exists | charter optional-sections precedent | nothing to suggest |
|
|
33
50
|
|
|
34
|
-
1
|
|
35
|
-
2. **Fan-out + Cost** — `sub_agents_spawned: { count, rationale }` + `cost: { estimated_input_tokens, actual_input_tokens, estimated_duration_min, actual_duration_min, delta_percent }`
|
|
36
|
-
3. **Web Research** — every URL fetched with access date + trust tier (per `agents/shared/rigor-contract.md`); count 0 acceptable if no research was needed
|
|
37
|
-
4. **Files Mutated** — list with diff summary (lines added / removed / files created)
|
|
38
|
-
5. **Gates Passed / Failed** — explicit list per `.claude/rules/capability-lifecycle.md` Gate Checklist
|
|
39
|
-
6. **Pillar Impact Attribution** — `progress_toward_pillar: <axis>.<pillar_id>+<delta>` per Decision 17
|
|
40
|
-
7. **Verification Commands** — exact commands run with exit codes + key output lines (≤200 chars)
|
|
41
|
-
8. **Open Questions / Blockers** — explicit None if fully closed. When an ASK gate's default-if-no-response was exercised this run, this section MUST carry one `Default applied: <question summary> → option <N> (<one-line reason>)` line per default taken (the operational counterpart to `agents/shared/user-question-protocol.md` → Operationalising Default-if-no-Response step 3); absence of the line when a default was applied is a P8 B1 gate failure
|
|
42
|
-
9. **Learnings Captured** — IDs of any learnings written to `.hatch3r/learnings/` this run; cross-reference `rules/hatch3r-learning-system.md`
|
|
51
|
+
Charter-field mapping: Status + Outcome → line 1; Done → outcome + files facet; the rest → exception lines. Learning-system's "citing zero when `applies-to` matched is a gate failure" becomes fired-condition-with-no-line.
|
|
43
52
|
|
|
44
|
-
##
|
|
53
|
+
## Handoff Mapping
|
|
45
54
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- **Done
|
|
49
|
-
- **
|
|
50
|
-
- **
|
|
55
|
+
Handoff surfaces (`rules/hatch3r-handoff-readiness.md`, `skills/hatch3r-handoff-prepare/SKILL.md`, `agents/hatch3r-handoff-preparer.md`) derive their fields from the recap:
|
|
56
|
+
|
|
57
|
+
- **Work Done** ← recap outcome (line 1) + files facet
|
|
58
|
+
- **Work Remaining** ← `Not done:` line; absent ⇒ `None — full scope completed`
|
|
59
|
+
- **Blockers** ← `Blockers:` line; absent ⇒ `None`
|
|
60
|
+
- **Open Findings** ← `Open findings:` line; absent ⇒ none
|
|
51
61
|
|
|
52
62
|
## Confidence-to-Action Mapping (D13)
|
|
53
63
|
|
|
54
|
-
When a review loop ran this turn, the
|
|
64
|
+
When a review loop ran this turn, the `Confidence:` exception line MUST append the action guidance for the loop's terminal confidence level (`reviewLoopConfidence` in `src/pipeline/reviewLoop.ts`). This is the canonical confidence-to-action text — `confidenceExplanation` in `src/pipeline/reviewLoop.ts` returns these exact three strings, so the typed helper and this user-facing rule stay byte-identical (the strings are no longer reachable only from a unit test, closing D13-SA13.2-F2):
|
|
55
65
|
|
|
56
66
|
- **high** — The fix was correct on the first attempt. Human review is optional but recommended for critical code paths.
|
|
57
67
|
- **medium** — The fix required one round of corrections, which is normal for moderately complex changes. A brief human review is recommended.
|
|
@@ -61,7 +71,7 @@ Omit the mapping when no review loop ran (e.g. a Tier 1 typo edit with no review
|
|
|
61
71
|
|
|
62
72
|
## Pattern Rationale (D13 in-flow teaching — default-ON at Tier ≥ 2)
|
|
63
73
|
|
|
64
|
-
|
|
74
|
+
At Tier ≥ 2 the orchestrator MUST emit a `## Pattern Rationale` block before the Iteration Summary — one SHORT line per framework pattern applied this turn (rule citation + pillar served + plain-language reason), so sub-agent reasoning reaches the user instead of being summarized away (D13 SA13.4 F5/F6):
|
|
65
75
|
|
|
66
76
|
```
|
|
67
77
|
pattern_rationale:
|
|
@@ -71,38 +81,26 @@ pattern_rationale:
|
|
|
71
81
|
why: <≤1 sentence plain language>
|
|
72
82
|
```
|
|
73
83
|
|
|
74
|
-
Emission policy:
|
|
75
|
-
|
|
76
|
-
- **Default-ON at Tier ≥ 2:** emit one line for each mutated file that applies a named rule the user did not request explicitly. A Tier ≥ 2 turn that applied at least one such pattern and omits the block is a P5 gate failure (same enforcement class as the §9 Validation Gate).
|
|
77
|
-
- **Tier 1 exemption:** Tier 1 trivial edits (typo, frontmatter-only, single-line clarification) skip the block — no pattern is taught, so no field appears, preserving token budget. This mirrors the Tier-1 exemption in `rules/hatch3r-agent-orchestration.md` (Per-Turn Pipeline-State Header).
|
|
78
|
-
- **No-pattern case:** when a Tier ≥ 2 turn applied no named rule beyond what the user requested, emit `pattern_rationale: none (no implicit pattern applied)` rather than dropping the field, so the block's absence is never ambiguous.
|
|
79
|
-
- **`--quiet` opt-out:** the `--quiet` CLI flag suppresses the block at the user surface (same precedent as cost data in `rules/hatch3r-cost-visibility.md` → "appears in user-facing iteration summaries by default … suppressing via the `--quiet` CLI flag"). Suppression is user-surface only; it does not weaken the Tier ≥ 2 emission contract for default (non-`--quiet`) runs.
|
|
84
|
+
Emission policy: one line per mutated file that applies a named rule the user did not request explicitly; a Tier ≥ 2 turn that applied at least one such pattern and omits the block is a P5 gate failure (same enforcement class as the Validation Gate below). Tier 1 trivial edits (typo, frontmatter-only, single-line clarification) skip the block, mirroring the Tier-1 exemption in `rules/hatch3r-agent-orchestration.md` → Per-Turn Pipeline-State Header. When a Tier ≥ 2 turn applied no named rule beyond the request, emit `pattern_rationale: none (no implicit pattern applied)` so absence is never ambiguous. A triggered plan/act split (`agents/shared/efficiency-patterns.md` P4) is recorded here as an entry carrying `plan_act_split: triggered`; a skipped split stays silent — silence asserts the skip. The `--quiet` CLI flag suppresses the block at the user surface only (same precedent as cost data in `rules/hatch3r-cost-visibility.md`); suppression does not weaken the Tier ≥ 2 emission contract for default runs.
|
|
80
85
|
|
|
81
86
|
## User-Accepted Bypass Record (D13)
|
|
82
87
|
|
|
83
|
-
When the user explicitly accepts a low-confidence PASS at an ASK checkpoint (per the
|
|
84
|
-
|
|
85
|
-
1. Emit `User-Accepted Bypass: yes` in §8 (Open Questions / Blockers) with the bypass reason verbatim from the user reply.
|
|
86
|
-
2. Append a single line to `.hatch3r/bypass-log.jsonl` (one JSON object per line — append-only, never rewritten):
|
|
88
|
+
When the user explicitly accepts a low-confidence PASS at an ASK checkpoint (per the Confidence Propagation Contract used by every core orchestrator), the orchestrator MUST (1) emit the `User-Accepted Bypass:` exception line with the bypass reason verbatim from the user reply, and (2) append one JSON object line to `.hatch3r/bypass-log.jsonl` (append-only, never rewritten; atomic append via the `src/merge/safeWrite.ts` pattern — temp+rename then concat):
|
|
87
89
|
|
|
88
90
|
```json
|
|
89
|
-
{"ts": "<ISO-8601>", "command": "<hatch3r-* name>", "verdict": "low", "user_reason": "<verbatim ≤200 chars>", "files": ["<paths>"], "session_id": "<id>"}
|
|
91
|
+
{"ts": "<ISO-8601 UTC>", "command": "<hatch3r-* name>", "verdict": "low", "user_reason": "<verbatim ≤200 chars, no PII>", "files": ["<paths>"], "session_id": "<host session id, else unknown>"}
|
|
90
92
|
```
|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
Absence of the line on a recorded bypass is a P5 gate failure.
|
|
93
95
|
|
|
94
96
|
## Validation Gate
|
|
95
97
|
|
|
96
|
-
A
|
|
98
|
+
A run fails the gate when the recap is missing, when any registry row's firing condition holds with no corresponding exception line, or when prose is substituted for the recap grammar. Registry-row checking is an explicit pre-status step: before declaring status, the orchestrator walks the table above and emits each line whose firing condition holds — the omission is caught before SUCCESS is declared.
|
|
97
99
|
|
|
98
100
|
## Emission-Rate Telemetry (current status: per-run gate only; cross-run rate not yet wired)
|
|
99
101
|
|
|
100
|
-
The
|
|
101
|
-
|
|
102
|
-
The SPACE-shaped activity/performance instrumentation (`src/pipeline/spaceTelemetry.ts`, Decision 24 sibling of cost-visibility) provides the recording primitive `recordSpaceMetric`, the in-process aggregator `getSpaceSummary`, and the across-runs reader `loadSpaceMetricsFromDisk`, but they are not invoked on the iteration-summary path: orchestrator commands and skills are LLM-interpreted markdown with no binding to compiled `src/`, and no command, skill, hook, or `src/` code emits an `iterationSummaryEmitted` metric. The cross-run emission-rate loop is therefore unwired — a future capability, not a live measurement (origin: D10-SA10.8-F-6; gap corrected D10-18). The module records on the `activity` and `performance` axes only; its `satisfaction` and `communication` axes are reserved with no feeder, so "SPACE" names the data shape, not full five-axis coverage (D10-40).
|
|
103
|
-
|
|
104
|
-
To wire it, a host-runtime bridge (a Claude Code / Cursor / Copilot post-turn hook or an MCP shim) would need to call `recordSpaceMetric({ metricId: "iterationSummaryEmitted", axis: "activity", value: <1 if the 9-section block was produced else 0> })` after each orchestrator/meaningful-skill turn, persisting one JSONL line per run to `.hatch3r/telemetry/space-<YYYY-MM-DD>.jsonl`; the audit cycle could then read the persisted JSONL across runs via `loadSpaceMetricsFromDisk` + `summarizeSpaceMetricRecords` (NOT `getSpaceSummary`, which sees only the current process's ring buffer) to check the CONSTITUTION §2 P5 "Sub-agent count emission on delegating artifacts: 100%" target against observed runs instead of only mandating it. `recordSpaceMetric` already honours the Silent Failure Contract (telemetry I/O routes through `src/pipeline/failureLog.ts` and never throws), so building the bridge adds no failure surface. Until that bridge ships, P5 emission compliance is enforced by the per-run validation gate above plus audit-cycle spot checks, not by an aggregate metric.
|
|
102
|
+
The Validation Gate asserts recap presence per run; no automated cross-run emission-rate measurement exists today. `src/pipeline/spaceTelemetry.ts` provides `recordSpaceMetric`, `loadSpaceMetricsFromDisk`, and `summarizeSpaceMetricRecords`, but nothing on the iteration-summary path invokes them — commands and skills are LLM-interpreted markdown with no binding to compiled `src/`, so the cross-run loop is a future capability, not a live measurement (origin D10-SA10.8-F-6; gap corrected D10-18). The module records only the `activity` and `performance` axes; `satisfaction` and `communication` are reserved with no feeder, so "SPACE" names the data shape, not five-axis coverage (D10-40). Wiring requires a host-runtime post-turn bridge emitting an `iterationSummaryEmitted` metric to `.hatch3r/telemetry/space-<YYYY-MM-DD>.jsonl`; until then, P5 emission compliance rests on the per-run gate plus audit-cycle spot checks.
|
|
105
103
|
|
|
106
104
|
## Pillar Service
|
|
107
|
-
- P5 — standardised
|
|
108
|
-
- P7 — cost
|
|
105
|
+
- P5 — one standardised recap plus an auditable exception-line registry prevents drift across orchestrators
|
|
106
|
+
- P7 — the recap cost facet surfaces token + duration deltas per Decision 24 at a fraction of the former template's token footprint
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: hatch3r-iteration-summary
|
|
3
3
|
type: rule
|
|
4
|
-
description:
|
|
4
|
+
description: Recap-contract iteration summary — every orchestrator command and meaningful skill run closes with a 1-2 line recap (status, outcome, files/sub-agents/gates/cost-delta telemetry) plus exception lines that fire only on non-default outcomes; silence asserts the default.
|
|
5
5
|
tags: [iteration, summary, telemetry, floor:content-quality]
|
|
6
6
|
precedence: high
|
|
7
7
|
alwaysApply: true
|
|
@@ -12,46 +12,56 @@ alwaysApply: true
|
|
|
12
12
|
|
|
13
13
|
## When Required
|
|
14
14
|
|
|
15
|
-
Every orchestrator command (`commands/hatch3r-*.md` with `orchestrator: true`) AND every meaningful skill run (`/h4tcher-*` or `/hatch3r-*` that mutates state) MUST
|
|
15
|
+
Every orchestrator command (`commands/hatch3r-*.md` with `orchestrator: true`) AND every meaningful skill run (`/h4tcher-*` or `/hatch3r-*` that mutates state) MUST close with the recap-contract Iteration Summary as the final user-facing output. The block opens with the literal heading `## Iteration Summary` — the stable extraction anchor for downstream consumers. Governance anchor: CONSTITUTION §6 Decision 23, superseded in place 2026-07-06 (the recap contract replaces the former sectioned template).
|
|
16
16
|
|
|
17
17
|
## Pre-Execution Cost Preview
|
|
18
18
|
|
|
19
|
-
Every orchestrator command MUST emit
|
|
19
|
+
Every orchestrator command MUST emit the pre-dispatch cost preview defined at `rules/hatch3r-cost-visibility.md` → Pre-Execution Estimate BEFORE its first sub-agent dispatch (Decision 24 at the user-facing surface). That rule owns the preview schema — do not restate it here. Commands wire the preview as an explicit pre-dispatch step (e.g., `commands/hatch3r-workflow.md` Step 0.5); the recap's cost facet closes the loop by reporting deltas against it.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
## The Recap
|
|
22
|
+
|
|
23
|
+
Under the `## Iteration Summary` heading, the body is a 1-2 line recap:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Line 1: **<SUCCESS|PARTIAL|FAILED|BLOCKED>** — <one outcome sentence naming the work object and end state>
|
|
27
|
+
Line 2: files <N> (+<added>/−<removed>) · sa <actual>/<expected> · gates <passed>/<run> · cost Δ<tok%>% tok / Δ<min%>% min · tier <1|2|3>
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Status enum reused from `agents/shared/quality-charter.md` §11. Facet order fixed (machine-parseable). `+<added>/−<removed>` are diff line totals (lines added/removed) across the changed files. `sa <actual>/<expected>` carries the fan-out count; **rationale stays a dispatch-time emission** per `rules/hatch3r-fan-out-discipline.md` (validate-fanout-emission unaffected). Merge condition: line 2 folds into line 1 parenthesized when ≥3 facets at rest (files 0, sa 0, gates 0); at-rest facets fold away except `files`, `sa`, and `tier` — e.g. `**SUCCESS** — Explained adapter precedence (read-only: files 0 · sa 0 · tier 1)`.
|
|
31
|
+
|
|
32
|
+
## Exception Lines
|
|
33
|
+
|
|
34
|
+
Below the recap, a line appears ONLY when its firing condition holds. An absent exception line is a positive claim of its Silent-when default — silence asserts the default. Each entry is a single line; `Cost:` is the one multi-line exception (its fenced YAML follows the line).
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
| Line | Format | Fires when | Gate preserved | Silent-when |
|
|
37
|
+
|---|---|---|---|---|
|
|
38
|
+
| Not done | `Not done: <item> [— deferred: <why> \| unverified: <what>]; …` | any scope item not done/deferred/unverified | charter honesty; handoff Work Remaining | full scope completed |
|
|
39
|
+
| Blockers | `Blockers: <blocker or open question>; …` | any open blocker | old §8; handoff Blockers | none open |
|
|
40
|
+
| Open findings | `Open findings: <finding_id> <sev> — <disposition>; …` | any findings-ledger row folds non-terminal, or terminal as `escalated`/`surfaced`, at recap time | findings-ledger run-exit invariant (`rules/hatch3r-findings-ledger.md`) | no ledger file for this run, or every row folds to done/deferred/declined/accepted-risk/already-resolved |
|
|
41
|
+
| Default applied | `Default applied: <question summary> → option <N> (<one-line reason>)` — format unchanged from the superseded template, one per default | ASK default exercised | **P8 B1** | no default taken |
|
|
42
|
+
| Gates failed | `Gates failed: <gate>: <one-line cause>; …` | recap gates shows failure | P1 actionability | all gates passed |
|
|
43
|
+
| Cost | `Cost: flagged_for_review: true` + fenced cost_actuals/delta YAML (the one multi-line exception) | any delta > 25% absolute | **Decision 24** / cost-visibility AC5 | deltas within ±25% (recap Δ facet suffices; telemetry persists regardless) |
|
|
44
|
+
| Confidence | `Confidence: <high\|medium\|low> — <basis>[. <D13 action string verbatim>]` | review loop ran OR confidence < high OR status ≠ SUCCESS | D13 mapping; reviewer-calibration; anti-inflation | SUCCESS + high + direct measurement + no loop |
|
|
45
|
+
| User-Accepted Bypass | `User-Accepted Bypass: yes — <verbatim reason ≤200 chars>` + JSONL append | accepted low-confidence PASS | D13 bypass record | no bypass |
|
|
46
|
+
| Learnings | `Learnings: consulted <ids> · surfaced <ids> · captured <ids>` (omit empty facets) | any facet non-empty | learning-system gates | no INDEX / zero matches / nothing captured |
|
|
47
|
+
| Tier | `formatTierUpgradeNote` output verbatim (one-liner, `src/pipeline/pipelineContext.ts:647-655`) | mid-run tier upgrade | D7-14 | no upgrade |
|
|
48
|
+
| Duplication | `Duplication: <n> match(es), closest <path>, overlap <none\|partial\|high>` or `Duplication: scan skipped (<reason>)` | scan matched OR skipped | anti-duplication silent-failure | scan ran clean |
|
|
49
|
+
| Next (optional, never gated) | `Next: <one-line suggested action>` | concrete next step exists | charter optional-sections precedent | nothing to suggest |
|
|
33
50
|
|
|
34
|
-
1
|
|
35
|
-
2. **Fan-out + Cost** — `sub_agents_spawned: { count, rationale }` + `cost: { estimated_input_tokens, actual_input_tokens, estimated_duration_min, actual_duration_min, delta_percent }`
|
|
36
|
-
3. **Web Research** — every URL fetched with access date + trust tier (per `agents/shared/rigor-contract.md`); count 0 acceptable if no research was needed
|
|
37
|
-
4. **Files Mutated** — list with diff summary (lines added / removed / files created)
|
|
38
|
-
5. **Gates Passed / Failed** — explicit list per `.claude/rules/capability-lifecycle.md` Gate Checklist
|
|
39
|
-
6. **Pillar Impact Attribution** — `progress_toward_pillar: <axis>.<pillar_id>+<delta>` per Decision 17
|
|
40
|
-
7. **Verification Commands** — exact commands run with exit codes + key output lines (≤200 chars)
|
|
41
|
-
8. **Open Questions / Blockers** — explicit None if fully closed. When an ASK gate's default-if-no-response was exercised this run, this section MUST carry one `Default applied: <question summary> → option <N> (<one-line reason>)` line per default taken (the operational counterpart to `agents/shared/user-question-protocol.md` → Operationalising Default-if-no-Response step 3); absence of the line when a default was applied is a P8 B1 gate failure
|
|
42
|
-
9. **Learnings Captured** — IDs of any learnings written to `.hatch3r/learnings/` this run; cross-reference `rules/hatch3r-learning-system.md`
|
|
51
|
+
Charter-field mapping: Status + Outcome → line 1; Done → outcome + files facet; the rest → exception lines. Learning-system's "citing zero when `applies-to` matched is a gate failure" becomes fired-condition-with-no-line.
|
|
43
52
|
|
|
44
|
-
##
|
|
53
|
+
## Handoff Mapping
|
|
45
54
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- **Done
|
|
49
|
-
- **
|
|
50
|
-
- **
|
|
55
|
+
Handoff surfaces (`rules/hatch3r-handoff-readiness.md`, `skills/hatch3r-handoff-prepare/SKILL.md`, `agents/hatch3r-handoff-preparer.md`) derive their fields from the recap:
|
|
56
|
+
|
|
57
|
+
- **Work Done** ← recap outcome (line 1) + files facet
|
|
58
|
+
- **Work Remaining** ← `Not done:` line; absent ⇒ `None — full scope completed`
|
|
59
|
+
- **Blockers** ← `Blockers:` line; absent ⇒ `None`
|
|
60
|
+
- **Open Findings** ← `Open findings:` line; absent ⇒ none
|
|
51
61
|
|
|
52
62
|
## Confidence-to-Action Mapping (D13)
|
|
53
63
|
|
|
54
|
-
When a review loop ran this turn, the
|
|
64
|
+
When a review loop ran this turn, the `Confidence:` exception line MUST append the action guidance for the loop's terminal confidence level (`reviewLoopConfidence` in `src/pipeline/reviewLoop.ts`). This is the canonical confidence-to-action text — `confidenceExplanation` in `src/pipeline/reviewLoop.ts` returns these exact three strings, so the typed helper and this user-facing rule stay byte-identical (the strings are no longer reachable only from a unit test, closing D13-SA13.2-F2):
|
|
55
65
|
|
|
56
66
|
- **high** — The fix was correct on the first attempt. Human review is optional but recommended for critical code paths.
|
|
57
67
|
- **medium** — The fix required one round of corrections, which is normal for moderately complex changes. A brief human review is recommended.
|
|
@@ -61,7 +71,7 @@ Omit the mapping when no review loop ran (e.g. a Tier 1 typo edit with no review
|
|
|
61
71
|
|
|
62
72
|
## Pattern Rationale (D13 in-flow teaching — default-ON at Tier ≥ 2)
|
|
63
73
|
|
|
64
|
-
|
|
74
|
+
At Tier ≥ 2 the orchestrator MUST emit a `## Pattern Rationale` block before the Iteration Summary — one SHORT line per framework pattern applied this turn (rule citation + pillar served + plain-language reason), so sub-agent reasoning reaches the user instead of being summarized away (D13 SA13.4 F5/F6):
|
|
65
75
|
|
|
66
76
|
```
|
|
67
77
|
pattern_rationale:
|
|
@@ -71,38 +81,26 @@ pattern_rationale:
|
|
|
71
81
|
why: <≤1 sentence plain language>
|
|
72
82
|
```
|
|
73
83
|
|
|
74
|
-
Emission policy:
|
|
75
|
-
|
|
76
|
-
- **Default-ON at Tier ≥ 2:** emit one line for each mutated file that applies a named rule the user did not request explicitly. A Tier ≥ 2 turn that applied at least one such pattern and omits the block is a P5 gate failure (same enforcement class as the §9 Validation Gate).
|
|
77
|
-
- **Tier 1 exemption:** Tier 1 trivial edits (typo, frontmatter-only, single-line clarification) skip the block — no pattern is taught, so no field appears, preserving token budget. This mirrors the Tier-1 exemption in `rules/hatch3r-agent-orchestration.md` (Per-Turn Pipeline-State Header).
|
|
78
|
-
- **No-pattern case:** when a Tier ≥ 2 turn applied no named rule beyond what the user requested, emit `pattern_rationale: none (no implicit pattern applied)` rather than dropping the field, so the block's absence is never ambiguous.
|
|
79
|
-
- **`--quiet` opt-out:** the `--quiet` CLI flag suppresses the block at the user surface (same precedent as cost data in `rules/hatch3r-cost-visibility.md` → "appears in user-facing iteration summaries by default … suppressing via the `--quiet` CLI flag"). Suppression is user-surface only; it does not weaken the Tier ≥ 2 emission contract for default (non-`--quiet`) runs.
|
|
84
|
+
Emission policy: one line per mutated file that applies a named rule the user did not request explicitly; a Tier ≥ 2 turn that applied at least one such pattern and omits the block is a P5 gate failure (same enforcement class as the Validation Gate below). Tier 1 trivial edits (typo, frontmatter-only, single-line clarification) skip the block, mirroring the Tier-1 exemption in `rules/hatch3r-agent-orchestration.md` → Per-Turn Pipeline-State Header. When a Tier ≥ 2 turn applied no named rule beyond the request, emit `pattern_rationale: none (no implicit pattern applied)` so absence is never ambiguous. A triggered plan/act split (`agents/shared/efficiency-patterns.md` P4) is recorded here as an entry carrying `plan_act_split: triggered`; a skipped split stays silent — silence asserts the skip. The `--quiet` CLI flag suppresses the block at the user surface only (same precedent as cost data in `rules/hatch3r-cost-visibility.md`); suppression does not weaken the Tier ≥ 2 emission contract for default runs.
|
|
80
85
|
|
|
81
86
|
## User-Accepted Bypass Record (D13)
|
|
82
87
|
|
|
83
|
-
When the user explicitly accepts a low-confidence PASS at an ASK checkpoint (per the
|
|
84
|
-
|
|
85
|
-
1. Emit `User-Accepted Bypass: yes` in §8 (Open Questions / Blockers) with the bypass reason verbatim from the user reply.
|
|
86
|
-
2. Append a single line to `.hatch3r/bypass-log.jsonl` (one JSON object per line — append-only, never rewritten):
|
|
88
|
+
When the user explicitly accepts a low-confidence PASS at an ASK checkpoint (per the Confidence Propagation Contract used by every core orchestrator), the orchestrator MUST (1) emit the `User-Accepted Bypass:` exception line with the bypass reason verbatim from the user reply, and (2) append one JSON object line to `.hatch3r/bypass-log.jsonl` (append-only, never rewritten; atomic append via the `src/merge/safeWrite.ts` pattern — temp+rename then concat):
|
|
87
89
|
|
|
88
90
|
```json
|
|
89
|
-
{"ts": "<ISO-8601>", "command": "<hatch3r-* name>", "verdict": "low", "user_reason": "<verbatim ≤200 chars>", "files": ["<paths>"], "session_id": "<id>"}
|
|
91
|
+
{"ts": "<ISO-8601 UTC>", "command": "<hatch3r-* name>", "verdict": "low", "user_reason": "<verbatim ≤200 chars, no PII>", "files": ["<paths>"], "session_id": "<host session id, else unknown>"}
|
|
90
92
|
```
|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
Absence of the line on a recorded bypass is a P5 gate failure.
|
|
93
95
|
|
|
94
96
|
## Validation Gate
|
|
95
97
|
|
|
96
|
-
A
|
|
98
|
+
A run fails the gate when the recap is missing, when any registry row's firing condition holds with no corresponding exception line, or when prose is substituted for the recap grammar. Registry-row checking is an explicit pre-status step: before declaring status, the orchestrator walks the table above and emits each line whose firing condition holds — the omission is caught before SUCCESS is declared.
|
|
97
99
|
|
|
98
100
|
## Emission-Rate Telemetry (current status: per-run gate only; cross-run rate not yet wired)
|
|
99
101
|
|
|
100
|
-
The
|
|
101
|
-
|
|
102
|
-
The SPACE-shaped activity/performance instrumentation (`src/pipeline/spaceTelemetry.ts`, Decision 24 sibling of cost-visibility) provides the recording primitive `recordSpaceMetric`, the in-process aggregator `getSpaceSummary`, and the across-runs reader `loadSpaceMetricsFromDisk`, but they are not invoked on the iteration-summary path: orchestrator commands and skills are LLM-interpreted markdown with no binding to compiled `src/`, and no command, skill, hook, or `src/` code emits an `iterationSummaryEmitted` metric. The cross-run emission-rate loop is therefore unwired — a future capability, not a live measurement (origin: D10-SA10.8-F-6; gap corrected D10-18). The module records on the `activity` and `performance` axes only; its `satisfaction` and `communication` axes are reserved with no feeder, so "SPACE" names the data shape, not full five-axis coverage (D10-40).
|
|
103
|
-
|
|
104
|
-
To wire it, a host-runtime bridge (a Claude Code / Cursor / Copilot post-turn hook or an MCP shim) would need to call `recordSpaceMetric({ metricId: "iterationSummaryEmitted", axis: "activity", value: <1 if the 9-section block was produced else 0> })` after each orchestrator/meaningful-skill turn, persisting one JSONL line per run to `.hatch3r/telemetry/space-<YYYY-MM-DD>.jsonl`; the audit cycle could then read the persisted JSONL across runs via `loadSpaceMetricsFromDisk` + `summarizeSpaceMetricRecords` (NOT `getSpaceSummary`, which sees only the current process's ring buffer) to check the CONSTITUTION §2 P5 "Sub-agent count emission on delegating artifacts: 100%" target against observed runs instead of only mandating it. `recordSpaceMetric` already honours the Silent Failure Contract (telemetry I/O routes through `src/pipeline/failureLog.ts` and never throws), so building the bridge adds no failure surface. Until that bridge ships, P5 emission compliance is enforced by the per-run validation gate above plus audit-cycle spot checks, not by an aggregate metric.
|
|
102
|
+
The Validation Gate asserts recap presence per run; no automated cross-run emission-rate measurement exists today. `src/pipeline/spaceTelemetry.ts` provides `recordSpaceMetric`, `loadSpaceMetricsFromDisk`, and `summarizeSpaceMetricRecords`, but nothing on the iteration-summary path invokes them — commands and skills are LLM-interpreted markdown with no binding to compiled `src/`, so the cross-run loop is a future capability, not a live measurement (origin D10-SA10.8-F-6; gap corrected D10-18). The module records only the `activity` and `performance` axes; `satisfaction` and `communication` are reserved with no feeder, so "SPACE" names the data shape, not five-axis coverage (D10-40). Wiring requires a host-runtime post-turn bridge emitting an `iterationSummaryEmitted` metric to `.hatch3r/telemetry/space-<YYYY-MM-DD>.jsonl`; until then, P5 emission compliance rests on the per-run gate plus audit-cycle spot checks.
|
|
105
103
|
|
|
106
104
|
## Pillar Service
|
|
107
|
-
- P5 — standardised
|
|
108
|
-
- P7 — cost
|
|
105
|
+
- P5 — one standardised recap plus an auditable exception-line registry prevents drift across orchestrators
|
|
106
|
+
- P7 — the recap cost facet surfaces token + duration deltas per Decision 24 at a fraction of the former template's token footprint
|
|
@@ -97,9 +97,9 @@ Before answering project-specific questions, these agents MUST read `.hatch3r/le
|
|
|
97
97
|
- `hatch3r-researcher`
|
|
98
98
|
- `hatch3r-fixer`
|
|
99
99
|
|
|
100
|
-
Bound agents cite consulted entry IDs in the
|
|
100
|
+
Bound agents cite consulted entry IDs in the `consulted` facet of the Iteration Summary's `Learnings:` exception line (`Learnings: consulted <ids> · …` per `rules/hatch3r-iteration-summary.md` → Exception Lines). Citing zero entries when `applies-to` matched is a fired condition with no line — a gate failure visible at audit time.
|
|
101
101
|
|
|
102
|
-
When `.hatch3r/learnings/INDEX.md` does not exist or contains zero entries:
|
|
102
|
+
When `.hatch3r/learnings/INDEX.md` does not exist or contains zero entries: the `Learnings:` line stays silent in the Iteration Summary — silence asserts "no learnings available" per the recap contract — and the agent proceeds.
|
|
103
103
|
|
|
104
104
|
### Consultation Efficiency
|
|
105
105
|
|
|
@@ -108,7 +108,7 @@ The gate above binds at task start; these heuristics bound its token cost (D6-17
|
|
|
108
108
|
1. **Scan the INDEX table first.** Read `.hatch3r/learnings/INDEX.md` and match each row's `Topic` + `Applies-To` against the current task; read the full body only for matched rows. Do not read every learning file body.
|
|
109
109
|
2. **Limit surfaced learnings to 5 per consultation.** When more than 5 match, prioritize by `confidence` (high > medium > low) then `created` (recent first).
|
|
110
110
|
3. **Consult once per task.** When an upstream step already consulted for this task (e.g. `hatch3r-board-pickup` Step 6, before delegation), the orchestrator passes the matched learnings to sub-agents as prompt enrichment instead of re-consulting per sub-agent.
|
|
111
|
-
4. **Skip below 3 files.** When `.hatch3r/learnings/` holds fewer than 3 entries, consultation overhead exceeds value —
|
|
111
|
+
4. **Skip below 3 files.** When `.hatch3r/learnings/` holds fewer than 3 entries, consultation overhead exceeds value — proceed under the same silent default as the empty-INDEX case above.
|
|
112
112
|
|
|
113
113
|
### Mid-Task Consult Content Security (ASI06)
|
|
114
114
|
|
|
@@ -122,9 +122,9 @@ The Injection Gate above is the deterministic JS read-path scan; a mid-task cons
|
|
|
122
122
|
|
|
123
123
|
The Mandatory Consultation Gate fires once, before work starts (write-then-consult). State-of-art assistants additionally surface knowledge *during* the edit (ambient-teach). To close that gap without runtime support, bound agents surface relevant learnings inline as they touch files:
|
|
124
124
|
|
|
125
|
-
- **Trigger:** while editing, when the file or pattern being changed matches a captured learning, surface that learning inline
|
|
125
|
+
- **Trigger:** while editing, when the file or pattern being changed matches a captured learning, surface that learning inline — via the `surfaced` facet of the Iteration Summary's `Learnings:` exception line — BEFORE completing the edit (not only at Step 0).
|
|
126
126
|
- **Relevant-learning criteria** (any one qualifies): (1) **path overlap** — the edited path matches the learning's `applies-to` glob; (2) **applies-to match** — an explicit module/path-prefix hit; (3) **semantic overlap** — the edit intent matches the learning `topic` (e.g. editing a retry path while a `topic: retry-backoff` learning exists).
|
|
127
|
-
- **Surfacing format:**
|
|
127
|
+
- **Surfacing format:** cite the entry IDs in the `surfaced` facet of the Iteration Summary's `Learnings:` exception line with a one-clause why-relevant; when none matched the facet is omitted — silence asserts zero.
|
|
128
128
|
- **Bound agents:** `hatch3r-implementer`, `hatch3r-fixer` (the code-mutating agents whose edits benefit most). This complements — does not replace — the once-per-run Consultation Gate above.
|
|
129
129
|
|
|
130
130
|
## Auto-Consolidation
|
|
@@ -157,7 +157,7 @@ When a trigger fires:
|
|
|
157
157
|
|
|
158
158
|
1. The capturing agent writes a new file `.hatch3r/learnings/<id>.md` with the structured frontmatter and a body paragraph (rule + Why + How to apply).
|
|
159
159
|
2. The agent regenerates `.hatch3r/learnings/INDEX.md` from the directory contents.
|
|
160
|
-
3. The
|
|
160
|
+
3. The Iteration Summary records the captured learning ID in the `captured` facet of the `Learnings:` exception line.
|
|
161
161
|
|
|
162
162
|
Project-local; learnings never escape the project boundary. The canonical framework repository's `agents/` and `rules/` do not consume project learnings.
|
|
163
163
|
|
|
@@ -97,9 +97,9 @@ Before answering project-specific questions, these agents MUST read `.hatch3r/le
|
|
|
97
97
|
- `hatch3r-researcher`
|
|
98
98
|
- `hatch3r-fixer`
|
|
99
99
|
|
|
100
|
-
Bound agents cite consulted entry IDs in the
|
|
100
|
+
Bound agents cite consulted entry IDs in the `consulted` facet of the Iteration Summary's `Learnings:` exception line (`Learnings: consulted <ids> · …` per `rules/hatch3r-iteration-summary.md` → Exception Lines). Citing zero entries when `applies-to` matched is a fired condition with no line — a gate failure visible at audit time.
|
|
101
101
|
|
|
102
|
-
When `.hatch3r/learnings/INDEX.md` does not exist or contains zero entries:
|
|
102
|
+
When `.hatch3r/learnings/INDEX.md` does not exist or contains zero entries: the `Learnings:` line stays silent in the Iteration Summary — silence asserts "no learnings available" per the recap contract — and the agent proceeds.
|
|
103
103
|
|
|
104
104
|
### Consultation Efficiency
|
|
105
105
|
|
|
@@ -108,7 +108,7 @@ The gate above binds at task start; these heuristics bound its token cost (D6-17
|
|
|
108
108
|
1. **Scan the INDEX table first.** Read `.hatch3r/learnings/INDEX.md` and match each row's `Topic` + `Applies-To` against the current task; read the full body only for matched rows. Do not read every learning file body.
|
|
109
109
|
2. **Limit surfaced learnings to 5 per consultation.** When more than 5 match, prioritize by `confidence` (high > medium > low) then `created` (recent first).
|
|
110
110
|
3. **Consult once per task.** When an upstream step already consulted for this task (e.g. `hatch3r-board-pickup` Step 6, before delegation), the orchestrator passes the matched learnings to sub-agents as prompt enrichment instead of re-consulting per sub-agent.
|
|
111
|
-
4. **Skip below 3 files.** When `.hatch3r/learnings/` holds fewer than 3 entries, consultation overhead exceeds value —
|
|
111
|
+
4. **Skip below 3 files.** When `.hatch3r/learnings/` holds fewer than 3 entries, consultation overhead exceeds value — proceed under the same silent default as the empty-INDEX case above.
|
|
112
112
|
|
|
113
113
|
### Mid-Task Consult Content Security (ASI06)
|
|
114
114
|
|
|
@@ -122,9 +122,9 @@ The Injection Gate above is the deterministic JS read-path scan; a mid-task cons
|
|
|
122
122
|
|
|
123
123
|
The Mandatory Consultation Gate fires once, before work starts (write-then-consult). State-of-art assistants additionally surface knowledge *during* the edit (ambient-teach). To close that gap without runtime support, bound agents surface relevant learnings inline as they touch files:
|
|
124
124
|
|
|
125
|
-
- **Trigger:** while editing, when the file or pattern being changed matches a captured learning, surface that learning inline
|
|
125
|
+
- **Trigger:** while editing, when the file or pattern being changed matches a captured learning, surface that learning inline — via the `surfaced` facet of the Iteration Summary's `Learnings:` exception line — BEFORE completing the edit (not only at Step 0).
|
|
126
126
|
- **Relevant-learning criteria** (any one qualifies): (1) **path overlap** — the edited path matches the learning's `applies-to` glob; (2) **applies-to match** — an explicit module/path-prefix hit; (3) **semantic overlap** — the edit intent matches the learning `topic` (e.g. editing a retry path while a `topic: retry-backoff` learning exists).
|
|
127
|
-
- **Surfacing format:**
|
|
127
|
+
- **Surfacing format:** cite the entry IDs in the `surfaced` facet of the Iteration Summary's `Learnings:` exception line with a one-clause why-relevant; when none matched the facet is omitted — silence asserts zero.
|
|
128
128
|
- **Bound agents:** `hatch3r-implementer`, `hatch3r-fixer` (the code-mutating agents whose edits benefit most). This complements — does not replace — the once-per-run Consultation Gate above.
|
|
129
129
|
|
|
130
130
|
## Auto-Consolidation
|
|
@@ -157,7 +157,7 @@ When a trigger fires:
|
|
|
157
157
|
|
|
158
158
|
1. The capturing agent writes a new file `.hatch3r/learnings/<id>.md` with the structured frontmatter and a body paragraph (rule + Why + How to apply).
|
|
159
159
|
2. The agent regenerates `.hatch3r/learnings/INDEX.md` from the directory contents.
|
|
160
|
-
3. The
|
|
160
|
+
3. The Iteration Summary records the captured learning ID in the `captured` facet of the `Learnings:` exception line.
|
|
161
161
|
|
|
162
162
|
Project-local; learnings never escape the project boundary. The canonical framework repository's `agents/` and `rules/` do not consume project learnings.
|
|
163
163
|
|
|
@@ -75,4 +75,4 @@ Apply layered verification from cheapest to most thorough; stop at the cheapest
|
|
|
75
75
|
|
|
76
76
|
Pick one schema-management tool per project and commit the schema declaration to the repo. Greenfield default: Atlas (50+ destructive/locking linters, auto-generated down migrations, GitHub Actions approval policies) or dbmate (plain-SQL portability with first-class `-- migrate:down`). Existing-project default: whatever already ships migrations in the repo. Acceptable tools: Atlas, Prisma Migrate (forward-only — surface to reviewer), Drizzle Kit (forward-only — surface), Flyway 11+, Liquibase 4.27+ Pro, sqitch, Alembic, Knex, dbmate, Bytebase. Run a migration linter in CI — Atlas analyze, `squawk` for raw Postgres SQL — fail the PR on destructive operations without an explicit `IRREVERSIBLE:` annotation.
|
|
77
77
|
|
|
78
|
-
Cross-references: see `hatch3r-data-classification` (PII / encrypted-column migration requirements), `hatch3r-feature-flags` (read-path switchover gating), `hatch3r-observability-metrics` (backfill progress metrics).
|
|
78
|
+
Cross-references: see `hatch3r-data-classification` (PII / encrypted-column migration requirements), `hatch3r-feature-flags` (read-path switchover gating), `hatch3r-observability-metrics` (backfill progress metrics), `hatch3r-contract-census` (in-code analog: façade contract-hold for field drop/rename outside the database).
|
|
@@ -70,4 +70,4 @@ Apply layered verification from cheapest to most thorough; stop at the cheapest
|
|
|
70
70
|
|
|
71
71
|
Pick one schema-management tool per project and commit the schema declaration to the repo. Greenfield default: Atlas (50+ destructive/locking linters, auto-generated down migrations, GitHub Actions approval policies) or dbmate (plain-SQL portability with first-class `-- migrate:down`). Existing-project default: whatever already ships migrations in the repo. Acceptable tools: Atlas, Prisma Migrate (forward-only — surface to reviewer), Drizzle Kit (forward-only — surface), Flyway 11+, Liquibase 4.27+ Pro, sqitch, Alembic, Knex, dbmate, Bytebase. Run a migration linter in CI — Atlas analyze, `squawk` for raw Postgres SQL — fail the PR on destructive operations without an explicit `IRREVERSIBLE:` annotation.
|
|
72
72
|
|
|
73
|
-
Cross-references: see `hatch3r-data-classification` (PII / encrypted-column migration requirements), `hatch3r-feature-flags` (read-path switchover gating), `hatch3r-observability-metrics` (backfill progress metrics).
|
|
73
|
+
Cross-references: see `hatch3r-data-classification` (PII / encrypted-column migration requirements), `hatch3r-feature-flags` (read-path switchover gating), `hatch3r-observability-metrics` (backfill progress metrics), `hatch3r-contract-census` (in-code analog: façade contract-hold for field drop/rename outside the database).
|
|
@@ -64,7 +64,7 @@ Append exactly one record per second pass to `.hatch3r/calibration-log.jsonl` (p
|
|
|
64
64
|
{"timestamp":"<ISO-8601>","first_pass_verdict":"PASS","second_pass_verdict":"PASS|REQUEST CHANGES","divergent":false,"second_pass_model_class":"different|re-roll","consecutive_clean_count":5,"trigger":"cadence|high-risk"}
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
`consecutive_clean_count` is the post-increment cross-run count at firing time; `trigger` records which Trigger branch fired (`high-risk` when the diff touched a safety-class surface and the second pass fired on the first clean PASS under the `N=1` fast path). `second_pass_model_class` is `different` for a cross-family second pass or `re-roll` for the same-family fallback; a `re-roll` record corresponds to a `calibration: degraded (same-family re-roll)` verdict annotation per Action. The project-local over-claim rate derived from this log feeds the
|
|
67
|
+
`consecutive_clean_count` is the post-increment cross-run count at firing time; `trigger` records which Trigger branch fired (`high-risk` when the diff touched a safety-class surface and the second pass fired on the first clean PASS under the `N=1` fast path). `second_pass_model_class` is `different` for a cross-family second pass or `re-roll` for the same-family fallback; a `re-roll` record corresponds to a `calibration: degraded (same-family re-roll)` verdict annotation per Action. The project-local over-claim rate derived from this log feeds the `Confidence:` exception line of the recap-contract Iteration Summary per `rules/hatch3r-iteration-summary.md`.
|
|
68
68
|
|
|
69
69
|
## Unavailability (visible skip, never silent)
|
|
70
70
|
|
|
@@ -79,6 +79,6 @@ Skip the second pass ONLY when no second model class is available AND the orches
|
|
|
79
79
|
|
|
80
80
|
- `agents/hatch3r-reviewer.md` §Runtime Confidence Calibration — the consuming agent body that invokes this contract (accessed 2026-05-28, trust tier: canonical).
|
|
81
81
|
- The across-cycle calibration protocol §Runtime complement (F13.2-F1) — the across-cycle measurement loop this runtime bound complements (accessed 2026-05-28, trust tier: canonical).
|
|
82
|
-
- `rules/hatch3r-iteration-summary.md` — consumes the project-local over-claim rate for the `Confidence
|
|
82
|
+
- `rules/hatch3r-iteration-summary.md` — consumes the project-local over-claim rate for the `Confidence:` exception line (accessed 2026-05-28, trust tier: canonical).
|
|
83
83
|
- Tian, Z. et al. "Overconfidence in LLM-as-a-Judge: Diagnosis and Confidence-Driven Solution" (arxiv:2508.06225). `https://arxiv.org/abs/2508.06225` (accessed 2026-06-09, peer-reviewed-methodology). Evidence that an LLM judge's predicted confidence significantly overstates realized correctness (the Overconfidence Phenomenon), so a self-reported clean PASS is structurally over-trusted — motivating the out-of-band second pass.
|
|
84
84
|
- Huang, J. et al. "Large Language Models Cannot Self-Correct Reasoning Yet." ICLR 2024 (arxiv:2310.01798). `https://arxiv.org/abs/2310.01798` (accessed 2026-06-06, peer-reviewed-methodology). Evidence that same-model self-critique shares the generator's blind spot, motivating the different-model-class setup recommendation in Action and the lowered safety-class `N=1` second-pass cadence (D23-2).
|
|
@@ -64,7 +64,7 @@ Append exactly one record per second pass to `.hatch3r/calibration-log.jsonl` (p
|
|
|
64
64
|
{"timestamp":"<ISO-8601>","first_pass_verdict":"PASS","second_pass_verdict":"PASS|REQUEST CHANGES","divergent":false,"second_pass_model_class":"different|re-roll","consecutive_clean_count":5,"trigger":"cadence|high-risk"}
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
`consecutive_clean_count` is the post-increment cross-run count at firing time; `trigger` records which Trigger branch fired (`high-risk` when the diff touched a safety-class surface and the second pass fired on the first clean PASS under the `N=1` fast path). `second_pass_model_class` is `different` for a cross-family second pass or `re-roll` for the same-family fallback; a `re-roll` record corresponds to a `calibration: degraded (same-family re-roll)` verdict annotation per Action. The project-local over-claim rate derived from this log feeds the
|
|
67
|
+
`consecutive_clean_count` is the post-increment cross-run count at firing time; `trigger` records which Trigger branch fired (`high-risk` when the diff touched a safety-class surface and the second pass fired on the first clean PASS under the `N=1` fast path). `second_pass_model_class` is `different` for a cross-family second pass or `re-roll` for the same-family fallback; a `re-roll` record corresponds to a `calibration: degraded (same-family re-roll)` verdict annotation per Action. The project-local over-claim rate derived from this log feeds the `Confidence:` exception line of the recap-contract Iteration Summary per `rules/hatch3r-iteration-summary.md`.
|
|
68
68
|
|
|
69
69
|
## Unavailability (visible skip, never silent)
|
|
70
70
|
|
|
@@ -79,6 +79,6 @@ Skip the second pass ONLY when no second model class is available AND the orches
|
|
|
79
79
|
|
|
80
80
|
- `agents/hatch3r-reviewer.md` §Runtime Confidence Calibration — the consuming agent body that invokes this contract (accessed 2026-05-28, trust tier: canonical).
|
|
81
81
|
- The across-cycle calibration protocol §Runtime complement (F13.2-F1) — the across-cycle measurement loop this runtime bound complements (accessed 2026-05-28, trust tier: canonical).
|
|
82
|
-
- `rules/hatch3r-iteration-summary.md` — consumes the project-local over-claim rate for the `Confidence
|
|
82
|
+
- `rules/hatch3r-iteration-summary.md` — consumes the project-local over-claim rate for the `Confidence:` exception line (accessed 2026-05-28, trust tier: canonical).
|
|
83
83
|
- Tian, Z. et al. "Overconfidence in LLM-as-a-Judge: Diagnosis and Confidence-Driven Solution" (arxiv:2508.06225). `https://arxiv.org/abs/2508.06225` (accessed 2026-06-09, peer-reviewed-methodology). Evidence that an LLM judge's predicted confidence significantly overstates realized correctness (the Overconfidence Phenomenon), so a self-reported clean PASS is structurally over-trusted — motivating the out-of-band second pass.
|
|
84
84
|
- Huang, J. et al. "Large Language Models Cannot Self-Correct Reasoning Yet." ICLR 2024 (arxiv:2310.01798). `https://arxiv.org/abs/2310.01798` (accessed 2026-06-06, peer-reviewed-methodology). Evidence that same-model self-critique shares the generator's blind spot, motivating the different-model-class setup recommendation in Action and the lowered safety-class `N=1` second-pass cadence (D23-2).
|
|
@@ -40,6 +40,10 @@ Authentication and authorization patterns (auth middleware, token validation, se
|
|
|
40
40
|
- Circuit breakers for downstream service failures. Degrade gracefully rather than retrying indefinitely or passing errors upstream.
|
|
41
41
|
- Health checks and readiness probes must not expose sensitive configuration or internal topology.
|
|
42
42
|
- Disable debug endpoints, verbose logging, and source maps in production builds. Gate behind feature flags if needed in staging.
|
|
43
|
+
- **Dangerous-capability environment gates are allowlists, never denylists.** A capability that must not run in production — debug endpoint, seed/reset script, test-auth bypass, destructive CLI verb, mock-payment mode — is gated by an explicit allowlist of named safe environments (`const ALLOWED = ['development','test']; if (!ALLOWED.includes(env)) refuse`).
|
|
44
|
+
- The denylist form `if (process.env.NODE_ENV !== 'production')` is the named anti-pattern: an unset, misspelled, or novel environment value (`stage`, `prod-eu`, `undefined` in a fresh container) evaluates as "not production" and ENABLES the capability.
|
|
45
|
+
- Unknown environment fails closed: an absent or unrecognized value takes the deny branch.
|
|
46
|
+
- Assert at startup that the resolved environment is a member of the project's known-environment enum; refuse to boot otherwise.
|
|
43
47
|
|
|
44
48
|
## CSRF Protection
|
|
45
49
|
|
|
@@ -35,6 +35,10 @@ Authentication and authorization patterns (auth middleware, token validation, se
|
|
|
35
35
|
- Circuit breakers for downstream service failures. Degrade gracefully rather than retrying indefinitely or passing errors upstream.
|
|
36
36
|
- Health checks and readiness probes must not expose sensitive configuration or internal topology.
|
|
37
37
|
- Disable debug endpoints, verbose logging, and source maps in production builds. Gate behind feature flags if needed in staging.
|
|
38
|
+
- **Dangerous-capability environment gates are allowlists, never denylists.** A capability that must not run in production — debug endpoint, seed/reset script, test-auth bypass, destructive CLI verb, mock-payment mode — is gated by an explicit allowlist of named safe environments (`const ALLOWED = ['development','test']; if (!ALLOWED.includes(env)) refuse`).
|
|
39
|
+
- The denylist form `if (process.env.NODE_ENV !== 'production')` is the named anti-pattern: an unset, misspelled, or novel environment value (`stage`, `prod-eu`, `undefined` in a fresh container) evaluates as "not production" and ENABLES the capability.
|
|
40
|
+
- Unknown environment fails closed: an absent or unrecognized value takes the deny branch.
|
|
41
|
+
- Assert at startup that the resolved environment is a member of the project's known-environment enum; refuse to boot otherwise.
|
|
38
42
|
|
|
39
43
|
## CSRF Protection
|
|
40
44
|
|
|
@@ -143,6 +143,20 @@ Every test must be deterministic. Mandates:
|
|
|
143
143
|
- **Database state:** Integration tests set up and tear down within the test via helpers. Never depend on database state from a previous test. Enforce tenancy isolation via per-test schema or transaction rollback.
|
|
144
144
|
- **Testcontainers** pinned by image digest, not tag.
|
|
145
145
|
|
|
146
|
+
## Degenerate-Input Guard
|
|
147
|
+
|
|
148
|
+
A test whose input turns the computation under test into a no-op verifies wiring, not behavior. Canonical degenerate vectors:
|
|
149
|
+
|
|
150
|
+
- A 0%-interest loan (interest math never executes).
|
|
151
|
+
- A one-record merge (no conflict branch).
|
|
152
|
+
- An empty-array pipeline (every stage vacuously passes).
|
|
153
|
+
- A zero-quantity or zero-price order (totals stay 0).
|
|
154
|
+
- A same-source-and-target move (no-op transfer).
|
|
155
|
+
- `now()` timestamps against expiry logic (never expires).
|
|
156
|
+
- Single-user fixtures against cross-tenant checks.
|
|
157
|
+
|
|
158
|
+
**Requirement:** for each changed behavior, at least one input **activates** the computation, and the assertion distinguishes the activated result from the degenerate baseline (the two expected outputs differ). **Reviewer treatment:** a suite green only on degenerate vectors is a Warning; on payment, auth, or data-mutation paths, Critical. "N passing" is evidence only when paired with which changed behaviors those N tests activate.
|
|
159
|
+
|
|
146
160
|
## Error Path Coverage
|
|
147
161
|
|
|
148
162
|
Error handling code is often under-tested because developers focus on happy paths. Enforce minimum error coverage:
|
|
@@ -138,6 +138,20 @@ Every test must be deterministic. Mandates:
|
|
|
138
138
|
- **Database state:** Integration tests set up and tear down within the test via helpers. Never depend on database state from a previous test. Enforce tenancy isolation via per-test schema or transaction rollback.
|
|
139
139
|
- **Testcontainers** pinned by image digest, not tag.
|
|
140
140
|
|
|
141
|
+
## Degenerate-Input Guard
|
|
142
|
+
|
|
143
|
+
A test whose input turns the computation under test into a no-op verifies wiring, not behavior. Canonical degenerate vectors:
|
|
144
|
+
|
|
145
|
+
- A 0%-interest loan (interest math never executes).
|
|
146
|
+
- A one-record merge (no conflict branch).
|
|
147
|
+
- An empty-array pipeline (every stage vacuously passes).
|
|
148
|
+
- A zero-quantity or zero-price order (totals stay 0).
|
|
149
|
+
- A same-source-and-target move (no-op transfer).
|
|
150
|
+
- `now()` timestamps against expiry logic (never expires).
|
|
151
|
+
- Single-user fixtures against cross-tenant checks.
|
|
152
|
+
|
|
153
|
+
**Requirement:** for each changed behavior, at least one input **activates** the computation, and the assertion distinguishes the activated result from the degenerate baseline (the two expected outputs differ). **Reviewer treatment:** a suite green only on degenerate vectors is a Warning; on payment, auth, or data-mutation paths, Critical. "N passing" is evidence only when paired with which changed behaviors those N tests activate.
|
|
154
|
+
|
|
141
155
|
## Error Path Coverage
|
|
142
156
|
|
|
143
157
|
Error handling code is often under-tested because developers focus on happy paths. Enforce minimum error coverage:
|
|
@@ -61,7 +61,7 @@ Adding a new tool to `src/cliTools/registry.ts::AVAILABLE_CLI_TOOLS` MUST satisf
|
|
|
61
61
|
7. **Capability matrix** — `src/adapters/canonical.ts` renders the skill to all 3 adapter outputs (cursor, claude, copilot); the per-adapter render path is tested in `src/__tests__/adapters/{name}.test.ts`.
|
|
62
62
|
8. **Alternative-tool comparison** — the PR body lists at least 2 named alternatives considered (with rejection rationale citing measurable trade-offs); avoids tool-duplication per `rules/hatch3r-anti-duplication.md`.
|
|
63
63
|
9. **Probe binary registration** — the `probe` field on the registry entry names the binary used by `detectInstalled()`; the probe MUST be the exact executable name printed by the install command output (e.g. `rg` for ripgrep, `fd` for fd, `jq` for jq).
|
|
64
|
-
10. **Iteration-summary entry** — the addition emits one
|
|
64
|
+
10. **Iteration-summary entry** — the addition emits one line in the recap-contract Iteration Summary citing the registry-entry diff link, per `rules/hatch3r-iteration-summary.md`.
|
|
65
65
|
|
|
66
66
|
## Removing or Demoting a Tool
|
|
67
67
|
|