create-anpunkit 2.1.0 → 2.3.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 (68) hide show
  1. package/bin/cli.js +2 -2
  2. package/package.json +2 -3
  3. package/template/.claude/agents/debugger.md +1 -1
  4. package/template/.claude/agents/e2e-runner.md +56 -29
  5. package/template/.claude/agents/implementer.md +14 -8
  6. package/template/.claude/agents/infra-provisioner.md +53 -59
  7. package/template/.claude/agents/planner.md +99 -30
  8. package/template/.claude/agents/researcher.md +16 -1
  9. package/template/.claude/agents/spec-author.md +126 -0
  10. package/template/.claude/agents/synthesizer.md +1 -1
  11. package/template/.claude/agents/test-author.md +81 -63
  12. package/template/.claude/anpunkit-manifest.json +66 -107
  13. package/template/.claude/commands/infra.md +7 -3
  14. package/template/.claude/commands/log-decision.md +1 -1
  15. package/template/.claude/commands/log-issue.md +1 -1
  16. package/template/.claude/commands/overview.md +55 -13
  17. package/template/.claude/commands/phase.md +153 -81
  18. package/template/.claude/commands/quick.md +1 -1
  19. package/template/.claude/commands/replan.md +1 -1
  20. package/template/.claude/commands/store-wisdom.md +1 -1
  21. package/template/.claude/commands/synthesize.md +1 -1
  22. package/template/.claude/commands/unstuck.md +1 -1
  23. package/template/.claude/hooks/session-start.sh +5 -11
  24. package/template/.claude/ref/compression.md +56 -0
  25. package/template/.claude/skills/karpathy-guidelines/SKILL.md +1 -1
  26. package/template/.gitattributes +1 -0
  27. package/template/AGENTS.md +264 -130
  28. package/template/CLAUDE.md +5 -9
  29. package/template/README.md +116 -136
  30. package/template/commands.src/infra.md +7 -3
  31. package/template/commands.src/log-decision.md +1 -1
  32. package/template/commands.src/log-issue.md +1 -1
  33. package/template/commands.src/overview.md +55 -13
  34. package/template/commands.src/phase.md +153 -81
  35. package/template/commands.src/quick.md +1 -1
  36. package/template/commands.src/replan.md +1 -1
  37. package/template/commands.src/store-wisdom.md +1 -1
  38. package/template/commands.src/synthesize.md +1 -1
  39. package/template/commands.src/unstuck.md +1 -1
  40. package/template/docs/DESIGN_LOG.md +414 -9
  41. package/template/knowledge/azure.md +161 -0
  42. package/template/knowledge/webapp.md +265 -0
  43. package/template/scripts/spec-conformance.sh +93 -0
  44. package/template/scripts/spec-staleness.sh +115 -0
  45. package/template/setup.sh +30 -111
  46. package/template/tests/helpers/spec-assert.py +162 -0
  47. package/template/tests/helpers/spec-assert.ts +158 -0
  48. package/template/.claude/hooks/cursor-session-start.sh +0 -17
  49. package/template/.claude/skills/caveman/SKILL.md +0 -39
  50. package/template/.cursor/commands/infra.md +0 -82
  51. package/template/.cursor/commands/log-decision.md +0 -29
  52. package/template/.cursor/commands/log-issue.md +0 -23
  53. package/template/.cursor/commands/overview.md +0 -145
  54. package/template/.cursor/commands/phase.md +0 -249
  55. package/template/.cursor/commands/quick.md +0 -25
  56. package/template/.cursor/commands/replan.md +0 -73
  57. package/template/.cursor/commands/store-wisdom.md +0 -191
  58. package/template/.cursor/commands/synthesize.md +0 -22
  59. package/template/.cursor/commands/unstuck.md +0 -36
  60. package/template/.cursor/hooks.json +0 -14
  61. package/template/.cursor/rules/anpunkit.md +0 -11
  62. package/template/anpunkit.png +0 -0
  63. package/template/docker-compose.test.yml +0 -34
  64. package/template/e2e/global-setup.ts +0 -57
  65. package/template/index.html +0 -340
  66. package/template/playwright.config.ts +0 -28
  67. package/template/scripts/auth-setup.sh +0 -51
  68. package/template/scripts/e2e-stack.sh +0 -65
@@ -3,16 +3,20 @@ description: Provision or verify Azure infrastructure. Generates Bicep, shows wh
3
3
  argument-hint: [provision | verify | update <what changed> | regenerate-env | auth-proof]
4
4
  ---
5
5
 
6
- Caveman ULTRA mode. You are the ORCHESTRATOR.
6
+ compression: user (.claude/ref/compression.md). You are the ORCHESTRATOR.
7
7
 
8
8
  Action: $ARGUMENTS (default: "provision" if INFRA.md missing, "verify" if present)
9
9
 
10
+ Only meaningful when docs/OVERVIEW.md has `infra_needed: true`. If
11
+ `infra_needed: false`, tell me this project has no infra phase and STOP.
12
+
10
13
  ---
11
14
 
12
15
  ## PRE-FLIGHT
13
16
 
14
- 1. Check `az account show` if it fails, STOP.
15
- Tell me: "Run `scripts/auth-setup.sh` first."
17
+ 1. Confirm cloud CLI auth per the project's knowledge doc (Azure:
18
+ `knowledge/azure.md` ritual `bash scripts/auth-setup.sh`; materialize it if
19
+ absent). If it fails, STOP and tell me the exact command to run.
16
20
 
17
21
  2. Determine mode from $ARGUMENTS or default logic.
18
22
 
