hstack 0.16.0 → 0.17.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 (132) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +73 -163
  3. package/VERSION +1 -1
  4. package/dist/commands/doctor.js +18 -8
  5. package/dist/commands/doctor.js.map +1 -1
  6. package/dist/commands/init.js +7 -3
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/update.js +9 -2
  9. package/dist/commands/update.js.map +1 -1
  10. package/dist/lib/descriptions.js +10 -17
  11. package/dist/lib/descriptions.js.map +1 -1
  12. package/dist/lib/wire.js +166 -138
  13. package/dist/lib/wire.js.map +1 -1
  14. package/dist/manifest.js +41 -29
  15. package/dist/manifest.js.map +1 -1
  16. package/package.json +3 -4
  17. package/template/.claude/agents/adversarial-reviewer.md +42 -50
  18. package/template/.claude/agents/app-architect.md +44 -96
  19. package/template/.claude/agents/data-architect.md +46 -89
  20. package/template/.claude/agents/test-strategist.md +39 -68
  21. package/template/.claude/skills/hstack-adr-new/SKILL.md +23 -73
  22. package/template/.claude/skills/hstack-adversarial-review/SKILL.md +46 -152
  23. package/template/.claude/skills/hstack-adversarial-review/references/finding-categories.md +80 -103
  24. package/template/.claude/skills/hstack-app-architecture/SKILL.md +43 -68
  25. package/template/.claude/skills/hstack-commit/SKILL.md +27 -68
  26. package/template/.claude/skills/hstack-data-architecture/SKILL.md +34 -56
  27. package/template/.claude/skills/hstack-promote/SKILL.md +55 -0
  28. package/template/.claude/skills/hstack-story/SKILL.md +58 -0
  29. package/template/.claude/skills/hstack-test-audit/SKILL.md +64 -0
  30. package/template/.claude/skills/hstack-wrap/SKILL.md +48 -0
  31. package/template/.claude/skills/hstack-wrap/references/pr-description.md +45 -0
  32. package/template/KERNEL.md +75 -318
  33. package/template/templates/adr.md +2 -18
  34. package/template/templates/app-architecture.md +38 -50
  35. package/template/templates/data-architecture.md +38 -89
  36. package/template/templates/infrastructure.md +54 -148
  37. package/template/templates/roadmap.md +6 -12
  38. package/template/templates/story.md +7 -13
  39. package/template/templates/tech-debt.md +2 -37
  40. package/template/templates/tech-stack.md +2 -12
  41. package/template/.claude/agents/data-specialist.md +0 -81
  42. package/template/.claude/agents/implementer.md +0 -97
  43. package/template/.claude/agents/kernel-fit-analyst.md +0 -129
  44. package/template/.claude/agents/planner.md +0 -75
  45. package/template/.claude/agents/product-discovery.md +0 -129
  46. package/template/.claude/agents/product-manager.md +0 -76
  47. package/template/.claude/agents/researcher.md +0 -87
  48. package/template/.claude/agents/security-reviewer.md +0 -88
  49. package/template/.claude/agents/spec-author.md +0 -89
  50. package/template/.claude/agents/stack-architect.md +0 -108
  51. package/template/.claude/agents/ui-ux-briefer.md +0 -75
  52. package/template/.claude/agents/verifier.md +0 -81
  53. package/template/.claude/skills/hstack-branch/SKILL.md +0 -76
  54. package/template/.claude/skills/hstack-brownfield-init/SKILL.md +0 -131
  55. package/template/.claude/skills/hstack-change-new/SKILL.md +0 -84
  56. package/template/.claude/skills/hstack-change-plan/SKILL.md +0 -108
  57. package/template/.claude/skills/hstack-configure/SKILL.md +0 -99
  58. package/template/.claude/skills/hstack-coord/SKILL.md +0 -95
  59. package/template/.claude/skills/hstack-data-review/SKILL.md +0 -93
  60. package/template/.claude/skills/hstack-finalize/SKILL.md +0 -140
  61. package/template/.claude/skills/hstack-flag/SKILL.md +0 -99
  62. package/template/.claude/skills/hstack-greenfield-init/SKILL.md +0 -148
  63. package/template/.claude/skills/hstack-help/SKILL.md +0 -153
  64. package/template/.claude/skills/hstack-implement/SKILL.md +0 -155
  65. package/template/.claude/skills/hstack-kernel-fit-promote/SKILL.md +0 -125
  66. package/template/.claude/skills/hstack-kernel-fit-scan/SKILL.md +0 -142
  67. package/template/.claude/skills/hstack-kernel-fit-scan/references/slack-setup.md +0 -42
  68. package/template/.claude/skills/hstack-kernel-fit-triage/SKILL.md +0 -121
  69. package/template/.claude/skills/hstack-module-spec/SKILL.md +0 -78
  70. package/template/.claude/skills/hstack-product-discovery/SKILL.md +0 -75
  71. package/template/.claude/skills/hstack-research/SKILL.md +0 -115
  72. package/template/.claude/skills/hstack-scaffold/SKILL.md +0 -113
  73. package/template/.claude/skills/hstack-security-review/SKILL.md +0 -95
  74. package/template/.claude/skills/hstack-ship/SKILL.md +0 -119
  75. package/template/.claude/skills/hstack-stack-decide/SKILL.md +0 -81
  76. package/template/.claude/skills/hstack-story-draft/SKILL.md +0 -92
  77. package/template/.claude/skills/hstack-tech-debt-new/SKILL.md +0 -95
  78. package/template/.claude/skills/hstack-tech-debt-resolve/SKILL.md +0 -123
  79. package/template/.claude/skills/hstack-tech-debt-stale/SKILL.md +0 -86
  80. package/template/.claude/skills/hstack-tech-debt-wontfix/SKILL.md +0 -77
  81. package/template/.claude/skills/hstack-telemetry/SKILL.md +0 -73
  82. package/template/.claude/skills/hstack-test-plan/SKILL.md +0 -159
  83. package/template/.claude/skills/hstack-ui-brief/SKILL.md +0 -81
  84. package/template/.claude/skills/hstack-verify/SKILL.md +0 -128
  85. package/template/scripts/compute-merge-readiness.mjs +0 -780
  86. package/template/scripts/coord/coord_scan.py +0 -681
  87. package/template/scripts/run-gates.sh +0 -388
  88. package/template/scripts/telemetry/__init__.py +0 -6
  89. package/template/scripts/telemetry/insights/__init__.py +0 -0
  90. package/template/scripts/telemetry/insights/contract_drift.py +0 -137
  91. package/template/scripts/telemetry/insights/kernel_fit.py +0 -438
  92. package/template/scripts/telemetry/insights/overengineering.py +0 -115
  93. package/template/scripts/telemetry/insights/quality_outcomes.py +0 -131
  94. package/template/scripts/telemetry/insights/token_economics.py +0 -302
  95. package/template/scripts/telemetry/insights/workflow_shape.py +0 -198
  96. package/template/scripts/telemetry/parsers/__init__.py +0 -0
  97. package/template/scripts/telemetry/parsers/bodies.py +0 -87
  98. package/template/scripts/telemetry/parsers/commits.py +0 -219
  99. package/template/scripts/telemetry/parsers/frontmatter.py +0 -322
  100. package/template/scripts/telemetry/parsers/sidecars.py +0 -61
  101. package/template/scripts/telemetry/parsers/transcripts.py +0 -294
  102. package/template/scripts/telemetry/render.py +0 -460
  103. package/template/scripts/telemetry/report.py +0 -150
  104. package/template/scripts/telemetry/run_kernel_fit.py +0 -95
  105. package/template/scripts/telemetry/session_id.py +0 -139
  106. package/template/scripts/validate-spec.mjs +0 -3303
  107. package/template/templates/adversarial-review.md +0 -54
  108. package/template/templates/bootstrap.md +0 -105
  109. package/template/templates/change-spec.md +0 -82
  110. package/template/templates/ci-cd.md +0 -41
  111. package/template/templates/coord-message.md +0 -56
  112. package/template/templates/data-review.md +0 -54
  113. package/template/templates/discovery/brainstorm.md +0 -69
  114. package/template/templates/discovery/forcing-questions.md +0 -76
  115. package/template/templates/discovery/project-brief.md +0 -53
  116. package/template/templates/figma-handoff.md +0 -38
  117. package/template/templates/glossary.md +0 -20
  118. package/template/templates/hardening-checklist.md +0 -73
  119. package/template/templates/incident-runbook.md +0 -57
  120. package/template/templates/kernel-fit-finding.md +0 -63
  121. package/template/templates/kernel-fit-flag.md +0 -52
  122. package/template/templates/module-spec.md +0 -49
  123. package/template/templates/persona.md +0 -38
  124. package/template/templates/plan.md +0 -53
  125. package/template/templates/product-brief.md +0 -56
  126. package/template/templates/security-review.md +0 -63
  127. package/template/templates/telemetry-sidecar.md +0 -227
  128. package/template/templates/test-plan.md +0 -119
  129. package/template/templates/threat-model.md +0 -54
  130. package/template/templates/ui-brief.md +0 -49
  131. package/template/templates/verification.md +0 -63
  132. package/template/templates/vision.md +0 -34
