hstack 0.7.0 → 0.16.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 (99) hide show
  1. package/CHANGELOG.md +277 -0
  2. package/README.md +39 -13
  3. package/VERSION +1 -1
  4. package/dist/commands/doctor.js +51 -1
  5. package/dist/commands/doctor.js.map +1 -1
  6. package/dist/commands/update.js +8 -2
  7. package/dist/commands/update.js.map +1 -1
  8. package/dist/lib/descriptions.js +167 -0
  9. package/dist/lib/descriptions.js.map +1 -0
  10. package/dist/lib/diff.js +1 -1
  11. package/dist/lib/git.js +16 -0
  12. package/dist/lib/git.js.map +1 -1
  13. package/dist/lib/wire.js +108 -4
  14. package/dist/lib/wire.js.map +1 -1
  15. package/dist/manifest.js +17 -2
  16. package/dist/manifest.js.map +1 -1
  17. package/package.json +3 -1
  18. package/template/.claude/agents/adversarial-reviewer.md +16 -64
  19. package/template/.claude/agents/app-architect.md +12 -49
  20. package/template/.claude/agents/data-architect.md +13 -51
  21. package/template/.claude/agents/data-specialist.md +5 -50
  22. package/template/.claude/agents/implementer.md +8 -65
  23. package/template/.claude/agents/kernel-fit-analyst.md +7 -68
  24. package/template/.claude/agents/planner.md +7 -42
  25. package/template/.claude/agents/product-discovery.md +12 -48
  26. package/template/.claude/agents/product-manager.md +8 -43
  27. package/template/.claude/agents/researcher.md +5 -41
  28. package/template/.claude/agents/security-reviewer.md +19 -54
  29. package/template/.claude/agents/spec-author.md +18 -52
  30. package/template/.claude/agents/stack-architect.md +14 -43
  31. package/template/.claude/agents/test-strategist.md +16 -57
  32. package/template/.claude/agents/ui-ux-briefer.md +6 -36
  33. package/template/.claude/agents/verifier.md +13 -45
  34. package/template/.claude/skills/hstack-adr-new/SKILL.md +6 -33
  35. package/template/.claude/skills/hstack-adversarial-review/SKILL.md +31 -52
  36. package/template/.claude/skills/hstack-adversarial-review/references/finding-categories.md +157 -0
  37. package/template/.claude/skills/hstack-app-architecture/SKILL.md +2 -29
  38. package/template/.claude/skills/hstack-branch/SKILL.md +4 -31
  39. package/template/.claude/skills/hstack-brownfield-init/SKILL.md +10 -37
  40. package/template/.claude/skills/hstack-change-new/SKILL.md +4 -31
  41. package/template/.claude/skills/hstack-change-plan/SKILL.md +21 -32
  42. package/template/.claude/skills/hstack-commit/SKILL.md +7 -35
  43. package/template/.claude/skills/hstack-configure/SKILL.md +7 -34
  44. package/template/.claude/skills/hstack-coord/SKILL.md +3 -39
  45. package/template/.claude/skills/hstack-data-architecture/SKILL.md +4 -30
  46. package/template/.claude/skills/hstack-data-review/SKILL.md +3 -42
  47. package/template/.claude/skills/hstack-finalize/SKILL.md +30 -49
  48. package/template/.claude/skills/hstack-flag/SKILL.md +9 -48
  49. package/template/.claude/skills/hstack-greenfield-init/SKILL.md +9 -36
  50. package/template/.claude/skills/hstack-help/SKILL.md +11 -37
  51. package/template/.claude/skills/hstack-implement/SKILL.md +28 -58
  52. package/template/.claude/skills/hstack-kernel-fit-promote/SKILL.md +7 -46
  53. package/template/.claude/skills/hstack-kernel-fit-scan/SKILL.md +5 -60
  54. package/template/.claude/skills/hstack-kernel-fit-scan/references/slack-setup.md +42 -0
  55. package/template/.claude/skills/hstack-kernel-fit-triage/SKILL.md +12 -50
  56. package/template/.claude/skills/hstack-module-spec/SKILL.md +5 -32
  57. package/template/.claude/skills/hstack-product-discovery/SKILL.md +5 -31
  58. package/template/.claude/skills/hstack-research/SKILL.md +3 -33
  59. package/template/.claude/skills/hstack-scaffold/SKILL.md +2 -29
  60. package/template/.claude/skills/hstack-security-review/SKILL.md +5 -43
  61. package/template/.claude/skills/hstack-ship/SKILL.md +43 -53
  62. package/template/.claude/skills/hstack-stack-decide/SKILL.md +3 -30
  63. package/template/.claude/skills/hstack-story-draft/SKILL.md +6 -33
  64. package/template/.claude/skills/hstack-tech-debt-new/SKILL.md +4 -31
  65. package/template/.claude/skills/hstack-tech-debt-resolve/SKILL.md +9 -44
  66. package/template/.claude/skills/hstack-tech-debt-stale/SKILL.md +10 -37
  67. package/template/.claude/skills/hstack-tech-debt-wontfix/SKILL.md +8 -35
  68. package/template/.claude/skills/hstack-telemetry/SKILL.md +5 -30
  69. package/template/.claude/skills/hstack-test-plan/SKILL.md +23 -46
  70. package/template/.claude/skills/hstack-ui-brief/SKILL.md +3 -30
  71. package/template/.claude/skills/hstack-verify/SKILL.md +26 -48
  72. package/template/KERNEL.md +410 -0
  73. package/template/scripts/compute-merge-readiness.mjs +780 -0
  74. package/template/scripts/coord/coord_scan.py +121 -22
  75. package/template/scripts/run-gates.sh +388 -0
  76. package/template/scripts/telemetry/insights/kernel_fit.py +1 -1
  77. package/template/scripts/telemetry/insights/token_economics.py +181 -8
  78. package/template/scripts/telemetry/parsers/sidecars.py +61 -0
  79. package/template/scripts/telemetry/parsers/transcripts.py +135 -22
  80. package/template/scripts/telemetry/render.py +68 -3
  81. package/template/scripts/telemetry/report.py +16 -4
  82. package/template/scripts/telemetry/run_kernel_fit.py +6 -2
  83. package/template/scripts/telemetry/session_id.py +139 -0
  84. package/template/scripts/validate-spec.mjs +3303 -0
  85. package/template/templates/adr.md +7 -0
  86. package/template/templates/adversarial-review.md +5 -5
  87. package/template/templates/ci-cd.md +14 -0
  88. package/template/templates/coord-message.md +3 -2
  89. package/template/templates/data-architecture.md +3 -6
  90. package/template/templates/kernel-fit-finding.md +2 -2
  91. package/template/templates/kernel-fit-flag.md +2 -2
  92. package/template/templates/plan.md +4 -0
  93. package/template/templates/product-brief.md +2 -2
  94. package/template/templates/roadmap.md +41 -0
  95. package/template/templates/security-review.md +1 -1
  96. package/template/templates/telemetry-sidecar.md +56 -13
  97. package/template/templates/test-plan.md +1 -1
  98. package/template/CLAUDE.md +0 -443
  99. package/template/templates/mvp-scope.md +0 -34
@@ -1,31 +1,12 @@
1
1
  ---
2
2
  name: hstack-help