@@ -3,7 +3,7 @@ description: Record an architectural decision in docs/DESIGN_LOG.md. Use only wh
3
3
  argument-hint: [what changed]
4
4
  ---
5
5
 
6
- Caveman ULTRA mode.
6
+ compression: user (.claude/ref/compression.md).
7
7
 
8
8
  Append an architectural decision to docs/DESIGN_LOG.md. Change: $ARGUMENTS
9
9
 
@@ -3,7 +3,7 @@ description: Log an error to docs/ISSUES.md with root cause + solution, in the c
3
3
  argument-hint: [short error description]
4
4
  ---
5
5
 
6
- Caveman ULTRA mode.
6
+ compression: user (.claude/ref/compression.md).
7
7
 
8
8
  Append an entry to docs/ISSUES.md. Error: $ARGUMENTS
9
9
 
@@ -2,7 +2,7 @@
2
2
  description: Bootstrap a new project. Runs design-research, research review, double grill (incl. data/state flow), datasource-understanding baseline, and planning. Run once per project.
3
3
  ---
4
4
 
5
- Caveman ULTRA mode.
5
+ compression: user (.claude/ref/compression.md).
6
6
 
7
7
  Recommended: run from plan mode (Shift+Tab). Planning agents are read-only by
8
8
  tool grant; plan mode adds a read-only gate on the main session too. Optional.
@@ -16,11 +16,17 @@ Goal: stand up a fresh project workspace with a well-grounded plan.
16
16
  ### Round 1 — Initial grill
17
17
 
18
18
  1. Run the `grill-me` skill to interrogate me. Goal: understand initial scope.
19
- Cover: project purpose, success criteria, external services, Azure services
20
- needed (type + sizing), region, deployment target (Azure or local for E2E),
21
- known constraints, unknowns. ALSO establish:
19
+ Cover: project purpose, success criteria, external services, cloud/infra
20
+ services needed (type + sizing, if any), region, known constraints, unknowns.
21
+ ALSO establish:
22
+ - **project_type**: web app / desktop app / script / library / other. This
23
+ drives the deterministic flag derivation (step 6) and knowledge-doc
24
+ selection.
22
25
  - **has_frontend**: is there a browser-facing UI? If yes, what is the frontend
23
26
  root path (e.g. `src/web/`, `app/`)? This drives the mandatory-E2E path match.
27
+ - **deploy meaning**: what does "done and shipped" mean for this project —
28
+ cloud deploy (where?), package publish (which registry?), verified
29
+ install/run instructions, or none (why)? This sets `deploy_kind`.
24
30
  Do not stop early. Do not write OVERVIEW.md yet.
25
31
 
26
32
  Store the round-1 answers as working context — do NOT write OVERVIEW.md yet.
@@ -86,11 +92,23 @@ Store the round-1 answers as working context — do NOT write OVERVIEW.md yet.
86
92
  - Project purpose and success criteria
87
93
  - Scope and constraints (informed by research findings)
88
94
  - External services with confirmed capabilities/limits
89
- - "Azure services" section: every service with expected SKU
90
- - Deployment target (azure-deployed or local-docker for E2E)
95
+ - Cloud/infra services section: every service with expected SKU (if any)
91
96
  - `has_frontend: true|false` and, if true, the frontend root path
92
97
  - Known risks / open questions (if any remain)
93
98
 
99
+ PROJECT FLAGS (hard rule 10 — declared once here, recorded verbatim, never
100
+ re-derived later):
101
+ - `project_type: web app|desktop app|script|library|other` (declared in round 1)
102
+ - `infra_needed: true|false` — derived: application types (web app, desktop
103
+ app, service) → true; script / library → false. Overridable here with a
104
+ stated reason.
105
+ - `e2e_kind: browser|cli|http|library-api` — derived: has_frontend → browser;
106
+ backend/API service → http; script → cli; library → library-api.
107
+ - `deploy_kind: cloud-deploy|package-publish|install-run-verified|none(<reason>)`
108
+ (from the round-1 "deploy meaning" answer).
109
+ - `knowledge_docs:` — derived list: web app or has_frontend → `knowledge/webapp.md`;
110
+ Azure services declared OR Azure cloud-deploy → `knowledge/azure.md`; else empty.
111
+
94
112
  OVERVIEW.md is written HERE — after the re-grill, not before.
95
113
 
96
114
  7. Write docs/DATAFLOW.md — a state-transition table per key object, driven by the
@@ -112,13 +130,27 @@ Store the round-1 answers as working context — do NOT write OVERVIEW.md yet.
112
130
 
113
131
  8. Hand OVERVIEW.md + DATAFLOW.md + design-research findings to the `planner`
114
132
  subagent. PLAN.md MUST:
115
- - Start with Phase 0 (infra setup) as the first entry (always).
116
- - End with a final code phase that contains the deploy task block.
133
+ - Start with Phase 0 (infra setup) as the first entry IFF `infra_needed: true`;
134
+ when `infra_needed: false` there is no Phase 0 Phase 1 is the first entry.
135
+ - End with a final code phase whose deploy task completes `deploy_kind`
136
+ (cloud deploy / package publish / verified install-run / none-with-reason).
117
137
  - For any phase whose `changes` touch the frontend root: include ≥1
118
138
  UI-existence acceptance criterion naming the specific user-visible
119
139
  interactive element the phase introduces (not "page renders 200").
120
140
  - Map each phase to the DATAFLOW transitions it is expected to make reachable.
121
141
 
