create-ccc-tutor 0.1.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 (106) hide show
  1. package/README.md +41 -0
  2. package/bin/cli.js +76 -0
  3. package/package.json +28 -0
  4. package/template/.claude/commands/abandon.md +7 -0
  5. package/template/.claude/commands/add-anti-flag.md +7 -0
  6. package/template/.claude/commands/add-constitution-clause.md +7 -0
  7. package/template/.claude/commands/audit-spec.md +7 -0
  8. package/template/.claude/commands/commit.md +7 -0
  9. package/template/.claude/commands/constitution-edit.md +7 -0
  10. package/template/.claude/commands/db-schema.md +7 -0
  11. package/template/.claude/commands/exam.md +66 -0
  12. package/template/.claude/commands/execution-plan.md +7 -0
  13. package/template/.claude/commands/feature-draft.md +7 -0
  14. package/template/.claude/commands/handoff.md +7 -0
  15. package/template/.claude/commands/implement.md +7 -0
  16. package/template/.claude/commands/init.md +7 -0
  17. package/template/.claude/commands/next.md +7 -0
  18. package/template/.claude/commands/offload.md +7 -0
  19. package/template/.claude/commands/pickup.md +7 -0
  20. package/template/.claude/commands/recall.md +7 -0
  21. package/template/.claude/commands/remember.md +7 -0
  22. package/template/.claude/commands/slide.md +87 -0
  23. package/template/.claude/commands/spec-finalize.md +7 -0
  24. package/template/.claude/commands/test-fix.md +7 -0
  25. package/template/.claude/commands/uninstall.md +7 -0
  26. package/template/.claude/settings.json +161 -0
  27. package/template/.claude-plugin/plugin.json +41 -0
  28. package/template/.codex/config.toml +24 -0
  29. package/template/.codex/hooks.json +4 -0
  30. package/template/.codex/install-skills.sh +18 -0
  31. package/template/.codex/skills/exam/SKILL.md +61 -0
  32. package/template/.codex/skills/slide/SKILL.md +69 -0
  33. package/template/.harness/agents/README.md +70 -0
  34. package/template/.harness/agents/_template/junior-agent-template.md +116 -0
  35. package/template/.harness/agents/backend-reviewer.md +153 -0
  36. package/template/.harness/agents/frontend-reviewer.md +158 -0
  37. package/template/.harness/agents/security-reviewer.md +148 -0
  38. package/template/.harness/agents/test-fixer.md +147 -0
  39. package/template/.harness/docs/doc-sync.md +29 -0
  40. package/template/.harness/docs/git-hygiene.md +56 -0
  41. package/template/.harness/docs/spec-model.md +47 -0
  42. package/template/.harness/docs/tool-map.md +120 -0
  43. package/template/.harness/docs/workflow.md +59 -0
  44. package/template/.harness/scripts/README.md +70 -0
  45. package/template/.harness/scripts/auditor-gate.sh +388 -0
  46. package/template/.harness/scripts/bootstrap-check.sh +103 -0
  47. package/template/.harness/scripts/budget-monitor.sh +223 -0
  48. package/template/.harness/scripts/check-prereqs.sh +165 -0
  49. package/template/.harness/scripts/checkpoint-recall.sh +136 -0
  50. package/template/.harness/scripts/checkpoint-write.sh +281 -0
  51. package/template/.harness/scripts/decision-log-append.sh +90 -0
  52. package/template/.harness/scripts/env-check.sh +286 -0
  53. package/template/.harness/scripts/format-edit.sh +80 -0
  54. package/template/.harness/scripts/lint-bans.sh +110 -0
  55. package/template/.harness/scripts/memory-archive.sh +129 -0
  56. package/template/.harness/scripts/memory-recall.sh +197 -0
  57. package/template/.harness/scripts/memory-snapshot.sh +124 -0
  58. package/template/.harness/scripts/post-migration.sh +58 -0
  59. package/template/.harness/scripts/precommit-cycles.sh +74 -0
  60. package/template/.harness/scripts/precommit-typecheck.sh +69 -0
  61. package/template/.harness/scripts/scratchpad-recall.sh +83 -0
  62. package/template/.harness/scripts/scratchpad-update.sh +39 -0
  63. package/template/.harness/scripts/standalone-bootstrap.md +443 -0
  64. package/template/.harness/skills/abandon/SKILL.md +157 -0
  65. package/template/.harness/skills/add-anti-flag/SKILL.md +205 -0
  66. package/template/.harness/skills/add-constitution-clause/SKILL.md +244 -0
  67. package/template/.harness/skills/audit-spec/SKILL.md +395 -0
  68. package/template/.harness/skills/commit/SKILL.md +270 -0
  69. package/template/.harness/skills/constitution-edit/SKILL.md +292 -0
  70. package/template/.harness/skills/db-schema/SKILL.md +145 -0
  71. package/template/.harness/skills/db-schema/references/methodology.md +202 -0
  72. package/template/.harness/skills/execution-plan/SKILL.md +346 -0
  73. package/template/.harness/skills/feature-draft/SKILL.md +426 -0
  74. package/template/.harness/skills/handoff/SKILL.md +211 -0
  75. package/template/.harness/skills/implement/SKILL.md +355 -0
  76. package/template/.harness/skills/init/SKILL.md +805 -0
  77. package/template/.harness/skills/next/SKILL.md +245 -0
  78. package/template/.harness/skills/offload/SKILL.md +134 -0
  79. package/template/.harness/skills/pickup/SKILL.md +213 -0
  80. package/template/.harness/skills/recall/SKILL.md +159 -0
  81. package/template/.harness/skills/remember/SKILL.md +205 -0
  82. package/template/.harness/skills/spec-finalize/SKILL.md +196 -0
  83. package/template/.harness/skills/test-fix/SKILL.md +363 -0
  84. package/template/.harness/skills/uninstall/SKILL.md +370 -0
  85. package/template/.harness/state/install.json +83 -0
  86. package/template/AGENTS.md +262 -0
  87. package/template/CCC_MAGI_LICENSE +201 -0
  88. package/template/CCC_MAGI_README.md +986 -0
  89. package/template/CLAUDE.md +658 -0
  90. package/template/codex.md +39 -0
  91. package/template/constitution.md +164 -0
  92. package/template/course/README.md +15 -0
  93. package/template/course/course_code(example)/exam/README.md +2 -0
  94. package/template/course/course_code(example)/slide/slide_example-1.pdf +40 -0
  95. package/template/course/course_code(example)/slide/slide_example-2.pdf +40 -0
  96. package/template/docs/features/slide-query-implementation.md +79 -0
  97. package/template/docs/features/slide-query.md +211 -0
  98. package/template/docs-harness/README.md +42 -0
  99. package/template/docs-harness/adoption-playbook.md +373 -0
  100. package/template/docs-harness/ccc-step1-driver-template.md +288 -0
  101. package/template/docs-harness/cli-configs-README.md +78 -0
  102. package/template/docs-harness/context-architecture-v2.md +249 -0
  103. package/template/docs-harness/design-spec.md +437 -0
  104. package/template/docs-harness/memory-layer.md +135 -0
  105. package/template/docs-harness/retrospective-notes.md +204 -0
  106. package/template/gitignore +106 -0
