create-anpunkit 2.2.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 (63) 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 +13 -3
  5. package/template/.claude/agents/implementer.md +1 -1
  6. package/template/.claude/agents/infra-provisioner.md +53 -59
  7. package/template/.claude/agents/planner.md +35 -29
  8. package/template/.claude/agents/researcher.md +16 -1
  9. package/template/.claude/agents/spec-author.md +9 -1
  10. package/template/.claude/agents/synthesizer.md +1 -1
  11. package/template/.claude/agents/test-author.md +9 -1
  12. package/template/.claude/anpunkit-manifest.json +52 -113
  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 +37 -12
  17. package/template/.claude/commands/phase.md +50 -25
  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/AGENTS.md +115 -84
  27. package/template/CLAUDE.md +4 -9
  28. package/template/README.md +91 -122
  29. package/template/commands.src/infra.md +7 -3
  30. package/template/commands.src/log-decision.md +1 -1
  31. package/template/commands.src/log-issue.md +1 -1
  32. package/template/commands.src/overview.md +37 -12
  33. package/template/commands.src/phase.md +50 -25
  34. package/template/commands.src/quick.md +1 -1
  35. package/template/commands.src/replan.md +1 -1
  36. package/template/commands.src/store-wisdom.md +1 -1
  37. package/template/commands.src/synthesize.md +1 -1
  38. package/template/commands.src/unstuck.md +1 -1
  39. package/template/docs/DESIGN_LOG.md +222 -8
  40. package/template/knowledge/azure.md +161 -0
  41. package/template/knowledge/webapp.md +265 -0
  42. package/template/setup.sh +30 -111
  43. package/template/.claude/hooks/cursor-session-start.sh +0 -17
  44. package/template/.claude/skills/caveman/SKILL.md +0 -39
  45. package/template/.cursor/commands/infra.md +0 -82
  46. package/template/.cursor/commands/log-decision.md +0 -29
  47. package/template/.cursor/commands/log-issue.md +0 -23
  48. package/template/.cursor/commands/overview.md +0 -162
  49. package/template/.cursor/commands/phase.md +0 -296
  50. package/template/.cursor/commands/quick.md +0 -25
  51. package/template/.cursor/commands/replan.md +0 -73
  52. package/template/.cursor/commands/store-wisdom.md +0 -191
  53. package/template/.cursor/commands/synthesize.md +0 -22
  54. package/template/.cursor/commands/unstuck.md +0 -36
  55. package/template/.cursor/hooks.json +0 -14
  56. package/template/.cursor/rules/anpunkit.md +0 -11
  57. package/template/anpunkit.png +0 -0
  58. package/template/docker-compose.test.yml +0 -34
  59. package/template/e2e/global-setup.ts +0 -57
  60. package/template/index.html +0 -339
  61. package/template/playwright.config.ts +0 -28
  62. package/template/scripts/auth-setup.sh +0 -51
  63. package/template/scripts/e2e-stack.sh +0 -65
@@ -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."
@@ -0,0 +1,56 @@
1
+ # Compression profiles — kit-native, single source, always-on
2
+
3
+ > **What this file is.** The ONE place compression rules live (anti-drift
4
+ > invariant). `AGENTS.md` declares profile `user` for all human-facing output;
5
+ > every subagent prompt declares profile `internal` with a one-line pointer
6
+ > here. Nothing restates these rules.
7
+ >
8
+ > **Never model-invoked.** This is not a skill. There is no trigger phrase, no
9
+ > description matcher, no `/command`. Compression is mandatory behavior wired
10
+ > by pointers, not invoked by pattern-match (v2.3, §5.61).
11
+
12
+ ## Shared rules (both profiles)
13
+
14
+ Respond terse. All technical substance stay. Only fluff die.
15
+
16
+ Drop: articles (a/an/the), filler (just/really/basically/actually/simply),
17
+ pleasantries (sure/certainly/of course/happy to), hedging. Fragments OK. Short
18
+ synonyms (big not extensive, fix not "implement a solution for"). Abbreviate
19
+ common terms (DB/auth/config/req/res/fn/impl). Strip conjunctions. Use arrows
20
+ for causality (X -> Y). One word when one word enough.
21
+
22
+ Technical terms stay exact. Code blocks unchanged. Errors quoted exact.
23
+
24
+ Pattern: `[thing] [action] [reason]. [next step].`
25
+
26
+ Not: "Sure! I'd be happy to help you with that. The issue you're experiencing is likely caused by..."
27
+ Yes: "Bug in auth middleware. Token expiry check use `<` not `<=`. Fix:"
28
+
29
+ ## Profile: `user`
30
+
31
+ Human-facing output — the orchestrator / main session, all slash commands.
32
+
33
+ Shared rules apply, plus the **Auto-Clarity exception**: expand to full clarity
34
+ temporarily for security warnings, irreversible-action confirmations,
35
+ multi-step sequences where fragment order risks misread, and clarification
36
+ requests or repeated questions. Resume compressed after.
37
+
38
+ ## Profile: `internal`
39
+
40
+ Agent-to-agent output — subagent returns, dispatch text, summaries between
41
+ roles. Shared rules apply, harder: no clarity exception (no human reads this
42
+ mid-flight). Return-format blocks are structure — keep the structure, fill the
43
+ fields tersely.
44
+
45
+ ## Exemptions are structural, not here
46
+
47
+ Exact-output artifacts — fixture JSON, spec table rows, matcher tokens,
48
+ emitted test/harness code, `# spec:` citations, quoted errors — are exempted
49
+ by explicit ARTIFACT EXEMPTION gates declared in the emitter prompts
50
+ (`spec-author`, `test-author`, `e2e-runner`), never by a rule in this file
51
+ (§5.60). Compression governs prose; contract material is byte-precise.
52
+
53
+ ## Persistence
54
+
55
+ Active every response, both profiles. No drift back to filler over long
56
+ sessions. No toggle phrases exist — there is nothing to switch off.
@@ -5,7 +5,7 @@ description: Coding and debugging discipline. Apply on every coding and debug ta
5
5
 