142
+ The planner ALSO writes the up-front SKELETON spec files (v2.2, §5.44/§5.51):
143
+ one `docs/spec-phase-<n>.md` per public-surface phase (skip Phase 0 + pure
144
+ infra/config/doc phases), enumerating the case NAMES — happy path, each named
145
+ edge, each named failure + error code — for every `dataflow:` transition and
146
+ every `acceptance` criterion, with `TBD` values. The generated header transcludes
147
+ that phase's `acceptance:` line + in-scope `DATAFLOW.md` transition rows verbatim.
148
+
149
+ 8b. STAMP each skeleton's staleness hash: for every `docs/spec-phase-<n>.md` the
150
+ planner wrote, run `bash scripts/spec-staleness.sh stamp <n>`. This embeds the
151
+ hash of the transcluded acceptance line + transition rows so phase-time
152
+ `/phase` can detect upstream drift. (Values are filled per phase by `spec-author`.)
153
+
122
154
  9. Create docs/STATE.md:
123
155
  ```
124
156
 
@@ -126,15 +158,18 @@ Store the round-1 answers as working context — do NOT write OVERVIEW.md yet.
126
158
 
127
159
  phase: 0 (pending)
128
160
  completed: project bootstrapped — design research, research review, double grill (incl. data/state flow) done
129
- next: run /infra to provision Azure infrastructure
161
+ next: <if infra_needed: "run /infra to provision infrastructure (Phase 0)"; else "run /phase 1">
130
162
  blocker: none
131
163
 
132
164
  ```
165
+ When `infra_needed: false`, set `phase: 1 (pending)` and the next line to
166
+ "run /phase 1".
133
167
  10. Create docs/ISSUES.md with header `# Issues` and `## Archived` section.
134
168
 
135
169
  11. Create empty docs/HISTORY.md.
136
170
 
137
- 12. Create docs/INFRA.md from the template (populated by /infra).
171
+ 12. Create docs/INFRA.md from the template (populated by /infra). Skip when
172
+ `infra_needed: false`.
138
173
 
139
174
  13. Create docs/ENDPOINTS.md:
140
175
  ```
@@ -144,6 +179,13 @@ blocker: none
144
179
  ```
145
180
 
146
181
  Then stop and show me PLAN.md + DATAFLOW.md for approval before any phase starts.
147
-
148
- Remind me: "Run `/infra` next to provision the Azure environment (Phase 0) and
149
- run the one-time AUTH PROOF before starting Phase 1."
182
+ EXTEND the approval surface (v2.2, §5.51 — one confirmation, no new gate): for each
183
+ public-surface phase, list the transition/acceptance ids it covers and the enumerated
184
+ case NAMES (no values). I confirm the case-name set is COMPLETE here these names
185
+ are the up-front behavioral contract; values get filled + reviewed per phase at
186
+ `/phase` SPEC REVIEW.
187
+
188
+ Remind me of the next step per `infra_needed`:
189
+ - `infra_needed: true` → "Run `/infra` next to provision the environment (Phase 0)
190
+ and run the one-time AUTH PROOF before starting Phase 1."
191
+ - `infra_needed: false` → "No infra phase — run `/phase 1` to start."
@@ -1,10 +1,10 @@
1
1
  ---
2
- description: Run one phase end-to-end. TDD phases run SCAFFOLD -> RED -> TEST REVIEW -> GREEN; non-TDD phases run IMPLEMENT -> TEST. Both with the debug circuit breaker and the regression + dataflow + evidence guards at CLOSE.
2
+ description: Run one phase end-to-end. TDD phases run SPEC fill -> SPEC REVIEW -> SCAFFOLD -> RED -> conformance -> GREEN -> boundary/E2E; non-TDD phases run IMPLEMENT -> TEST. Both with the debug circuit breaker and the regression + dataflow + evidence guards at CLOSE.
3
3
  argument-hint: [phase number]
4
4
  ---
5
5
 
6
- Caveman ULTRA mode. You are the ORCHESTRATOR. Route work to subagents —
7
- you do NOT implement or debug yourself.
6
+ compression: user (.claude/ref/compression.md). You are the ORCHESTRATOR. Route work to subagents —
7
+ you do NOT implement, fill specs, or debug yourself.
8
8
 
9
9
  Note: subagents cannot talk to the user. Only YOU can.
10
10
 
@@ -14,8 +14,9 @@ Target phase: $ARGUMENTS (default: the phase marked pending in docs/PLAN.md)
14
14
 
15
15
  ## 0. PRE-FLIGHT
16
16
 
17
- a. INFRA CHECK (phases > 0):
18
- - Read docs/INFRA.md. If Phase 0 not done -> STOP.
17
+ a. INFRA CHECK (phases > 0): read docs/OVERVIEW.md `infra_needed`.
18
+ - `infra_needed: false` -> no Phase 0 exists; SKIP this check entirely.
19
+ - `infra_needed: true`: read docs/INFRA.md. If Phase 0 not done -> STOP.
19
20
  Tell me: "Phase 0 (infra) not complete. Run `/infra` first."
20
21
  - Exception: if $ARGUMENTS is "0", tell me to run `/infra` directly.
21
22
 
@@ -29,20 +30,26 @@ b. PHASE STATE CHECK: Read docs/STATE.md and docs/PLAN.md.
29
30
  c. FINAL PHASE CHECK: Read docs/PLAN.md. Is this the last phase (no further
30
31
  pending phases after this one)? Record this as IS_FINAL_PHASE=true/false.
31
32
 
32
- d. AUTH LIVENESS GATE (hard rule 16 — replaces the old soft nudge): if this phase
33
- will run a real/E2E suite, confirm every credential it needs is live NOW.
33
+ d. AUTH LIVENESS GATE (hard rule 16): only if this phase touches a credentialed
34
+ external service and will run a boundary/E2E suite. Skip otherwise.
34
35
  - If INFRA.md has no `AUTH PROOF: PASS` marker -> STOP: "Auth never proven