3
- description: |
4
- Use this skill when the engineer (or a cofounder opening the repo cold) wants situation awareness — "where are we, what can I run, what's next." Read-only across every artifact; no subagents invoked, no disk writes, safe to run any time. Examples:
5
-
6
- <example>
7
- Context: The cofounder hasn't touched the repo in two weeks and wants to know what's in flight before starting work.
8
- user: "/hstack:help"
9
- assistant: "I'll read every change folder, the context layer, ADRs, tech-debt, research sessions, and the git state. You'll get a three-section report: where you are, health, commands you can run right now with READY / BLOCKED markers."
10
- <commentary>
11
- Default mode is the full status report. No arguments needed. Output is computed entirely from disk frontmatter — no subagent invocations, no MCP calls, fast even on a large repo.
12
- </commentary>
13
- </example>
14
-
15
- <example>
16
- Context: The engineer is mid-change and wants a focused view of one change-spec's phase progression.
17
- user: "/hstack:help --change 2026-05-billing-overage-warning"
18
- assistant: "I'll read every artifact for that change and render the phase DAG: spec → ui-brief / figma-handoff / data-review / security-review / plan → implement (N of M phases) → verify → adversarial-review → ship. Each phase shows status and the next action."
19
- <commentary>
20
- Detailed mode for one change. Useful when resuming work after an interruption — the DAG view shows exactly which phase is next and what artifact gates it.
21
- </commentary>
22
- </example>
3
+ description: Use for situation awareness across every hstack artifact — where the work stands, what is healthy, which commands are runnable now, or the phase DAG for one change. Read-only; no subagents, no writes.
23
4
  tools:
24
5
  - Read
25
6
  - Grep
26
7
  - Glob
27
8
  - Bash
28
- - "{{TODO-SCRIPT: hstack/scripts/validate-spec.ts — invoked in --validate sub-mode to surface any artifact drift}}"
9
+ - "node hstack/scripts/validate-spec.mjs — invoked in --validate sub-mode to surface any artifact drift"
29
10
  ---
30
11
 
31
12
  ## Purpose
@@ -47,8 +28,8 @@ Safe to run repeatedly. Output is computed from current disk state.
47
28
  - No flag (default): full three-section status report.
48
29
  - `--change <id>`: detailed view of one change-spec, including the phase DAG.
49
30
  - `--commands`: print only the Skills cheat sheet (no current-state computation).
50
- - `--explain <concept>`: look up a concept from the kernel, the template schemas, or the glossary. Examples: `--explain invariant`, `--explain tenant-isolation`, `--explain trivial-tag`.
51
- - `--validate`: run `{{TODO-SCRIPT: hstack/scripts/validate-spec.ts}}` against every artifact under `hstack/` and report violations.
31
+ - `--explain <concept>`: look up a concept from the kernel, `hstack/templates/`, the validator registry, or the glossary. Examples: `--explain invariant`, `--explain tenant-isolation`, `--explain trivial-tag`.
32
+ - `--validate`: run `node hstack/scripts/validate-spec.mjs` against every artifact under `hstack/` and report violations.
52
33
 
53
34
  ## Preconditions
54
35
 
@@ -84,11 +65,11 @@ No subagents are invoked. Every step is a direct file read or shell call.
84
65
  - Glob `hstack/adr/ADR-*.md`, count those at `status: proposed`. List ids.
85
66
  - Glob `hstack/tech-debt/TD-*.md`. For `status: open`: count and list the top 3 by severity, with the suggested command `/hstack:tech-debt-resolve <td-id>` for each. For `status: in-progress`: list each with its resolving change-spec id (from the Resolution Log) and the change-spec's current status — flag any inconsistency where the change-spec is `shipped` but the TD is still `in-progress` as "run /hstack:finalize <change-id> to complete resolution".
86
67
  - Glob `hstack/research/sessions/*.md`, count those within the 30-day retention window. List the most recent 3.
87
- - **Context docs.** Walk the canonical list from the kernel's "Product context" section: `vision`, `glossary`, `mvp-scope`, `personas/`, `data-architecture`, `tech-stack`, `ci-cd`, `infrastructure`, `threat-model`, `hardening-checklist`, `incident-runbook`. For each, classify:
68
+ - **Context docs.** Walk the canonical list from the kernel's "Product context" section: `vision`, `glossary`, `roadmap`, `personas/`, `data-architecture`, `tech-stack`, `ci-cd`, `infrastructure`, `threat-model`, `hardening-checklist`, `incident-runbook`. For each, classify:
88
69
  - Missing entirely → "Run `/hstack:configure --interview <name>` (or `/hstack:init` if `init-status != complete`)."
89
70
  - Status not `current` (e.g., `drafted`, `needs-refresh`) → flag with the same routing.
90
71
  Author routing mirrors `/hstack:configure` §`--interview`:
91
- - `vision`, `glossary`, `mvp-scope`, `personas`, `data-architecture`, `tech-stack`, `ci-cd` → `product-manager`.
72
+ - `vision`, `glossary`, `roadmap`, `personas`, `data-architecture`, `tech-stack`, `ci-cd` → `product-manager`.
92
73
  - `infrastructure`, `incident-runbook` → `spec-author`.
93
74
  - `threat-model`, `hardening-checklist` → `security-reviewer`.
94
75
  - Glob `hstack/specs/*/spec.md`, list any module-spec at `status: needs-refresh`.
@@ -114,7 +95,7 @@ No subagents are invoked. Every step is a direct file read or shell call.
114
95
 
115
96
  ### `--change <id>` mode
116
97
 
117
- Read every artifact in `hstack/specs/changes/<id>/`. Render the phase DAG as ASCII with status per node:
98
+ Read the **frontmatter** of every artifact in `hstack/specs/changes/<id>/` — the DAG below is computed entirely from `status`, `steps-completed` and `blocked-on`, so no artifact body is read (kernel § Reading artifacts). Open a body only when the engineer asks a follow-up the frontmatter cannot answer. Render the phase DAG as ASCII with status per node:
118
99
 