6
6
  # karpathy-guidelines
7
7
 
8
- Apply on every coding + debug task. Caveman ULTRA mode.
8
+ Apply on every coding + debug task.
9
9
 
10
10
  ## Coding
11
11
  - Smallest change that works. No speculative abstraction. No "while I'm here".
@@ -1,15 +1,16 @@
1
1
  # anpunkit — portable agent methodology (single source of truth)
2
2
 
3
- <!-- ANPUNKIT-AGENTS-SENTINEL-v2.2 -->
4
- > **SENTINEL.** The HTML comment above (`ANPUNKIT-AGENTS-SENTINEL-v2.2`) is a
3
+ <!-- ANPUNKIT-AGENTS-SENTINEL-v2.3 -->
4
+ > **SENTINEL.** The HTML comment above (`ANPUNKIT-AGENTS-SENTINEL-v2.3`) is a
5
5
  > load-bearing marker. `setup.sh` greps for the bare prefix `ANPUNKIT-AGENTS-SENTINEL`
6
6
  > to confirm this file resolved on disk and was not clobbered. Do not remove or
7
7
  > rename it.
8
8
 
9
9
  > **What this file is.** The complete, tool-agnostic methodology for the anpunkit
10
10
  > workflow: the loop, the roles, the procedures, the rituals, and the hard rules.
11
- > This is the ONE place every rule lives. Claude Code, Cursor, and any tool that
12
- > reads the open `AGENTS.md` standard get the full methodology from here.
11
+ > This is the ONE place every rule lives. Claude Code reads the full methodology
12
+ > from here (as can any tool supporting the open `AGENTS.md` standard). v2.3 is
13
+ > Claude Code only.
13
14
 
14
15
  > **Anti-drift invariant (load-bearing).** Every rule lives in exactly ONE place:
15
16
  > this file. `CLAUDE.md` restates NO rule — it only maps roles to Claude-native
@@ -17,8 +18,10 @@
17
18
  > its automation may never contradict. Duplication between files is an
18
19
  > architectural defect, not a convenience.
19
20
 
20
- Caveman ULTRA mode always on. Apply the `karpathy-guidelines` skill (engineering
21
- discipline) on every coding and debugging task.
21
+ Compression is always on: profile `user` from `.claude/ref/compression.md`
22
+ governs all human-facing output; every subagent prompt declares profile
23
+ `internal`. Apply the `karpathy-guidelines` skill (engineering discipline) on
24
+ every coding and debugging task.
22
25
 
23
26
  -----
24
27
 
@@ -26,7 +29,7 @@ discipline) on every coding and debugging task.
26
29
 
27
30
  `design-research -> grill (×2) -> plan -> implement -> test -> deploy`, one
28
31
  VERTICAL SLICE per phase. Implement AND test a phase before the next. The last
29
- phase always includes deployment.
32
+ phase always includes DEPLOY_KIND completion.
30
33
 
31
34
  A phase runs in one of two orders, chosen at RESEARCH time by the TDD
32
35
  APPLICABILITY check (see Procedures → `phase`):
@@ -42,6 +45,17 @@ from the acceptance spec." Size is NOT the criterion. On ambiguity, default
42
45
  `TDD_PHASE=true` AND state the classification + reason so a human can override to