35
36
  reusable. Run `/infra` first."
36
- - Run `scripts/auth-setup.sh --check` (Entra token obtainable + not expired)
37
- and, for each external system this phase touches (docs/DATAFLOW.md external
38
- rows + docs/ENDPOINTS.md auth column), confirm its credential is obtainable
39
- headlessly. Any failure -> real/E2E is BLOCKED; tell me what to run; the
37
+ - Run the liveness command recorded in docs/INFRA.md `## AUTH` (Azure projects:
38
+ the ritual per `knowledge/azure.md`, i.e. `bash scripts/auth-setup.sh`) and,
39
+ for each external system this phase touches (docs/DATAFLOW.md external rows +
40
+ docs/ENDPOINTS.md auth column), confirm its credential is obtainable
41
+ headlessly. Any failure -> boundary/E2E is BLOCKED; tell me what to run; the
40
42
  MOCK suite may still proceed.
41
43
 
42
44
  e. FRONTEND TRIGGER (hard rule 13): read docs/OVERVIEW.md `has_frontend` + the
43
45
  frontend root. Set FRONTEND_PHASE=true iff `has_frontend: true` AND this
44
46
  phase's `changes` (docs/PLAN.md) include any path under the frontend root.
45
- This is a PATH MATCH, not a judgment call. Record FRONTEND_PHASE for the GATE.
47
+ This is a PATH MATCH, not a judgment call. Record FRONTEND_PHASE it gates the
48
+ `ui` boundary run + evidence at CLOSE.
49
+
50
+ f. FLAG BASELINES: read docs/OVERVIEW.md `e2e_kind` + `deploy_kind`. These are the
51
+ project baselines; §1 binds this phase's effective E2E_KIND and (final phase)
52
+ confirms DEPLOY_KIND.
46
53
 
47
54
  ---
48
55
 
@@ -57,8 +64,9 @@ datasource, compare what it touches to the confirmed BASELINE in
57
64
  docs/research/datasource-<name>.md. If it touches a NEW table/column beyond the
58
65
  baseline -> surface my understanding of just that delta as a falsifiable claim;
59
66
  WAIT for confirm; append it to datasource-<name>.md. If it touches only confirmed
60
- data -> proceed with a one-line note, no stop. Real/E2E against an UNCONFIRMED
61
- datasource is HARD-BLOCKED (mock still runs).
67
+ data -> proceed with a one-line note, no stop. Boundary/E2E against an UNCONFIRMED
68
+ datasource is HARD-BLOCKED (mock still runs). The confirmed baseline is what
69
+ `spec-author` grounds fixtures in.
62
70
 
63
71
  Then classify the phase:
64
72
 
@@ -66,63 +74,115 @@ Then classify the phase:
66
74
  exported function/class, CLI command, message contract) assertable from the
67
75
  acceptance spec. Size is NOT the criterion.
68
76
 
69
- - Clear public surface -> `TDD_PHASE=true` -> run the TDD path (§2 → §3a → §3r → §3b).
77
+ - Clear public surface -> `TDD_PHASE=true` -> run the TDD path (§2 → §3 → §4 → §5 → §6 → §7).
70
78
  - Pure infra/config/doc, no public surface -> `TDD_PHASE=false` -> run the
71
79
  non-TDD path (§2N → §3N).
72
80
  - AMBIGUOUS -> default `TDD_PHASE=true`, but STATE the classification + the reason
73
- to me, so I can override to non-TDD BEFORE SCAFFOLD fires. (Hard rule 11: never
74
- downgrade a TDD phase just to dodge the RED gate.)
81
+ to me, so I can override to non-TDD BEFORE SPEC fill fires. (Hard rule 11: never
82
+ downgrade a TDD phase just to dodge the gates.)
83
+
84
+ FLAG BINDING (hard rule 10): bind this phase's effective E2E_KIND — `browser` iff
85
+ FRONTEND_PHASE, else the OVERVIEW `e2e_kind` baseline. If IS_FINAL_PHASE, restate
86
+ `deploy_kind` and confirm the final phase's deploy task realizes it. STATE both
87
+ bindings. Divergence from OVERVIEW is mine to resolve — never silently re-derived.
75
88
 
76
89
  =====================================================================
77
90
  ## TDD PATH (TDD_PHASE=true)
78
91
  =====================================================================
79
92
 