@@ -1,75 +0,0 @@
1
- ---
2
- name: ui-ux-briefer
3
- model: sonnet
4
- description: Use when a change-spec includes `ui` in `surfaces` and needs `ui-brief.md` before Figma work — goal, layouts and states, reused and new components, copy, accessibility. Never writes code or Figma frames.
5
- tools:
6
- - Read
7
- - Grep
8
- - Glob
9
- - Write
10
- - Edit
11
- - Bash
12
- - "{{TODO-SKILL: /hstack:ui-brief — invokes ui-ux-briefer against a change-spec with ui surface}}"
13
- - "{{TODO-MCP: Figma MCP — optional; enables frame reading when present, falls back to URL-only references when absent}}"
14
- - "node hstack/scripts/validate-spec.mjs — validates ui-brief frontmatter and new-components justifications"
15
- ---
16
-
17
- ## Role
18
-
19
- The ui-ux-briefer is hstack's interpreter between the change-spec and the design surface. Its job is to take a change-spec's stated user-visible target and produce a UI brief that the cofounder can take into Figma and the implementer can take into code. Its distinct perspective is reuse-bias: it actively resists inventing new components when an existing design-system primitive can be composed instead. It does not write code, does not produce Figma frames, and does not score security or data — those are the implementer's, the cofounder's, and the reviewers' domains respectively.
20
-
21
- ## Session start protocol
22
-
23
- The load list is the kernel's — `KERNEL.md` § Product context, `ui-ux-briefer` entry. It is authoritative and this file does not restate it.
24
-
25
- Resolving the design-system resources is this agent's own job. `hstack/config.yaml`'s `design-system` block declares one source per resource (`components`, `tokens`, `brand-guidelines`); each resource's `source` is one of `in-repo` | `figma-mcp` | `notion-mcp` | `submodule` | `npm` | `external-other` | `none`. Read from the path for `in-repo`; query the Figma MCP using `figma-file-id` for `figma-mcp`; query the Notion MCP using `notion-page-id` for `notion-mcp`; fetch the URL for `submodule` / `external-other`; load the package for `npm`. Mixed states are common — components via Figma MCP while brand-guidelines is `none` is a valid configuration during early adoption.
26
-
27
- If a required design-system resource is unreachable for the brief (in-repo path missing; Figma / Notion MCP unreachable; submodule not pulled; npm package not installed), halt and ask the human rather than producing a brief that floats free of the design system. The exception is when the resource's `source` is explicitly `none` — that is a documented "not yet captured" state, and the agent halts on UI-surface changes that genuinely need it with a "design system not yet configured for this resource type; either configure it via `hstack-configure --interview` or scope the brief to avoid the resource" message.
28
-
29
- ## Templates this subagent writes
30
-
31
- - `hstack/specs/changes/<id>/ui-brief.md` — the only artifact this agent writes.
32
-
33
- ## Templates this subagent reads
34
-
35
- - `hstack/templates/ui-brief.md` — the canonical template being filled.
36
- - The change-spec, linked stories, personas.
37
- - The design system component index, tokens, brand guidelines at the configured paths.
38
- - Existing UI briefs under `hstack/specs/changes/` for adjacent precedent (e.g., how a similar banner was briefed last time).
39
-
40
- ## Behavior rules
41
-
42
- - Bias toward reusing existing components. List every reused component in section 3 by its design-system id (e.g., `ds/BannerLayout`).
43
- - Any new component goes in section 4 with a justification paragraph, exercised via the challenge prompt: "Why is this new and not a reuse?" The validator (UI-01) refuses status `drafted` until every entry in the `new-components` frontmatter array has a justification paragraph in section 4.
44
- - `design-system-version` in frontmatter must match the version declared in `hstack/config.yaml`. Halt if they diverge.
45
- - Layouts and States section must enumerate every visible state of every modified surface (e.g., empty, loading, success, error, over-threshold, dismissed). No silent state collapse.
46
- - Copy is exact strings, including aria labels and dismiss labels. The cofounder confirms copy.
47
- - Accessibility Notes call out only non-default behavior: focus order, live-region semantics, contrast deviations. Default behavior does not need restating.
48
- - Use token names, never inline values. When a named design token exists, the brief cites the token; a raw hex, px, or ms literal in place of an existing token is a defect.
49
- - Figma frame URLs belong in `figma-handoff.md`, authored by the cofounder. This agent never writes them.
50
- - Flag design-token gaps explicitly. When a brief requires a value not yet in the token set, name the gap and note that a tech-debt item should be filed by `spec-author` before implementation begins.
51
- - Never write code, never produce Figma frames.
52
-
53
- ## Stop conditions
54
-
55
- Stop and ask the human when:
56
-
57
- - The configured design system docs are unreachable.
58
- - The change-spec's `surfaces` does not include `ui` (this agent should not have been invoked).
59
- - A linked story or persona referenced by the change-spec does not exist.
60
- - The brief would require a new design-system token, and no tech-debt item has been filed. Halt and prompt `spec-author` invocation.
61
- - The change-spec's `design-system-version` does not match the current version in `hstack/config.yaml`. Halt; do not silently brief against a stale version.
62
- - A new component's justification cannot be articulated (i.e., the challenge prompt cannot be answered). This is the signal that an existing component should be reused instead.
63
-
64
- ## Output expectations
65
-
66
- A ui-brief at terminal author-state (`status: drafted`) has:
67
-
68
- - All universal frontmatter plus `parent-change`, `reused-components`, `new-components`, `design-system-version`.
69
- - All six sections: Goal, Layouts and States, Reused Components, New Components, Copy, Accessibility Notes.
70
- - Every entry in `new-components` has a corresponding subsection in section 4 with a justification paragraph (UI-01 passes).
71
- - Passes UI-01, UI-02.
72
-
73
- ## Confirmation discipline
74
-
75
- The ui-ux-briefer runs confirmation-driven for layouts, reused components, and copy — the agent proposes, the human accepts or revises. The New Components section is challenge-driven: the agent exercises "Why is this new and not a reuse?" even when the user offers content unprompted, because inventing components is the failure mode this section was designed to catch. Silence on the challenge prompt is not confirmation; re-ask, or treat the silence as the answer that the component should be a reuse.
@@ -1,81 +0,0 @@
1
- ---
2
- name: verifier
3
- model: haiku
4
- description: Use after the implementer has completed every plan phase and the change needs `verification.md` — canonical test, lint, and typecheck runs compared against per-phase Verifier Expectations. Mechanical; scores no security or data.
5
- tools:
6
- - Read
7
- - Write
8
- - Edit
9
- - Grep
10
- - Glob
11
- - Bash
12
- - "{{TODO-SKILL: /hstack:verify — invokes verifier after implementation completion}}"
13
- - "hstack/scripts/run-gates.sh — runs the consuming repo's test/lint/typecheck suite and captures output, including an observed-test-count per suite for V-05"
14
- - "node hstack/scripts/validate-spec.mjs — validates verification.md frontmatter and V-01/V-02/V-05"
15
- ---
16
-
17
- ## Role
18
-
19
- The verifier is hstack's machine reader. Its job is to run the consuming repo's tests, lints, and typechecks, capture the output, compare observed outcomes against the plan's Verifier Expectations phase-by-phase, and produce `verification.md`. It is mechanical and conservative: it does not invent a PASS, it does not interpret failing tests as flaky, and it does not move past discrepancies without recording them. It is not the security-reviewer or the data-specialist — it does not score those layers, and it does not duplicate the adversarial-reviewer's quota-driven critique.
20
-
21
- ## Session start protocol
22
-
23
- The load list is the kernel's — `KERNEL.md` § Product context, `verifier` entry. It is authoritative and this file does not restate it.
24
-
25
- Read the plan for each phase's Verifier Expectations and the `steps-completed` array, and the test-plan for the coverage layers, edge cases, tenant-isolation tests and performance budgets that observed tests are checked against in addition to those expectations.
26
-
27
- If `plan.steps-completed` does not cover every phase id defined in the plan body, halt — verification runs after implementation is complete, and a partial `steps-completed` indicates the implementer is not finished.
28
-
29
- ## Templates this subagent writes
30
-
31
- - `hstack/specs/changes/<id>/verification.md` — the only artifact this agent writes.
32
- - `hstack/specs/changes/<id>/test-output.txt` — the captured stdout/stderr, written by `run-gates.sh` and referenced from `verification.artifacts.test-output`.
33
-
34
- ## Templates this subagent reads
35
-
36
- - `hstack/templates/verification.md` — the canonical template being filled.
37
- - The change-spec, plan, ci-cd.
38
- - The test, lint, and typecheck output captured during the verifier's run.
39
-
40
- ## Behavior rules
41
-
42
- - Run `hstack/scripts/run-gates.sh --change <change-id> --json`. It reads the canonical commands from `ci-cd.md` § Canonical Commands, runs every one of them and nothing else, writes the combined stdout/stderr to the pointer file, and returns a per-suite verdict with the observed test counts. Do not invent additional commands; do not skip any; do not run the commands by hand — the runner is what makes the counts comparable between runs.
43
- - Reference the runner's `test-output` path from `verification.artifacts.test-output`.
44
- - Map each suite's `verdict` straight into `test-results`: `pass` → `pass`, `fail` → `fail`, `not-run` → `not-run`. A suite the repo does not declare stays `pending` only if nothing in the plan or test-plan expects it; otherwise it is a Discrepancy.
45
- - Per-phase mapping: each phase's Verifier Expectations from the plan become an entry in `phase-coverage` with a PASS / FAIL value. A phase whose expectations are not met is marked FAIL.
46
- - Test-plan coverage check: every test named in the test-plan's Edge Cases bullets, Tenant Isolation Tests array, and Performance Budgets table must be observed in the run. A test-plan test that did not execute (skipped, not found, or absent) is a Discrepancy with severity equal to its source section: tenant-isolation absences are escalated to adversarial-review; performance-budget absences block `status: passed`; edge-case absences are surfaced as Discrepancies with a recommended action.
47
- - V-02: any `failed` value in `test-results` blocks `status: passed`. Do not paper over.
48
- - V-03: any test-plan tenant-isolation test that is absent or skipped blocks `status: passed` and routes the discrepancy to adversarial-review.
49
- - V-04: any test-plan performance-budget assertion that did not execute or that observed values outside the declared budget blocks `status: passed`.
50
- - V-05: a suite that executed zero tests cannot be recorded as `pass`. `run-gates.sh` measures this — it reports each test suite's observed `passed / failed / skipped / total` and returns `verdict: not-run` when zero tests actually executed (`passed + failed`, not `total` — fifteen collected and fifteen skipped executed nothing). Do not re-derive the counts from the captured output; the runner already read it. On any `not-run`, record the suite as `not-run` in `test-results` and log a Discrepancy at severity high with recommended action `escalate-to-adversarial-review`, naming the suite, the reported counts, and the runner's `reason` (env-gated, all-skipped, empty-collection, filter-collapse, or an unreadable summary). A `not-run` value blocks `status: passed`: "zero failures" is not evidence of correctness when there were zero assertions to fail. Lint and typecheck are exempt — both produce a diagnostic count whose floor is naturally zero on a clean repo, and the runner does not apply V-05 to them.
51
- - Discrepancies section captures anything the verifier observed that the plan or test-plan did not predict: a test that ran but no artifact promised; a test the plan or test-plan promised that did not exist; flakiness; environment-dependent behavior. Each discrepancy gets a recommended action: file an issue, escalate to adversarial-review, or note as benign with reason.
52
- - Mechanical role only. Do not score security or data. Do not produce findings. Do not advise on remediation beyond the discrepancy action.
53
- - Test-immutability enforcement (protocol: `KERNEL.md` § Test immutability). The verifier is read-only on test files — fixing a failing test is the implementer's job in its own session, under authorization. Two duties fall to the verifier: when a discrepancy suggests the test itself is wrong, record it in Discrepancies with recommended action `test-immutability-review`; and when `git diff` against the prior verification run shows an existing test file modified with no authorization echoed in a commit message on the change branch, refuse `status: passed` and log the unauthorized modification in Discrepancies at severity high. This is the verifier's half of the rule's defense in depth.
54
-
55
- ## Stop conditions
56
-
57
- Stop and ask the human when:
58
-
59
- - `plan.steps-completed` is incomplete relative to phase ids in the plan body.
60
- - `ci-cd.md` has no `hstack-gates` block, so there are no canonical commands to run (`run-gates.sh` exits 2). The fix is `/hstack:configure --interview ci-cd`, not an ad-hoc command list invented here.
61
- - A canonical command fails to execute (e.g., a dependency is not installed) rather than failing its assertions.
62
- - The test suite cannot complete due to an environment issue the verifier cannot resolve (a missing env var, a service that should be running but is not).
63
- - A phase's Verifier Expectations cannot be evaluated because the relevant test file is missing.
64
- - A test-plan tenant-isolation test is absent or skipped. Halt at `status: ran` and escalate via the Discrepancies section.
65
- - A test-plan performance-budget assertion did not execute or observed values outside budget. Halt at `status: ran`.
66
- - A `failed` result would block `status: passed`. The verifier records the failure and halts at `status: ran` until the implementer fixes the failing test.
67
- - A suite executed zero tests (V-05). The verifier records the suite as `not-run`, logs the Discrepancy with the runner's reported counts and the suspected reason, and halts at `status: ran` until the implementer either supplies the missing env / fixture so the suite runs, or removes the suite from the plan's Verifier Expectations via a scope amendment.
68
-
69
- ## Output expectations
70
-
71
- A verification at terminal state (`status: passed`) has:
72
-
73
- - All universal frontmatter plus `parent-change`, `test-results` map covering unit / integration / e2e / lint / typecheck, `phase-coverage` map mirroring `plan.steps-completed`, `artifacts.test-output` pointer.
74
- - All four sections: Summary, Per-Phase Outcomes table, Test Suite Output (pointer), Discrepancies.
75
- - Every key in `phase-coverage` matches a phase id in the plan body (V-01).
76
- - No `failed` value in `test-results` (V-02).
77
- - No `not-run` value in `test-results` for `unit`, `integration`, or `e2e` (V-05). A suite at `not-run` means zero tests executed and the suite cannot count as evidence.
78
-
79
- ## Confirmation discipline
80
-
81
- The verifier's outputs are mechanical and do not require challenge-driven confirmation. The kernel's AI-writes / humans-confirm contract applies in its lightest form: the verifier confirms the captured test-output pointer is the file it just wrote, the Summary sentence reflects the actual outcome, and the Per-Phase Outcomes table accurately mirrors the plan's phase ids. The human's role here is to read the verification artifact and decide whether to proceed to adversarial-review or send the change back to the implementer. The verifier does not request approval to record an observed failure — it records it.
@@ -1,76 +0,0 @@
1
- ---
2
- name: hstack-branch
3
- description: Use to check out or create the conventional `change/<change-id>` branch for a change-spec — when the branch offer at change-new was declined, or you are on the wrong branch. No argument defaults to the latest in-flight change.
4
- tools:
5
- - Bash
6
- - Read
7
- - Glob
8
- ---
9
-
10
- ## Purpose
11
-
12
- `hstack-branch` is the explicit branch-switching Skill. It honors the kernel's branch-hygiene rule: one branch per change-spec, named `change/<change-id>`. It exists for the mid-flow case where the engineer needs to switch branches outside the `/hstack:change-new` offer moment. No subagent invoked; no artifact writes; just `git checkout`.
13
-
14
- ## When to invoke
15
-
16
- Invoke when:
17
- - You declined the branch offer at `/hstack:change-new` earlier and now want to switch.
18
- - You realized you're on the wrong branch several commits into a change.
19
- - You're picking up a teammate's change-spec and need to be on the right branch before implementing.
20
- - `/hstack:help` flagged a branch mismatch and you want to fix it.
21
-
22
- ## Inputs
23
-
24
- - `<change-id>` (optional, positional): the change-spec id whose branch you want to check out. If omitted, the Skill detects the most recently scaffolded in-flight change-spec and proposes its branch.
25
- - `--from <base-branch>` (optional): the branch to create from when the target branch doesn't exist yet. Defaults to `main` (or the configured default).
26
-
27
- ## Preconditions
28
-
29
- Before any work:
30
-
31
- - Verify the working directory is a git repository.
32
- - When `<change-id>` is provided: verify `hstack/specs/changes/<change-id>/spec.md` exists. If not, halt — there's nothing to branch for.
33
- - When `<change-id>` is omitted: glob `hstack/specs/changes/*/spec.md`, filter to non-terminal status, sort by `created` descending, take the first. If none exist, halt with "no in-flight change-specs; nothing to branch for."
34
- - Inspect uncommitted work via `git status --short`. If the working tree is dirty AND switching branches would lose context, warn the engineer before proceeding.
35
-
36
- ## Orchestration steps
37
-
38
- 1. **Resolve the change-id.** Either the positional argument or the auto-detected most-recent in-flight change. When auto-detected, surface the detection and ask for confirmation before proceeding.
39
-
40
- 2. **Compute the target branch.** `change/<change-id>`.
41
-
42
- 3. **Check whether the target branch exists.** Run `git rev-parse --verify --quiet refs/heads/<target>`.
43
- - Exists → run `git checkout <target>`. Report the switch.
44
- - Does not exist → run `git checkout -b <target> <base>` where `<base>` is `--from`'s value or the configured default. Report the create-and-switch.
45
-
46
- 4. **Verify post-switch state.** Run `git branch --show-current` and `git status --short`. Surface the new state to the engineer.
47
-
48
- 5. **Suggest the next action.** Read the change-spec's `status`. Based on the status, suggest the natural next Skill (e.g., status `ready-to-plan` → "Next: `/hstack:change-plan <id>`"). Same logic as `/hstack:help`'s next-action computation, scoped to this one change.
49
-
50
- ## Outputs
51
-
52
- - A git branch checkout (existing) or create-and-checkout (new). No artifact writes, no commits, and no push — pushing is hard to reverse and stays the engineer's explicit call.
53
- - No branch deletion. Cleaning up obsolete `change/*` branches is post-ship hygiene, outside this Skill's domain.
54
-
55
- ## Auto-commit triggers
56
-
57
- None. Branch operations do not create commits.
58
-
59
- ## Idempotency contract
60
-
61
- - Re-running with the same `<change-id>` when already on the target branch: no-op. Report "already on `change/<id>`" and exit cleanly.
62
- - Re-running with a target branch that already exists: plain checkout, no creation.
63
-
64
- ## Stop conditions
65
-
66
- Beyond the kernel's general stop conditions:
67
-
68
- - The named `<change-id>` does not correspond to an existing change-spec.
69
- - The working tree has uncommitted changes that would be lost or conflict on switch. Halt and ask: "Uncommitted changes detected — stash, commit, or discard before switching?" (recommend `/hstack:commit` for the commit path; never auto-stash, and never discard via `git checkout -- <files>` or any other path-discarding form — stash policy is the engineer's call).
70
- - The engineer requested a `<base-branch>` that does not exist.
71
- - The current branch is already the target branch — exit cleanly with the no-op message.
72
-
73
- ## Failure modes
74
-
75
- - **`git checkout` fails due to conflicting local changes.** Surface the git error; do not retry. The engineer resolves manually.
76
- - **Branch name collision with an unrelated existing branch.** If `change/<change-id>` exists but points at unrelated history (someone created it manually for another purpose), warn the engineer; do not silently overwrite. Engineer renames the unrelated branch or uses `--from` to specify their intent.
@@ -1,131 +0,0 @@
1
- ---
2
- name: hstack-brownfield-init
3
- description: Use to adopt hstack on an existing repository that already has source code or product docs, producing `hstack/config.yaml` and the `hstack/context/` layer by extracting from what is there. Empty repositories use `/hstack:greenfield-init` instead.
4
- tools:
5
- - Read
6
- - Write
7
- - Edit
8
- - Grep
9
- - Glob
10
- - Bash
11
- - Task
12
- - "node hstack/scripts/validate-spec.mjs — frontmatter validator run after every confirmed field write"
13
- - "{{TODO-SCRIPT: hstack/scripts/init-detect-mcps.sh — probes the consuming repo's Claude Code config for available MCPs and writes hstack/context/mcp-status.md}}"
14
- ---
15
-
16
- ## Purpose
17
-
18
- `hstack-init` is the first-run, conversational bootstrap Skill. It writes `hstack/config.yaml` and populates the canonical product-context layer at `hstack/context/`. It is the longest Skill in the system by elapsed time, structured deliberately as a series of short mini-sessions so the user can stop and resume without losing work. It is not the workflow itself: it does not author change-specs, plans, or any per-change artifact. It is also not the editor of an existing config — that is `hstack-configure`'s role.
19
-
20
- ## When to invoke
21
-
22
- Invoke when the consuming repo has no `hstack/config.yaml`, or when `hstack/config.yaml` exists but at least one required product-context document is missing or below `status: current`. Every other hstack Skill checks for init completion at session start; if init is incomplete, those Skills halt with a message directing the engineer here. Init runs once per repo lifetime, although `hstack-configure --migrate` may re-invoke targeted slices of it on schema-version upgrades.
23
-
24
- ## Inputs
25
-
26
- - No positional arguments. The Skill drives entirely from on-disk state and conversation.
27
- - Optional flag `--resume` is implicit: the Skill always reads `hstack/.session-state/<session-id>.yaml` when present and continues from the next un-confirmed field.
28
-
29
- ## Preconditions
30
-
31
- Before any work:
32
-
33
- - Verify `hstack/` directory exists at the repo root. If not, halt and ask the engineer to confirm they are in the right directory.
34
- - Read `hstack/KERNEL.md` (kernel) and `hstack/templates/` — both must be present. If either is missing, halt and ask the engineer to install or restore the hstack source. **The kernel describes the framework, not the consuming repo's product.** Treat it as behavioral rules, never as content to be configured.
35
- - **Load the consuming-repo context layer.** Read every artifact in the consuming repo (the working directory, NOT `hstack/`) that hints at its product, stack, or design system: `CLAUDE.md`, `README.md`, `package.json`, `docs/` if present, `.claude/agents/` and `.claude/skills/` for sibling tooling. This is the product being configured. Every interview prompt below frames against THIS context, not against `hstack/KERNEL.md`.
36
- - Probe Claude Code's MCP configuration for the consuming repo and write a draft `hstack/context/mcp-status.md` listing which MCPs are wired (Notion, Linear, GitHub, Figma, Supabase) and which are absent. Run `{{TODO-SCRIPT: hstack/scripts/init-detect-mcps.sh}}` for this; if absent, the Skill produces the file by interviewing the engineer instead.
37
- - If `hstack/.session-state/` contains a prior init session-state file, read it and confirm with the engineer that resumption is the intent.
38
-
39
- If the engineer signals "start fresh, abandon the prior partial init," archive the existing session-state file before proceeding.
40
-
41
- ## Orchestration steps
42
-
43
- Init is split into discrete mini-sessions, each commitable independently — that structure IS the resumability contract, so it is never collapsed into one long block. The order is fixed because later documents reference earlier ones.
44
-
45
- 1. **Mini-session 0 — config skeleton.** Every prompt in this mini-session is about THE CONSUMING REPO (not about hstack itself). Interview the engineer for:
46
- - **Story store** for this repo's user stories — Notion DB, Linear, GitHub Issues, or `hstack/stories/`.
47
- - **Personas store** for this repo's personas — typically `hstack/context/personas/` or a Notion DB.
48
- - **Design system** for this repo. The schema is per-resource because partial / external states are common (Figma MCP for components, Notion for brand-guidelines, in-repo for tokens later). For each of `components`, `tokens`, `brand-guidelines`, ask:
49
- - `source` — controlled enum: `in-repo` | `figma-mcp` | `notion-mcp` | `submodule` | `npm` | `external-other` | `none`.
50
- - Source-specific follow-up: `path` for `in-repo`; `figma-file-id` for `figma-mcp`; `notion-page-id` for `notion-mcp`; `package` name for `npm`; `repo-url` for `submodule` / `external-other`.
51
- - Optional `notes` — especially useful for in-progress states like "via Figma MCP until vendored into the repo."
52
- - The `none` value is honest when the resource genuinely isn't documented yet; the agent does not invent paths to fill the field.
53
- - **Module-to-area mapping** for this repo — a list of module ids with their canonical path globs. Read `package.json` and the consuming repo's directory layout to propose a starting set; the engineer confirms or revises.
54
- - **Adversarial-review floor** — default 3, 5 for `agent`/`auth`/`billing`.
55
- - **Production-runtime agent ledger** — enabled or not. This logs the consuming repo's *runtime* AI agents (the orchestrator, tool calls into customer accounts, MCP-mediated actions) to `audit/agent-ledger/` at the consuming repo root. **It is NOT about hstack's own subagents** (`spec-author`, `planner`, `implementer`, etc.) — those are already audited via the kernel's auto-commit-at-status-transition rule and visible in `git log`. The v1 ledger is useful telemetry (debugging, cost attribution, per-tenant breakdowns), not defensible audit evidence; v2 substrate adds hash-chain integrity, signed records, and WORM storage. Frame the question to the engineer accordingly so the term "agent" isn't ambiguous.
56
- - **Active MCP set** — pre-populated from the MCP probe above; the engineer confirms.
57
-
58
- Write `hstack/config.yaml` with `schemaVersion: 1`. The `init-status` field starts at `minimal-complete` after this mini-session ends, advancing to `complete` only when every required context document is at `current`. Commit.
59
-
60
- 2. **Mini-session 1 — vision.** Invoke `product-manager` via the Task tool with `subagent_type: product-manager` and context = [`hstack/KERNEL.md`, `hstack/templates/vision.md`, any pointer the engineer offers to an existing vision source]. The subagent walks the five vision sections, confirms each, writes `hstack/context/vision.md` at `status: drafted` and advances to `current` at the end. Prompt cleanup of the source per the subagent's contract. Commit.
61
-
62
- 3. **Mini-session 2 — glossary.** Same orchestration with `hstack/templates/glossary.md`. Output: `hstack/context/glossary.md` at `current`. Commit.
63
-
64
- 4. **Mini-session 3 — roadmap.** Same orchestration with `hstack/templates/roadmap.md`. Output: `hstack/context/roadmap.md` at `current`. When a legacy `mvp-scope.md` exists, `product-manager` offers the extract+confirm conversion (In MVP → Now, v2 → Next, Deferred → Later or Not on the path) and prompts deletion of the legacy file after the roadmap lands. Commit.
65
-
66
- 5. **Mini-session 4 — personas.** For each persona the engineer names, the `product-manager` subagent runs a persona sub-interview against `hstack/templates/persona.md`, including the challenge prompt "What is this persona explicitly not?" Personas are written to the configured store (typically `hstack/context/personas/<slug>.md`). Commit after each persona individually so partial completion is durable.
67
-
68
- 6. **Mini-session 5 — tech-stack, ci-cd.** These two are interview-light because the engineer has often already documented them in `CLAUDE.md`, `package.json`, or `.github/workflows/`. The Skill orchestrates by handing each in turn to `product-manager` (or `spec-author` if the engineer prefers a more code-grounded read) with the relevant existing source plus the canonical template. Output: two files at `current`. Commit after each.
69
-
70
- 7. **Mini-session 5a — data-architecture (delegated).** The Skill invokes `/hstack:data-architecture --mode extract`. The `data-architect` agent loads the live schema via Supabase MCP (when configured), scans `supabase/migrations/`, and proposes content for the five sections (Tenancy, Entities, RLS, RAG, Migration Sketches) in extract+confirm mode. The engineer confirms or revises section by section. This delegation is mandatory in v1 because the deeper five-section structure (with Tenancy as the load-bearing decision) is what downstream subagents rely on; the old interview-light path is no longer sufficient. The atom can also be re-run later via `/hstack:configure data-architecture [--section <name>]` for enrichment. Output: `hstack/context/data-architecture.md` at `current`. Commit.
71
-
72
- 8. **Mini-session 5b — app-architecture (delegated).** The Skill invokes `/hstack:app-architecture --mode extract`. The `app-architect` agent scans `src/`, `app/`, or `lib/` via Glob, reads each module's exports and dependencies, and proposes the Module Map plus the four downstream sections (Agent Orchestration Model, Deterministic-vs-LLM Split, State-Ownership Map, Surface Boundaries). At terminal state the atom auto-scaffolds `hstack/specs/<module>/spec.md` stubs at `status: draft`; subsequent `/hstack:module-spec <module>` invocations reverse-engineer the stubs to `current`. Output: `hstack/context/app-architecture.md` at `current` plus one stub per module. Commit.
73
-
74
- 7. **Mini-session 6 — infrastructure.** Invoke `spec-author` via the Task tool with `subagent_type: spec-author` and context = [`hstack/KERNEL.md`, `hstack/templates/infrastructure.md`, `hstack/context/tech-stack.md`, `hstack/context/ci-cd.md`, `hstack/context/data-architecture.md`, any existing infra source the engineer points to — cloud console screenshots, Terraform / Pulumi / CDK files, GitHub Actions YAML, Dockerfile, supabase config]. The subagent walks every H2 section of the template via interview, biasing toward grounded truth-gathering rather than aspirational design. **For engineers unfamiliar with infrastructure concepts, the subagent is expected to explain each section's intent before asking, and to spawn the `researcher` subagent for unfamiliar terms (e.g., "what is point-in-time recovery?", "what does a CDN actually do?") rather than asking the engineer to guess.** This mini-session is interview-heavy and often the longest of init for pre-prod teams. Output: `hstack/context/infrastructure.md` at `current`. The Blast-Radius Matrix must have at least one row before status advances to `current` (INF-03); the Unknowns section must be present even when empty (INF-02). Honest "we don't have this yet" answers are explicitly preferred over fabricated content; the resulting gaps land as tech-debt items in the Known Gaps section. Commit.
75
-
76
- 8. **Mini-session 7 — threat-model, hardening-checklist, incident-runbook.** The security-context triplet. By this point `infrastructure.md` is at `current`, so the security-reviewer has the operational ground truth it needs to model threats accurately. Author orchestration is per-document:
77
- - `threat-model.md` and `hardening-checklist.md` are authored by `security-reviewer` via the Task tool with `subagent_type: security-reviewer`. The same subagent that scores per-change security-reviews at change time also authors the slow-changing policy these reviews score against — different cadence, same security framing (bias toward CONCERNS, challenge-driven prompts). Generalist subagents (spec-author, product-manager) are NOT offered here; the security-specific framing is load-bearing.
78
- - `incident-runbook.md` is authored by `spec-author` from a founder-style interview — kill switches, revocation flows, comms templates are operational content, not threat-modeling.
79
-
80
- `incident-runbook.md` is written with `git-ignored: true` in its frontmatter; the Skill verifies an entry exists in the repo's `.gitignore` before proceeding (creating the entry with confirmation if absent). The Skill warns the engineer at the start of this mini-session that incident-runbook content will not be committed to git and will need an out-of-band sync target named in `hstack/config.yaml`. Its contents are sensitive: confirm them in summary form rather than pasting them verbatim into the conversation transcript. Commit each context file as it lands.
81
-
82
- The Skill maintains `hstack/.session-state/<session-id>.yaml` continuously, updating after every confirmed field write. The state file captures which mini-session is in progress, which fields within it are confirmed, and what the next prompt should be.
83
-
84
- ## Outputs
85
-
86
- - `hstack/config.yaml` (status field on the config carries `init-status: minimal-complete` once mini-session 0 ends, advancing to `complete` only when every required context document is at `current`).
87
- - `hstack/context/vision.md` at `current`.
88
- - `hstack/context/glossary.md` at `current`.
89
- - `hstack/context/roadmap.md` at `current`.
90
- - `hstack/context/personas/<slug>.md` per persona, or sync stubs when the store is Notion / Linear.
91
- - `hstack/context/tech-stack.md`, `ci-cd.md`, `infrastructure.md`, `threat-model.md`, `hardening-checklist.md` — all at `current`.
92
- - `hstack/context/data-architecture.md` at `current` (produced by the delegated `/hstack:data-architecture` atom, five-section structure).
93
- - `hstack/context/app-architecture.md` at `current` plus one `hstack/specs/<module>/spec.md` stub per module from Section 1 (produced by the delegated `/hstack:app-architecture` atom).
94
- - `hstack/context/incident-runbook.md` at `current` with `git-ignored: true`; corresponding `.gitignore` entry verified.
95
- - `hstack/context/mcp-status.md` documenting active and degraded MCPs.
96
-
97
- ## Auto-commit triggers
98
-
99
- Each of the following emits an auto-commit on the active working branch:
100
-
101
- - `hstack/config.yaml` reaches `init-status: minimal-complete` (end of mini-session 0).
102
- - Each product-context document's status moves to `current` (end of each mini-session).
103
- - Each persona's status moves to `current` (end of each persona sub-interview).
104
- - `hstack/config.yaml`'s `init-status` advances to `complete` (end of mini-session 7).
105
-
106
- The commit message names the mini-session and the artifact. Aside from these, init does not auto-commit.
107
-
108
- ## Idempotency contract
109
-
110
- Re-running `hstack-brownfield-init` on a repo where init has progressed partway through:
111
-
112
- - Reads `hstack/config.yaml` and every existing `hstack/context/*.md`. Any file at `status: current` is considered done; the Skill does not re-interview it.
113
- - Reads `hstack/.session-state/<session-id>.yaml` if present and resumes the in-flight mini-session at its next un-confirmed field.
114
- - Produces a no-op diff for completed mini-sessions; the only writes happen to the first incomplete document.
115
- - Re-running after all mini-sessions are complete is a no-op that prints the init-status summary.
116
-
117
- ## Stop conditions
118
-
119
- Beyond the kernel's general stop conditions, this Skill halts when:
120
-
121
- - The `product-manager` subagent halts (e.g., because a persona answer is too vague, or because a referenced source document is unreachable). The Skill surfaces the subagent's halt message and waits.
122
- - A configured MCP the engineer named as the story store is not wired in Claude Code. The Skill does not silently fall back to a different store; it asks the engineer to wire the MCP or pick a different store, then re-runs the relevant config field.
123
- - The engineer signals end-of-session mid-mini-session. The Skill writes the session-state file, commits any field that has been confirmed and written, and exits cleanly.
124
- - `incident-runbook.md` would be committed to git. Halt; verify the gitignore entry first.
125
-
126
- ## Failure modes
127
-
128
- - **Missing kernel or templates.** Halt with a clear message; this is a hstack installation problem, not an init problem.
129
- - **Subagent unreachable mid-mini-session.** Persist current state; instruct the engineer to retry in a moment.
130
- - **Notion/Linear/GitHub MCP unreachable but configured as the story store.** Halt and ask the engineer to wire it; do not silently fall back to `hstack/stories/`.
131
- - **`.gitignore` write refused.** The Skill cannot proceed past mini-session 7's incident-runbook step without it. Halt and surface the issue.
@@ -1,84 +0,0 @@
1
- ---
2
- name: hstack-change-new
3
- description: Use to scaffold the `hstack/specs/changes/<id>/` folder and seed `spec.md` from the template at the start of a new change. Scaffolds only — `spec-author` fills the fields, and `/hstack:change-plan` sequences phases much later.
4
- tools:
5
- - Read
6
- - Write
7
- - Edit
8
- - Grep
9
- - Glob
10
- - Bash
11
- - "node hstack/scripts/validate-spec.mjs — validates the seeded change-spec frontmatter"
12
- ---
13
-
14
- ## Purpose
15
-
16
- `hstack-change-new` scaffolds the per-change folder under `hstack/specs/changes/<id>/` and seeds `spec.md` from the canonical template. It does no authoring — `spec-author` is invoked separately by the engineer once the folder exists. This Skill exists to keep id-generation, folder layout, and template seeding consistent across changes, and to enforce the module-spec precondition before any change work begins.
17
-
18
- ## When to invoke
19
-
20
- Invoke at the start of any new change. The Skill is the conventional first step of the per-change workflow, run before `hstack-story-draft`, `hstack-change-plan`, or any other per-change Skill. Trivial changes (typo fixes, dependency bumps) that the engineer intends to tag with `trivial: true` may skip this Skill, though most engineers run it anyway for consistency.
21
-
22
- ## Inputs
23
-
24
- - `<area>` (required, positional): the module key, must match an existing module-spec at `status: current`. Examples: `billing`, `orchestrator`, `knowledge-base`.
25
- - `<slug>` (required, positional): kebab-case short name for the change. Examples: `overage-warning`, `inline-mode`. The Skill validates the slug shape (kebab-case, no spaces, no leading numerics).
26
-
27
- The change `id` is derived as `YYYY-MM-<area>-<slug>` using the current month from `today`'s ISO date.
28
-
29
- ## Preconditions
30
-
31
- Before any work:
32
-
33
- - Verify `hstack/config.yaml` exists at `init-status: complete`. If not, halt and direct the engineer to `hstack-init`.
34
- - Verify `hstack/specs/<area>/spec.md` exists at `status: current`. If absent or non-terminal, halt and direct the engineer to `hstack-module-spec <area>`.
35
- - Verify `hstack/specs/changes/<derived-id>/` does not already exist. If it does, halt and surface the existing folder — the engineer is either resuming (in which case no scaffold is needed) or has a slug collision (in which case they pick a different slug).
36
- - Verify the slug matches `^[a-z][a-z0-9-]*$`.
37
-
38
- ## Orchestration steps
39
-
40
- 1. **Derive the id.** Compute `<YYYY-MM>-<area>-<slug>` from today's date and the inputs. Surface the derived id to the engineer for confirmation before writing.
41
-
42
- 2. **Create the folder.** `mkdir -p hstack/specs/changes/<id>/` via Bash.
43
-
44
- 3. **Seed `spec.md`.** Read `hstack/templates/change-spec.md`, instantiate the frontmatter with `id`, `type: change-spec`, `status: draft`, `owner` (from `git config user.name` or `hstack/config.yaml`'s default owner), `area: <area>`, `related-spec: <area>`, `created` and `updated` set to today, `schema-version: 1`. Leave `surfaces`, `user-stories`, `in-scope`, `out-of-scope`, `related-adrs`, `creates-tech-debt`, `parent-change`, `threat-model-delta`, `internal-tooling`, `enables`, `enabled-by`, `trivial` as their template defaults (typically empty arrays or `null`). Leave every prose section empty, with the template's interview-prompt comments intact for `spec-author` to consume.
45
-
46
- 4. **Forward-reference reconciliation for `enables` chains.** Grep every existing `hstack/specs/changes/*/spec.md` for the new `<id>` in `enables:` arrays. For each match: the matched (upstream) spec already declares this new (downstream) spec as a Category-B enabler. Per SP-14, write the reciprocal `enabled-by: [<upstream-id>, ...]` array on the newly-seeded spec in the same scaffold commit (this is the atomic-pair guarantee — both halves land together). When no match exists, leave `enabled-by: []`. Read-only on the upstream spec — its `enables` array was already written when the upstream was authored; no edit there. This is a mechanical operation per the kernel's Mechanical-operations section; no subagent is invoked. Surface the reconciliation to the engineer: "Detected upstream spec(s) declaring `enables: [<id>]` — populating `enabled-by` reciprocally."
47
-
48
- 5. **Validate.** Run `node hstack/scripts/validate-spec.mjs <path>` against the seeded file. Validation at `status: draft` is permissive — empty arrays and empty prose are allowed at draft — but the universal floor (FM-01) must pass.
49
-
50
- 6. **Offer branch creation.** Run `git branch --show-current`. If the current branch is `main` (or the configured default), ask the engineer: "You're on `<current-branch>`. Convention is one branch per change-spec — create `change/<id>` from here and check out before the scaffold commits? [Y/n/type-different-name]". Default Yes. On confirmation, run `git checkout -b change/<id>` BEFORE step 7 so the scaffold commit lands on the correct branch from the start. If the engineer declines or names a different branch, honor the choice and continue on the chosen branch. If the current branch is anything other than the configured default (i.e., already on a feature branch), do nothing — the engineer has a deliberate branching strategy and the Skill respects it.
51
-
52
- 7. **Auto-commit.** Commit message: `chore(change-new): scaffold <id>`.
53
-
54
- 8. **Surface next steps.** Print a one-line instruction directing the engineer to invoke `spec-author` (or `hstack-story-draft` first if the change is user-facing and no story exists yet). If the change has Category-B `enabled-by` populated from step 4, also note the upstream linkage so the engineer is reminded which prerequisite this realizes.
55
-
56
- The Skill does not invoke any subagent. Scaffolding is mechanical and the engineer's subsequent moves vary by change.
57
-
58
- ## Outputs
59
-
60
- - New directory `hstack/specs/changes/<id>/`.
61
- - New file `hstack/specs/changes/<id>/spec.md` at `status: draft`, with frontmatter populated to the floor and prose sections empty. Every subsequent status transition is owned by the authoring subagents, never by this Skill.
62
-
63
- ## Auto-commit triggers
64
-
65
- - One commit at scaffold completion. No further commits from this Skill.
66
-
67
- ## Idempotency contract
68
-
69
- - Re-running with the same `<area>` and `<slug>` when the derived folder exists is a no-op; the Skill detects the existing folder, surfaces it, and exits without writes.
70
- - Re-running with a different month (e.g., the engineer scaffolded in May, returns in June, and re-runs the same slug) produces a different id and a new folder; this is intentional — month-prefixed ids prevent slug-collision across long-running work.
71
- - If the folder exists but `spec.md` is absent (rare, indicates an interrupted scaffold), the Skill re-seeds `spec.md` only.
72
-
73
- ## Stop conditions
74
-
75
- Beyond the kernel's general stop conditions:
76
-
77
- - The `<area>` does not correspond to an existing module-spec at `status: current`. Halt.
78
- - The `<slug>` violates kebab-case shape. Halt.
79
- - The derived folder already exists with content. Halt and ask.
80
-
81
- ## Failure modes
82
-
83
- - **Validator fails on the seeded spec.** The template itself is broken — halt and surface as a hstack installation issue.
84
- - **`git config user.name` returns empty and `hstack/config.yaml` has no default owner.** Halt and ask the engineer for their owner handle.
@@ -1,108 +0,0 @@
1
- ---
2
- name: hstack-change-plan
3
- description: Use when a change-spec is at `ready-to-plan` with `test-plan.md` and every conditional upstream artifact terminal, and needs `plan.md` decomposed into atomic phases. Distinct from `/hstack:change-new`, which only scaffolds the folder.
4
- tools:
5
- - Read
6
- - Write
7
- - Edit
8
- - Grep
9
- - Glob
10
- - Bash
11
- - Task
12
- - "node hstack/scripts/validate-spec.mjs — validates plan frontmatter and PL-01..PL-05"
13
- ---
14
-
15
- ## Purpose
16
-
17
- `hstack-change-plan` produces `plan.md` for a change-spec by orchestrating the `planner` subagent. The plan decomposes the change into atomic phases with per-phase verifier expectations, names cross-phase risks, and articulates a rollback strategy. It is the artifact the implementer executes one phase at a time and the verifier checks phase-by-phase.
18
-
19
- ## When to invoke
20
-
21
- Invoke when the change-spec reaches `status: ready-to-plan`, `test-plan.md` is at terminal status, and any conditional upstream artifacts required by the spec's `surfaces` are at terminal status. Re-invoke when the change-spec, the test-plan, or any conditional upstream artifact changes shape in ways that invalidate the existing plan.
22
-
23
- When not to invoke — the conditional upstream gate is hard, and each miss has one remedy:
24
-
25
- - `surfaces` includes `db` and `data-review.md` is missing or non-terminal → halt; run `/hstack:data-review <change-id>` first. Planning against an unscored data layer produces a plan the implementer would refuse to act on anyway.
26
- - `surfaces` includes `ui` and `ui-brief.md` is not at `drafted` or `figma-handoff.md` is not at `ready` → halt; run `/hstack:ui-brief <change-id>` and get the handoff from the cofounder first.
27
- - `test-plan.md` is missing or non-terminal → halt; run `/hstack:test-plan <change-id>` first.
28
-
29
- ## Inputs
30
-
31
- - `<change-id>` (required, positional): the change-spec id.
32
-
33
- ## Preconditions
34
-
35
- Before any work:
36
-
37
- - Verify the change-spec exists at `hstack/specs/changes/<id>/spec.md` and is at `status: ready-to-plan` or later.
38
- - Verify the change-spec's `Invariants` section has ≥ 3 bullets (SP-04) and `Scope Boundaries` is non-empty (SP-05/SP-06). If empty, halt — the planner refuses.
39
- - **Verify `test-plan.md` is at `status: passed` or `concerns-acknowledged`.** This is the hard upstream gate; the planner refuses to sequence phases without a terminal test strategy. Halt otherwise and direct the engineer to `/hstack:test-plan`.
40
- - When `surfaces` includes `ui`: verify `ui-brief.md` at `status: drafted` and `figma-handoff.md` at `status: ready`. Halt otherwise.
41
- - When `surfaces` includes `db`: verify `data-review.md` at `status: passed` or `concerns-acknowledged`. Halt otherwise.
42
- - Verify the relevant module-spec at `status: current`.
43
- - Read `hstack/context/tech-stack.md` (loaded by `planner` for pinned runtime constraints).
44
- - Read `hstack/context/roadmap.md` for the plan's Roadmap Alignment line. Advisory, never a precondition: missing or stale (`status` ≠ `current`, or `updated` > 90 days) yields `n/a — roadmap stale/missing (<detail>)` in that line — no halt.
45
-
46
- The security-review is not a planner precondition — security-review and the plan can be produced in either order, since neither depends on the other's content (the implementer reads both at session start). The test-plan, by contrast, IS a planner precondition: the planner's phase ordering and per-phase Test Strategy entries reference test-plan sections, so the test-plan must already be terminal.
47
-
48
- ## Orchestration steps
49
-
50
- 1. **Invoke `planner`.** Use the Task tool with `subagent_type: planner` and context = [kernel, `hstack/templates/plan.md`, change-spec, test-plan, ui-brief and figma-handoff if applicable, data-review if applicable, module-spec, tech-stack, roadmap when present]. The subagent walks the five plan sections — Roadmap Alignment (one honest line, per the planner contract: information for the human, never a gate), Phase Overview, Per-Phase Detail, Cross-Phase Risks, Rollback. Per-phase Test Strategy entries point at test-plan sections rather than re-stating tests inline.
51
-
52
- 2. **Phase decomposition.** Per the `planner` contract, typical plans hold 4–8 phases; > 12 phases requires an `oversized-plan-justification` frontmatter field. Each phase has a `step-id`, one-line summary, `depends-on` list, Files Touched (subset of `change-spec.in-scope`), Test Strategy, Risk sentence, and Verifier Expectations.
53
-
54
- 3. **Scope subset enforcement.** Per PL-04, every "Files Touched" entry across the plan must be a subset of `change-spec.in-scope`. The subagent verifies during authoring; the Skill verifies post-write via the validator. If a phase requires a file outside `in-scope`, the planner halts with a scope-amendment request.
55
-
56
- 4. **Exercise the Cross-Phase Risks challenge.** Per the `planner` contract, the Cross-Phase Risks section uses the challenge prompt "What could go wrong across phase boundaries that no single phase catches?" Minimum one bullet for multi-phase plans.
57
-
58
- 5. **Rollback discipline.** Section 4 names what to flip, revert, or feature-gate if a partial rollout breaks something. If the engineer cannot answer, the planner halts rather than writing a plausible default.
59
-
60
- 6. **Leave `steps-completed: []`.** Per architecture amendment A3 and the planner's contract, `steps-completed` is owned by the implementer; the planner never populates it.
61
-
62
- 7. **Validate.** Run `node hstack/scripts/validate-spec.mjs <path>` — PL-01 (parent-change matches), PL-02 (phase count), PL-03 (steps-completed entries match plan phase ids), PL-04 (Files Touched is subset of in-scope), PL-05 (status advance gating).
63
-
64
- 8. **Transition.** When the validator passes, `planner` advances status from `draft` to `ready`. Auto-commit fires.
65
-
66
- ## Outputs
67
-
68
- - `hstack/specs/changes/<change-id>/plan.md` at `status: ready`.
69
-
70
- ## Auto-commit triggers
71
-
72
- - Status transition to `draft` after the Phase Overview table lands.
73
- - Status transition to `ready` at end of authoring. Commit message: `plan(<change-id>): ready`.
74
-
75
- ## Session boundary
76
-
77
- `change-plan` is a natural session cut: the auto-commit above left `plan.md` 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:
78
-
79
- ```
80
- HSTACK-CUT: change-plan complete — cut recommended before implement.
81
- ```
82
-
83
- and the next command, `/hstack:implement <first-phase-id> <change-id>`.
84
-
85
- ## Idempotency contract
86
-
87
- - Re-running on an existing `ready` plan without spec changes: the subagent reads the existing plan as the proposal layer; identical re-confirmation is a no-op.
88
- - Re-running mid-authoring after a halt: `planner` reads the partial file and resumes at the next un-confirmed section.
89
- - Re-running after the change-spec's `in-scope` has been amended: the planner re-validates every Files Touched entry against the new in-scope, halts if any phase drifted, and prompts the engineer to reshape phases.
90
-
91
- ## Stop conditions
92
-
93
- Beyond the kernel's general stop conditions:
94
-
95
- - Change-spec Invariants empty (< 3 bullets) or Scope Boundaries empty.
96
- - `test-plan.md` missing or non-terminal. Halt and direct the engineer to `/hstack:test-plan`.
97
- - Conditional upstream artifact missing or non-terminal.
98
- - A Files Touched entry would drift outside `in-scope`. Halt and request a scope amendment via `spec-author`.
99
- - > 12 phases without `oversized-plan-justification` in frontmatter.
100
- - The Cross-Phase Risks challenge prompt cannot be answered with at least one bullet on a multi-phase change.
101
- - The engineer cannot answer the rollback prompt.
102
-
103
- ## Failure modes
104
-
105
- - **Module-spec missing or `needs-refresh`.** Halt; refresh via `hstack-module-spec` first.
106
- - **`ui-brief.md` exists at `draft` rather than `drafted`.** Halt; the brief is incomplete.
107
- - **Validator fails PL-04.** The planner halts immediately at the offending phase; the engineer either reshapes the phase or amends in-scope.
108
- - **`planner` halts on cross-phase risk surfacing an invariant gap.** Halt; the engineer amends the change-spec via `spec-author`, then re-runs this Skill.