43
46
  non-TDD before SPEC fill fires.
44
47
 
48
+ **Project flags (adaptive loop, hard rule 10).** DECLARED once at `/overview` and
49
+ recorded in `docs/OVERVIEW.md`: `project_type`, `has_frontend` (+ root),
50
+ `infra_needed`, `e2e_kind` (browser | cli | http | library-api), `deploy_kind`
51
+ (cloud-deploy | package-publish | install-run-verified | none), `knowledge_docs`.
52
+ Per-phase bindings happen at RESEARCH (same idiom as `TDD_PHASE`): the effective
53
+ `E2E_KIND` (browser iff the phase is a frontend phase, else the baseline) and,
54
+ on the final phase, `DEPLOY_KIND` confirmation. Derivation is deterministic
55
+ (tables live in `commands.src/overview.md`); nothing is inferred mid-phase.
56
+ These branch the loop: Phase 0 exists iff `infra_needed`; the boundary run is
57
+ selected by `E2E_KIND`; the final phase completes `DEPLOY_KIND`.
58
+
45
59
  **SPEC REVIEW (v2.2)** is the mandatory human gate on every TDD phase, sitting
46
60
  UPSTREAM — between RESEARCH and SCAFFOLD, before any code. The reviewable,
47
61
  authoritative artifact is the SPEC, not the test. After RESEARCH, `spec-author`
@@ -69,26 +83,28 @@ real message against the running backend + real services (v2.1's "real API suite
69
83
  phase. A mock mirror is optional and shares the SAME fixture + comparator via a
70
84
  `TEST_MODE` flag, so it cannot assert different values than the boundary test. (§5.47)
71
85
 
72
- **E2E is mandatory, not a judgment call.** If the project is frontend-bearing
73
- (`has_frontend: true` in `docs/OVERVIEW.md`) AND the phase's `changes` touch the
74
- frontend root recorded in OVERVIEW.md, `ui` boundary cases MUST run before CLOSE.
75
- The trigger is a deterministic path match, not "does this phase feel frontend-y." A
86
+ **The boundary run is mandatory, not a judgment call (per E2E_KIND).** Every phase
87
+ that ships or changes its outer surface MUST run the boundary suite before CLOSE,
88
+ selected by the phase's bound `E2E_KIND`. **Browser** (`has_frontend: true` AND the
89
+ phase's `changes` touch the frontend root recorded in OVERVIEW.md a deterministic
90
+ path match, not "does this feel frontend-y"): `ui` boundary cases MUST run; a
76
91
  frontend file changed with no `ui` boundary run is a loud CLOSE failure. `e2e-runner`
77
92
  EMITS the Playwright assertion from each case's `ui` descriptor (it no longer authors
78
- blind) and retains screenshot-on-each-UI-existence-assertion as the visual backstop.
79
- On `has_frontend: false` projects there is no browser: `ui` case rows are invalid and
80
- all cases are `data` boundary. (§5.34, §5.54)
93
+ blind) and retains screenshot-on-each-UI-existence-assertion as the visual backstop
94
+ (browser practice + stack ritual: `knowledge/webapp.md`). **cli / http /
95
+ library-api**: the phase's real-mode boundary suite is the outer run, executed
96
+ against the shipped artifact with its transcript captured as evidence. On a project
97
+ whose `e2e_kind` is not `browser` there is no browser: `ui` case rows are invalid.
98
+ (§5.34, §5.54, §5.65)
81
99
 
82
100
  -----
83
101
 
84
102
  ## Roles (fresh-context workers)
85
103
 
86
- Each role is a fresh-context worker. Where the host tool supports named subagents
87
- (Claude Code natively; Cursor reads the same `.claude/agents/` files via its
88
- Claude-compatibility path), each maps to a definition file. Where it does not, the role
89
- degrades to a bounded sub-task that dumps its noise to a file and returns only a
90
- terse summary + path. Workers cannot address the user — only the orchestrator
91
- can. Escalation is at most two hops.
104
+ Each role is a fresh-context worker. On Claude Code each maps to a named subagent
105
+ definition file (`.claude/agents/*.md`). Each worker dumps its noise to a file and
106
+ returns only a terse summary + path. Workers cannot address the user — only the
107
+ orchestrator can. Escalation is at most two hops.
92
108
 
93
109
  - **researcher** — two modes. DESIGN: domain/constraint research before planning
94
110
  (service limits, API contracts, architectural constraints, cost surprises);