80
- ## 2. SCAFFOLD
93
+ ## 2. SPEC FILL + STALENESS
94
+
95
+ a. SKELETON CHECK: confirm docs/spec-phase-<n>.md exists (planner generated it at
96
+ /overview). If MISSING (planner classified it non-TDD, or it's a new phase from
97
+ /replan): generate the skeleton NOW from this phase's PLAN.md `acceptance` +
98
+ `dataflow:` transitions in the planner skeleton format (generated header + named
99
+ `TBD` rows), then `bash scripts/spec-staleness.sh stamp <n>` to stamp its hash.
100
+
101
+ b. Dispatch `spec-author`. It fills each case row with a real input payload
102
+ (`fixtures/<case-id>-input.json`), concrete expected output
103
+ (`fixtures/<case-id>-expected.json`), matcher tokens for volatile fields,
104
+ `error-code` for failures, and `selector/assert/value` `ui` descriptors —
105
+ grounded in the RESEARCH findings + the confirmed datasource baseline.
106
+
107
+ c. CASE-SET-DIVERGENCE (hard re-entry, hard rule 12 / §5.52): if `spec-author`
108
+ returns `CASE-SET-DIVERGENCE` (a required case can't be filled from real facts,
109
+ or research revealed an unlisted/contradicted case) -> STOP. Surface the finding.
110
+ I amend the up-front case-name contract in the skeleton; you re-stamp
111
+ (`bash scripts/spec-staleness.sh stamp <n>`); then re-dispatch `spec-author` to
112
+ re-fill from scratch. AI never amends the case-name set — I own the contract.
113
+
114
+ d. STALENESS (hard rule 17): run `bash scripts/spec-staleness.sh <n>`. Nonzero
115
+ (upstream PLAN acceptance line / DATAFLOW rows drifted since the skeleton was
116
+ stamped, e.g. via /replan) -> regenerate the skeleton header from current
117
+ PLAN/DATAFLOW, re-stamp, re-dispatch `spec-author`. Do NOT hand-edit the hash.
118
+
119
+ ## 3. SPEC REVIEW — human gate (hard rule 12)
120
+
121
+ STOP. Surface the FILLED cases to me as FALSIFIABLE CLAIMS in plain language, e.g.:
122
+ - "POST /orders/submit with an empty line-item list → 422 EMPTY_ORDER."
123
+ - "Successful submit of a 3-line order → 201; order.id is a UUID; order.status is
124
+ 'submitted'."
125
+ Re-run `bash scripts/spec-staleness.sh <n>` at entry (nonzero -> back to §2d).
126
+ SCAFFOLD cannot begin until I confirm. Classify any rejection WITH me (§5.50):
127
+ - WRONG EXPECTED -> fix the case row + `fixtures/<case-id>-expected.json`; no
128
+ re-research. (You may patch the fixture directly per my correction.)
129
+ - WRONG INPUT SHAPE -> re-dispatch `spec-author` with the correction.
130
+ - NEW CASE or CONTRADICTED CASE -> hard re-entry (§2c): I amend the skeleton, you
131
+ re-stamp, re-confirm the amended case(s) + any case sharing their `covers` id
132
+ (the staleness hash certifies the unchanged remainder — not re-read), re-fill.
133
+ Loop until I approve. Unskippable on TDD phases.
134
+
135
+ ## 4. SCAFFOLD
81
136
 
82
137
  Dispatch `implementer` in SCAFFOLD mode: interface stubs only (signatures +
83
- types; bodies raise NotImplementedError / return 501); NO logic, NO tests.
84
- Returns the stub files + the interface surface.
138
+ types; bodies raise NotImplementedError / return 501); NO logic, NO tests, NO
139
+ edits to the spec or fixtures. Returns the stub files + the interface surface.
140
+
141
+ ## 5. RED
85
142
 
86
- ## 3a. RED
143
+ Dispatch `test-author` to EMIT the boundary harness from the locked spec `data`
144
+ rows: one deep-equality assertion per case against `fixtures/<case-id>-expected.json`
145
+ via the kit comparator `tests/helpers/spec-assert.*`, each citing its case with a
146
+ `# spec: <case-id>` comment. It does NOT author assertions — it generates them from
147
+ the spec. Place contract/ENDPOINTS/transition tests in `tests/regression/`,
148
+ phase-local in `tests/phase-<n>/`.
87
149
 
88
- Dispatch `test-author` to write the REAL API suite (+ mock) BLIND against the
89
- stubs + acceptance, AND emit docs/test-plan-phase-<n>.md (acceptance criteria →
90
- test names, plus a mandatory "NOT covered / assumptions" section). Place
91
- contract/ENDPOINTS/DATAFLOW-transition tests in `tests/regression/`, phase-local
92
- tests in `tests/phase-<n>/`. Run the suite.
150
+ If FRONTEND_PHASE (and the phase has `ui` cases): also dispatch `e2e-runner` to EMIT
151
+ Playwright assertions from each `ui` case's `fixtures/<case-id>-ui.json` descriptor,
152
+ each citing `// spec: <case-id>`. Run the suites.
93
153
 
94
- RED GATE = every acceptance test COLLECTS cleanly AND FAILS (assertion /
95
- NotImplemented).
96
- - Any test PASSES on stubs -> STOP (spec trivial or test wrong); show me.
154
+ RED GATE = every case test COLLECTS cleanly AND FAILS (assertion / NotImplemented).
155
+ - Any test PASSES on stubs -> STOP (spec trivial or emitter wrong); show me.
97
156
  - Collection / import / syntax error -> stub mismatch; re-dispatch SCAFFOLD to
98
157
  fix SIGNATURES (not logic); re-run.
99
- - UNDERSPEC -> STOP; ask me to sharpen the acceptance spec.
100
158
 
101
- ## 3r. TEST REVIEWhuman gate (hard rule 12)
159
+ ## 6. CONFORMANCE GATE (hard rule 18) replaces the v2.1 human TEST REVIEW
102
160
 
103
- STOP. Surface docs/test-plan-phase-<n>.md to me: what each acceptance criterion
104
- maps to, and the "NOT covered / assumptions" section. GREEN cannot begin until I
105
- approve. On rejection, classify with me:
106
- - MISREAD of an adequate spec -> re-dispatch `test-author` with my feedback as
107
- added constraint; re-run RED; re-present the test plan.
108
- - UNDERSPEC (the acceptance spec itself is too vague) -> sharpen the acceptance
109
- spec in docs/PLAN.md, then re-dispatch `test-author` fresh.
110
- Loop until I approve. This gate is unskippable on TDD phases.
161
+ Run `bash scripts/spec-conformance.sh <n>`. It loud-fails (and BLOCKS GREEN) if:
162
+ - any `TBD` marker remains in docs/spec-phase-<n>.md or a referenced fixture, OR
163
+ - any case-id in the spec table has no boundary test citing it (`# spec: <case-id>`).
164
+ Nonzero -> fix the gap (re-dispatch `spec-author` for a stray TBD, or `test-author`/
165
+ `e2e-runner` for a missing citation) and re-run. GREEN cannot start until it passes.
111
166
 
