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,373 @@
1
+ # Harness Adoption Playbook
2
+
3
+ Step-by-step guide for installing the harness in a project. Works for greenfield (new project) and brownfield (existing project) scenarios, via two installation paths.
4
+
5
+ > **`/init` is the fast path.** Once the harness is on disk and the bootstrap has run, `/init` asks you the questions in Phase 1 here and fills the slots automatically. This playbook is the full manual flow — useful when `/init` doesn't fit your situation, or when you want to understand what `/init` is doing under the hood.
6
+
7
+ ## File layout overview
8
+
9
+ CCC-MAGI ships TWO root-level "AI context" files plus the project constitution:
10
+
11
+ | File | Read by | Contains |
12
+ |---|---|---|
13
+ | `AGENTS.md` | Codex / Cursor / Cline / Aider / Gemini CLI / Devin / etc. | Universal project context + auditor brief |
14
+ | `CLAUDE.md` | Claude Code only (others ignore) | Claude-specific workflow, Bootstrap, Language Awareness |
15
+ | `constitution.md` | Every AI agent (per § preamble) | Universal Core (5 invariants) + Project Identity + Red Lines + Slot Registry |
16
+
17
+ If you use Claude Code, both `CLAUDE.md` and `AGENTS.md` are read by Claude — Claude Code natively reads `CLAUDE.md` and CCC's setup instructs it to also read `AGENTS.md` for project context.
18
+
19
+ If you use Codex / Cursor / Cline / Aider, those tools read `AGENTS.md` natively. The `CLAUDE.md` file is also present but those tools ignore it.
20
+
21
+ This dual setup means: any AI tool coming to the project gets the right context without manual configuration.
22
+
23
+ ## Two installation paths
24
+
25
+ The harness supports two install paths. Pick whichever fits your setup:
26
+
27
+ ### Path A — Through CCC (desktop wrapper)
28
+
29
+ If you use **CCC (Claude Code Controller)** as your desktop session manager:
30
+
31
+ 1. Open CCC, click "new session", pick your project folder.
32
+ 2. In the session view, click the "Harness" button.
33
+ 3. In the HarnessWizard window, click "Environment Detection".
34
+ 4. Confirm token usage warning → CCC opens a terminal at your session path with your AI CLI running.
35
+ 5. The AI walks you through:
36
+ - **Step 1** (Bootstrap): detect existing harness configs, present 3-option menu, archive/delete other configs, **pull CCC-MAGI from GitHub** to your project.
37
+ - **Step 2** (`/init`): fill 16 L0 questions, write `.harness/state/install.json`.
38
+ 6. CCC HarnessWizard shows ✅ Step 1 / ✅ Step 2 / ✅ All configuration complete.
39
+
40
+ CCC users do NOT need to manually clone CCC-MAGI — Step 1 pulls it for you. See `CCC_harness_flow.md` (in this repo) for the full spec.
41
+
42
+ ### Path B — Standalone (no CCC)
43
+
44
+ If you DON'T use CCC, or want full manual control:
45
+
46
+ 1. `git clone <CCC-MAGI-repo> .ccc-magi-temp` in your project (you do this yourself).
47
+ 2. Move contents into the right locations (see Step 1.1 below for the file mapping).
48
+ 3. Open your AI CLI (`claude` or `codex`) at the project root.
49
+ 4. The CLI reads `CLAUDE.md`, sees the **Bootstrap Status Check** block, sees `.harness/state/install.json` doesn't exist → AI reads `.harness/scripts/standalone-bootstrap.md` and walks you through:
50
+ - Detection + 3-option menu (same as CCC's Step 1, minus the git clone — you did that)
51
+ - If you pick 1/2: invoke `/init` for Step 2 (L0 filling)
52
+ - If you pick 3: AI continues working without harness this session; re-prompts next session
53
+
54
+ This playbook below documents Path B in detail. Path A is the same flow but with CCC's GUI driving terminal spawning + monitoring.
55
+
56
+ ---
57
+
58
+ ## Phase 0 — Preconditions
59
+
60
+ Before starting:
61
+
62
+ - [ ] You have a project (or are about to create one) with a git repo initialized.
63
+ - [ ] Working tree is clean (`git status` clean).
64
+ - [ ] You have a CLI installed (Claude Code, Codex, or both — single-engine mode works with one).
65
+ - [ ] You've decided whether this will be **greenfield** (new project, no existing code) or **brownfield** (existing code that the harness will wrap).
66
+ - [ ] You've skimmed `constitution.md` and `CLAUDE.md` so you know what you're signing up for.
67
+
68
+ ### Recommended branch
69
+
70
+ For brownfield adoption, work on a dedicated branch so it's easy to back out:
71
+
72
+ ```bash
73
+ git checkout -b feat/install-harness
74
+ ```
75
+
76
+ For greenfield, install directly on `main`.
77
+
78
+ ---
79
+
80
+ ## Phase 1 — Install harness templates + fill slots
81
+
82
+ **Goal:** the harness's template files land in your project, and project-specific values get filled into the slot registry.
83
+
84
+ ### Step 1.1 — Copy the harness
85
+
86
+ Copy the contents of `outcome/` from the harness package into your project root (or a known subdirectory; the convention is the project root):
87
+
88
+ ```
89
+ your-project/
90
+ ├── constitution.md ← from outcome/constitution.md
91
+ ├── CLAUDE.md ← from outcome/CLAUDE.md
92
+ ├── AGENTS.md ← from outcome/AGENTS.md
93
+ ├── skills/ ← from outcome/skills/
94
+ ├── agents/ ← from outcome/agents/
95
+ └── .harness/ ← created by the install (scripts/, state/)
96
+ └── scripts/ ← copy from outcome/cli-configs/scripts-template/
97
+ ```
98
+
99
+ Plus CLI configs into their canonical locations:
100
+
101
+ ```
102
+ .claude/settings.json ← from outcome/cli-configs/claude/settings.json
103
+ .codex/config.toml ← from outcome/cli-configs/codex/config.toml
104
+ .codex/hooks.json ← from outcome/cli-configs/codex/hooks.json
105
+ ```
106
+
107
+ ### Step 1.2 — Fill the L0 slots
108
+
109
+ Open `constitution.md` and the slot registry block at the top. Fill every L0 slot. The harness can't run with unfilled L0 slots — that's the entire point of L0.
110
+
111
+ L0 slots, in plain language:
112
+
113
+ | Slot | Question for you |
114
+ |------|------------------|
115
+ | `project_name` | What's this project called? |
116
+ | `project_description` | One sentence, no jargon — what does this do? |
117
+ | `project_stage` | early / beta / prod / scale — where are you now? |
118
+ | `project_scale_target` | What scale are you building toward? |
119
+ | `team_size` | solo / small / large |
120
+ | `primary_concern` | What is this harness primarily protecting? (stability / speed / security / ...) |
121
+ | `out_of_scope_items` | What should the harness NOT keep harping on? |
122
+ | `auditor_model` | Display name of the second model (default Codex; None = single-engine) |
123
+ | `language_mode` | plain (default) or professional — affects how prompts are phrased to you |
124
+ | `spec_dir` | Where feature specs live (default `docs/features/`) |
125
+ | `implementation_dir` | Where implementation notes live (default same as spec_dir) |
126
+
127
+ Then the L0 constitution-identity slots (Section 2 of constitution.md):
128
+
129
+ | Slot | Question |
130
+ |------|----------|
131
+ | `project_audience` | Who do we serve? (one sentence) |
132
+ | `project_non_goals` | What do we deliberately NOT do? |
133
+ | `project_compliance` | Compliance / legal floors (GDPR / HIPAA / PCI / none / other) |
134
+ | `project_performance_floor` | Performance floors that can't be crossed |
135
+ | `project_identity_other` | Other "if-violated-it's-not-this-project-anymore" statements |
136
+
137
+ ### Step 1.3 — Fill the L1 slots as you go
138
+
139
+ L1 slots are answered at the appropriate stage. Some can be auto-detected from manifests (`package.json`, `pyproject.toml`, etc.):
140
+
141
+ - `tech_stack` — auto-detect from manifests
142
+ - `repo_structure` — auto-detect from filesystem, confirm with you
143
+ - `test_framework` — auto-detect from dependencies, confirm
144
+ - `test_runner_command` — auto-detect from scripts, confirm
145
+
146
+ Other L1 slots need you to answer when relevant:
147
+
148
+ - `release_lanes` — default `[git-push]`; you can add OTA / staged environments
149
+ - `backend_db_type` — leave empty if no backend (db-schema skill skips entirely)
150
+ - `error_tracker` — Sentry / Bugsnag / none / other
151
+ - `test_required` — true (default) or false
152
+ - `junior_reviewers` — which plugins to enable (see `outcome/agents/README.md`)
153
+ - `dependency_flow` — optional; leave blank if no enforcement
154
+ - `supported_locales` — default `["zh-Hans", "en", "ko"]`; adjust to your project
155
+ - `high_trap_libraries` — libraries to force `context7` verification on
156
+ - `feature_folder_pattern`, `client_code_paths`, `backend_code_paths` — per your repo layout
157
+
158
+ L2 slots (anti-flag rules, project red lines) start empty and grow over time. Don't fill them now.
159
+
160
+ ### Step 1.4 — Customize the example agents
161
+
162
+ The harness ships 4 example agents in `agents/` (`frontend-reviewer`, `backend-reviewer`, `security-reviewer`, `test-fixer`). Each has `example: true` in its frontmatter. Decide:
163
+
164
+ - Keep `frontend-reviewer` if your project has client-side code
165
+ - Keep `backend-reviewer` if `backend_db_type` is configured (it auto-skips otherwise)
166
+ - Keep `security-reviewer` if your project touches PII or auth
167
+ - Keep `test-fixer` if `test_required = true`
168
+
169
+ Replace the project-specific checklist categories in each kept agent with rules from your `{{rule_sources}}`. The structure stays; the content swaps.
170
+
171
+ Add your own junior reviewer plugins by copying `agents/_template/junior-agent-template.md`. Register the new agent in the `junior_reviewers` slot.
172
+
173
+ ### Step 1.5 — Customize the CLI hook scripts
174
+
175
+ The harness's `claude/settings.json` and `codex/hooks.json` reference these scripts at `.harness/scripts/`:
176
+
177
+ - `precommit-typecheck.sh` — your stack's typecheck (e.g., `tsc --noEmit`, `mypy`, `cargo check`)
178
+ - `lint-bans.sh` — grep for your anti-flag patterns from `AGENTS.md`
179
+ - `precommit-cycles.sh` — your dependency-cycle check (e.g., `madge --circular src/`); skip if `dependency_flow` is empty
180
+ - `format-edit.sh` — your formatter (e.g., `prettier --write`, `black`, `gofmt`)
181
+ - `post-migration.sh` — only if `backend_db_type` is configured (refresh schema cache + regenerate typed bindings)
182
+ - `auditor-gate.sh` — invokes the auditor CLI with structured output; the harness ships a reference implementation in `outcome/cli-configs/scripts-template/`
183
+
184
+ ### Step 1.6 — Commit Phase 1
185
+
186
+ ```bash
187
+ git add constitution.md CLAUDE.md AGENTS.md skills/ agents/ .claude/ .codex/ .harness/
188
+ git commit -m "feat(harness): install workflow harness
189
+
190
+ - Add constitution, workflow rules, agent definitions
191
+ - Configure cross-model audit (auditor: {{auditor_model}})
192
+ - Hook scripts at .harness/scripts/ customized for stack
193
+ - Two-file feature spec model active
194
+
195
+ See constitution.md and CLAUDE.md for design rationale."
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Phase 2 — First feature as dogfood
201
+
202
+ **Goal:** run a real feature through the harness end-to-end. The first run validates the install AND surfaces gaps before they compound.
203
+
204
+ ### Greenfield path
205
+
206
+ 1. Pick the simplest meaningful feature (e.g., "user can sign in").
207
+ 2. Run `/feature-draft <name>`.
208
+ 3. Walk Stage 1 with the harness paraphrasing your intent and running edge-case sweeps.
209
+ 4. Continue through stages 2 → 8.
210
+ 5. Smoke-test the feature on a real environment (Stage 7).
211
+ 6. Commit.
212
+
213
+ ### Brownfield path
214
+
215
+ 1. Pick a feature that already has code but no spec (or stale spec).
216
+ 2. Run `/audit-spec <name>`.
217
+ 3. Walk the intent rounds, then let the harness's fresh-context subagent read the code and produce an as-built reading.
218
+ 4. Resolve each delta (code-vs-spec) with the harness's a/b/c/d decision framing.
219
+ 5. Continue through stages 3+ if Section 9 has actionable deltas.
220
+ 6. Smoke-test.
221
+ 7. Commit.
222
+
223
+ ### What to watch for during Phase 2
224
+
225
+ - **The CEO spec accidentally carrying tech jargon.** Stage 2's plain-language check should catch this, but it's worth watching during Stage 1.
226
+ - **The audit gate not firing.** Confirm `.harness/scripts/auditor-gate.sh` actually invokes your auditor model.
227
+ - **Lane misclassification.** A "trivial" change that should have been stability-fix; a "stability-fix" that turned out to need spec changes.
228
+ - **Subagent invocation gaps.** A frontend change that didn't trigger `frontend-reviewer` (means your `client_code_paths` slot is wrong).
229
+
230
+ If any of these happen, halt and fix the config before continuing.
231
+
232
+ ---
233
+
234
+ ## Phase 3 — Gradual adoption (brownfield only)
235
+
236
+ After Phase 2, the brownfield project has one feature in the new spec model and many features still in the old shape (or no shape at all).
237
+
238
+ Adopt remaining features in priority order. Suggested order:
239
+
240
+ 1. **Highest-risk features first** — auth, payments, anything touching PII. These benefit most from the harness's audit invariant.
241
+ 2. **Most-edited features second** — anything where you find yourself making changes weekly. The harness pays for itself fastest here.
242
+ 3. **Foundational features third** — features other features depend on. Improving them improves everything downstream.
243
+ 4. **Low-risk leaf features last** — simple settings screens, static content. The harness's overhead may exceed the value here.
244
+
245
+ Each feature is one `/audit-spec <name>` invocation. The harness handles the rest.
246
+
247
+ Optional: track progress in `.harness/audit-progress.md`:
248
+
249
+ ```markdown
250
+ # Feature Audit Progress
251
+
252
+ ## Done
253
+ - [x] auth (2026-MM-DD)
254
+
255
+ ## In Progress
256
+ - [ ] chat
257
+
258
+ ## Backlog
259
+ - [ ] sell
260
+ - [ ] feed
261
+ ...
262
+ ```
263
+
264
+ ---
265
+
266
+ ## Tuning
267
+
268
+ ### `--force-load-bearing` (rare; explicit reset)
269
+
270
+ LOAD_BEARING files (`CLAUDE.md`, `AGENTS.md`, `constitution.md`) carry user-rendered slot values from `/init` and accumulated `/constitution-edit` Section 3 red lines. The default content-hash detection in `install-into.sh` / `npx create-ccc-magi` preserves these whenever the file's current hash differs from the last-shipped hash (treated as "user-modified").
271
+
272
+ Pass `--force-load-bearing` only when you explicitly want to discard local LOAD_BEARING modifications and reinstall the shipped version. The original file is backed up with the `.pre-ccc-magi` suffix before being overwritten. Use cases:
273
+
274
+ - You're starting over after a botched `/init` run
275
+ - Your `constitution.md` got corrupted by an editor mishap
276
+ - You want to compare your customizations against the latest shipped template (look at the `.pre-ccc-magi` backup afterward)
277
+
278
+ `--force` (existing flag) implies `--force-load-bearing`. For day-to-day re-installs (delivering harness updates), do NOT pass either flag — the content-hash registry at `.harness/state/shipped-hashes.json` auto-updates files you haven't modified while preserving everything else.
279
+
280
+ ### Tuning budget pressure
281
+
282
+ CCC-MAGI includes a budget-pressure hook (P1.6) that emits advisory warnings as the session context fills up. The threshold is 200,000 tokens by default — the Opus historical baseline.
283
+
284
+ If you're using a 1M-context model variant, raise the budget so the hook doesn't fire prematurely:
285
+
286
+ ```bash
287
+ export CCC_CONTEXT_BUDGET=1000000 # add to ~/.zprofile or ~/.bashrc
288
+ ```
289
+
290
+ Below 50% of budget: hook is silent (zero token overhead).
291
+ At 50-89%: advisory `additionalContext` (~200 tokens) suggesting model downgrade for subagents + narrower reads.
292
+ At 90%+: stronger advisory + recommendation that the user run `/compact`.
293
+
294
+ ---
295
+
296
+ ## Troubleshooting
297
+
298
+ ### Q: A skill keeps invoking my old CLI's CLAUDE.md location
299
+
300
+ Your `.claude/settings.json` or `AGENTS.md` reference may be stale. Check `outcome/cli-configs/README.md § Required hook scripts` for the canonical paths the harness expects.
301
+
302
+ ### Q: My CEO spec keeps drifting into tech jargon
303
+
304
+ You may have skipped Stage 2 or the auditor's plain-language check isn't firing. Re-run `/spec-finalize <name>` — Stage 2 explicitly scans for tech-term creep and halts on each match.
305
+
306
+ ### Q: The audit chain takes forever
307
+
308
+ Audit cost scales with diff size, not change importance. If a feature change is too large for any reasonable audit, split it into smaller commits. The lane system exists partly to encourage this.
309
+
310
+ If the auditor model is genuinely too slow for your iteration speed, consider:
311
+
312
+ - Switching to a faster auditor model (smaller, faster variant of the same family).
313
+ - Single-engine fallback (`auditor_model = None`) — weaker bias-cancellation, but viable for early-stage solo work.
314
+ - Skipping audit on a per-commit basis is **not an option** (Constitution § 1).
315
+
316
+ ### Q: Lane classification is wrong, the harness wants to drag a 5-line change through full workflow
317
+
318
+ If the change has no intent change AND no schema change AND no new dependency AND <20 LOC, it's trivial-change. Tell the harness explicitly during pre-stage: "this is a trivial-change."
319
+
320
+ ### Q: Smoke test feels like overhead for tiny UI tweaks
321
+
322
+ Trivial-change skips Stage 7 for pure copy / text / translation changes. Spot-check on device for any logic change. If you find yourself wanting to skip Stage 7 for a logic change, that's a signal the change isn't actually trivial.
323
+
324
+ ### Q: I want to bypass the auditor for an emergency hotfix
325
+
326
+ You don't bypass — you use the stability-fix lane with auditor Quick mode if it's truly small, or accept the full audit cost if it's not. Constitution § 1 isn't negotiable for emergencies. The discipline is the entire point.
327
+
328
+ (If your project is in such a fragile state that hotfixes need to ship unaudited, the hotfix isn't the problem — the underlying stability is. Fix that, not the harness.)
329
+
330
+ ### Q: My team doesn't have a second model for cross-model audit
331
+
332
+ Set `auditor_model = None` to enable single-engine fallback. Fresh-context invocation of the same model still catches a class of errors (the implementer's contextual blind spots) — it just doesn't catch model-prior blind spots. Better than no audit; worse than two-model.
333
+
334
+ ### Q: I want to extend the harness with my own stage / agent / skill
335
+
336
+ - New agent: copy `agents/_template/junior-agent-template.md`, fill in, register in `junior_reviewers` slot.
337
+ - New skill: copy an existing `skills/<skill>/SKILL.md` as a template, follow the shape.
338
+ - New stage: this is a non-trivial extension — read `design-spec.md` first to understand why there are 9 stages, then propose changes via the harness's own flow (yes, dogfood your harness on the harness).
339
+
340
+ ---
341
+
342
+ ## Time estimates
343
+
344
+ ```
345
+ Phase 0 (preconditions): 5–15 min
346
+ Phase 1 (install + slots): 30–60 min (longer for brownfield with deep customization)
347
+ Phase 2 (first feature): 2–4 hours (first run is slowest; later features run faster)
348
+ Phase 3 (gradual adoption): per-feature, asynchronous, on your own schedule
349
+ ```
350
+
351
+ The full Phase 0 → 2 install is typically a single afternoon for a solo developer on a clean project.
352
+
353
+ ---
354
+
355
+ ## Submitting to Anthropic Plugin Marketplace
356
+
357
+ CCC-MAGI ships a plugin manifest at `.claude-plugin/plugin.json` so it can be submitted to Anthropic's `claude-community` marketplace.
358
+
359
+ ### Process (manual, external)
360
+
361
+ 1. **Verify the manifest is current**: bump `version` in `outcome/.claude-plugin/plugin.json` to match the new release
362
+ 2. **Tag the release**: `git tag v0.X.Y && git push --tags`
363
+ 3. **Fork** `anthropics/claude-plugins-community` on GitHub
364
+ 4. **Add CCC-MAGI** to their `marketplace.json` (or whatever submission format they use at submission time — check current docs)
365
+ 5. **Open a PR** with the addition
366
+ 6. **Wait for Anthropic review** (typically 1-2 weeks per their docs)
367
+ 7. **Once merged**, users can install via `/plugin install @claude-community/ccc-magi`
368
+
369
+ ### Trade-off note
370
+
371
+ Plugin-only installation gives users the skills (e.g., `/feature-draft`, `/audit-spec`) globally — but NOT the constitution.md, slot registry, or `.harness/state/install.json` (those require per-project installation).
372
+
373
+ For full CCC-MAGI experience: `install-into.sh` or `npx create-ccc-magi` remains the recommended primary path. The plugin marketplace is the "I want the skills, not the discipline" lightweight option.
@@ -0,0 +1,288 @@
1
+ # CCC Step 1 Driver — Template
2
+
3
+ This file is a **template / reference** for the Step 1 driver that CCC (Claude Code Controller) should bundle in its application package.
4
+
5
+ It is NOT part of the runtime CCC-MAGI installed in a user's project. It lives in the CCC-MAGI GitHub repo's `docs-harness/` as a reference for the CCC team to copy + adapt into the CCC app bundle.
6
+
7
+ ---
8
+
9
+ ## Where it should live in CCC
10
+
11
+ ```
12
+ <CCC project root>/
13
+ └── packages/app/resources/
14
+ └── harness-step1-driver.md ← copy this file's content here
15
+ ```
16
+
17
+ This path is a suggestion; the actual location is at CCC's discretion. What matters is that CCC's `SessionManager` (or equivalent) can read this file and inject its contents as a prompt into the spawned AI CLI session.
18
+
19
+ ---
20
+
21
+ ## How CCC uses this driver
22
+
23
+ ```
24
+ User clicks "Environment Detection" in CCC's HarnessWizard
25
+
26
+ HarnessWizard sends IPC: HARNESS_STEP1_RUN { sessionPath: "/path/to/user/project" }
27
+
28
+ Main process:
29
+ 1. Read packages/app/resources/harness-step1-driver.md
30
+ 2. Open new terminal at sessionPath
31
+ 3. Launch user's preferred AI CLI (claude / codex / ...)
32
+ 4. Inject the driver content as initial prompt
33
+ 5. Monitor stdout for "✓ Task complete, close terminal"
34
+
35
+ Driver runs (AI reads driver, walks user through detection + 3-option menu + git pull)
36
+
37
+ On completion marker detected, close terminal
38
+
39
+ HarnessWizard transitions to Step 2 state
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Driver content (copy below into the CCC bundle's driver file)
45
+
46
+ ```markdown
47
+ # CCC Bundled Step 1 Driver
48
+
49
+ You are an AI assistant invoked by CCC (Claude Code Controller) to perform Step 1 of harness installation: **detect any existing harness configurations in this project + present a 3-option menu to the user + (optionally) pull CCC-MAGI from GitHub**.
50
+
51
+ **You are running inside a CCC-spawned terminal.** Behaviors specific to this environment:
52
+
53
+ - After completing your task, output the exact string `✓ Task complete, close terminal` on its own line. CCC monitors stdout for this; matching it triggers terminal close.
54
+ - You can assume `git`, `bash`, and the user's chosen AI CLI tooling are available in PATH.
55
+ - Do NOT prompt the user to "press any key" or other terminal-ish UX — CCC's GUI is also visible; user can scroll back if needed.
56
+
57
+ ## Language Awareness
58
+
59
+ This driver is written in English (stable + token-efficient). When you talk to the user, talk in their OS locale's language. Detect at session start:
60
+
61
+ ```bash
62
+ locale 2>/dev/null | head -1 | sed 's/LANG=//' | sed 's/\..*//'
63
+ ```
64
+
65
+ Common locales: `en_*` → English; `zh_*` → 简体/繁體中文; `ja_*` → 日本語; `ko_*` → 한국어. Default English on failure.
66
+
67
+ User-facing menus and prompts in this driver are templates — translate when displaying. The completion markers (`✓ Task complete, close terminal` / `✗ Task cancelled, close terminal`) are byte-exact and NEVER translated (CCC parses them).
68
+
69
+ ---
70
+
71
+ ## Step A — Scan for existing harness configurations
72
+
73
+ (Same detection logic as `outcome/scripts/standalone-bootstrap.md` Step A. Refer to that file as the canonical source; the layers are:)
74
+
75
+ - Layer 1: Known harness markers (BMAD, SpecKit, OpenSpec, Cursor rules, Cline rules, etc.)
76
+ - Layer 2: Canonical AI config files, case-insensitive (CLAUDE.md / AGENTS.md / AGENT.md and variants)
77
+ - Layer 3: AI-shaped directories (agent/, agents/, ai/, prompts/, skills/, rules/, instructions/, harness/, workflow/)
78
+ - Layer 4: Suspicious markdown at project root (excluding README/LICENSE/CHANGELOG/etc., AND excluding anything in Layer 5)
79
+ - Layer 5: CCC-MAGI owned files — ALWAYS filter out, surface separately in 🟢 section. In CCC mode (this driver), CCC-MAGI should NOT yet be present since this driver runs BEFORE git clone. But on a re-run (e.g., user previously clicked Environment Detection then closed without finishing), the partial install may have placed our files; recognize them by name + signature:
80
+ - `constitution.md` + signature `SLOT REGISTRY`
81
+ - `CLAUDE.md` + signature `Bootstrap Status Check`
82
+ - `AGENTS.md` + signature `Auditor Instructions (for MAGI / Codex)`
83
+ - `.harness/`, `.claude/`, `.codex/`, `docs-harness/` directories
84
+ - `CCC_MAGI_README.md`, `CCC_MAGI_LICENSE`
85
+ - Layer 6: User's original files backed up by us — pattern `*.pre-ccc-magi` (or `*.pre-ccc-magi.<timestamp>`). Content is the user's, filename is ours. Surface separately in 🟡 section; do NOT include in the 3-option menu set.
86
+
87
+ Use `Glob` + `Read` tools to scan. Read first 80 lines of suspicious candidates to make semantic judgments.
88
+
89
+ ## Step B — Present findings and confirm
90
+
91
+ (Same as standalone-bootstrap.md Step B — refer to it for the canonical output template, including the 5-category grouping: 📕/📗/📘 numbered askable items, ✅ confirmed unrelated, 🟢 CCC-MAGI self, 🟡 user's backed-up originals.)
92
+
93
+ Critical rules:
94
+ - Numbered list (1, 2, 3...) ONLY for 📕/📗/📘 items the user actually decides on.
95
+ - 🟢 and 🟡 sections are informational — show them so the user understands what's there, but they are NOT in the editable set.
96
+ - Loop user confirmation until "done".
97
+
98
+ ### Special case: empty confirmed set
99
+
100
+ If after the user's responses the confirmed-harness list is **empty** (user marked all candidates as "not harness", or said "none" upfront), there is nothing to archive or delete. **Skip Step C and Step D entirely; jump directly to Step E** (git clone CCC-MAGI + then invoke /init for Step 2 configuration).
101
+
102
+ Acknowledge this to the user before jumping (translate to user's locale per Language Awareness):
103
+
104
+ ```
105
+ You confirmed there are no existing harness files to handle.
106
+ Proceeding directly to install stage (pull CCC-MAGI + configure).
107
+ ```
108
+
109
+ Then proceed to Step E. The git clone runs unconditionally; the only thing skipped is the archive/delete action (which has nothing to act on).
110
+
111
+ ## Step C — Present 3-option menu
112
+
113
+ Display this menu to the user (translate to user's locale per Language Awareness; the template below is English-canonical):
114
+
115
+ ```
116
+ How would you like to handle these harness files?
117
+
118
+ [1] Take over + archive (recommended ★)
119
+ → Create old_version_harness/ directory at project root
120
+ → Move the confirmed files / directories above into it
121
+ → Then pull CCC-MAGI from GitHub
122
+ → On completion, proceed to Step 2 configuration
123
+
124
+ [2] Take over + delete
125
+ → Delete the confirmed files / directories above
126
+ → Then pull CCC-MAGI from GitHub
127
+ → On completion, proceed to Step 2 configuration
128
+ → Warning: deletion is irreversible
129
+
130
+ [3] Decline CCC-MAGI
131
+ → Close terminal
132
+ → CCC window will show a "Declined — rerun?" button
133
+ → No files in your project will be modified
134
+
135
+ Enter 1 / 2 / 3:
136
+ ```
137
+
138
+ ## Step D — Execute the chosen option
139
+
140
+ ### Option 1 (Archive)
141
+
142
+ 1. Confirm with user.
143
+ 2. `mkdir old_version_harness && mv <files...> old_version_harness/`
144
+ 3. Write `old_version_harness/README.md` documenting the archive.
145
+ 4. Proceed to Step E (git pull).
146
+
147
+ ### Option 2 (Delete)
148
+
149
+ 1. Show explicit warning + require typed `DELETE` confirmation.
150
+ 2. `rm -rf <files...>`
151
+ 3. Proceed to Step E.
152
+
153
+ ### Option 3 (Decline)
154
+
155
+ 1. Acknowledge to the user (translate to user's locale):
156
+ ```
157
+ OK — CCC-MAGI will not be installed this time.
158
+ ```
159
+ 2. Output the **decline marker** (NOT the success marker — these are different so CCC can route correctly):
160
+ ```
161
+ ✗ Task cancelled, close terminal
162
+ ```
163
+ Note the leading `✗` (U+2717 BALLOT X) instead of `✓` (U+2713 CHECK MARK). CCC monitors stdout for both markers and routes to different UI states.
164
+ 3. Halt. CCC closes the terminal; HarnessWizard transitions to "Declined — rerun?" state.
165
+
166
+ ## Step E — Pull CCC-MAGI from GitHub
167
+
168
+ **Reached if**: user picked option 1 or 2 in Step C, OR confirmed-set was empty (Step B special case).
169
+
170
+ ```bash
171
+ # CUSTOMIZE THIS COMMAND when CCC-MAGI is published.
172
+ # Placeholder — actual repo URL/method TBD per CCC_harness_flow.md decision 2 (deferred to Round 3).
173
+ git clone https://github.com/<OWNER>/CCC-MAGI.git .ccc-magi-temp
174
+ ```
175
+
176
+ Then move the cloned contents into the right project locations (mirror of /init Step 4 file mappings):
177
+
178
+ - `.ccc-magi-temp/constitution.md` → `./constitution.md`
179
+ - `.ccc-magi-temp/CLAUDE.md` → `./CLAUDE.md`
180
+ - `.ccc-magi-temp/AGENTS.md` → `./AGENTS.md`
181
+ - `.ccc-magi-temp/skills/*` → `.harness/skills/`
182
+ - `.ccc-magi-temp/agents/*` → `.harness/agents/` (filtered)
183
+ - `.ccc-magi-temp/scripts/*` → `.harness/scripts/` (with chmod +x on .sh)
184
+ - `.ccc-magi-temp/cli-configs/claude/settings.json` → `.claude/settings.json`
185
+ - `.ccc-magi-temp/cli-configs/codex/*` → `.codex/`
186
+ - `.ccc-magi-temp/docs-harness/*` → `./docs-harness/`
187
+
188
+ Clean up:
189
+ ```bash
190
+ rm -rf .ccc-magi-temp
191
+ ```
192
+
193
+ Verify the install:
194
+ - `constitution.md` exists at project root
195
+ - `.harness/scripts/auditor-gate.sh` exists and is executable
196
+ - `.harness/scripts/standalone-bootstrap.md` exists
197
+
198
+ If any verification fails, report it to the user with the specific failure; do NOT emit the completion marker (let CCC's terminal stay open so user can investigate).
199
+
200
+ ## Step F — Output completion marker
201
+
202
+ **Two possible markers — pick based on outcome:**
203
+
204
+ ### After successful Step E (user picked 1 or 2 and install completed):
205
+ ```
206
+ ✓ Task complete, close terminal
207
+ ```
208
+ (Leading `✓` = U+2713 CHECK MARK)
209
+
210
+ ### After Step D Option 3 (user declined):
211
+ ```
212
+ ✗ Task cancelled, close terminal
213
+ ```
214
+ (Leading `✗` = U+2717 BALLOT X)
215
+
216
+ These are the EXACT strings. No variations, no prefixes, no suffixes. Must be on its own line.
217
+
218
+ CCC monitors stdout for **either** marker:
219
+ - Matches `✓ Task complete, close terminal` → terminal closes; HarnessWizard transitions to "Step 1 complete" → enables "Step 2" button
220
+ - Matches `✗ Task cancelled, close terminal` → terminal closes; HarnessWizard transitions to "Declined — rerun?" state
221
+
222
+ Per CCC_harness_flow.md decision 4, the two markers exist specifically so CCC can route to the correct UI state from stdout alone, without filesystem post-checks.
223
+
224
+ ## Completion criteria for Step 1
225
+
226
+ Step 1 is complete when ALL of the following are true:
227
+
228
+ 1. Detection has surfaced findings to the user (Step B loop completed with "done")
229
+ 2. User has explicitly picked option 1, 2, or 3 (Step C)
230
+ 3. The chosen option's action has executed (Step D + E if applicable)
231
+ 4. One of the two markers has been emitted on its own line (Step F):
232
+ - `✓ Task complete, close terminal` on options 1/2 success path
233
+ - `✗ Task cancelled, close terminal` on option 3 (decline) path
234
+
235
+ **The completion marker is the contract between this driver and CCC.** Without ANY marker, CCC will hold the terminal open indefinitely. Emitting the WRONG marker will route CCC's UI to the wrong state.
236
+
237
+ ---
238
+
239
+ ## Rules you MUST follow
240
+
241
+ (Same as standalone-bootstrap.md "Rules you MUST follow" section.)
242
+
243
+ - Never skip the user-confirmation loops
244
+ - Never delete files under option 1 (move only)
245
+ - Never execute option 2 without typed DELETE confirmation
246
+ - Never improvise the 3-option menu text
247
+ - Never skip emitting the completion marker — CCC depends on it
248
+ - Never emit `✓` marker on Option 3 (decline) — that would route CCC to "Step 1 complete" instead of "Declined". Emit `✗` instead.
249
+ ```
250
+
251
+ ---
252
+
253
+ ## What CCC needs to provide alongside this driver
254
+
255
+ For this driver to work, CCC must:
256
+
257
+ 1. **Bundle this `.md` file** in its app resources
258
+ 2. **Spawn a terminal** at the user's session path
259
+ 3. **Launch the chosen AI CLI** in that terminal (existing CCC capability via `SessionManager.launchInteractive()`)
260
+ 4. **Inject this driver's content as the initial prompt** (new capability — currently CCC doesn't do prompt injection at session start; needs new IPC channel and main-process handler)
261
+ 5. **Monitor terminal stdout** for the completion marker `✓ Task complete, close terminal` and close the terminal when matched
262
+ 6. **Transition HarnessWizard UI state** based on Step 1 outcome (success → enable Step 2 button; declined → show "Rerun" button)
263
+
264
+ Per `CCC_harness_flow.md` § 9.2, this maps to:
265
+ - New file: `<CCC>/packages/app/resources/harness-step1-driver.md`
266
+ - Updated `<CCC>/packages/app/src/main/SessionManager.ts` — add prompt injection capability
267
+ - Updated `<CCC>/packages/app/src/shared/ipc-channels.ts` — add `HARNESS_STEP1_RUN` channel
268
+ - Updated `<CCC>/packages/app/src/renderer/src/components/HarnessWizard.tsx` — enable the previously-dormant flow
269
+
270
+ ---
271
+
272
+ ## Difference vs standalone-bootstrap.md
273
+
274
+ | Aspect | This driver (CCC-bundled) | standalone-bootstrap.md (in CCC-MAGI) |
275
+ |--------|---------------------------|-------------------------------------------|
276
+ | Where bundled | CCC app package | CCC-MAGI GitHub repo |
277
+ | Triggered by | CCC UI button | CLAUDE.md Bootstrap Status Check block |
278
+ | Includes git clone? | **Yes** (Step E pulls CCC-MAGI) | No (CCC-MAGI already cloned by user manually) |
279
+ | Completion marker | **Required** (CCC closes terminal on match) | Optional (no terminal to close in standalone) |
280
+ | Option 3 behavior | Closes terminal + CCC shows "declined" UI | AI continues working in same CLI session |
281
+
282
+ ---
283
+
284
+ ## Version
285
+
286
+ ```
287
+ 2026-05-21 v1 — initial template; CCC team copies into bundle
288
+ ```