@@ -98,9 +114,10 @@ can. Escalation is at most two hops.
98
114
  datasource-<name>.md`. IMPL: per-phase codebase + service investigation. Checks
99
115
  the shared KB snapshot first (step 0). Writes findings to `docs/research/`;
100
116
  returns terse summary + path.
101
- - **planner** — research → vertical-slice `docs/PLAN.md`. Phase 0 (infra) always
102
- first; the last phase always contains the deploy task. For any phase whose
103
- `changes` touch the frontend root, the `acceptance` MUST include ≥1 UI-existence
117
+ - **planner** — research → vertical-slice `docs/PLAN.md`. Phase 0 (infra) first
118
+ iff `infra_needed: true`; the last phase always completes `deploy_kind`. For any
119
+ phase whose `changes` touch the frontend root, the `acceptance` MUST include ≥1
120
+ UI-existence
104
121
  criterion naming the specific user-visible interactive element introduced (not
105
122
  "page renders 200"). Populates each phase's expected `DATAFLOW.md` transitions.
106
123
  At `/overview` it ALSO enumerates the up-front CASE-NAME contract (§5.44): for
@@ -118,10 +135,12 @@ can. Escalation is at most two hops.
118
135
  facts, or research reveals an unlisted branch/failure-mode. `spec-author` is NOT
119
136
  `implementer` (author ≠ implementer invariant, §5.53) and never reads
120
137
  implementation logic.
121
- - **infra-provisioner** — generates Bicep, runs `az deployment what-if`, applies
122
- only on human approval, writes `docs/INFRA.md` + `.env.test`. Runs the one-time
123
- AUTH PROOF (§5.37): proves every credential the project's real tests will use is
124
- obtainable headlessly twice in a row (prime + reuse) with zero prompts.
138
+ - **infra-provisioner** — dispatched only when `infra_needed: true` (Phase 0).
139
+ Generates IaC, runs the provider's what-if/plan diff, applies only on human
140
+ approval, writes `docs/INFRA.md` + `.env.test`. Runs the one-time AUTH PROOF
141
+ (§5.37): proves every credential the project's real tests will use is obtainable
142
+ headlessly twice in a row (prime + reuse) with zero prompts. Cloud-specific
143
+ practice (Azure Bicep/`az`, Entra/MSAL) lives in `knowledge/azure.md`.
125
144
  - **implementer** — builds ONE phase. Two MODES for TDD phases (SCAFFOLD: stubs
126
145
  only; FILL: logic to green) plus a legacy full-build mode for non-TDD phases.
127
146
  Writes code, never tests. On TDD phases it reads the human-approved filled
@@ -136,13 +155,16 @@ can. Escalation is at most two hops.
136
155
  not invent assertions — there is nothing for a human to review at the test layer.
137
156
  Places contract/transition tests in `tests/regression/`, phase-local in
138
157
  `tests/phase-<n>/`; mock-vs-boundary is a `TEST_MODE` flag on the SAME test.
139
- - **e2e-runner** — now a Playwright EMITTER for `ui` boundary cases, not a blind
140
- author (§5.54). Reads `docs/INFRA.md` for the target and each `ui` case's
158
+ - **e2e-runner** — the browser boundary emitter (E2E_KIND `browser`), dispatched
159
+ only for frontend phases; a Playwright EMITTER for `ui` boundary cases, not a
160
+ blind author (§5.54). Reads `docs/INFRA.md` for the target and each `ui` case's
141
161
  `fixtures/<case-id>-ui.json` descriptor (`selector / assert / value`, closed
142
162
  vocabulary: `visible | text-equals | enabled | count`), and emits the assertion.
143
163
  Captures a screenshot at EACH UI-existence assertion regardless of pass/fail
144
164
  (capture-on-success) to `docs/evidence/e2e-phase-<n>/`, plus a summary in
145
- `docs/research/e2e-<slug>.md`.
165
+ `docs/research/e2e-<slug>.md`. Stack ritual + config templates: `knowledge/webapp.md`.
166
+ (Non-browser E2E_KINDs — cli/http/library-api — have no separate emitter; the
167
+ real-mode boundary suite is the outer run.)
146
168
  - **debugger** — debugs in an ISOLATED context. Writes a trace to
147
169
  `docs/research/debug-<slug>.md`; returns a summary.
148
170
  - **synthesizer** — compresses `docs/STATE.md` / `docs/ISSUES.md`, prunes
@@ -154,8 +176,8 @@ The orchestrator ROUTES. It does not implement or debug.
154
176
 
155
177
  ## Procedures (the slash-command set)
156
178
 
157
- Named procedures, each with a canonical body in `commands.src/<name>.md` and a
158
- generated copy per tool (`.claude/commands/`, `.cursor/commands/`).
179
+ Named procedures, each with a canonical body in `commands.src/<name>.md`, copied
180
+ to `.claude/commands/` at install.
159
181
 
160
182
  - **overview** — bootstrap a project: design-research → grill r1 → design-research
161
183
  → RESEARCH REVIEW → re-grill r2 (covers data structures, dataflow, and object
@@ -163,9 +185,11 @@ generated copy per tool (`.claude/commands/`, `.cursor/commands/`).
163
185
  confirmed datasource understanding) → planner → `PLAN.md` (Phase 0 always first)
164
186
  + skeleton `docs/spec-phase-<n>.md` case-name files. The end-of-`/overview` human
165
187
  approval is EXTENDED to confirm the cross-phase skeleton case-name set in the same
166
- surface (no new gate, §5.51).
167
- - **infra** provision/verify Azure infra: Bicep → what-if → human review → apply
168
- `INFRA.md` + `.env.test`. Runs the one-time AUTH PROOF.
188
+ surface (no new gate, §5.51). Also declares the project flags (`project_type`,
189
+ `infra_needed`, `e2e_kind`, `deploy_kind`, `knowledge_docs`).
190
+ - **infra** provision/verify infra (only when `infra_needed: true`): IaC →
191
+ what-if/plan → human review → apply → `INFRA.md` + `.env.test`. Runs the one-time
192
+ AUTH PROOF. Cloud specifics in `knowledge/azure.md`.
169
193
  - **phase [n]** — run one phase end-to-end with the circuit breaker. Chooses the
170
194
  TDD or non-TDD order at RESEARCH. PRE-FLIGHT runs the auth liveness check. TDD
171
195
  phases: `spec-author` fills the spec → `spec-staleness.sh` → SPEC REVIEW (human,
@@ -188,9 +212,8 @@ generated copy per tool (`.claude/commands/`, `.cursor/commands/`).
188
212
 
189
213
  ## Rituals (model-run fallback for hooks)
190
214
 
191
- Where the host tool can run lifecycle hooks (Claude Code, Cursor), these rituals
192
- are AUTOMATED by hook scripts and must NOT be run by hand. Where the tool cannot
193
- inject context, the model performs them itself.
215
+ On Claude Code these rituals are AUTOMATED by hook scripts and must NOT be run by
216
+ hand. Where a host tool cannot inject context, the model performs them itself.
194
217
 
195
218
  ### SESSION-OPEN (start / clear / compact-resume)
196
219
 
@@ -198,7 +221,7 @@ At the start of every session, before any other work, surface:
198
221
  1. git state (branch, uncommitted count, last 3 commits).
199
222
  2. `docs/STATE.md` — the current position. READ THIS FIRST.
200
223
  3. open items in `docs/ISSUES.md`.
201
- 4. `docs/research/INDEX.md` (research map) + infra status + auth nudge.
224
+ 4. `docs/research/INDEX.md` (research map) + infra status (when `infra_needed`).
202
225
  5. shared KB: pull latest + load `docs/.kb-snapshot.md` if `.claude/kb-config.json`
203
226
  exists.
204
227
  6. a one-line reminder of the hard rules below.
@@ -220,7 +243,7 @@ recover: current phase, next action, open blocker.
220
243
  attempts.
221
244
  4. End of phase -> synthesize -> context reset -> next phase.
222
245
  5. **PHASE GATE** = every current-phase spec case's BOUNDARY test passes (`data`:
223
- real HTTP/CLI/message; `ui`: Playwright with screenshot evidence) AND the
246
+ real HTTP/CLI/message; `ui` (browser E2E_KIND): Playwright with screenshot evidence) AND the
224
247
  accumulated mock regression corpus stays green AND every `docs/ENDPOINTS.md`
225
248
  entry has at least one test in `tests/regression/` AND `spec-conformance.sh`
226
249
  passed (no TBD, every case-id cited by a boundary test) AND every REACHABLE
@@ -230,20 +253,25 @@ recover: current phase, next action, open blocker.
230
253
  6. On TDD phases the behavioral contract is the human-approved
231
254
  `docs/spec-phase-<n>.md`; tests are GENERATED from its case rows (not authored):
232
255
  `test-author` emits a deep-equality harness against the shared fixtures for
233
- `data` cases, `e2e-runner` emits Playwright from the `ui` descriptor. Because the
256
+ `data` cases, `e2e-runner` emits Playwright from the `ui` descriptor (browser
257
+ E2E_KIND). Because the
234
258
  spec row and the test load the SAME fixture, a test physically cannot assert
235
259
  different values than the locked spec. Humans review the spec (SPEC REVIEW), never
236
260
  the tests.
237
- 7. Service outage is not a bug — `SERVICE UNAVAILABLE` / `AZURE UNAVAILABLE` /
238
- `STACK NOT READY` / `FLAKE` do not spend the debug budget. Only `LOGIC FAIL`
239
- reaches the debugger.
240
- 8. E2E auth = ROPC with a dedicated MFA-excluded test account. NEVER script the
241
- Microsoft login UI.
261
+ 7. Service outage is not a bug — `SERVICE UNAVAILABLE` / `STACK NOT READY` /
262
+ `FLAKE` (plus cloud-specific aliases like `AZURE UNAVAILABLE` per the knowledge
263
+ doc) do not spend the debug budget. Only `LOGIC FAIL` reaches the debugger.
264
+ 8. E2E auth = a dedicated headless-capable test credential. NEVER script an
265
+ interactive login UI. (Provider specifics — Azure ROPC + MFA-excluded account —
266
+ in `knowledge/azure.md`.)
242
267
  9. Architectural change (new/removed agent, hook, command, or a changed workflow
243
268
  rule)? -> run `log-decision` before closing. A phase that changes an object's
244
269
  state lifecycle MUST update `docs/DATAFLOW.md` in the same CLOSE.
245
- 10. Azure project? Run `scripts/auth-setup.sh` ONCE per session before any Azure
246
- work. Never debug an auth error without checking this first.
270
+ 10. **Deterministic flags.** `project_type` / `has_frontend` / `infra_needed` /
271
+ `e2e_kind` / `deploy_kind` / `knowledge_docs` are DECLARED at `/overview` and
272
+ recorded in `docs/OVERVIEW.md`; per-phase `TDD_PHASE` + effective `E2E_KIND`
273
+ are bound at RESEARCH and stated. No flag is ever inferred silently mid-phase;
274
+ changing one is a `/replan`-level event.
247
275
  11. **No-rationalization (scoped).** Do not, in order to dodge a gate:
248
276
  downgrade a TDD phase to non-TDD or route phase-worthy work through `quick`
249
277
  (RED gate); set `has_frontend: false` or keep a touched element out of the
@@ -261,12 +289,15 @@ recover: current phase, next action, open blocker.
261
289
  (§5.52). Unskippable on TDD phases; absent on the non-TDD path (no behavioral
262
290
  contract to review). Replaces the v2.1 human TEST REVIEW gate (removed — humans
263
291
  no longer review tests).
264
- 13. **Mandatory frontend E2E + evidence.** When `has_frontend: true` and the
265
- phase's `changes` touch the frontend root recorded in OVERVIEW.md, E2E MUST
266
- run. Each UI-existence assertion captures a screenshot (on success too) to
267
- `docs/evidence/e2e-phase-<n>/`. Frontend files changed with no E2E run, or a
268
- closed frontend phase with no evidence on disk, fails CLOSE hard. (Evidence is
269
- gitignored present-on-disk at CLOSE is the check, not committed history.)
292
+ 13. **Mandatory boundary run + evidence (per E2E_KIND).** Browser: when
293
+ `has_frontend: true` and the phase's `changes` touch the frontend root recorded
294
+ in OVERVIEW.md, E2E MUST run; each UI-existence assertion captures a screenshot
295
+ (on success too) to `docs/evidence/e2e-phase-<n>/`. Other kinds
296
+ (cli/http/library-api): the phase's boundary tests MUST run in real mode against
297
+ the outer surface with output captured to the same evidence dir. Boundary-relevant
298
+ files changed with no boundary run, or a closed phase with no evidence on disk,
299
+ fails CLOSE hard. (Evidence is gitignored — present-on-disk at CLOSE is the check,
300
+ not committed history.)
270
301
  14. **DATAFLOW transition coverage (re-seamed v2.2, §5.56).** Every transition in
271
302
  `docs/DATAFLOW.md` whose trigger is reachable in the code shipped so far MUST
272
303
  have ≥1 FILLED CASE in `docs/spec-phase-<n>.md` (was: ≥1 test in
@@ -282,12 +313,13 @@ recover: current phase, next action, open blocker.
282
313
  confirmed (baseline at `/overview`; per-phase delta-confirm for any
283
314
  new table/column). The mock suite still runs. No testing against data you
284
315
  never confirmed understanding of.
285
- 16. **Auth proof + liveness.** A one-time AUTH PROOF at `/infra` proves every
286
- credential the real tests use — Entra/MSAL app login AND external datasource
287
- credentials — is obtainable headlessly twice in a row (prime + reuse) with
288
- zero prompts; "reusable without interaction" means exactly this. Each `/phase`
289
- PRE-FLIGHT runs a cheap liveness check (token obtainable, not expired) before
290
- dispatching real/E2E. Both fail loud; the mock suite proceeds regardless.
316
+ 16. **Auth proof + liveness.** A one-time AUTH PROOF at `/infra` (when
317
+ `infra_needed`) proves every credential the real tests use — the app login AND
318
+ every external datasource credential — is obtainable headlessly twice in a row
319
+ (prime + reuse) with zero prompts; "reusable without interaction" means exactly
320
+ this. Each `/phase` PRE-FLIGHT runs a cheap liveness check (the command recorded
321
+ in `docs/INFRA.md ## AUTH`) before dispatching real/E2E. Both fail loud; the
322
+ mock suite proceeds regardless.
291
323
  17. **Spec staleness (§5.55).** `scripts/spec-staleness.sh <n>` runs immediately