112
- ## 3b. GREEN
167
+ ## 7. GREEN + BOUNDARY/E2E
113
168
 
114
- Dispatch `implementer` in FILL mode with the phase spec + research + the test
115
- file paths (it MAY read the tests — frozen before logic, no overfit — but must
116
- NOT edit them). Fill to green. Budget 3, WARN@2, STUCK@3.
169
+ Dispatch `implementer` in FILL mode with the FILLED docs/spec-phase-<n>.md + its
170
+ fixtures + research + the generated test file paths (it MAY read the tests — frozen
171
+ before logic, no overfit but must NOT edit tests, spec, or fixtures). Fill to
172
+ green against the spec. Budget 3, WARN@2, STUCK@3.
117
173
 
118
- If FRONTEND_PHASE (from PRE-FLIGHT e): dispatch `e2e-runner` — MANDATORY, not
119
- optional (hard rule 13). It reads INFRA.md target, runs `scripts/e2e-stack.sh up`
120
- / Playwright / `down`, and captures a screenshot at EACH UI-existence assertion
121
- regardless of pass/fail to docs/evidence/e2e-phase-<n>/, with a summary in
122
- docs/research/e2e-<slug>.md. Acceptance spec has no UI-existence criterion ->
123
- e2e-runner returns UNDERSPEC -> STOP, sharpen the spec.
174
+ Run the BOUNDARY suite (real HTTP/CLI/message; `TEST_MODE=real`)the outer surface
175
+ per this phase's bound E2E_KIND. Capture evidence (hard rule 13):
176
+ - `browser` (FRONTEND_PHASE): dispatch `e2e-runner` to run its emitted `ui` specs
177
+ MANDATORY reads INFRA.md target, runs the stack ritual per `knowledge/webapp.md`
178
+ (`scripts/e2e-stack.sh up` / Playwright / `down`), captures a screenshot at EACH
179
+ UI-existence assertion regardless of pass/fail to docs/evidence/e2e-phase-<n>/,
180
+ with a summary in docs/research/e2e-<slug>.md.
181
+ - `cli` / `http` / `library-api`: the real-mode boundary suite IS the outer run;
182
+ capture its transcript (invocation + result) to docs/evidence/e2e-phase-<n>/.
183
+ No separate emitter is dispatched.
124
184
 
125
- PHASE GATE (rule 5) -> go to §456 (see GATE below).
185
+ PHASE GATE (rule 5) -> go to §8910 (see GATE below).
126
186
 
127
187
  =====================================================================
128
188
  ## NON-TDD PATH (TDD_PHASE=false)
@@ -133,22 +193,24 @@ PHASE GATE (rule 5) -> go to §4/§5/§6 (see GATE below).
133
193
  Dispatch `implementer` (legacy mode) with phase spec + research summary.
134
194
  Returns STUCK -> go to ESCALATE.
135
195
  If IS_FINAL_PHASE: phase spec includes the deploy task; confirm the return
136
- includes "deployed URL" before proceeding.
196
+ realizes `deploy_kind` (deployed URL / published version / verified install-run)
197
+ before proceeding.
137
198
 
138
199
  ## 3N. TEST (blind)
139
200
 
140
- Dispatch `test-author`. It writes MOCK + REAL API suites from the acceptance
141
- spec — never reads the logic. (No TEST REVIEW gate on the non-TDD path — no
142
- public surface to mis-test. e2e-runner only if FRONTEND_PHASE.)
201
+ Dispatch `test-author`. It writes MOCK + boundary suites from the acceptance
202
+ spec — never reads the logic. (No spec file, SPEC REVIEW, or conformance gate on
203
+ the non-TDD path — no public surface to contract. e2e-runner only if FRONTEND_PHASE.)
143
204
 
144
205
  =====================================================================
145
206
 
146
207
  ## GATE (both paths)
147
208
 
148
- PHASE GATE = current-phase REAL API suite passes AND (FRONTEND_PHASE) E2E passes
149
- WITH evidence captured AND the accumulated mock regression corpus stays green AND
150
- every docs/ENDPOINTS.md entry has a regression test AND every REACHABLE
151
- docs/DATAFLOW.md transition has a regression test (all checked at CLOSE).
209
+ PHASE GATE = current-phase BOUNDARY suite passes AND (FRONTEND_PHASE) the `ui`
210
+ boundary passes WITH evidence captured AND the accumulated mock regression corpus
211
+ stays green AND every docs/ENDPOINTS.md entry has a regression test AND (TDD)
212
+ `spec-conformance.sh` passed AND every REACHABLE docs/DATAFLOW.md transition has a
213
+ filled case in the phase spec (all checked at CLOSE).
152
214
  - GATE PASS -> go to CLOSE.
153
215
  - GATE BLOCKED (SERVICE UNAVAILABLE, STACK NOT READY, AZURE UNAVAILABLE, FLAKE)
154
216
  -> tell me, wait. Not a code bug. For AZURE UNAVAILABLE: suggest `/infra verify`.
@@ -156,17 +218,17 @@ docs/DATAFLOW.md transition has a regression test (all checked at CLOSE).
156
218
 
157
219
  ---
158
220
 
159
- ## 4. FIX
221
+ ## 8. FIX
160
222
 
161
223
  Dispatch `debugger` (isolated context) on the specific failure.