@@ -0,0 +1,805 @@
1
+ ---
2
+ name: init
3
+ description: |
4
+ Project configuration. Fills constitution.md, scaffolds .harness/ + .claude/ + .codex/, writes install.json (the "configured" marker). Supports two onboarding modes:
5
+ - **Simple** (5 questions, ~3 min) — defaults for 11 slots; great for solo / hackathon / side project
6
+ - **Pro** (16 questions, ~15 min) — full identity contract for serious + team projects
7
+
8
+ After description is captured, runs a **suggestion engine** that pre-fills sensible defaults for remaining slots based on what the user just described.
9
+
10
+ Trigger when the user:
11
+ - Invokes /init, /init --simple, /init --pro, /init --upgrade-to-pro
12
+ - Says "set up the harness" / "配置 CCC-MAGI" / "harness 설치"
13
+ - Says "I want to upgrade to pro mode" / "升级到专业版" / "切到专业模式" / "现在我想答完所有问题" / "プロモードに切り替える" / "프로 모드로 업그레이드" → invoke `/init --upgrade-to-pro`
14
+ - Arrives from the bootstrap flow (standalone-bootstrap.md or CCC's bundled Step 1 driver)
15
+ argument-hint: [--simple | --pro | --upgrade-to-pro] [--ccc-driven] [--config <yaml>] [--force]
16
+ ---
17
+
18
+ # /init
19
+
20
+ Drive the configuration step of harness setup — what CCC's flow calls "Step 2".
21
+
22
+ > *Constitutional basis: this skill fills constitution.md (Section 2 — Project Identity) with the user's specific values, then writes `.harness/state/install.json` as the canonical "configured" marker that all other systems (CCC's session-open check, CLAUDE.md's Bootstrap Status Check, the AI-driven detection in `standalone-bootstrap.md`) use to know the harness is ready.*
23
+
24
+ ## Language Awareness
25
+
26
+ This skill's instructions are in English (more stable + token-efficient). When you ask the 16 L0 questions of the user, ask in their OS locale's language. See `CLAUDE.md § Language Awareness` (detect via `locale` / `$LANG`; default English).
27
+
28
+ The question templates below are written in English; translate them to the user's locale when actually displaying. Slot VALUES that the user types (project name, description, etc.) get written verbatim to constitution.md — don't translate user-entered content.
29
+
30
+ **TodoWrite items**: if you use the TodoWrite tool to track your /init progress (Step 0 / Step 1 / etc.), **write the `content` field in the user's OS locale**, not in English. The TodoWrite list is shown to the user — keeping it in English while the user is conversing in Chinese / Japanese / Korean breaks the locale contract. Internal field names (`status`, `activeForm`) stay as-is; only the user-readable `content` translates.
31
+
32
+ ## Where this skill sits in the bootstrap flow
33
+
34
+ ```
35
+ Existing harness present?
36
+ ↓ (handled by:)
37
+ Step 1 — Bootstrap standalone-bootstrap.md OR CCC bundled Step 1 driver
38
+ - Detect existing harness
39
+ - 3-option menu (archive / overwrite / decline)
40
+ - Archive or delete other configs
41
+
42
+ Step 2 — /init (this skill)
43
+ - Project mode detection
44
+ - L0 question flow
45
+ - Slot filling
46
+ - Template rendering
47
+ - Validation
48
+ - Write install.json ← single canonical "configured" marker
49
+
50
+ Harness fully usable
51
+ ```
52
+
53
+ **This skill does NOT run detection.** If you arrive here and detection hasn't happened, you may be in one of these states:
54
+
55
+ - **Standalone user who jumped straight to `/init` skipping bootstrap** → that's their choice; warn but proceed
56
+ - **CCC-driven invocation** → CCC already ran detection in Step 1; skip detection
57
+ - **Force re-init (`--force`)** → user explicitly wants to reconfigure; skip detection
58
+
59
+ ## What this skill produces
60
+
61
+ ```
62
+ <project-root>/
63
+ ├── constitution.md ← filled with L0 slot values
64
+ ├── CLAUDE.md ← references constitution; bootstrap header intact
65
+ ├── AGENTS.md ← auditor context, anti-flag rules placeholder
66
+ ├── .harness/
67
+ │ ├── skills/ ← copied from outcome/skills/
68
+ │ ├── agents/ ← copied from outcome/agents/ (filtered by enabled plugins)
69
+ │ ├── scripts/ ← copied from outcome/scripts/, chmod +x
70
+ │ ├── state/
71
+ │ │ └── install.json ← ★ written at Step 5 — completion marker
72
+ │ └── audits/ ← empty, for /audit-spec snapshots
73
+ ├── .claude/
74
+ │ └── settings.json ← from outcome/cli-configs/claude/settings.json
75
+ ├── .codex/
76
+ │ ├── config.toml ← from outcome/cli-configs/codex/config.toml
77
+ │ └── hooks.json ← from outcome/cli-configs/codex/hooks.json
78
+ └── docs/features/ ← empty (or {{spec_dir}} per user choice)
79
+ ```
80
+
81
+ ## Modes
82
+
83
+ | Mode | How it's triggered | What it asks | Time | Defaults |
84
+ |------|---------------------|----|----|----|
85
+ | **Simple (default)** | `/init` or `/init --simple` | **5 questions** (identity essentials + audit + tests) | ~3 min | 11 slots get smart defaults from description + auto-detect |
86
+ | **Pro** | `/init --pro` or user picks Pro at the mode prompt | **16 questions** (full identity contract) | ~15 min | 0 — every L0 slot explicitly answered |
87
+ | **Upgrade Simple → Pro** | `/init --upgrade-to-pro` or user says "升级到专业版"/"upgrade to pro" | The **11 questions Simple skipped** (5 already-answered ones stay) | ~10 min | Reads existing install.json; appends instead of overwriting |
88
+ | **CCC-driven** | CCC's HarnessWizard invokes `/init --ccc-driven --config <yaml>` | Reads answers from `<yaml>`; only asks for missing fields | varies | per yaml |
89
+ | **Force re-init** | `/init --force` | Bypasses "already configured" guard; re-runs full Simple or Pro flow | 3-15 min | overwrites prior install |
90
+
91
+ ### Picking mode at run time
92
+
93
+ When `/init` is invoked WITHOUT explicit `--simple` / `--pro` flag, **ask the user once at the very start** (in their OS locale):
94
+
95
+ ```
96
+ ─── Choose onboarding mode ─────────────────────────────────────
97
+
98
+ Welcome to CCC-MAGI. Pick how thorough you want the setup:
99
+
100
+ [1] Simple — 5 questions, ~3 minutes
101
+ Smart defaults for everything else. Great for:
102
+ • Solo / side projects
103
+ • Hackathons / weekend hacks
104
+ • "Just want to try it"
105
+ You can upgrade to Pro later anytime.
106
+
107
+ [2] Pro — 16 questions, ~15 minutes
108
+ Full project identity contract. Great for:
109
+ • Team projects (3+ devs)
110
+ • Long-term maintenance projects
111
+ • Compliance-sensitive work (GDPR / HIPAA / PCI)
112
+ • Anything you'll explain to a stakeholder later
113
+
114
+ >
115
+ ```
116
+
117
+ If user says "1" / "simple" / "简单" / "シンプル" → Simple mode.
118
+ If user says "2" / "pro" / "professional" / "专业" / "プロ" → Pro mode.
119
+ If user picks Simple, remind once at the end: *"You can upgrade to Pro anytime by saying 'upgrade to pro' or running `/init --upgrade-to-pro`."*
120
+
121
+ ---
122
+
123
+ ## Step 0 — Precondition check (do not skip)
124
+
125
+ Before doing anything, check the current state:
126
+
127
+ ```bash
128
+ test -f .harness/state/install.json
129
+ ```
130
+
131
+ ### If install.json EXISTS
132
+
133
+ Surface to the user (display in user's locale):
134
+
135
+ ```
136
+ ⚠️ Detected an existing CCC-MAGI install:
137
+ - .harness/state/install.json (written <date>)
138
+ - mode: <greenfield|brownfield>
139
+ - version: <version>
140
+
141
+ What do you want?
142
+ [1] Cancel — keep current install
143
+ [2] Re-configure — re-run /init from scratch (existing constitution.md will be overwritten)
144
+ [3] Edit a single slot — abort /init, use /constitution-edit instead
145
+
146
+ Please enter 1 / 2 / 3:
147
+ ```
148
+
149
+ - 1 → exit cleanly
150
+ - 2 → continue (or require `--force` flag, depending on safety preference; default: ask user to confirm)
151
+ - 3 → exit; remind user about `/constitution-edit`
152
+
153
+ ### If install.json DOES NOT EXIST but `.harness/` is present
154
+
155
+ This is a **partial install** (interrupted previous /init OR bootstrap-only state).
156
+
157
+ ```
158
+ ⚠️ .harness/ exists but install.json is missing.
159
+ This means either:
160
+ (a) A previous /init was interrupted partway through
161
+ (b) Bootstrap ran but /init has not yet been invoked
162
+
163
+ Recommended action: clean restart.
164
+
165
+ Continue anyway and overwrite partial state? [yes / clean / abort]
166
+ yes — proceed, treat existing files as scratch
167
+ clean — rm -rf .harness/, constitution.md (placeholder), then proceed fresh
168
+ abort — stop, let me investigate manually
169
+ ```
170
+
171
+ Wait for user response. **Restart policy** (per CCC_harness_flow.md decision 6): no Resume; clean state then re-run.
172
+
173
+ ### If neither exists (clean state)
174
+
175
+ Proceed to Step 1.
176
+
177
+ ---
178
+
179
+ ## Step 1 — Detect project shape (greenfield vs brownfield)
180
+
181
+ Check the project root:
182
+
183
+ ```
184
+ Greenfield indicators:
185
+ - No source files (no src/, app/, lib/, etc.)
186
+ - No package manifest (no package.json, pyproject.toml, go.mod, Cargo.toml)
187
+ - No git history beyond initial commit
188
+ - Empty or near-empty directory
189
+
190
+ Brownfield indicators:
191
+ - Source code present
192
+ - One or more manifests
193
+ - Git log with multiple commits
194
+ - Existing tooling configs (tsconfig.json, .eslintrc, etc.)
195
+ ```
196
+
197
+ Compute a confidence score; if ambiguous, ask the user (display in user's locale):
198
+
199
+ ```
200
+ Detected project state: <greenfield | brownfield | uncertain>
201
+ Reason: <one-line>
202
+
203
+ Is this correct?
204
+ [1] Yes (proceed as <detected>)
205
+ [2] No, let me choose:
206
+ a. greenfield — brand new project, starting from scratch
207
+ b. brownfield — existing project with code; scan existing structure
208
+
209
+ Enter 1 / 2a / 2b:
210
+ ```
211
+
212
+ Record the result as `project_mode`. The Step 2 question flow uses different defaults per mode.
213
+
214
+ ---
215
+
216
+ ## Step 2 — L0 slot question flow
217
+
218
+ The slot inventory and ordering live in `constitution.md` § Slot registry (17 L0 slots — Block A through Block E below). What changes between modes is **how many of those 17 get explicitly asked vs defaulted**.
219
+
220
+ ### Question inventory (full Pro mode = 16 asked + 1 auto)
221
+
222
+ | # | Slot | Block | Mode coverage | Default if skipped (Simple mode) |
223
+ |---|---|---|---|---|
224
+ | Q1 | `project_name` | A | Simple + Pro | auto-detect from manifest |
225
+ | Q2 | `project_description` | A | **Simple + Pro** (always) | — (required, no default) |
226
+ | Q3 | `project_stage` | A | Pro only | `early` |
227
+ | Q4 | `project_scale_target` | A | Pro only | "small / personal" (from description) |
228
+ | Q5 | `team_size` | B | Simple + Pro | `solo` |
229
+ | Q6 | `primary_concern` | B | Pro only | inferred from description (keyword extract) |
230
+ | Q7 | `out_of_scope_items` | B | Pro only | `[]` (empty) |
231
+ | Q8 | `auditor_model` | C | Simple + Pro | (asked; see CLI detection below) |
232
+ | Q9 | `language_mode` | C | Pro only | `plain` |
233
+ | Q10 | `project_audience` | D | Pro only | "general users of {{project_name}}" |
234
+ | Q11 | `project_non_goals` | D | Pro only | `[]` (empty) |
235
+ | Q12 | `project_compliance` | D | Pro only | `none` |
236
+ | Q13 | `project_performance_floor` | D | Pro only | "no formal floor yet" |
237
+ | Q14 | `project_identity_other` | D | Pro only | `[]` (empty) |
238
+ | Q15 | `spec_dir` | E | Pro only | `docs/features/` |
239
+ | Q16 | `implementation_dir` | E | Pro only | `docs/features/` |
240
+ | L1.test | `test_required` | — | Simple + Pro | `true` |
241
+
242
+ **Simple mode = 5 asked**: Q1 + Q2 + Q5 + Q8 + L1.test (test_required)
243
+ **Pro mode = 16 asked**: all 16 above
244
+ **Upgrade Simple→Pro = 11 asked**: everything except the 5 Simple already covered
245
+
246
+ ---
247
+
248
+ ### Step 2A — Suggestion engine (fires after Q2 — description capture)
249
+
250
+ After the user answers Q2 (`project_description`), pause the question flow and run a **suggestion engine** before continuing:
251
+
252
+ > **Internal prompt** (do NOT show to user — runs in your head before the next question): *"Based on the project description '<their answer>', what are sensible default values for: project_stage, project_scale_target, primary_concern, project_audience, project_non_goals, project_compliance, project_performance_floor? Give 2-3 concrete options for each. Mark the most likely with ⭐."*
253
+
254
+ Generate the suggestions in **one pass** (all slots at once — saves tokens and reveals AI's understanding consistency to user).
255
+
256
+ Then for each subsequent question (Q3-Q16), present the question + show the suggestion.
257
+
258
+ #### Presentation rule (HARD — for UX consistency)
259
+
260
+ **For multi-choice questions** (Pattern A below; the labeled option lists in Pattern B; the menus in Simple mode Q3/Q4/Q5; the 3-option auditor menu in Step 2C; `[Y]/[n]` confirmations):
261
+
262
+ → **Use Claude Code's `AskUserQuestion` tool**, not plain-text `[1] [2] [3]` prompts.
263
+
264
+ `AskUserQuestion` renders an interactive arrow-key menu — significantly better UX for non-technical CEOs than asking them to type letters or numbers (no typo risk, language-independent, visual feedback, accessible). The text examples below (e.g., `[a] early [b] beta ...`) describe the **content** of options, not the literal rendering.
265
+
266
+ **For free-text questions** (Pattern B's "[E] write your own" branch; Pattern C's free-form input; the project_description Q2 which has no fixed options):
267
+
268
+ → Plain text Q&A is correct — the user is typing, not picking.
269
+
270
+ **Why this matters**: CCC-MAGI's audience includes non-technical founders. The arrow-key menu lets them scan options and pick without touching letters. Without this rule, AI behavior is inconsistent across sessions (real bug observed in v0.10.2 testing: same `/init` flow rendered as text on macOS vs interactive menus on Windows). Make every session feel like the Windows session did.
271
+
272
+ #### Pattern A — Fixed-options question (multiple choice with highlighted default)
273
+
274
+ ```
275
+ Q3. Project stage?
276
+ Based on your description, I'd guess: ⭐ early
277
+
278
+ [a] early — just starting, no users yet ⭐ suggested
279
+ [b] beta — internal testing / small user group
280
+ [c] prod — publicly released, has users
281
+ [d] scale — at scale, operations-mature
282
+ > [Enter to accept ⭐ / type a-d for different / type "?" for why]
283
+ ```
284
+
285
+ If user types `?`, show the reasoning: *"You said '<description>' — the words 'just starting' / 'side project' / similar suggest pre-launch state. If users are already using it, pick beta or prod."*
286
+
287
+ #### Pattern B — Open-ended question (3-5 example values + free input)
288
+
289
+ ```
290
+ Q6. What is this harness primarily protecting?
291
+ Based on your description, the most likely concerns are:
292
+
293
+ [A] data integrity (no lost messages / files)
294
+ [B] real-time sync reliability (multi-device consistency)
295
+ [C] user privacy (chat content stays private)
296
+ [D] velocity (ship features fast) ← uncommon for this kind of project
297
+ [E] write your own
298
+
299
+ Can pick multiple (e.g., "A+B") or single. >
300
+ ```
301
+
302
+ User picks letters, types free text, or combinations like `A+C`.
303
+
304
+ #### Pattern C — Confirmatory question (suggested value pre-filled, edit if needed)
305
+
306
+ ```
307
+ Q10. Who do you serve? (one sentence)
308
+ ⭐ Suggested based on description:
309
+ "remote engineering teams at 5-50 person companies"
310
+
311
+ > [Enter to accept / type your own]
312
+ ```
313
+
314
+ ### Step 2B — Simple mode (5 questions)
315
+
316
+ After mode pick = Simple, run only the 5 essential questions, but still run the suggestion engine after Q2.
317
+
318
+ Display in user's locale:
319
+
320
+ ```
321
+ ─── Simple Setup · 5 questions, ~3 minutes ─────────────────────
322
+
323
+ Q1/5. Project name
324
+ Detected from manifest: "my-app"
325
+ > [Enter to accept / type new]
326
+
327
+ Q2/5. One-sentence project description (plain language, no jargon)
328
+ e.g.: "team chat app with file sharing for remote engineers"
329
+ >
330
+
331
+ [Suggestion engine runs here — produces defaults for the 11 skipped slots]
332
+
333
+ Q3/5. Team size?
334
+ Based on description, suggesting: ⭐ small (2-5 people)
335
+ [a] solo [b] small ⭐ [c] large
336
+ >
337
+
338
+ Q4/5. Auto-write tests when implementing features?
339
+ [Y] Yes (recommended — MAGI Tester runs at Stage 6)
340
+ [n] No (skip Stage 6 entirely)
341
+ >
342
+
343
+ Q5/5. Cross-model auditor (MAGI Verdict)?
344
+ [CLI detection results here — see Step 2C below]
345
+ >
346
+
347
+ ✓ Done. 11 other slots set to smart defaults. Run /init --upgrade-to-pro
348
+ anytime (or say "upgrade to pro") to answer them properly.
349
+ ```
350
+
351
+ ### Step 2C — CLI detection for the auditor question (Q5/Q8)
352
+
353
+ Run this detection logic before asking the auditor question:
354
+
355
+ ```bash
356
+ HAS_CLAUDE=$(command -v claude >/dev/null && echo yes || echo no)
357
+ HAS_CODEX=$(command -v codex >/dev/null && echo yes || echo no)
358
+ HAS_GEMINI=$(command -v gemini >/dev/null && echo yes || echo no)
359
+ CURRENT_CLI= # detect parent process — likely claude or codex
360
+ ```
361
+
362
+ Branch on results:
363
+
364
+ **Branch 1 — Both Claude + Codex installed** (Tier 1 ideal):
365
+ ```
366
+ You have both Claude Code and Codex CLI. Pick auditor:
367
+ [1] ⭐ Codex review (use Codex CLI as auditor, default gpt-5.5)
368
+ [2] Same model (current writer also reviews, fresh context)
369
+ [3] Skip audit entirely (⚠️ violates Universal Core — NOT recommended)
370
+ >
371
+ ```
372
+
373
+ **Branch 2 — Only your current CLI installed**:
374
+ ```
375
+ You're using Claude Code. Codex CLI is not installed.
376
+ [1] Install Codex CLI now, then use Codex review (default gpt-5.5)
377
+ (1 command — opens https://github.com/openai/codex)
378
+ [2] Same model (current writer also reviews, fresh context)
379
+ [3] Skip audit entirely (⚠️ NOT recommended)
380
+ >
381
+ ```
382
+
383
+ **Branch 3 — Some other CLI** (Cursor / Cline / Aider / Gemini / etc.):
384
+ ```
385
+ You're using <detected CLI>. Note: CCC-MAGI is Tier-3 tested on this CLI
386
+ (some hooks may not fire — see README § CLI compatibility).
387
+
388
+ [1] Same model (current writer also reviews, fresh context)
389
+ [2] Install Codex CLI as auditor (Codex review, default gpt-5.5)
390
+ [3] Skip audit (⚠️ NOT recommended)
391
+ >
392
+ ```
393
+
394
+ For Simple mode: limit to options [1] and [2]; don't show "skip audit" (Universal Core compliance).
395
+
396
+ ### Step 2D — Pro mode (16 questions)
397
+
398
+ After mode pick = Pro, ask all 16 questions, organized in 5 thematic blocks. The suggestion engine STILL runs after Q2 and pre-fills defaults for Q3-Q16 (user can accept, edit, or override).
399
+
400
+ **Convention for every Pro-mode block**: at top of each block, tell user once:
401
+ `(Per question: [Enter] = accept ⭐ suggestion / type new value / type "skip <Qn>" / type "?" for reasoning)`
402
+
403
+ #### Block A — Identity (Q1-Q4)
404
+ - Q1 project_name — auto-detected default
405
+ - Q2 project_description — ALWAYS asked, NO default (triggers suggestion engine)
406
+ - Q3 project_stage — choice a/b/c/d, suggestion highlighted
407
+ - Q4 project_scale_target — open-ended with 3-5 example suggestions
408
+
409
+ #### Block B — Scope + Discipline (Q5-Q7)
410
+ - Q5 team_size — solo/small/large, suggestion based on git activity (brownfield) or description (greenfield)
411
+ - Q6 primary_concern — open-ended with letter-coded suggestion list
412
+ - Q7 out_of_scope_items — open-ended with examples from description's negative space
413
+
414
+ #### Block C — Engine (Q8-Q9)
415
+ - Q8 auditor_model — CLI-detected, branches per Step 2C above
416
+ - Q9 language_mode — plain/professional, default plain
417
+
418
+ #### Block D — Project identity / Red lines (Q10-Q14, → constitution Section 2)
419
+ - Q10 project_audience — confirmatory pattern (suggestion pre-filled)
420
+ - Q11 project_non_goals — open-ended with description-derived examples
421
+ - Q12 project_compliance — GDPR/HIPAA/PCI/none/other, suggestion based on `project_audience` keywords
422
+ - Q13 project_performance_floor — open-ended with example latencies
423
+ - Q14 project_identity_other — OPTIONAL, can skip with empty
424
+
425
+ #### Block E — Paths (Q15-Q16)
426
+ - Q15 spec_dir — default `docs/features/`
427
+ - Q16 implementation_dir — default `docs/features/`
428
+
429
+ ### Step 2E — Upgrade mode (Simple → Pro)
430
+
431
+ If invoked via `/init --upgrade-to-pro` or natural language ("升级到专业版" / "upgrade to pro" / etc.):
432
+
433
+ 1. Read existing `.harness/state/install.json`
434
+ 2. Identify which 5 slots are already answered (Q1, Q2, Q5, Q8, test_required)
435
+ 3. Re-run the suggestion engine on the existing `project_description` to produce fresh defaults for the 11 skipped slots
436
+ 4. Walk through Q3, Q4, Q6, Q7, Q9, Q10, Q11, Q12, Q13, Q14, Q15, Q16 in that order
437
+ 5. Update install.json with `"mode": "pro"` and `"upgraded_from_simple_at": "<timestamp>"` fields
438
+ 6. Update constitution.md Section 2 with new identity slots
439
+
440
+ Don't overwrite the 5 existing answers unless user explicitly says so.
441
+
442
+ ### Brownfield-mode adjustments (regardless of Simple/Pro)
443
+
444
+ In brownfield mode, auto-detect defaults from the codebase BEFORE asking:
445
+
446
+ - **Q1 (project_name)**: scan `package.json:name`, `pyproject.toml:name`, `Cargo.toml:name`, `go.mod`, `composer.json:name`
447
+ - **Q2 (project_description)**: scan README.md first paragraph
448
+ - **Q3 (project_stage)**: heuristic — git log < 30 commits AND no test files → early; has tests + CI but no prod marker → beta; otherwise → prod (low confidence — confirm)
449
+ - **Q5 (team_size)**: count distinct git authors in last 90 days
450
+
451
+ For each auto-detected default, show:
452
+ ```
453
+ Q1. Project name (detected from package.json: "my-app")
454
+ Press Enter to accept, or type new value:
455
+ ```
456
+
457
+ ### Confirmation block (after all questions in the chosen mode)
458
+
459
+ Display the full L0 slot table for confirmation (user's locale). Highlight:
460
+ - ✓ values user explicitly answered
461
+ - 🤖 values from suggestion engine (accepted by user)
462
+ - ⚙️ values defaulted (Simple mode skipped slots)
463
+ - 🔍 values auto-detected (brownfield)
464
+
465
+ ```
466
+ About to write the following configuration to constitution.md:
467
+
468
+ project_name : my-app 🔍 detected
469
+ project_description : "..." ✓ user
470
+ project_stage : early ⚙️ default (Simple mode)
471
+ team_size : small 🤖 suggested + accepted
472
+ ...
473
+
474
+ All correct? Type "yes" to continue, "no" to re-answer specific Q#:
475
+ ```
476
+
477
+ ---
478
+
479
+ ## Step 3 — L1 slot auto-detect + ask
480
+
481
+ L1 slots (see constitution.md § Slot registry) fill on-demand. At /init we resolve the ones that affect installation:
482
+
483
+ - `tech_stack` → AUTO scan manifests; CONFIRM
484
+ - `test_framework` → AUTO scan dev deps (jest / vitest / pytest / etc.); CONFIRM
485
+ - `test_runner_command` → AUTO from package.json scripts or framework default
486
+ - `feature_folder_pattern` → AUTO scan fs (src/features/ / app/ / lib/ / pages/); CONFIRM
487
+ - `client_code_paths` → derived from feature_folder_pattern + repo layout
488
+ - `backend_code_paths` → AUTO scan (supabase/ / api/ / server/ / functions/); OPTIONAL
489
+ - `backend_db_type` → derived from backend_code_paths (postgres-via-supabase / postgres-raw / mongodb / sqlite / none); OPTIONAL
490
+ - `migration_dir` → derived from backend_db_type
491
+ - `rls_auth_function` → derived from backend_db_type (Postgres+Supabase → `(SELECT auth.uid())`; others: OPTIONAL)
492
+ - `error_tracker` → ASK
493
+ - `release_lanes` → DEFAULT to `[git-push]`; ASK if more (OTA / staged env)
494
+ - `supported_locales` → DEFAULT `["zh-Hans", "en", "ko"]`; ASK
495
+ - `high_trap_libraries` → seed from detected stack (e.g., RN+Expo → FlashList, Expo SDK; Next.js → Next-specific)
496
+ - `junior_reviewers` → derived from tech_stack (frontend-reviewer if client; backend-reviewer if backend; security-reviewer always)
497
+ - `pii_columns` → DEFAULT `[phone, email, name, address, payment]`; ASK
498
+ - `auditor_model_id` → DEFAULT `gpt-5.5` from slot registry; **auto-fill, not asked**. User can change later via `/constitution-edit`. Filled whenever `auditor_model != None` (i.e., dual-engine).
499
+
500
+ L2 slots (`anti_flag_rules`, `project_red_lines`) start empty.
501
+
502
+ ---
503
+
504
+ ## Step 4 — Render templates
505
+
506
+ For each file in the harness package, produce the rendered version with double-brace placeholders replaced.
507
+
508
+ ### Render rules
509
+
510
+ (In the rules below, `<NAME>` is a stand-in for any registered slot name like `project_name`, `spec_dir`, etc. The literal template syntax in the harness files uses double curly braces: `{` `{` `<NAME>` `}` `}`. We split it here so this documentation block isn't itself misread as a slot reference.)
511
+
512
+ - A bare double-braced slot reference → the string value of the slot, unmodified
513
+ - A double-braced slot reference followed by a literal suffix → string value + literal suffix (no space)
514
+ - Slot values containing characters that need escaping in their target file format: shell-escape for bash files; JSON-escape for `.json` files; TOML-string-escape for `.toml`.
515
+
516
+ ### File mappings
517
+
518
+ | Source (in harness package) | Destination (in user project) |
519
+ |------------------------------|--------------------------------|
520
+ | `constitution.md` | project root |
521
+ | `CLAUDE.md` | project root |
522
+ | `AGENTS.md` | project root |
523
+ | `skills/*` (all 9 skills) | `.harness/skills/` |
524
+ | `agents/_template/` + `README.md` | `.harness/agents/_template/` |
525
+ | `agents/<reviewer>.md` (enabled ones) | `.harness/agents/<reviewer>.md` |
526
+ | `scripts/*.sh` + `scripts/standalone-bootstrap.md` + `scripts/README.md` | `.harness/scripts/` (sh files chmod +x; md files copied as-is) |
527
+ | `cli-configs/claude/settings.json` | `.claude/settings.json` |
528
+ | `cli-configs/codex/config.toml` | `.codex/config.toml` |
529
+ | `cli-configs/codex/hooks.json` | `.codex/hooks.json` |
530
+ | `docs-harness/*` (5 files) | `docs-harness/` (project root) |
531
+
532
+ Junior-reviewer filtering: agents/backend-reviewer.md is copied **only if** `backend_db_type` is non-empty. agents/frontend-reviewer.md is copied **only if** `client_code_paths` is non-empty. Other agents always copy.
533
+
534
+ Skill filtering: skills/db-schema/ is copied **only if** `backend_db_type` is non-empty.
535
+
536
+ Create empty dirs: `.harness/state/`, `.harness/audits/`, `{{spec_dir}}` (if absent).
537
+
538
+ **Important**: the Bootstrap Status Check block at the top of `CLAUDE.md` MUST be preserved verbatim during rendering. It is the load-bearing trigger for standalone bootstrap on future sessions.
539
+
540
+ ---
541
+
542
+ ## Step 5 — Permissions + completion marker (write install.json LAST)
543
+
544
+ ### Make scripts executable
545
+
546
+ ```bash
547
+ chmod +x .harness/scripts/*.sh
548
+ ```
549
+
550
+ ### Configure auditor CLI env (optional)
551
+
552
+ Write to `.harness/state/auditor.env` for shell sourcing.
553
+
554
+ If `auditor_model = Codex`:
555
+ ```
556
+ AUDITOR_CLI=codex
557
+ AUDITOR_MODEL_ID={{auditor_model_id}}
558
+ ```
559
+
560
+ If `auditor_model = None` (single-engine fallback):
561
+ ```
562
+ AUDITOR_CLI=claude
563
+ ```
564
+
565
+ ### Write install.json (★ THIS IS THE COMPLETION MARKER ★)
566
+
567
+ **This must be the LAST file write in Step 5.** It signals "harness is fully configured" to every other system:
568
+
569
+ - CCC's session-open check (CCC_harness_flow.md § 5.2)
570
+ - CLAUDE.md's Bootstrap Status Check (each session start)
571
+ - The AI-driven detection in `standalone-bootstrap.md` (which checks `install.json` before deciding whether to run bootstrap)
572
+
573
+ If Step 6 validation fails, `install.json` should still be written (the install IS done, validation surfaces issues to fix). Only if a Step 4 file write FAILS should install.json NOT be written.
574
+
575
+ **MUST contain COMPLETE slot state** — every L0 and resolved L1 slot value gets recorded. This lets downstream skills (/feature-draft, /resume, /constitution-edit, etc.) read project state without re-reading constitution.md and re-parsing slots. The full schema:
576
+
577
+ ```bash
578
+ cat > .harness/state/install.json <<JSON
579
+ {
580
+ "schema_version": 2,
581
+
582
+ "installed_at": "<ISO-8601 timestamp, e.g., 2026-05-28T10:00:00Z>",
583
+ "harness_version": "<package version, e.g., 0.9.0>",
584
+ "skill_set_version": "<sha-or-timestamp-of-source-skills, optional>",
585
+
586
+ "onboarding": {
587
+ "mode": "<simple|pro>",
588
+ "upgraded_from_simple_at": "<ISO timestamp, only set if Simple → Pro upgrade happened>",
589
+ "questions_asked": [<list of Q-numbers actually answered, e.g., [1, 2, 3, 5, 8] for Simple mode>],
590
+ "questions_defaulted": [<list of Q-numbers using smart defaults, e.g., [4, 6, 7, 9, ...]>]
591
+ },
592
+
593
+ "project_mode": "<greenfield|brownfield>",
594
+
595
+ "slots": {
596
+ "_comment": "All L0 + resolved L1 slot values. Source: constitution.md § Slot registry. Every key here should match a slot name in that registry.",
597
+
598
+ "project_name": "<value>",
599
+ "project_description": "<value>",
600
+ "project_stage": "<early|beta|prod|scale>",
601
+ "project_scale_target": "<value>",
602
+ "team_size": "<solo|small|large>",
603
+ "primary_concern": "<value>",
604
+ "out_of_scope_items": [<list>],
605
+ "auditor_model": "<Codex|Claude|None|...>",
606
+ "auditor_model_id": "<e.g., gpt-5.5>",
607
+ "language_mode": "<plain|professional>",
608
+ "spec_dir": "<e.g., docs/features/>",
609
+ "implementation_dir": "<e.g., docs/features/>",
610
+
611
+ "project_audience": "<value>",
612
+ "project_non_goals": [<list>],
613
+ "project_compliance": "<GDPR|HIPAA|PCI|none|other>",
614
+ "project_performance_floor": "<value>",
615
+ "project_identity_other": [<list>],
616
+
617
+ "tech_stack": "<value, AUTO from manifests>",
618
+ "repo_structure": "<value, AUTO from fs scan>",
619
+ "dependency_flow": "<value, AUTO or OPTIONAL>",
620
+ "release_lanes": [<list, e.g., ["git-push"]>],
621
+ "backend_change_lane": "<value, OPTIONAL>",
622
+ "error_tracker": "<Sentry|Bugsnag|none|other>",
623
+ "test_required": true|false,
624
+ "junior_reviewers": [<list, e.g., ["frontend-reviewer", "backend-reviewer", "security-reviewer"]>],
625
+ "rule_sources": [<list, starts empty>],
626
+ "supported_locales": [<list, e.g., ["zh-Hans", "en", "ko"]>],
627
+ "edge_case_categories": [<list of 8 categories, defaults + user additions>],
628
+ "test_framework": "<jest|vitest|pytest|none|auto>",
629
+ "test_runner_command": "<e.g., npm test>",
630
+ "feature_folder_pattern": "<value>",
631
+ "client_code_paths": [<list>],
632
+ "backend_code_paths": [<list>],
633
+ "backend_db_type": "<postgres|mysql|mongodb|none|other>",
634
+ "high_trap_libraries": [<list of libraries needing context7 version check>],
635
+ "migration_dir": "<value, only if backend_db_type set>",
636
+ "pii_columns": [<list, e.g., ["phone", "email", "name", "address", "payment"]>],
637
+ "rls_auth_function": "<value, only if backend supports>",
638
+
639
+ "_comment_l2": "L2 (grow-over-time) slots are tracked separately — anti_flag_rules in AGENTS.md, project_red_lines in constitution.md § 3. Not duplicated here."
640
+ },
641
+
642
+ "environment": {
643
+ "_comment": "Snapshot of env-check.json content at /init time. Useful for /audit and /resume to know what tier was active.",
644
+ "platform": "<darwin|linux|windows-wsl|windows-git-bash|unknown>",
645
+ "tier": "<1-claude-codex|2-single-claude|3-other|0-none>",
646
+ "ai_clis_installed": {"claude": true|false, "codex": true|false, "gemini": true|false}
647
+ },
648
+
649
+ "magi_system": {
650
+ "_comment": "Records which models back which MAGI positions. Lets downstream skills know who's playing what.",
651
+ "core_cli": "<claude|codex|cursor|...>",
652
+ "verdict_cli": "<codex|claude|gemini|none>",
653
+ "verdict_model_id": "<gpt-5.5|claude-sonnet-4-6|...>"
654
+ },
655
+
656
+ "render_status": {
657
+ "_comment": "Which files were rendered + their slot count + any per-file warnings. Helps /constitution-edit and re-installs know what to touch.",
658
+ "constitution.md": {"slots_filled": N, "warnings": []},
659
+ "CLAUDE.md": {"slots_filled": N, "warnings": []},
660
+ "AGENTS.md": {"slots_filled": N, "warnings": []}
661
+ }
662
+ }
663
+ JSON
664
+ ```
665
+
666
+ **Why the verbose schema**: Simple mode hides 11 questions from the user but still WRITES their default values to install.json. This way `/feature-draft` doesn't have to re-derive "what's my project_audience" — it just reads it. Sparse install.json (the v0.8.x format) forced every downstream skill to re-parse constitution.md, which is fragile.
667
+
668
+ **Upgrade path**: When `/init --upgrade-to-pro` is invoked, **don't overwrite** the existing JSON wholesale. Read it, update only the slots that got new answers, set `onboarding.upgraded_from_simple_at`, and write back.
669
+
670
+ ---
671
+
672
+ ## Step 6 — Validate the install
673
+
674
+ Run smoke checks (each prints ✅ or ❌):
675
+
676
+ 1. **No unfilled L0 slots** — `grep -rn "{{" constitution.md` should return only L1/L2 references (in the registry comment block), not unfilled L0 substitutions.
677
+ 2. **All scripts exist + executable** — `for f in .harness/scripts/*.sh; do [ -x "$f" ] && echo ✅; done`
678
+ 3. **JSON files parse** — `python3 -c "import json; json.load(open('.claude/settings.json'))"` etc.
679
+ 4. **TOML files parse** — basic structural check (`grep "^\[" .codex/config.toml`)
680
+ 5. **`install.json` exists and parses** — proves Step 5 completed.
681
+ 6. **CLAUDE.md still has Bootstrap Status Check block** — sanity check that rendering didn't strip the safety header.
682
+ 7. **standalone-bootstrap.md exists** at `.harness/scripts/standalone-bootstrap.md` — proves the standalone path is intact.
683
+
684
+ If any check fails, report it but DO NOT auto-rollback. Tell the user the specific failure + how to fix.
685
+
686
+ ---
687
+
688
+ ## Step 7 — Next steps prompt
689
+
690
+ Display in user's locale:
691
+
692
+ ```
693
+ ✅ CCC-MAGI fully configured.
694
+
695
+ Suggested next steps:
696
+
697
+ • Review what was written to constitution.md at the top to confirm it's correct
698
+ (to adjust any L0 slot, run /constitution-edit)
699
+ • For a new feature: /feature-draft <name>
700
+ • To audit an existing feature: /audit-spec <name>
701
+ • To change an existing feature: /audit-spec <name>, then act on the Section 9 deltas
702
+
703
+ Docs:
704
+ • constitution.md — project constitution (immovable Universal Core + project identity)
705
+ • CLAUDE.md — workflow operating manual
706
+ • AGENTS.md — auditor role contract
707
+ • docs-harness/README.md — entry point to framework meta-docs
708
+ ```
709
+
710
+ **If running in CCC-driven mode**, additionally emit the terminal-close marker on its own line:
711
+
712
+ ```
713
+ ✓ Task complete, close terminal
714
+ ```
715
+
716
+ This is the signal CCC's terminal monitor watches for. In interactive mode, do NOT emit this marker — the user is staying in the same CLI session.
717
+
718
+ ---
719
+
720
+ ## CCC-driven mode
721
+
722
+ When invoked with `--ccc-driven --config <yaml-path>`:
723
+
724
+ 1. Read the YAML config. Expected schema:
725
+ ```yaml
726
+ slots:
727
+ project_name: my-app
728
+ project_description: ...
729
+ ...
730
+ choices:
731
+ project_mode: greenfield | brownfield
732
+ reviewers_enabled: [frontend, backend, security]
733
+ ```
734
+
735
+ Note: `existing_harness_action` is NOT in this YAML anymore — CCC's Step 1 driver has already handled it before /init was invoked.
736
+
737
+ 2. Validate the config covers all required L0 slots. If missing any, exit with structured error (CCC will collect what's missing and re-invoke).
738
+
739
+ 3. Skip every interactive prompt — use config values directly.
740
+
741
+ 4. At end of Step 6 (validation), emit a structured JSON report to stdout (for CCC to parse):
742
+ ```json
743
+ {
744
+ "status": "success" | "error",
745
+ "validation_results": [
746
+ {"check": "no_unfilled_l0_slots", "passed": true},
747
+ ...
748
+ ],
749
+ "next_actions": ["/feature-draft <name>", "/audit-spec <name>"]
750
+ }
751
+ ```
752
+
753
+ 5. Emit the terminal-close marker on its own line:
754
+ ```
755
+ ✓ Task complete, close terminal
756
+ ```
757
+
758
+ ---
759
+
760
+ ## Error recovery (Restart policy)
761
+
762
+ Per CCC_harness_flow.md decision 6, /init does NOT support Resume. If anything goes wrong:
763
+
764
+ 1. **User can abort at any prompt** — type `abort` (or Ctrl-C). Whatever partial state exists is left as-is for the user to manually clean up.
765
+ 2. **Step 4 file-write failure** — surface the specific failure; do NOT write install.json; leave the user in a "partially installed but no install.json" state.
766
+ 3. **Next time the user runs /init**, Step 0's "partial install" branch detects this and offers `clean` to wipe and start over.
767
+
768
+ There is intentionally no auto-rollback. Manual clean-up + restart is simpler than partial-state recovery.
769
+
770
+ ---
771
+
772
+ ## Trust contract
773
+
774
+ - **`/init` never silently modifies files outside its declared output**. Every file write is enumerated in Step 4's file mapping table.
775
+ - **Detection of existing harness is NOT this skill's job** — bootstrap (standalone-bootstrap.md or CCC Step 1 driver) handles it.
776
+ - **L0 slots are mandatory**. The skill cannot complete with any L0 slot unfilled.
777
+ - **`install.json` is the single canonical "configured" marker**. No other file plays this role.
778
+ - **Validation in Step 6 is informational, not gating**. Validation failures surface issues; they do NOT roll back install.json.
779
+ - **Bootstrap header in CLAUDE.md is preserved verbatim during rendering** — load-bearing for future sessions.
780
+
781
+ ---
782
+
783
+ ## Anti-patterns the skill blocks
784
+
785
+ - **Running detection inside /init** → bootstrap handles it; don't duplicate
786
+ - **Skipping L0 question if user "doesn't know"** → "I don't know" is a valid answer; the slot gets a placeholder + a note in `## Decision history` so the auditor can flag it for revisit
787
+ - **Auto-detecting answers without confirmation** → every brownfield auto-detect requires explicit user confirmation before becoming the slot value
788
+ - **Filling slots in CLAUDE.md / AGENTS.md without filling constitution.md first** → constitution is the single source; the rest reference it
789
+ - **Writing install.json before Step 4 completes** → install.json must reflect a complete install, not a partial one
790
+ - **Stripping the Bootstrap Status Check block from CLAUDE.md during rendering** → would break next-session standalone bootstrap
791
+
792
+ ---
793
+
794
+ ## Completion criteria
795
+
796
+ `/init` is complete when:
797
+
798
+ - Step 0 has run (precondition check; either clean state or user-confirmed re-init)
799
+ - Step 1 has run (project mode determined)
800
+ - Step 2-3 have run (all L0 + relevant L1 slots filled)
801
+ - Step 4 has run (all template files written to their destinations)
802
+ - Step 5 has run (scripts executable, `install.json` written, auditor env configured)
803
+ - Step 6 validation has run (and either all passed, or user has explicitly accepted any failures)
804
+ - User has seen Step 7's next-steps prompt
805
+ - **In CCC-driven mode**: the terminal-close marker has been emitted on its own line