292
324
  after `spec-author` fills the spec AND again at SPEC REVIEW entry. It re-hashes
293
325
  the current `PLAN.md` `acceptance:` line + the in-scope `DATAFLOW.md` transition
@@ -323,12 +355,19 @@ the KB. The kit works normally without a KB.
323
355
 
324
356
  - `docs/STATE.md` — current position. Small. Rewritten, not appended.
325
357
  - `docs/ISSUES.md` — error log. Deduped by synthesizer.
326
- - `docs/PLAN.md` — the phase plan. Phase 0 (infra) always first; last phase has
327
- the deploy task.
358
+ - `docs/PLAN.md` — the phase plan. Phase 0 (infra) first iff `infra_needed`; last
359
+ phase completes `deploy_kind`.
328
360
  - `docs/HISTORY.md` — one line per finished phase.
329
361
  - `docs/DESIGN_LOG.md` — kit architectural rationale (§5.x decision log).
330
362
  - `docs/OVERVIEW.md` — project scope. Written after the double-grill in `overview`.
331
- Carries `has_frontend` + the frontend root path, and the data/state-flow summary.
363
+ Carries the project flags (`project_type`, `has_frontend` + frontend root,
364
+ `infra_needed`, `e2e_kind`, `deploy_kind`, `knowledge_docs`) and the
365
+ data/state-flow summary.
366
+ - `knowledge/<usecase>.md` — preinstalled matured practice (`webapp.md`,
367
+ `azure.md`), consulted by `researcher` when listed in OVERVIEW `knowledge_docs`.
368
+ Ships use-case templates materialized per project on demand.
369
+ - `.claude/ref/compression.md` — kit-native compression profiles (`user`,
370
+ `internal`), single source, always-on. Not a skill.
332
371
  - `docs/DATAFLOW.md` — state-transition table per key object (`object | states |
333
372
  transition (from→to) | trigger | who writes | external system`). Living doc,