162
- - FIXED -> re-run TEST (and the regression corpus).
224
+ - FIXED -> re-run the boundary suite (and the regression corpus).
163
225
  - SERVICE UNAVAILABLE -> tell me, wait. Suggest `/infra verify` if Azure.
164
226
  - WARN (2 attempts failed) -> relay immediately, then let debugger finish attempt 3.
165
227
  - STUCK -> go to ESCALATE.
166
228
 
167
229
  ---
168
230
 
169
- ## 5. ESCALATE — circuit breaker. Mode B.
231
+ ## 9. ESCALATE — circuit breaker. Mode B.
170
232
 
171
233
  FIRST STUCK: STOP. Present to me: the problem, 3 failed hypotheses, the
172
234
  debugger's recommendation, the debug file path. Ask what to do. Wait. Options:
@@ -179,20 +241,25 @@ what to try next. Hand control to me.
179
241
 
180
242
  ---
181
243
 
182
- ## 6. CLOSE
244
+ ## 10. CLOSE
183
245
 
184
246
  REGRESSION + COVERAGE GATES (before closing — all FAIL HARD, do not close):
185
- - Run `scripts/regression.sh` (mock corpus). A failure BLOCKS close -> route to FIX.
247
+ - Run `bash scripts/regression.sh` (mock corpus). A failure BLOCKS close -> route to FIX.
186
248
  - ENDPOINTS COVERAGE: every `docs/ENDPOINTS.md` entry MUST have >=1 test in
187
249
  `tests/regression/`. Zero coverage -> FAIL HARD.