119
100
  ```
120
101
  spec [ready-for-implementation]
@@ -138,15 +119,16 @@ Just the Skills cheat sheet. No state computation. Useful when typing in muscle
138
119
 
139
120
  ### `--explain <concept>` mode
140
121
 
141
- Grep `hstack/CLAUDE.md`, `hstack/context/glossary.md`, and (if available) the cached template schemas for the concept. Print the most relevant paragraph plus a pointer to the source file. If the concept is not found in any source, print: "Not in the kernel, glossary, or template schemas. Try the architecture doc at the URL in `hstack/README.md`, or ask in natural language and I'll pull from kernel context."
122
+ Grep `hstack/KERNEL.md`, `hstack/context/glossary.md`, and `hstack/templates/*.md` for the concept, and run `node hstack/scripts/validate-spec.mjs --rules` when the concept looks like a rule id (`SP-*`, `TD-*`, `AR-*`, …). Print the most relevant paragraph plus a pointer to the source file. If the concept is not found in any source, print: "Not in the kernel, the glossary, the templates, or the validator registry. Ask in natural language and I'll pull from kernel context."
142
123
 
143
124
  ### `--validate` mode
144
125
 
145
- Run `{{TODO-SCRIPT: hstack/scripts/validate-spec.ts}}` against every artifact under `hstack/`. Group failures by validation-rule id (SP-*, PL-*, AR-*, etc.) and name the offending file. Read-only — does not auto-fix anything.
126
+ Run `node hstack/scripts/validate-spec.mjs` against every artifact under `hstack/`. Group failures by validation-rule id (SP-*, PL-*, AR-*, etc.) and name the offending file. Read-only — does not auto-fix anything.
146
127
 
147
128
  ## Outputs
148
129
 
149
- - Console-rendered status report. No disk writes. No commits.
130
+ - Console-rendered status report. No disk writes, no commits, and no network: the report is computed from local file reads and git alone, never from an MCP call.
131
+ - Where an artifact's status is ambiguous, the report prints the ambiguity. It never invents a next action to fill the gap.
150
132
  - No mutation of any artifact frontmatter.
151
133
 
152
134
  ## Auto-commit triggers
@@ -169,11 +151,3 @@ Beyond the kernel's general stop conditions:
169
151
  - **Cofounder runs the Skill before vendoring is complete.** Print the install pointer; do not try to compute a status report.
170
152
  - **Many in-flight change-specs with conflicting next-action recommendations.** Just list them all; let the engineer prioritize.
171
153
  - **Git state cannot be read (not a git repo).** Skip the git-related health lines; surface a "git not initialized" note.
172
-
173
- ## Anti-patterns
174
-
175
- - Never write to any artifact, never auto-commit. The Skill's value is that it's safe to run any time.
176
- - Never invoke a subagent. Status awareness does not require the conversational interview machinery.
177
- - Never invent a "next action" for an artifact whose status is ambiguous — print the ambiguity, not a guess.
178
- - Never run the validators with `--fix` or any write flag (when the validator gains those).
179
- - Never call MCPs or perform network requests for the status report. Local file reads only.
@@ -1,34 +1,6 @@
1
1
  ---
2
2
  name: hstack-implement
3
- description: |
4
- Use this skill when a change-spec is at `ready-for-implementation` and the engineer wants to execute one task from the plan. This is the only Skill that causes code to be written, and it does so exclusively by invoking the `implementer` subagent against one `task-id` at a time, scope-locked to the change-spec's `in-scope` allowlist. Defense in depth: the Skill checks preconditions and forbidden surfaces before invoking the subagent, and the subagent re-checks at every Read / Edit / Write. Examples:
5
-
6
- <example>
7
- Context: A UI-only change-spec for the billing-overage banner is at ready-for-implementation; the plan has five phases and phase-3 is next.
8
- user: "/hstack:implement 2026-05-billing-overage-warning phase-3-component"
9
- assistant: "I'll verify upstream gates (security-review passed, ui-brief drafted, figma-handoff ready), then invoke implementer for phase-3. Files Touched is a strict subset of in-scope; the subagent refuses any path outside it."
10
- <commentary>
11
- The Skill enforces the scope-lock contract from the kernel — Reads as well as Writes are restricted to `in-scope` plus the canonical session-start context loads. Phase-3 is the only thing executed; the Skill does not anticipate phase-4.
12
- </commentary>
13
- </example>
14
-
15
- <example>
16
- Context: A multi-surface change touching ui, db, and api is at ready-for-implementation; phase-2 lands a migration and regenerates types.
17
- user: "/hstack:implement 2026-06-knowledge-citations phase-2-migration"
18
- assistant: "I'll invoke implementer for phase-2. The migration runs against local Supabase only; types regen via `supabase gen types typescript --local`; no `supabase db push` against any remote project."
19
- <commentary>
20
- The kernel's database workflow is enforced both at the Skill level (the Skill refuses to invoke if the engineer attempts a remote-environment migration) and at the subagent level. Defense in depth on the highest-risk surface.
21
- </commentary>
22
- </example>
23
-
24
- <example>
25
- Context: Mid-phase, the implementer halts because lib/billing/queries.ts is needed but is not in `in-scope`.
26
- user: "/hstack:implement 2026-05-billing-overage-warning phase-4-wire"
27
- assistant: "The implementer halted at the queries.ts edit — that file is out-of-scope. Don't proceed; emit the scope-amendment request to the conversation, halt, and wait for the engineer to update the change-spec via spec-author."
28
- <commentary>
29
- This is the precondition-failure / scope-amendment case. The Skill does not unilaterally extend in-scope. The engineer invokes spec-author to amend the change-spec, the Skill re-runs, the implementer re-loads and continues.
30
- </commentary>
31
- </example>
3
+ description: Use when a change-spec is at `ready-for-implementation` and one named phase of the plan should be executed. The only Skill that causes code to be written, one task at a time, scope-locked to `in-scope`.
32
4
  tools:
33
5
  - Read
34
6
  - Write
@@ -37,13 +9,13 @@ tools:
37
9
  - Glob
38
10
  - Bash
39
11
  - Task
40
- - "{{TODO-SCRIPT: hstack/scripts/validate-spec.ts — validates plan.steps-completed updates against PL-03/PL-04/PL-05}}"
12
+ - "node hstack/scripts/validate-spec.mjs — validates plan.steps-completed updates against PL-03/PL-04/PL-05"
41
13
  - "{{TODO-OTHER: in-scope-enforcement guard — runtime check at every Edit/Write that refuses paths outside change-spec.in-scope; v1 implemented inside the implementer subagent's prompt; v2 substrate moves to a subagent-runtime hook}}"
42
14
  ---
43
15
 
44
16
  ## Purpose
45
17
 
46
- `hstack-implement` is the only Skill that causes code to be written. It orchestrates the `implementer` subagent against one named task from the plan, scope-locked to the change-spec's `in-scope` allowlist. It is the workflow's last line of gating before code lands on disk: it re-checks every upstream gate, enumerates the kernel's forbidden tools, and refuses to invoke the implementer when preconditions are not met.
18
+ `hstack-implement` is the only Skill that causes code to be written. It orchestrates the `implementer` subagent against one named task from the plan. It is the workflow's last line of gating before code lands on disk: it re-checks every upstream gate, enumerates the kernel's forbidden tools, and refuses to invoke the implementer when preconditions are not met.
47
19
 
48
20
  ## When to invoke
49
21
 
@@ -56,7 +28,7 @@ Invoke once the change-spec is at `status: ready-for-implementation` (which mean
56
28
 
57
29
  ## Preconditions
58
30
 
59
- Before any work — the Skill re-checks every gate even when the change-spec carries `status: ready-for-implementation`, because frontmatter can drift:
31
+ Before any work — the Skill re-checks every gate even when the change-spec carries `status: ready-for-implementation`, because frontmatter can drift. Every check below reads **frontmatter only**, except the two that name a body section (the plan's phase ids and Files Touched); the Skill does not load artifact bodies, because the `implementer` subagent loads what it needs from its own session-start list (kernel § Reading artifacts):
60
32
 
61
33
  - Change-spec at `hstack/specs/changes/<change-id>/spec.md`. `status` must be `ready-for-implementation` or `in-progress`. `Invariants` ≥ 3 bullets, `in-scope` non-empty, every `in-scope` glob resolves.
62
34
  - Plan at `hstack/specs/changes/<change-id>/plan.md` at `status: ready` or `in-progress`. `<task-id>` must match a phase id in the plan body. `Files Touched` for the phase must be a strict subset of `in-scope`.
@@ -74,24 +46,25 @@ Enumerate the kernel's forbidden tool surfaces explicitly before invoking the su
74
46
  - Raw shell (`psql`, `bash`, `sh`) executed against production or remote Supabase. Local Supabase only.
75
47
  - `supabase db push` / `supabase db reset` against any remote project. Local stack only.
76
48
  - Pipedream Connect against live customer accounts without per-invocation explicit human approval.
77
- - Any tool that mutates state outside the `in-scope` list.
78
49
  - MCPs not in the consuming repo's configured allow set.
79
50
  - `--no-verify` or other hook-bypassing git flags.
80
51
  - `--update-snapshots`, `jest --updateSnapshot`, `vitest -u`, or any equivalent bulk snapshot-update flag.
81
52
  - Destructive git operations (`git push --force`, `git reset --hard`, `git checkout .`) without explicit per-invocation authorization.
82
- - Modifications to existing test files without per-test authorization via the test-immutability protocol (`Ok to change test <name>`, `Ok to delete test <name>`, `Ok to update snapshot <name>`, `Ok to refresh fixture <name>`).
53
+ - Modifications to existing test files without per-test authorization via the test-immutability protocol (step 8).
83
54
 
84
55
  If the named phase appears to require any of the above, halt before invoking — surface the violation, ask the engineer to either reshape the phase or authorize per-invocation.
85
56
 
86
57
  ## Orchestration steps
87
58
 
59
+ 0. **Open the phase window (mechanical, no LLM turn, no commit).** The moment the preconditions above pass and *before* any subagent invocation, run `python3 hstack/scripts/telemetry/session_id.py` and keep its `session_id` and `now` values — they become `session_id` and `phase_opened_at` in the sidecar below (ADR-0009). On failure or a null session id, hold `null` for both and continue.
60
+
88
61
  1. **Re-verify gates.** Run the precondition checks above. Any failure halts the Skill with a precise message naming the failing artifact and field.
89
62
 
90
63
  2. **Invoke `implementer`.** Use the Task tool with `subagent_type: implementer` and context = [kernel, change-spec, plan, test-plan, security-review, data-review when present, ui-brief and figma-handoff when present, module-spec, tech-stack]. The subagent loads only the In-Scope file list for code reading; everything outside the canonical session-start context plus In-Scope is refused per the kernel.
91
64
 
92
- 3. **Phase execution.** The subagent executes one phase per invocation. It writes the code diff scoped to the phase's Files Touched, updates `plan.steps-completed` to include `<task-id>` when the phase completes, and writes the tests named in the test-plan sections the phase's Test Strategy references. Test names, file paths, and assertion shape come from the test-plan; the implementer does not rename or omit tests.
65
+ 3. **Phase execution.** The subagent executes one phase per invocation — the named task, then stop, never anticipating the next phase. It writes the code diff scoped to the phase's Files Touched, updates `plan.steps-completed` to include `<task-id>` when the phase completes, and writes the tests named in the test-plan sections the phase's Test Strategy references. Test names, file paths, and assertion shape come from the test-plan; the implementer does not rename or omit tests.
93
66
 
94
- 4. **Database workflow enforcement.** For phases touching schema: the subagent creates migration files via `supabase migration new <descriptive_name>`; enables RLS in the same migration as a new table; regenerates types via `supabase gen types typescript --local > types/database.types.ts`. Never `supabase db push` / `supabase db reset` against a remote project.
67
+ 4. **Database workflow enforcement.** For phases touching schema: the subagent creates migration files via `supabase migration new <descriptive_name>` and never invents a filename; enables RLS in the same migration as a new table; regenerates types via `supabase gen types typescript --local > types/database.types.ts`. Never `supabase db push` / `supabase db reset` against a remote project.
95
68
 
96
69
  5. **Trigger.dev v4 only.** For phases touching trigger code, the subagent uses `@trigger.dev/sdk` task / schemaTask; never `client.defineJob` (v2 deprecated). `triggerAndWait` returns a `Result`; `result.ok` is checked before reading `result.output`.
97
70
 
@@ -99,13 +72,13 @@ If the named phase appears to require any of the above, halt before invoking —
99
72
 
100
73
  7. **Hook failures.** If a pre-commit hook fails on the auto-commit, the subagent investigates and fixes the underlying issue; does not bypass via `--no-verify`. If the fix would require out-of-scope edits, halt with a scope-amendment request.
101
74
 
102
- 8. **Test-immutability protocol.** When the subagent determines an existing test file must be modified, deleted, or have a snapshot updated, it halts before touching the file and runs the kernel's authorization protocol: surface the test name, the reason, the proposed change, and the alternatives; wait for the canonical phrase verbatim (`Ok to change test <name>`, `Ok to delete test <name>`, `Ok to update snapshot <name>`, `Ok to refresh fixture <name>`); echo the phrase in the commit message body and add a footnote under the relevant phase in `plan.md`. The Skill enforces this defense-in-depth — if a subagent's diff shows a modified pre-existing test file without a matching authorization in the conversation, the Skill blocks the commit.
75
+ 8. **Test-immutability protocol.** When the subagent determines an existing test file must be modified, deleted, or have a snapshot updated, it halts before touching the file and runs the kernel's authorization protocol: surface the test name, the reason, the proposed change, and the alternatives; wait for the canonical phrase verbatim (`Ok to change test <name>`, `Ok to delete test <name>`, `Ok to update snapshot <name>`, `Ok to refresh fixture <name>`); echo the phrase in the commit message body and add a footnote under the relevant phase in `plan.md`. Authorization is per-test and per-conversation; a blanket "fix the tests" is refused, and bulk snapshot-update flags are forbidden regardless of scope. The Skill enforces this defense-in-depth — if a subagent's diff shows a modified pre-existing test file without a matching authorization in the conversation, the Skill blocks the commit.
103
76
 
104
- 8. **Validate.** Run `{{TODO-SCRIPT: hstack/scripts/validate-spec.ts}}` against the plan — PL-03 (every `steps-completed` entry matches a plan phase id), PL-04 (every Files Touched path is a subset of `in-scope`), PL-05 (plan status gating).
77
+ 9. **Validate.** Run `node hstack/scripts/validate-spec.mjs <path>` against the plan — PL-03 (every `steps-completed` entry matches a plan phase id), PL-04 (every Files Touched path is a subset of `in-scope`), PL-05 (plan status gating).
105
78
 
106
79
  ## Outputs
107
80
 
108
- - Code diffs in the consuming repo, scoped to `change-spec.in-scope` and matching the phase's Files Touched.
81
+ - Code diffs in the consuming repo, matching the phase's Files Touched.
109
82
  - Test files written or updated per the phase's Test Strategy.
110
83
  - `plan.md` updated with `<task-id>` appended to `steps-completed`; `blocked-on: null` (or set to a phase id when interactive blocker stops progress).
111
84
  - One git commit on the active working branch naming `<change-id>` and `<task-id>`.
@@ -123,9 +96,12 @@ At the phase-completion auto-commit above, write `hstack/specs/changes/<change-i
123
96
 
124
97
  ```json
125
98
  {
126
- "schema_version": 1,
99
+ "schema_version": 2,
127
100
  "skill": "hstack-implement",
128
101
  "change_id": "<change-id>",
102
+ "session_id": "<session id from step 0, or null>",
103
+ "phase_opened_at": "<ISO-8601 from step 0, or null>",
104
+ "phase_closed_at": "<ISO-8601, now — same write as this sidecar, or null>",
129
105
  "phase_id": "<task-id>",
130
106
  "started_at": "<ISO-8601, session start of this phase>",
131
107
  "completed_at": "<ISO-8601, now>",
@@ -139,6 +115,18 @@ At the phase-completion auto-commit above, write `hstack/specs/changes/<change-i
139
115
 
140
116
  `.telemetry/` is git-ignored in the consuming repo. The sidecar write must not introduce any new LLM turn or confirmation gate — it is a deterministic write bundled with the existing commit. If the sidecar write fails, log and continue; the canonical commit must still land.
141
117
 
118
+ The three phase-window fields (`session_id`, `phase_opened_at`, `phase_closed_at`) come from step 0 and from this write. Their rules — best-effort, unmeasured rather than zero, never a halt — are stated once in `hstack/templates/telemetry-sidecar.md` § The phase window, which is the canonical schema and wins over any Skill.
119
+
120
+ ## Session boundary
121
+
122
+ `implement` is a natural session cut: the auto-commit above left `plan.md` (`steps-completed`) and the committed code on disk, so the conversation holds nothing the next phase needs. The cut-notice format, the kickoff-prompt template and the context-block rules are in `KERNEL.md` § Session boundaries; this Skill's two variables are:
123
+
124
+ ```
125
+ HSTACK-CUT: implement complete — cut recommended before the next phase, or verify once every phase is done.
126
+ ```
127
+
128
+ and the next command, `/hstack:implement <next-phase-id> <change-id>`.
129
+
142
130
  ## Idempotency contract
143
131
 
144
132
  - Re-running with the same `<task-id>` after the phase already landed: the subagent reads `steps-completed`, recognizes the phase as done, and produces a no-op diff. Re-running on a partially applied phase: the subagent reads current file state and applies only the remaining diff.
@@ -165,21 +153,3 @@ Beyond the kernel's general stop conditions:
165
153
  - **Type regen fails after a migration.** The phase is incomplete; `steps-completed` is not advanced; halt and surface.
166
154
  - **Tests written but failing.** Halt at `steps-completed` not advanced; the engineer either re-invokes after fixing or amends the plan via the planner.
167
155
  - **Validator fails PL-04.** A Files Touched path crept outside `in-scope` — halt; this should have been caught upstream.
168
-
169
- ## Anti-patterns
170
-
171
- - Never bypass scope-lock by one file, even one line. Halt and amend.
172
- - Never modify the change-spec. `steps-completed` lives on the plan.
173
- - Never weaken or remove an invariant.
174
- - Never use `service_role` Supabase keys in agent code paths.
175
- - Never use raw shell or `supabase db push` against production or any remote project.
176
- - Never use Pipedream Connect against live customer accounts without explicit per-invocation approval.
177
- - Never skip a hook with `--no-verify`. Fix the failing check.
178
- - Never execute destructive git operations without explicit authorization in the current conversation.
179
- - Never anticipate the next phase. Execute the named task and stop.
180
- - Never use `client.defineJob` (Trigger.dev v2 deprecated).
181
- - Never invent a migration filename. Use `supabase migration new <descriptive_name>`.
182
- - Never claim a phase complete when tests fail or types are stale.
183
- - Never edit, delete, or neutralize an existing test without per-test authorization. The kernel's test-immutability rule is non-negotiable; the default fix for a failing test is to fix the code under test.
184
- - Never run bulk snapshot-update flags. Each snapshot update needs its own authorization.
185
- - Never accept a blanket "fix the tests" authorization. Per-test scope is mandatory.
@@ -1,35 +1,6 @@
1
1
  ---
2
2
  name: hstack-kernel-fit-promote
3
- description: |
4
- Use this skill when the engineer has decided that an `acknowledged` (or `open`) kernel-fit finding warrants a kernel change captured as an ADR. The Skill seeds the finding's Evidence + Kernel surface + Proposed direction into an ADR Context section and routes through `/hstack:adr-new --from-kernel-fit <id> --slug <slug>`, where `spec-author` runs the normal Nygard interview — the human gate the kernel's "AI writes, humans confirm" contract requires at the kernel-modification layer. After the ADR lands, the Skill writes the reciprocal `promoted-to` back-reference on the finding and flips it to `status: promoted`. Two commits in v1 — the ADR commit (from `adr-new`) and the back-reference commit (from this Skill); see Failure modes for the recoverable-two-commit carve-out (analogous to the `/hstack:finalize` in-progress carve-out). Examples:
5
-
6
- <example>
7
- Context: The engineer reviewed KF-0001 (KF-P1, Category-A claim spans production paths), acknowledged it via triage last week, and now wants to land an ADR tightening the SP-13 guidance.
8
- user: "/hstack:kernel-fit-promote KF-0001 --slug sp-13-prose-guidance-tightening"
9
- assistant: "I'll read KF-0001, verify status (open or acknowledged), construct the ADR Context seed from Evidence + Kernel surface + Proposed direction, and invoke `/hstack:adr-new --from-kernel-fit KF-0001 --slug sp-13-prose-guidance-tightening`. spec-author runs the Nygard interview — Title, Status, Context (seeded), Decision, Consequences (with the challenge prompt), Alternatives Considered. After the ADR lands at terminal status, I'll write `promoted-to: adr:ADR-NNNN-...` on KF-0001, flip status to `promoted`, append a Triage Log entry, and commit. The ADR commit and the back-reference commit are separate — see Failure modes for the recoverable carve-out."
10
- <commentary>
11
- The promote Skill is the only path that elevates a kernel-fit finding to an ADR. The kernel's "AI writes, humans confirm" contract is preserved because `/hstack:adr-new`'s spec-author interview is the human gate; the engineer reviews and confirms every Nygard section before the ADR lands. The promote Skill itself performs no field-level interview — it is a mechanical wrapper plus a reciprocal back-reference write per ADR-0001.
12
- </commentary>
13
- </example>
14
-
15
- <example>
16
- Context: The engineer wants to route a finding to tech-debt instead of an ADR — the kernel surface is not yet ready for revision but the team wants to track the gap.
17
- user: "/hstack:kernel-fit-promote KF-0004 --target tech-debt --slug halt-enum-missing-figma-mcp-case"
18
- assistant: "I'll route through `/hstack:tech-debt-new --from-kernel-fit KF-0004 --slug halt-enum-missing-figma-mcp-case`. spec-author runs the six-section TD interview (Title, Why we took the shortcut, What it costs us, Fix sketch, Pre-conditions, Acceptance). After the TD lands, I'll write `promoted-to: tech-debt:TD-NNNN-...` on KF-0004 and flip status to `promoted`."
19
- <commentary>
20
- The `--target tech-debt` flag is the secondary promotion path — useful when the engineer recognizes the kernel-fit gap but does not yet have a defensible Decision section for an ADR. Tech-debt captures "we know about this; here's what fixing it would look like; here's what's blocking us from fixing it now." Same reciprocal write contract as the ADR path.
21
- </commentary>
22
- </example>
23
-
24
- <example>
25
- Context: A scan-Skill run between `/hstack:kernel-fit-promote` invocations has superseded the finding the engineer is now trying to promote.
26
- user: "/hstack:kernel-fit-promote KF-0001 --slug internal-tooling-split"
27
- assistant: "I'll halt — KF-0001 is at `status: superseded` (`superseded-by: KF-0007`). Promote KF-0007 instead; its body restates the same pattern with newer evidence. The promote Skill never promotes a superseded finding because the audit trail would route the ADR back to a stale body."
28
- <commentary>
29
- Promote refuses on terminal-from-promote statuses (`promoted`, `dismissed`, `superseded`, `archived`). The Skill is conservative — re-running on a superseded finding would write the back-reference on the wrong artifact and the audit trail would skew. The engineer's recovery is to promote the superseding finding.
30
- </commentary>
31
- </example>
32
-
3
+ description: Use to elevate an `open` or `acknowledged` kernel-fit finding into an ADR (or a tech-debt item) and write the reciprocal back-reference. The third step of the kernel-fit loop, after `/hstack:kernel-fit-scan` and `/hstack:kernel-fit-triage`.
33
4
  tools:
34
5
  - Read
35
6
  - Write
@@ -38,7 +9,7 @@ tools:
38
9
  - Glob
39
10
  - Bash
40
11
  - Task
41
- - "{{TODO-SCRIPT: hstack/scripts/validate-spec.ts — validates the finding back-reference and the new ADR/TD frontmatter (KF-04 reciprocity, AD-01..AD-04 for ADR, TD-01..TD-04 for tech-debt)}}"
12
+ - "node hstack/scripts/validate-spec.mjs — validates the finding back-reference and the new ADR/TD frontmatter (KF-04 reciprocity, AD-01..AD-04 for ADR, TD-01..TD-04 for tech-debt)"
42
13
  ---
43
14
 
44
15
  ## Purpose
@@ -87,7 +58,7 @@ Do NOT invoke when:
87
58
 
88
59
  3. **Confirm before routing.** Print the proposed slug, the target (adr or tech-debt), and the seed preface. Ask "Route to /hstack:<target>-new with this seed? (Y/n)". Default Yes. On `n`, abort without writing.
89
60
 
90
- 4. **Route to the authoring Skill.**
61
+ 4. **Route to the authoring Skill.** Always through `/hstack:adr-new` or `/hstack:tech-debt-new`, never by invoking `spec-author` directly — routing is what keeps the authoring Skills' challenge prompts and validation rules in the path.
91
62
 
92
63
  For `--target adr` (default):
93
64
  - Invoke `/hstack:adr-new --from-kernel-fit <finding-id> --slug <slug>` via the Task tool or Skill orchestration mechanism. `spec-author` walks the six Nygard sections; the seeded Context is the engineer's starting material to review and revise.
@@ -100,20 +71,20 @@ Do NOT invoke when:
100
71
 
101
72
  5. **Capture the new artifact id.** Parse the downstream Skill's terminal commit message for `ADR-NNNN-<slug>` or `TD-NNNN-<slug>`. On parse failure (downstream Skill halted mid-interview), the promote Skill halts too — re-invocation will resume from the same step once the downstream Skill completes.
102
73
 
103
- 6. **Write the reciprocal back-reference on the finding.** Per ADR-0001 (mechanical writes by the Skill orchestrator), the promote Skill performs the `Edit` itself:
74
+ 6. **Write the reciprocal back-reference on the finding.** Per ADR-0001 (mechanical writes by the Skill orchestrator), the promote Skill performs the `Edit` itself. These four fields plus the Triage Log append are the only writes permitted here; the finding's body — Evidence, Kernel surface, Proposed direction, Counter-explanations, Confidence rationale — is the analyst's and is immutable from this Skill:
104
75
  - `promoted-to: adr:ADR-NNNN-<slug>` (or `tech-debt:TD-NNNN-<slug>`)
105
76
  - `status: <prev> → promoted`
106
77
  - `owner: <git-handle>` (if not already set by triage)
107
78
  - `updated: <today>`
108
79
  - Append to `## Triage Log`: `- \`status: <prev> → promoted\` on <today> by <owner>. Promoted to: <promoted-to>. Triggered by \`/hstack:kernel-fit-promote <id> --slug <slug>\`.`
109
80
 
110
- Defensive Triage Log check: if `## Triage Log` is not present (legacy finding), append the section header first.
81
+ Defensive log-header check per the kernel: if `## Triage Log` is absent, append it before writing the entry.
111
82
 
112
83
  7. **Print the proposed-diff preview** for the back-reference edit (per the kernel's mechanical-operations confirmation gate). Ask "Apply back-reference and flip status to promoted? (Y/n)". Default Yes.
113
84
 
114
85
  8. **Edit + validate + commit.** On `Y`:
115
86
  - `Edit` the finding file.
116
- - Run `{{TODO-SCRIPT: hstack/scripts/validate-spec.ts}}` against the finding. KF-04 (promoted requires `promoted-to` non-null AND referenced ADR/TD exists) must pass; the reciprocity check verifies the ADR's `promoted-from-kernel-fit` contains this finding's id.
87
+ - Run `node hstack/scripts/validate-spec.mjs <path>` against the finding. KF-04 (promoted requires `promoted-to` non-null AND referenced ADR/TD exists) must pass; the reciprocity check verifies the ADR's `promoted-from-kernel-fit` contains this finding's id.
117
88
  - On validation pass: `git add` the finding file and commit with message `kernel-fit(<finding-id>): promoted to <promoted-to>`.
118
89
  - On validation failure: halt; revert via `git checkout -- <finding-file>`. The ADR commit from step 4 has already landed and is correct — re-invoke promote (it is idempotent on the finding's promoted status, and the back-reference write will retry).
119
90
 
@@ -148,17 +119,7 @@ Beyond the kernel's general stop conditions:
148
119
 
149
120
  ## Failure modes
150
121
 
151
- - **Recoverable two-commit carve-out (analogous to `/hstack:finalize` in-progress carve-out).** The kernel's atomicity rule (CLAUDE.md `## Mechanical operations § Atomicity for reciprocal pairs`) requires both halves of a reciprocal write to land in the same commit. The finalize Skill carves out an exception for multi-TD resolutions where intermediate state is intentional and recoverable by re-running. Promote adopts the same shape: the ADR (or TD) commit and the finding back-reference commit are separate, and an interruption between them is recoverable by re-running this Skill. During the window between the two commits, on-disk state shows the ADR with `promoted-from-kernel-fit: [<id>]` and the finding still at `status: open` or `acknowledged` — this is intentional and re-runnable. The Forbidden-no-matter-what kernel bullet about reciprocal-pair atomicity applies to **standing** state (post-promote), not the transient window during a single promote invocation. v2 substrate could add `--defer-commit` to the authoring Skills so both writes land atomically; v1 accepts the two-commit pattern for honest implementation reality.
122
+ - **Recoverable two-commit carve-out (analogous to `/hstack:finalize` in-progress carve-out).** The kernel's atomicity rule (KERNEL.md `## Mechanical operations § Atomicity for reciprocal pairs`) requires both halves of a reciprocal write to land in the same commit. The finalize Skill carves out an exception for multi-TD resolutions where intermediate state is intentional and recoverable by re-running. Promote adopts the same shape: the ADR (or TD) commit and the finding back-reference commit are separate, and an interruption between them is recoverable by re-running this Skill. During the window between the two commits, on-disk state shows the ADR with `promoted-from-kernel-fit: [<id>]` and the finding still at `status: open` or `acknowledged` — this is intentional and re-runnable. The Forbidden-no-matter-what kernel bullet about reciprocal-pair atomicity applies to **standing** state (post-promote), not the transient window during a single promote invocation. v2 substrate could add `--defer-commit` to the authoring Skills so both writes land atomically; v1 accepts the two-commit pattern for honest implementation reality.
152
123
  - **Authoring Skill writes the wrong `promoted-from-kernel-fit` id.** Defense: this Skill's validation at step 8 cross-checks. If the ADR's array does not contain the finding id, the back-reference write is refused and the engineer reconciles by editing the ADR's frontmatter (this is itself a mechanical write per ADR-0001; manual `git commit --amend` is the recovery path, but the engineer should prefer re-running promote after correcting the ADR).
153
124
  - **Drive-by promote.** The Skill's preflight does not detect promote attempts on `low`-confidence findings — the engineer is trusted to make this judgment. If a pattern of `low`-confidence promotes emerges, that itself becomes a future kernel-fit detection pattern (KF-Pn: "engineers promote findings the analyst rated low").
154
125
  - **Engineer wants to promote two findings to one ADR.** Not supported in v1. Run promote twice with the same `--slug` — the second invocation will halt because the slug collides on `adr-new`'s precondition check. The engineer's recovery is to dismiss one of the findings with a rationale ("subsumed by KF-other-id promoting under slug X") and promote only the canonical one.
155
-
156
- ## Anti-patterns
157
-
158
- - Never auto-promote without engineer invocation. The contract is non-negotiable per ADR-0004.
159
- - Never promote a finding at `low` confidence without a real reason. The analyst encoded a signal by setting confidence; ignoring it is a smell.
160
- - Never edit the finding's body (Evidence, Kernel surface, Proposed direction, Counter-explanations, Confidence rationale) during promote. Those are the analyst's domain and are immutable from this Skill's perspective. The Triage Log append and the four frontmatter changes (status, promoted-to, owner, updated) are the only writes permitted.
161
- - Never write the ADR or TD body. That is `spec-author`'s job, routed via the authoring Skill. Even pre-filling the Decision section based on the finding's Proposed direction is forbidden — the engineer's Decision must engage with the kernel-change question fresh.
162
- - Never promote a `superseded` finding. The audit trail would route the ADR to a stale body.
163
- - Never invoke `spec-author` directly from this Skill. Route through the appropriate authoring Skill (`hstack-adr-new` or `hstack-tech-debt-new`) so the existing challenge-prompts and validation rules apply.
164
- - Never bypass the validator at step 8. KF-04 reciprocity is the load-bearing check that makes the kernel-fit-to-ADR audit chain reconstructible.
@@ -1,35 +1,6 @@
1
1
  ---
2
2
  name: hstack-kernel-fit-scan
3
- description: |
4
- Use this skill when the engineer wants to scan for kernel-fit gaps — patterns in shipped practice suggesting the kernel itself (CLAUDE.md, templates, validators, Skill flows) needs revision. The Skill runs the detection layer (`scripts/telemetry/run_kernel_fit.py`), invokes the `kernel-fit-analyst` subagent to synthesize one finding file per fired pattern, then nudges Slack on `high`/`medium` confidence findings with a 14-day dedup gate. Findings land at `hstack/kernel-fit/findings/KF-NNNN-<slug>.md`; the disk artifact is canonical, Slack is a side-channel pointer with graceful degradation when MCP is unwired. Promotion to a kernel change is human-gated via `/hstack:kernel-fit-promote`. See ADR-0004.
5
-
6
- <example>
7
- Context: The engineer wants a weekly kernel-fit scan after shipping several changes.
8
- user: "/hstack:kernel-fit-scan"
9
- assistant: "I'll run the detector against this repo's shipped changes / ADRs / tech-debt / commits / transcripts in the last 30 days. If any pattern fires, I'll invoke `kernel-fit-analyst` to synthesize findings (one file per pattern). Slack nudge on medium/high; dedup against open findings within 14 days. Disk-write is the load-bearing action — if Slack MCP is unreachable, the scan still completes and findings land on disk."
10
- <commentary>
11
- The Skill is opt-in by invocation. It is the only Skill that causes the `kernel-fit-analyst` subagent to run. Detection is post-hoc and derivative — no decision-time instrumentation; the no-parallel-tracker rule is preserved because the detector reads, never writes.
12
- </commentary>
13
- </example>
14
-
15
- <example>
16
- Context: The detector returns no fired patterns — the kernel is in good shape against the current corpus.
17
- user: "/hstack:kernel-fit-scan"
18
- assistant: "Detection ran; no patterns fired. No findings written, no Slack notification, no commit. The kernel-fit-analyst subagent was not invoked (no work to do). Exit clean."
19
- <commentary>
20
- No-fire is the most common output on a healthy repo, especially in the first 4–8 weeks of operation. The Skill must not invoke the subagent or write anything when no pattern fires — every Slack message has a cost in attention, and the dedup gate's purpose is undermined if scans run noise-free but the engineer still sees messages.
21
- </commentary>
22
- </example>
23
-
24
- <example>
25
- Context: KF-P1 fires but an open finding for the same pattern already exists from a scan 5 days ago.
26
- user: "/hstack:kernel-fit-scan"
27
- assistant: "KF-P1 fired with 3 evidence rows. An open finding (KF-0003) already exists for KF-P1 from 5 days ago — within the 14-day dedup window. I'll invoke the analyst; if the new evidence is materially equivalent the analyst will skip writing and surface the dedup; if it is materially stronger, the analyst writes a new KF-NNNN and supersedes KF-0003. Either way no Slack message fires today — the engineer was already notified within the window."
28
- <commentary>
29
- Dedup happens at two layers: (a) the analyst decides whether to write a new finding or skip (per its supersession carve-out); (b) the Skill decides whether to fire Slack. The 14-day window is the v1 default — tunable when calibration data exists.
30
- </commentary>
31
- </example>
32
-
3
+ description: Use to detect kernel-fit gaps — patterns in shipped practice suggesting the kernel itself needs revision — and synthesize one finding file per fired pattern. The first step of the kernel-fit loop; triage and promotion are separate Skills.
33
4
  tools:
34
5
  - Read
35
6
  - Write
@@ -39,7 +10,7 @@ tools:
39
10
  - Bash
40
11
  - Task
41
12
  - "{{TODO-MCP: Slack — mcp__claude_ai_Slack__slack_send_message — required for kernel-fit notifications. Without it, findings still land on disk; the Skill logs to stderr and exits 0 (deliberate carve-out from the kernel's general MCP-unreachable stop condition — Slack is a side-channel pointer, not authoritative state).}}"
42
- - "{{TODO-SCRIPT: hstack/scripts/validate-spec.ts — validates kernel-fit-finding frontmatter and KF-01 through KF-05}}"
13
+ - "node hstack/scripts/validate-spec.mjs — validates kernel-fit-finding frontmatter and KF-01 through KF-05"
43
14
  ---
44
15
 
45
16
  ## Purpose
@@ -111,7 +82,7 @@ The Skill is opt-in. There is no cron, no automatic invocation, no event-driven
111
82
  Promote: /hstack:kernel-fit-promote KF-NNNN --slug <adr-slug>
112
83
  ```
113
84
 
114
- Bundle multiple findings into a single message when more than one fires in this scan. When flag-processing occurred, append the **flag tail summary** as the last line of the same Slack message:
85
+ Bundle multiple findings into a single message when more than one fires in this scan — one scan, one message, never carried across runs. When flag-processing occurred, append the **flag tail summary** as the last line of the same Slack message:
115
86
 
116
87
  ```
117
88
  Flags processed: <P> total — <FF> folded, <E> emitted, <NA> not-actionable, <TT> transcript-truncated.
@@ -166,32 +137,6 @@ Slack-MCP-unreachable is NOT a stop condition. See step 7.
166
137
 
167
138
  ## Configuring Slack notifications (consumer-side)
168
139
 
169
- Slack notifications are opt-in per consumer. Without wiring, the Skill still works findings land on disk and the engineer discovers them via `/hstack:help`. To enable Slack nudges on `medium`/`high` confidence findings:
170
-
171
- 1. **Wire the MCP server.** Add the Slack MCP to your Claude Code MCP configuration so `mcp__claude_ai_Slack__slack_send_message` is callable from the session that runs `/hstack:kernel-fit-scan`. Follow Anthropic's Slack MCP install docs; the auth scope `chat:write` is required.
172
-
173
- 2. **Configure the destination channel.** Add a `kernel-fit` block to `hstack/config.yaml`:
174
-
175
- ```yaml
176
- kernel-fit:
177
- slack-channel: "#hstack-kernel-fit" # public channel id or name; the bot must be invited
178
- slack-fallback: "dm" # "dm" | "off" — behavior when slack-channel is absent or unreachable
179
- ```
180
-
181
- `slack-channel` is optional. When absent and `slack-fallback: "dm"`, the Skill sends to the invoking engineer's DM via the bot. When `slack-fallback: "off"`, missing channel behaves identically to unreachable MCP (log to stderr, exit 0).
182
-
183
- 3. **Verify with a dry-run.** Run `/hstack:kernel-fit-scan --no-slack` first to confirm the detection layer produces output on your corpus, then re-run without the flag once Slack is wired. The first non-`--no-slack` run will surface any auth or channel issues as the documented graceful-degradation log line.
184
-
185
- What you do NOT need to do: no code to write, no hook to install. The Skill is prose-driven; the runtime LLM agent invokes the MCP when the tool is available in the session and the config names a destination. The `{{TODO-MCP}}` placeholder in the tools array is the framework convention naming the contract — the consumer's MCP wiring satisfies it.
186
-
187
- ## Anti-patterns
140
+ One-time consumer setup, not scan-time reading. The full procedure MCP wiring and the `chat:write` scope, the `kernel-fit` block in `hstack/config.yaml` (`slack-channel`, `slack-fallback`), and the `--no-slack` dry-run — lives in `references/slack-setup.md` alongside this file.
188
141
 
189
- - Never invoke the `kernel-fit-analyst` subagent when no patterns fired. Empty invocations waste tokens and produce nothing.
190
- - Never auto-promote a finding to an ADR. Promotion is a separate, human-invoked Skill (`/hstack:kernel-fit-promote`). The contract is non-negotiable per ADR-0004.
191
- - Never silently retry Slack on transient failure. The disk artifact is canonical; the engineer's `/hstack:help` covers the missed-notification case.
192
- - Never write outside `hstack/kernel-fit/findings/` or modify any artifact not produced by the analyst this run. This Skill orchestrates; it does not author.
193
- - Never claim the analyst's output is measured truth. Frame every finding as LLM-strategized judgment per the kernel's v1 / v2 split rule.
194
- - Never bundle a Slack notification across scan runs. One scan, one message (or zero, when the dedup gate suppresses or Slack is unreachable).
195
- - Never re-process a pin already in `hstack/kernel-fit/flags/processed/`. The analyst's discipline rule (no re-processing) is mirrored here: the Skill globs only `pending/`, never `processed/`. If the engineer believes a processed pin was mis-classified, the path is to re-flag (creating a fresh pin), not to move the prior pin back.
196
- - Never include the flag tail summary in the Slack message when every pin was classified `not-actionable`. The tail's purpose is to surface actionable signal — the all-not-actionable case is pure noise and the suppression is deliberate.
197
- - Never commit a pin move. Pins are gitignored per ADR-0005; the `git mv` from `pending/` to `processed/` is filesystem-only and produces no staged change.
142
+ Read that file only when the engineer is wiring Slack for the first time, or when a run reported a Slack auth / channel / destination problem. Do not read it on a normal scan: Slack is opt-in, the disk artifact is canonical, and an unwired or unreachable Slack is not a stop condition (step 7).
@@ -0,0 +1,42 @@
1
+ # Configuring Slack notifications for `/hstack:kernel-fit-scan` (consumer-side)
2
+
3
+ Reference file for `hstack-kernel-fit-scan`. Read it **only** when the engineer is
4
+ wiring Slack for the first time, or when a scan run reported a Slack auth /
5
+ channel / destination problem. It is not needed on a normal scan: the disk
6
+ artifact is canonical, and an unwired or unreachable Slack degrades gracefully
7
+ (log to stderr, exit 0).
8
+
9
+ Slack notifications are opt-in per consumer. Without wiring, the Skill still
10
+ works — findings land on disk and the engineer discovers them via
11
+ `/hstack:help`. To enable Slack nudges on `medium` / `high` confidence findings:
12
+
13
+ 1. **Wire the MCP server.** Add the Slack MCP to your Claude Code MCP
14
+ configuration so `mcp__claude_ai_Slack__slack_send_message` is callable from
15
+ the session that runs `/hstack:kernel-fit-scan`. Follow Anthropic's Slack MCP
16
+ install docs; the auth scope `chat:write` is required.
17
+
18
+ 2. **Configure the destination channel.** Add a `kernel-fit` block to
19
+ `hstack/config.yaml`:
20
+
21
+ ```yaml
22
+ kernel-fit:
23
+ slack-channel: "#hstack-kernel-fit" # public channel id or name; the bot must be invited
24
+ slack-fallback: "dm" # "dm" | "off" — behavior when slack-channel is absent or unreachable
25
+ ```
26
+
27
+ `slack-channel` is optional. When absent and `slack-fallback: "dm"`, the Skill
28
+ sends to the invoking engineer's DM via the bot. When `slack-fallback: "off"`,
29
+ a missing channel behaves identically to an unreachable MCP (log to stderr,
30
+ exit 0).
31
+
32
+ 3. **Verify with a dry-run.** Run `/hstack:kernel-fit-scan --no-slack` first to
33
+ confirm the detection layer produces output on your corpus, then re-run
34
+ without the flag once Slack is wired. The first non-`--no-slack` run will
35
+ surface any auth or channel issues as the documented graceful-degradation log
36
+ line.
37
+
38
+ What you do NOT need to do: no code to write, no hook to install. The Skill is
39
+ prose-driven; the runtime LLM agent invokes the MCP when the tool is available in
40
+ the session and the config names a destination. The `{{TODO-MCP}}` placeholder in
41
+ the Skill's `tools` array is the framework convention naming the contract — the
42
+ consumer's MCP wiring satisfies it.