334
373
  grill-driven; drives the CLOSE transition-coverage gate. The data-side analogue
@@ -350,8 +389,8 @@ the KB. The kit works normally without a KB.
350
389
  NO per-project comparator code. (v2.2)
351
390
  - `docs/evidence/e2e-phase-<n>/` — screenshot evidence captured at each UI-existence
352
391
  assertion (gitignored; present-on-disk at CLOSE is the gate). (v2.1)
353
- - `docs/INFRA.md` — Azure infra manifest: resource IDs, endpoints, cost estimates,
354
- E2E target, AUTH PROOF result.
392
+ - `docs/INFRA.md` — infra manifest (when `infra_needed`): resource IDs, endpoints,
393
+ cost estimates, E2E target, `## AUTH` liveness command, AUTH PROOF result.
355
394
  - `docs/ENDPOINTS.md` — API/service endpoint catalogue. Maintained by implementer
356
395
  each phase. Drives the CLOSE coverage gate.
357
396
  - `docs/research/` — full research + debug files. `INDEX.md` is the searchable map.
@@ -359,10 +398,12 @@ the KB. The kit works normally without a KB.
359
398
  `debug-<slug>.md` (debugger traces), `datasource-<name>.md` (confirmed data
360
399
  understanding, referenced from DATAFLOW.md external rows).