188
- - DATAFLOW COVERAGE (hard rule 14): every `docs/DATAFLOW.md` transition whose
189
- trigger is REACHABLE in the code shipped so far MUST have >=1 test in
190
- `tests/regression/`. Zero coverage on a reachable transition -> FAIL HARD.
191
- Unreachable transitions list as PENDING (not failed). IF IS_FINAL_PHASE: any
192
- transition still PENDING -> FAIL HARD (everything must be live by the last phase).
193
- - EVIDENCE (FRONTEND_PHASE only, hard rule 13): docs/evidence/e2e-phase-<n>/ must
194
- contain at least the per-UI-existence-assertion screenshots. Empty -> FAIL HARD.
195
- - IF IS_FINAL_PHASE: additionally run `scripts/regression.sh --real` (full real
250
+ - DATAFLOW COVERAGE (hard rule 14, re-seamed v2.2): every `docs/DATAFLOW.md`
251
+ transition whose trigger is REACHABLE in the code shipped so far MUST have >=1
252
+ FILLED CASE in docs/spec-phase-<n>.md. Zero coverage on a reachable transition ->
253
+ FAIL HARD. Unreachable transitions list as PENDING (not failed). IF
254
+ IS_FINAL_PHASE: any transition still PENDING -> FAIL HARD. (The case→test half is
255
+ already enforced by `spec-conformance.sh` at §6 every case-id is cited by a
256
+ boundary test, which by placement lands in tests/regression/.)
257
+ - EVIDENCE (hard rule 13): docs/evidence/e2e-phase-<n>/ must contain the boundary
258
+ run's evidence — per-UI-existence-assertion screenshots for `browser`, or the
259
+ captured boundary-run transcript for `cli`/`http`/`library-api`. Required whenever
260
+ this phase closes an E2E_KIND boundary (browser: FRONTEND_PHASE; others: the phase
261
+ ships/changes the outer surface). Empty when required -> FAIL HARD.
262
+ - IF IS_FINAL_PHASE: additionally run `bash scripts/regression.sh --real` (full real
196
263
  corpus). A failure blocks close.
197
264
 
198
265
  Mark phase `done` in docs/PLAN.md.
@@ -202,31 +269,35 @@ ARCHITECTURE / DATAFLOW SELF-CHECK:
202
269
  workflow rule? YES -> run `/log-decision`. NO -> state why not.
203
270
  - Did this phase add/change an object's STATE LIFECYCLE? YES -> update
204
271
  docs/DATAFLOW.md (hard rule 9) in this CLOSE, and confirm new reachable
205
- transitions are covered. NO -> state why not.
272
+ transitions are covered by a filled case. NO -> state why not.
206
273
 
207
274
  IF IS_FINAL_PHASE — FINAL CLOSE sequence:
208
275
 
209
276
  a. Run `/synthesize` — pass the signal that this is the final phase so the
210
277
  synthesizer runs the extended pass (OVERVIEW.md + README.md update).
211
278
 
212
- b. Read docs/ENDPOINTS.md. Surface a "READY TO USE" summary to me:
279
+ b. Surface a "READY TO USE" summary to me, shaped by `deploy_kind`:
213
280
  ```
214
281
  ✅ PROJECT COMPLETE
215
282
 
216
- Deployed at: <base URL from docs/INFRA.md "Deployed base URL">
283
+ <deploy_kind line:
284
+ cloud-deploy -> Deployed at: <base URL from docs/INFRA.md "Deployed base URL">
285
+ package-publish -> Published: <package name> @ <version> to <registry>
286
+ install-run-verified -> Verified install/run: <the exact commands, confirmed working>
287
+ none(<reason>) -> Not shipped: <reason>>
217
288
 
218
- ## Endpoints
219
- <paste the full docs/ENDPOINTS.md table>
289
+ ## Interface
290
+ <web/http: paste the full docs/ENDPOINTS.md table; cli: the command surface;
291
+ library: the public API surface>
220
292
 
221
293
  ## Quick start
222
- - Base URL: <URL>
223
- - Auth: <Bearer token / API key / none from ENDPOINTS.md>
224
- - Health check: GET <base URL>/health
294
+ <how to use it, per deploy_kind — base URL + auth + health check for a service;
295
+ install + invoke for a CLI; import + call for a library>
225
296
 
226
297
  ## Docs
227
- - Full endpoint catalogue: docs/ENDPOINTS.md
298
+ - Full interface catalogue: docs/ENDPOINTS.md
228
299
  - Object/state flow: docs/DATAFLOW.md
229
- - Infrastructure: docs/INFRA.md
300
+ - Infrastructure: docs/INFRA.md (if infra_needed)
230
301
  - Project history: docs/HISTORY.md
231
302
  ```
232
303
  Tell me the project is complete and ready to use.
@@ -246,6 +317,7 @@ After each step, update docs/STATE.md:
246
317
  phase: <n> (in progress)
247
318
  tdd: <true|false>
248
319
  frontend_phase: <true|false>
320
+ e2e_kind: <browser|cli|http|library-api — the bound value>
249
321
  completed: <steps done so far>
250
322
  next: <exact next step>
251
323
  blocker: <none or open issue>
@@ -3,7 +3,7 @@ description: Make a small, obvious change directly — no agent chain, no phase
3
3
  argument-hint: [what to change]
4
4
  ---
5
5
 
6
- Caveman ULTRA mode. Apply `karpathy-guidelines` skill.
6
+ compression: user (.claude/ref/compression.md). Apply `karpathy-guidelines` skill.
7
7
 
8
8
  Purpose: skip the orchestration tax for a 5-line fix.
9
9
 
@@ -3,7 +3,7 @@ description: Revise docs/PLAN.md when it no longer matches reality — add, cut,
3
3
  argument-hint: [what changed about the plan]
4
4
  ---
5
5
 
6
- Caveman ULTRA mode.
6
+ compression: user (.claude/ref/compression.md).
7
7
 
8
8
  Recommended: run from plan mode (Shift+Tab). Optional; the command stops for
9
9
  your approval regardless.
@@ -2,7 +2,7 @@
2
2
  description: Promote resolved issues and research findings from this project to the shared anpunkit-kb repo. Analyzes, proposes candidates for your review, then pushes approved entries.
3
3
  ---
4
4
 
5
- Caveman ULTRA mode. You are the ORCHESTRATOR.
5
+ compression: user (.claude/ref/compression.md). You are the ORCHESTRATOR.
6
6
 
7
7
  Purpose: share what this project learned with all future projects.
8
8
  Only resolved issues and completed research qualify. Open issues do NOT.
@@ -2,7 +2,7 @@
2
2
  description: Compress handoff docs, dedup the issue log, prune snapshots. Run before /clear.
3
3
  ---
4
4
 
5
- Caveman ULTRA mode.
5
+ compression: user (.claude/ref/compression.md).
6
6
 
7
7
  Trigger: end of a phase, or any time STATE.md / ISSUES.md feel bloated.
8
8
 
@@ -2,7 +2,7 @@
2
2
  description: Forced re-research after a circuit breaker. Stops flailing, re-routes to deep research with full memory of dead ends.
3
3
  ---
4
4
 
5
- Caveman ULTRA mode.
5
+ compression: user (.claude/ref/compression.md).
6
6
 
7
7
  Trigger: I chose "re-research" at a circuit breaker (see /phase step 5).
8
8
 
@@ -44,17 +44,11 @@ if [ -f docs/research/INDEX.md ]; then
44
44
  emit ""
45
45
  fi
46
46
 
47
- # 3c. infra status + auth nudge
47
+ # 3c. infra status
48
48
  if [ -f docs/INFRA.md ]; then
49
49
  INFRA_STATUS=$(grep -m1 '^phase 0:' docs/INFRA.md 2>/dev/null || true)
50
- PROJECT_HASH=$(echo "$PWD" | md5sum 2>/dev/null | cut -c1-8 || echo "anpunkit")
51
- MARKER="/tmp/anpunkit-auth-${USER:-unknown}-${PROJECT_HASH}"
52
- if [ ! -f "$MARKER" ]; then
53
- emit "## Azure infra present — auth check needed"
54
- emit "Run scripts/auth-setup.sh once this session before any Azure work."
55
- if echo "$INFRA_STATUS" | grep -qi 'NOT DONE'; then
56
- emit "Phase 0 not complete — run /infra to provision before starting phase 1."
57
- fi
50
+ if echo "$INFRA_STATUS" | grep -qi 'NOT DONE'; then
51
+ emit "## Infra: Phase 0 not complete — run /infra to provision before starting phase 1."
58
52
  emit ""
59
53
  fi
60
54
  fi
@@ -121,12 +115,12 @@ fi
121
115
 
122
116
  # 4. hard rule reminder
123
117
  emit "## RULES (enforced this session)"
124
- emit "- caveman ULTRA mode is active."
118
+ emit "- compression active: profile user (.claude/ref/compression.md); subagents run profile internal."
125
119
  emit "- before debugging ANY error: grep ISSUES.md AND research/INDEX.md first."
126
120
  emit "- debug attempts: WARN at 2; first hard-stop at 3 STOPS and asks you."
127
121
  emit "- end of every phase: run /synthesize, then /clear."
128
122
  emit "- small obvious change? use /quick, not /phase."
129
- emit "- Azure project? run scripts/auth-setup.sh once per session before Azure work."
123
+ emit "- infra project (infra_needed)? run the INFRA.md AUTH liveness command once per session before real/E2E work."
130
124
  if [ -f "$KB_CONFIG" ]; then
131
125
  emit "- KB active: researcher checks docs/.kb-snapshot.md before web search."
132
126
  emit "- learned something worth keeping? run /store-wisdom."