361
400
  - `docs/.snapshots/` — pre-compact recovery markers (auto-pruned, gitignored).
362
- - `infra/` — Bicep templates. Committed (IaC audit trail). `infra/params.json`
363
- holds no secrets.
364
- - `e2e/`, `scripts/e2e-stack.sh`, `docker-compose.test.yml`, `playwright.config.ts`
365
- the E2E stack.
401
+ - `infra/` — IaC templates, generated per project by `infra-provisioner`. Committed
402
+ (audit trail). `infra/params.json` holds no secrets. (Azure Bicep specifics:
403
+ `knowledge/azure.md`.)
404
+ - `knowledge/webapp.md` owns the browser E2E stack templates (`playwright.config.ts`,
405
+ `e2e/global-setup.ts`, `docker-compose.test.yml`, `scripts/e2e-stack.sh`) —
406
+ materialized into the project only when a browser phase needs them, then user-owned.
366
407
  - `tests/phase-<n>/` — phase-local test suites.
367
408
  - `tests/regression/` — cross-phase contract tests (the regression corpus). Run by
368
409
  `scripts/regression.sh` (default mock; `--real` runs the real corpus).
@@ -370,7 +411,6 @@ the KB. The kit works normally without a KB.
370
411
  from the current `PLAN.md` acceptance line + `DATAFLOW.md` rows (rule 17). (v2.2)
371
412
  - `scripts/spec-conformance.sh <n>` — loud-fails on any remaining `TBD` or any
372
413
  case-id with no citing boundary test (rule 18). Runs between RED and GREEN. (v2.2)
373
- - `scripts/auth-setup.sh` — session Azure credential check. Run once per session.
374
414
  - `.claude/kb-config.json` — shared KB path + remote (optional, written by setup.sh).
375
415
  - `docs/.kb-snapshot.md` — KB INDEX loaded this session (auto-generated, gitignored).
376
416
 
@@ -378,18 +418,9 @@ the KB. The kit works normally without a KB.
378
418
 
379
419
  ## Capability matrix (which tools get what)
380
420
 
381
- - **Claude Code — full (reference implementation).** Generated commands; all three
382
- lifecycle hooks WITH context injection (SessionStart / PreCompact / SubagentStop);
383
- named subagents (`.claude/agents/*.md`); `@AGENTS.md` import; shared KB.
384
- - **Cursor full (verified against cursor.com/docs, 2026-06).** Generated
385
- commands (`.cursor/commands/`); the three lifecycle hooks via `.cursor/hooks.json`
386
- (sessionStart / preCompact / subagentStop) wired to the SAME shared hook scripts —
387
- sessionStart injects context via a JSON-envelope wrapper
388
- (`cursor-session-start.sh`); named subagents work natively because Cursor reads
389
- `.claude/agents/*.md` directly (no duplication); methodology via a
390
- `.cursor/rules/` pointer at this file. Known degradations: `model: haiku/opus`
391
- tiers are Claude-specific (Cursor falls back to inherit/compatible), and Cursor's
392
- preCompact is observational (the snapshot side-effect still runs; no context
393
- modification).
421
+ - **Claude Code — full (the only supported target, v2.3).** Generated commands
422
+ (`.claude/commands/`); all three lifecycle hooks WITH context injection
423
+ (SessionStart / PreCompact / SubagentStop); named subagents (`.claude/agents/*.md`);
424
+ `@AGENTS.md` import; shared KB.
394
425
  - **Everything else.** Reads this `AGENTS.md` if it supports the open standard.
395
- No generated adapters. Not claimed as supported in v2.0.
426
+ No generated adapters, no support claim (Cursor parity was dropped in v2.3, §5.69).
@@ -35,12 +35,6 @@ hooks (wired in `.claude/settings.json`) perform them:
35
35
  live position before compaction.
36
36
  - **SubagentStop** (`.claude/hooks/subagent-stop.sh`) writes a subagent trace.
37
37
 
38
- The same script bodies are wired for Cursor in `.cursor/hooks.json`; only the
39
- wiring differs (Cursor's sessionStart expects JSON output, so it runs the shared
40
- body through the `cursor-session-start.sh` envelope wrapper). Cursor also reads
41
- `.claude/agents/*.md` natively for subagents — one set of role files serves both
42
- tools.
43
-
44
38
  ## /clear keeps hooks
45
39
 
46
40
  `/clear` does not drop hooks — the wiring lives in `settings.json`, not in
@@ -48,9 +42,10 @@ context. After `/clear`, SessionStart fires again and re-injects state.
48
42
 
49
43
  ## Skills resolution
50
44
 
51
- - `karpathy-guidelines` — kit-owned (`.claude/skills/karpathy-guidelines/`).
52
- - `caveman`, `grill-me` — global-authoritative if installed; the vendored copies
53
- under `.claude/skills/` are a fallback only.
45
+ - `karpathy-guidelines`, `grill-me` — kit-owned (`.claude/skills/…`), the sole
46
+ source. No "global-authoritative if installed" resolution.
47
+ - Compression is kit-native (`.claude/ref/compression.md`), NOT a skill — always
48
+ on, single source, never model-invoked.
54
49
 
55
50
  ## Platform notes
56
51