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,245 @@
1
+ ---
2
+ name: next
3
+ description: Inspect the current workflow state and suggest the next CCC-MAGI command. Use when the user doesn't know which skill to invoke next, or wants a sanity check on workflow progress. Reads constitution.md + spec_dir + git state; does NOT auto-invoke any other skill. Trigger when the user invokes /next OR says any of these (any language; match by intent, not exact wording) — English "what's next", "where am I", "next step", "what should I do", "what now", "I'm lost", "which skill should I run"; 中文「下一步干嘛」「下一步该跑啥」「接下来咋办」「接下来呢」「现在该做啥」「现在该跑哪个 skill」「我该跑啥」「我迷路了」「下一步推荐」; 日本語「次は何」「次どうする」「次のステップ」; 한국어「다음 뭐 해야」「다음 단계」「뭘 해야 돼」; or similar workflow-disambiguation intent in any locale.
4
+ allowed-tools: Read, Bash(test:*), Bash(ls:*), Bash(git rev-parse:*), Bash(git status:*), Bash(git branch:*), Bash(grep:*), Bash(find:*)
5
+ argument-hint: <optional feature name>
6
+ ---
7
+
8
+ # /next
9
+
10
+ Inspect the current state of the project and the active feature, then **suggest** the next CCC-MAGI command to run. This skill is a wayfinder — it never auto-invokes another skill, never modifies any file. Decision authority stays with the user.
11
+
12
+ > *Companion to the 9-stage workflow + 13 skills. The harness intentionally requires explicit confirmation at every stage; `/next` reduces the cognitive cost of figuring out which stage you're at without erasing the discipline.*
13
+
14
+ ## Language Awareness
15
+
16
+ This skill's instructions are in English. When you talk to the user (presenting state, the recommendation, asking clarifying questions), use the user's OS locale language. See `CLAUDE.md § Language Awareness`. File paths, slot names, JSON keys, and skill names (`/feature-draft`, etc.) stay in English regardless of locale.
17
+
18
+ ## What this skill produces
19
+
20
+ A single human-readable status block in the user's locale that:
21
+
22
+ 1. States the detected feature and inferred workflow stage.
23
+ 2. Lists the filesystem signals it read.
24
+ 3. Recommends the next command (or asks for disambiguation if state is ambiguous).
25
+ 4. Surfaces alternative commands the user might pick instead.
26
+
27
+ **This skill writes nothing to disk.** It is read-only.
28
+
29
+ ---
30
+
31
+ ## Step 0 — Pre-flight: is CCC-MAGI configured?
32
+
33
+ Check `.harness/state/install.json` exists:
34
+
35
+ ```bash
36
+ test -f .harness/state/install.json
37
+ ```
38
+
39
+ If it does NOT exist, print exactly:
40
+
41
+ ```
42
+ ❌ CCC-MAGI is not configured for this project (no .harness/state/install.json).
43
+
44
+ Next: run /init to configure.
45
+ ```
46
+
47
+ Then halt the skill. Do not proceed to later steps.
48
+
49
+ ---
50
+
51
+ ## Step 1 — Resolve current feature
52
+
53
+ If `$ARGUMENTS` is non-empty, use that string (trimmed) as the feature name and skip auto-detection.
54
+
55
+ Otherwise, auto-detect in priority order:
56
+
57
+ 1. **Git branch name.** Run `git rev-parse --abbrev-ref HEAD 2>/dev/null`. If the branch matches one of these patterns, extract `<name>`:
58
+ - `feat/<name>-...` or `feat/<name>` (no trailing dash)
59
+ - `fix/<name>-...` or `fix/<name>`
60
+ - `audit/<name>-...` or `audit/<name>`
61
+
62
+ 2. **Most recently modified spec file.** Look in `${spec_dir}` (resolved at Step 2) for `<feature>.md` files (exclude `<feature>-plan.md` and `<feature>-implementation.md`). Pick the one with the newest modification time as the candidate feature.
63
+
64
+ 3. **Ask the user.** If neither yields a feature, list any `<feature>.md` files found in `${spec_dir}` and ask:
65
+
66
+ ```
67
+ I couldn't auto-detect which feature you're working on.
68
+
69
+ Either:
70
+ - Tell me the feature name (I'll inspect its state)
71
+ - Or list active features: I see <list of <name>.md files in spec_dir>
72
+
73
+ Wait for user response before continuing.
74
+ ```
75
+
76
+ Wait for the user's reply. Do not guess.
77
+
78
+ ---
79
+
80
+ ## Step 2 — Read constitution.md to find directories
81
+
82
+ Read `constitution.md` to extract slot values:
83
+
84
+ - `spec_dir` — feature spec directory. Default fallback: `docs/features/`.
85
+ - `implementation_dir` — implementation notes directory. Default fallback: `docs/features/`.
86
+ - `backend_db_type` — used in Step 3 to decide whether to check for a schema doc.
87
+
88
+ If `constitution.md` is missing or unreadable, fall back to the defaults above and note the fallback in the final report.
89
+
90
+ ---
91
+
92
+ ## Step 3 — Inspect filesystem state for the feature
93
+
94
+ Compute these state booleans for the resolved feature. Use the resolved directory values from Step 2.
95
+
96
+ - `SPEC_EXISTS` — `test -f "${spec_dir}${feature}.md"`
97
+ - `SPEC_FINALIZED` — only if `SPEC_EXISTS`: `grep -q "FINALIZED" "${spec_dir}${feature}.md"`
98
+ - `IMPL_EXISTS` — `test -f "${implementation_dir}${feature}-implementation.md"`
99
+ - `PLAN_EXISTS` — `test -f "${spec_dir}${feature}-plan.md"`
100
+ - `BACKEND_PROJECT` — `backend_db_type` slot is non-empty and not `none`
101
+ - `SCHEMA_DOC_EXISTS` — heuristic: `test -f "${implementation_dir}${feature}-schema.md"` OR any file matching `${implementation_dir}${feature}-schema*.md`. If uncertain after these checks, treat as `false` and note the uncertainty in the report rather than guessing.
102
+ - `GIT_HAS_CHANGES` — `git status --porcelain` returns at least one line.
103
+ - `STATE_AUDITS_EXIST` — `test -d .harness/state/auditor-approvals` AND `ls .harness/state/auditor-approvals/${feature}-*.json 2>/dev/null` returns ≥1 entry.
104
+ - `CHECKPOINT_EXISTS` — `test -f .harness/state/workflow-checkpoints/${feature}.json`
105
+ - `CHECKPOINT_DATA` — if `CHECKPOINT_EXISTS`: parse with `jq '.current_stage, .stages_completed, .stages_skipped, .last_activity_at, .stage_in_progress'` for state cross-check.
106
+
107
+ If any check errors out (e.g., directories don't exist yet), treat the corresponding boolean as `false` and continue.
108
+
109
+ ### Step 3a — Cross-check filesystem state vs checkpoint (MAGI Archivist)
110
+
111
+ If `CHECKPOINT_EXISTS`, the checkpoint is the **canonical truth** for workflow state. Filesystem booleans serve as drift detection:
112
+
113
+ - If checkpoint says `current_stage = 5` but `SPEC_EXISTS = false` → drift; surface to CEO ("Checkpoint expects spec at `${spec_dir}${feature}.md` but it's missing. Suggest /pickup to inspect, or /feature-draft to restart").
114
+ - If checkpoint says `stages_skipped: [3]` and reason is "no backend" → skip Stage 3 in the recommendation.
115
+ - If checkpoint's `stage_in_progress.files_done_list` is non-empty → the user is mid-Stage-5; suggest `/pickup` instead of `/implement` (resume picks up at the right file).
116
+ - If `last_activity_at` is > 7 days ago → add a flag: "Last activity 8 days ago — `/pickup` for context recall recommended."
117
+
118
+ Without checkpoint, fall back to pure filesystem inference (existing logic below).
119
+
120
+ ---
121
+
122
+ ## Step 4 — Determine workflow stage + recommended next command
123
+
124
+ Apply this state machine in priority order. The first matching branch wins.
125
+
126
+ ```
127
+ IF NOT SPEC_EXISTS:
128
+ → Stage: 0 (pre-Stage 1)
129
+ → Suggest: /feature-draft ${feature}
130
+ → Reason: "No spec file yet at ${spec_dir}${feature}.md."
131
+
132
+ ELIF SPEC_EXISTS AND NOT SPEC_FINALIZED:
133
+ → Stage: 1 done, Stage 2 pending
134
+ → Suggest: /spec-finalize ${feature}
135
+ → Reason: "Spec exists but not FINALIZED. Run /spec-finalize to lock it in."
136
+
137
+ ELIF SPEC_FINALIZED AND BACKEND_PROJECT AND NOT SCHEMA_DOC_EXISTS:
138
+ → Stage: 2 done, Stage 3 pending
139
+ → Suggest: /db-schema ${feature}
140
+ → Reason: "Spec finalized; backend project but no schema design yet. Run /db-schema (or skip if no DB change)."
141
+
142
+ ELIF SPEC_FINALIZED AND NOT PLAN_EXISTS:
143
+ → Stage: 3 done (or skipped), Stage 4 pending
144
+ → Suggest: /execution-plan ${feature}
145
+ → Reason: "Spec ready. Time to write the per-file execution plan."
146
+
147
+ ELIF PLAN_EXISTS AND NOT GIT_HAS_CHANGES:
148
+ → Stage: 4 done, Stage 5 not started
149
+ → Suggest: /implement ${feature}
150
+ → Reason: "Plan exists but no code changes yet. Run /implement to start coding."
151
+
152
+ ELIF PLAN_EXISTS AND GIT_HAS_CHANGES:
153
+ → Stage: 5 in progress
154
+ → Suggest: /test-fix OR continue /implement ${feature}
155
+ → Reason: "Code changes detected. Either continue /implement or move to /test-fix when implementation is done."
156
+
157
+ ELIF GIT_HAS_CHANGES AND NOT PLAN_EXISTS:
158
+ → Lane: stability-fix or trivial-change (no Stage 4 plan needed)
159
+ → Suggest: /test-fix (if test_required) then /commit
160
+ → Reason: "Changes detected without a plan file. This looks like a trivial-change or stability-fix lane. Run /test-fix (if test_required) then /commit when ready."
161
+
162
+ ELIF NOT GIT_HAS_CHANGES AND PLAN_EXISTS:
163
+ → Stage: 6 / 7 done; plan file expected to be deleted at Stage 8 (commit)
164
+ → Suggest: /commit
165
+ → Reason: "Looks like all stages done. Run /commit to ship + clean up the plan file."
166
+
167
+ ELSE:
168
+ → Idle state
169
+ → Suggest: /feature-draft <new-feature> OR /audit-spec <existing-feature>
170
+ → Reason: "No active work detected. Either start a new feature or audit an existing one."
171
+ ```
172
+
173
+ If the detected state matches multiple branches in confusing ways (e.g., plan exists AND a different feature has uncommitted changes), default to **surfacing the ambiguity** to the user rather than picking one — see Step 5.
174
+
175
+ ---
176
+
177
+ ## Step 5 — Present the recommendation
178
+
179
+ Print a structured report in the user's locale. Use this shape (translate the prose; keep skill names, file paths, and slot names verbatim):
180
+
181
+ ```
182
+ 📍 Current state for feature: <feature>
183
+
184
+ Stage: <stage number / name>
185
+ Workflow lane: <inferred lane — full / stability-fix / trivial — or "ambiguous, ask">
186
+
187
+ Detected state:
188
+ ✓/✗ Spec exists (${spec_dir}${feature}.md)
189
+ ✓/✗ Spec FINALIZED
190
+ ✓/✗ Implementation notes (${implementation_dir}${feature}-implementation.md)
191
+ ✓/✗ Plan file (${spec_dir}${feature}-plan.md)
192
+ ✓/✗ Git uncommitted changes
193
+ ✓/✗ Auditor approvals on file
194
+
195
+ ▶ Recommended next: <command>
196
+
197
+ Reason: <one-sentence explanation>
198
+
199
+ You can also (NL-first — just tell me in plain words; slash forms shown in parens only as fallback):
200
+ - Switch features: name the other feature (e.g., "看 X 这个 feature")
201
+ - Start something new: tell me what to build (e.g., "做个 X 功能")
202
+ - Audit an existing feature: ask me to check it (e.g., "审一下 X")
203
+ - See full workflow stages: see CLAUDE.md § Workflow
204
+ ```
205
+
206
+ After printing, **wait for the user to respond** (Spec-Kit discipline). Do NOT auto-invoke the recommended command. The user has to type the command explicitly themselves.
207
+
208
+ If the state was ambiguous, replace the `▶ Recommended next` line with:
209
+
210
+ ```
211
+ ▶ Ambiguous — please clarify:
212
+ <enumerate the candidate next commands and which signal points to each>
213
+ ```
214
+
215
+ …and wait for the user's pick.
216
+
217
+ ---
218
+
219
+ ## Rules / Anti-patterns
220
+
221
+ - **NEVER auto-invoke another skill** — `/next` only suggests; the user must explicitly type the recommended command.
222
+ - **NEVER modify any file** — read-only inspection. No writes to `.harness/state/`, no edits to constitution.md or spec files.
223
+ - **NEVER run `git commit` or `git push`** — out of scope.
224
+ - **NEVER guess a feature name from prose** — only the explicit `$ARGUMENTS`, the git branch pattern, or the most-recently-modified spec file are authoritative. If none yield a feature, ask the user.
225
+ - **NEVER translate file paths, slot names, or skill names** — those stay in English regardless of locale.
226
+ - **Surface ambiguity rather than picking arbitrarily** — if multiple features look active or the state doesn't match a single branch cleanly, ask the user instead of guessing.
227
+
228
+ ---
229
+
230
+ ## Trust contract
231
+
232
+ - This skill writes to **zero files**. It is strictly read-only.
233
+ - It reads at most: `constitution.md`, `.harness/state/install.json`, files in `${spec_dir}` and `${implementation_dir}`, and runs read-only git commands (`rev-parse`, `status`, `branch`).
234
+ - The user always types the next command themselves — `/next` is a wayfinder, not an autopilot.
235
+
236
+ ---
237
+
238
+ ## Completion criteria
239
+
240
+ `/next` is complete when:
241
+
242
+ - Step 0 has run (CCC-MAGI presence verified, or skill halted with the install message).
243
+ - Step 1 has resolved a feature name (either from `$ARGUMENTS`, auto-detection, or a user response).
244
+ - Steps 2–4 have computed state and selected a recommendation (or flagged ambiguity).
245
+ - Step 5 has displayed the report to the user and the skill has stopped without invoking any other command.
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: offload
3
+ description: |
4
+ Spawn a fresh-context subagent to complete a discrete sub-task and return a 1-2K summary. Use when budget pressure (~75%) makes finishing the current sub-task in the main thread risky, but you don't need full session handoff yet.
5
+
6
+ Trigger when:
7
+ - Budget-monitor 75% menu surfaces "[2] /offload <task>"
8
+ - User says "把这个交给 subagent / 找个新 context 做 X / spawn agent for X / offload X"
9
+ - You (AI) recognize the main thread context is full but a discrete next sub-task has clean boundaries
10
+ allowed-tools: Task, Read, Bash(git status:*)
11
+ argument-hint: <task description>
12
+ ---
13
+
14
+ # /offload
15
+
16
+ Subagent isolation as a budget-pressure release valve. Instead of forcing a full session handoff at 75%, you spawn an isolated-context subagent that does a discrete sub-task and returns just its summary. The main thread context grows by ~1-2K tokens instead of by the sub-task's full execution trace.
17
+
18
+ ## When this is the right answer
19
+
20
+ - Context is ~70-85% and a clean sub-task is next (refactor a file, write a set of tests, search for a pattern across the codebase, generate a script)
21
+ - The sub-task has **clear inputs and clear outputs** — easily described in ≤300 chars
22
+ - You don't need ongoing dialogue with the user inside the sub-task
23
+
24
+ ## When this is NOT the right answer
25
+
26
+ - Context >95% → use `/handoff` instead (offload only delays the inevitable)
27
+ - Sub-task requires user judgment partway through → can't be isolated
28
+ - Sub-task is "improve the whole codebase" → too vague; subagent will burn budget without a clear stop condition
29
+ - The work would only cost ~1K tokens anyway → just do it inline
30
+
31
+ ## How it works
32
+
33
+ You invoke the Task tool with a carefully-scoped prompt. The subagent runs in its own 200K context window, returns a single message back. From the main thread's perspective, the cost is:
34
+ - ~500 tokens of subagent prompt
35
+ - ~500-2000 tokens of subagent return summary
36
+
37
+ Total main-thread overhead: typically 1-3K tokens vs. the 10-30K the task would have cost inline.
38
+
39
+ ## Step 1 — Scope the sub-task
40
+
41
+ Before invoking, you (the AI) write a tight sub-task prompt:
42
+
43
+ ```
44
+ Task: <one-sentence description>
45
+
46
+ Inputs:
47
+ - <relevant file paths>
48
+ - <constraints>
49
+
50
+ Outputs:
51
+ - <what the subagent should return>
52
+ - <format expectations>
53
+
54
+ Constraints:
55
+ - Stay focused on this sub-task only
56
+ - Don't open Explore agents recursively
57
+ - Report in ≤500 words
58
+ ```
59
+
60
+ Ask the user to confirm the scope before invoking (in CEO's locale):
61
+
62
+ ```
63
+ ─── Offload Plan ─────────────────────────────────
64
+
65
+ Sub-task: <description>
66
+
67
+ Inputs:
68
+ - <list>
69
+
70
+ Subagent will return:
71
+ - <list>
72
+
73
+ Expected main-thread overhead: ~1-3K tokens
74
+ Subagent type: general-purpose
75
+
76
+ Confirm?
77
+ [1] Spawn subagent
78
+ [2] Edit scope
79
+ [3] Cancel (do task inline instead)
80
+ ```
81
+
82
+ ## Step 2 — Invoke
83
+
84
+ On `[1]`:
85
+
86
+ Use the Task tool with:
87
+ - `subagent_type: "general-purpose"` (default) OR a specific type if the project has one matching the sub-task (e.g., `test-fixer` for test work, `backend-reviewer` for backend audits)
88
+ - A self-contained `prompt` that gives the subagent enough context — it CANNOT see your conversation history
89
+ - `description` short summary (3-5 words)
90
+
91
+ CRITICAL: the prompt must be self-contained. The subagent has no access to:
92
+ - Conversation history
93
+ - TodoWrite state
94
+ - Open files in your main session
95
+
96
+ So bake in: file paths to read, the specific objective, the success criteria, and any project conventions the subagent needs to know.
97
+
98
+ ## Step 3 — Report back to CEO
99
+
100
+ Once the subagent returns, summarize in CEO's locale:
101
+
102
+ ```
103
+ ✓ Offload complete
104
+
105
+ Sub-task: <description>
106
+ Subagent verdict: <PASS / CONCERNS / FAIL>
107
+
108
+ Summary:
109
+ <subagent's return summary, paraphrased to ≤200 chars>
110
+
111
+ Files modified by subagent:
112
+ <list, or "none">
113
+
114
+ Main thread overhead: ~<N>K tokens
115
+
116
+ Next: continue with <next planned action>
117
+ ```
118
+
119
+ ## Trust contract
120
+
121
+ - This skill spawns ONE subagent. Multiple offloads in a single turn defeat the purpose.
122
+ - The subagent runs without user oversight — only invoke when the scope is clear-cut and the risk is bounded.
123
+ - Subagent failures (subagent returns "couldn't do X") are surfaced to CEO; you don't silently retry.
124
+
125
+ ## When you should auto-invoke vs. ask the CEO
126
+
127
+ - **Auto-invoke** if the user explicitly said `/offload <task>` (clear intent)
128
+ - **Ask first** if budget-monitor 75% menu fired and you're proposing offload — show the Step 1 scope plan
129
+ - **Don't auto-invoke** mid-task without budget pressure — that's just using a subagent for no reason
130
+
131
+ ## Completion criteria
132
+
133
+ - Subagent invoked, returned a result, user has seen the Step 3 summary, OR
134
+ - Subagent failed or was cancelled at Step 1; control returned to main thread; alternative plan stated
@@ -0,0 +1,213 @@
1
+ ---
2
+ name: pickup
3
+ description: |
4
+ Resume an in-progress feature from where you left off (across sessions, devices, days). Reads `.harness/state/workflow-checkpoints/<feature>.json` and restores: which stage you were at, which artifacts exist, what files were already implemented, what audit verdicts have been issued, and what CEO decisions were made.
5
+
6
+ Trigger when the user:
7
+ - Invokes `/pickup` (no args = resume current git-branch's feature; with feature name = resume that one)
8
+ - Says "continue where I left off" / "继续上次的进度" / "前回の続きから" / "이어서 작업"
9
+ - Says "what was I doing on user-login?" / "user-login 我做到哪了?"
10
+ - Reopens Claude on a branch that matches an existing checkpoint (SessionStart hook auto-surfaces this)
11
+ argument-hint: [<feature-slug>] [--list] [--force-restart]
12
+ ---
13
+
14
+ # /pickup
15
+
16
+ > *Operational basis: Stage 7 of `CLAUDE.md § Workflow` (CEO smoke test) and Stage 8 (commit) presume a coherent workflow state. When a session is interrupted between stages, `/pickup` reconstructs that state.*
17
+
18
+ > **MAGI position**: This skill is operated by **MAGI Archivist** (per `AGENTS.md § MAGI System`). Archivist's job is to recall and announce prior state, then hand control back to MAGI Core for the next stage.
19
+
20
+ ## When to use
21
+
22
+ Three common entry points:
23
+
24
+ 1. **Cross-day continuation** — you stopped Friday at Stage 5 (3/8 files done), come back Monday. `/pickup` picks up exactly there.
25
+ 2. **Cross-device continuation** — you started on laptop, finish on desktop. Both have the same git branch + checkpoint file (if committed) or separate checkpoint files (if gitignored, which is the default).
26
+ 3. **Session timeout / compaction loss** — context window filled up, conversation compacted. `/pickup` reloads the structural state without re-paraphrasing every prior decision.
27
+
28
+ ## What it produces
29
+
30
+ Standard output (in user's locale):
31
+
32
+ ```
33
+ ─── MAGI Archivist · Resume Report ─────────────────────────────
34
+
35
+ 📂 Feature: user-login
36
+ Branch: feature/user-login
37
+ Mode: new-feature (full lane)
38
+
39
+ Started: 2026-05-25 14:00
40
+ Last activity: 2026-05-26 18:30 (16 hours ago)
41
+
42
+ ─── Progress ───────────────────────────────────
43
+ ✅ Stage 1 — spec drafted (docs/features/user-login.md, sha 4f7a)
44
+ ✅ Stage 2 — spec finalized (MAGI Verdict: PASS, risk=3)
45
+ ⏭️ Stage 3 — db schema (skipped: no backend)
46
+ ✅ Stage 4 — execution plan (docs/features/user-login-plan.md)
47
+ (MAGI Verdict: CONCERNS, risk=6)
48
+ ↳ CEO accepted, added index before commit
49
+ ⏳ Stage 5 — implementing (3 of 8 files done)
50
+ ✓ src/auth/types.ts
51
+ ✓ src/auth/session.ts
52
+ ✓ src/auth/login.ts
53
+ ▢ src/auth/middleware.ts ← next
54
+ ▢ src/auth/index.ts
55
+ ▢ tests/auth/login.test.ts
56
+ ▢ tests/auth/session.test.ts
57
+ ▢ src/routes/auth.ts
58
+ ⬜ Stage 6 — test-fix (pending)
59
+ ⬜ Stage 7 — CEO smoke (pending — CEO required for this)
60
+ ⬜ Stage 8 — commit (pending)
61
+
62
+ ─── Recent decisions (from decision-log.md, 3 most recent) ───
63
+ • 2026-05-26 15:00 — CEO: "accept index on session_id"
64
+ • 2026-05-26 14:50 — MAGI Verdict: CONCERNS — session_id needs index
65
+ • 2026-05-25 14:05 — CEO: "edge case #3 (race condition) is in scope"
66
+
67
+ What now? (NL-first — just tell me in plain words; slash forms in parens are optional fallback)
68
+ [1] Continue from where you left off — Stage 5, src/auth/middleware.ts (recommended)
69
+ [2] Re-validate Stage 4 first — re-run the cross-model auditor
70
+ [3] See full checkpoint detail
71
+ [4] Abandon this feature — mark dead, archive checkpoint (/abandon user-login)
72
+ [5] Switch to a different feature — just name it
73
+ >
74
+ ```
75
+
76
+ ## How to invoke
77
+
78
+ ### No args — resume current branch's feature
79
+ ```
80
+ /pickup
81
+ ```
82
+ - Reads current git branch (e.g., `feature/user-login`)
83
+ - Strips prefix `feature/` → feature slug `user-login`
84
+ - Reads `.harness/state/workflow-checkpoints/user-login.json`
85
+ - Surfaces the report above
86
+ - If no checkpoint exists for this branch → tells user (NL-first): *"No checkpoint for user-login. You can either tell me what new feature to start, or ask me to list other in-progress features (slash fallback: `/feature-draft <name>` or `/pickup --list`)."*
87
+
88
+ ### Explicit feature name
89
+ ```
90
+ /pickup user-login
91
+ ```
92
+ - Reads `.harness/state/workflow-checkpoints/user-login.json` regardless of current branch
93
+ - If user is on a different branch, asks: *"Switch to feature/user-login first? [Y/n]"*
94
+
95
+ ### List all in-progress
96
+ ```
97
+ /pickup --list
98
+ ```
99
+ Outputs:
100
+ ```
101
+ In-progress features:
102
+ ● user-login Stage 5 (16h ago) ← current branch
103
+ ○ notifications Stage 2 (3 days ago)
104
+ ○ billing Stage 1 (5 days ago)
105
+ ○ admin-dashboard Stage 6 (1 day ago) ⚠️ test-fix iter 3/3, escalate
106
+ ```
107
+
108
+ ### Force restart from current stage
109
+ ```
110
+ /pickup --force-restart
111
+ ```
112
+ - Re-loads the checkpoint but invalidates the "in-progress" state of the current stage
113
+ - Useful when you want to redo Stage 5 from scratch (e.g., wholesale plan change)
114
+ - Does NOT reset prior stages' artifacts — those are kept
115
+
116
+ ## Checkpoint schema (for reference; auto-written by stage skills)
117
+
118
+ Path: `.harness/state/workflow-checkpoints/<feature-slug>.json`
119
+
120
+ ```json
121
+ {
122
+ "schema_version": 1,
123
+ "feature": "user-login",
124
+ "feature_slug": "user-login",
125
+ "branch": "feature/user-login",
126
+ "started_at": "2026-05-25T14:00:00Z",
127
+ "last_activity_at": "2026-05-26T18:30:00Z",
128
+ "mode": "new-feature", // or "audit"
129
+ "lane": "full", // or "stability-fix" / "trivial"
130
+ "current_stage": 5,
131
+ "stages_completed": [1, 2, 4],
132
+ "stages_skipped": [3],
133
+ "stages_skipped_reasons": {"3": "no backend"},
134
+ "artifacts": {
135
+ "spec": {"path": "docs/features/user-login.md", "sha256": "4f7a...", "exists": true},
136
+ "implementation": {"path": "docs/features/user-login-implementation.md", "sha256": "8c11...", "exists": true},
137
+ "plan": {"path": "docs/features/user-login-plan.md", "sha256": "2bb0...", "exists": true},
138
+ "schema": null
139
+ },
140
+ "audits": [
141
+ {"stage": 2, "verdict": "PASS", "risk": 3, "at": "2026-05-25T14:30:00Z"},
142
+ {"stage": 4, "verdict": "CONCERNS", "risk": 6, "at": "2026-05-26T14:50:00Z"}
143
+ ],
144
+ "stage_in_progress": {
145
+ "stage_number": 5,
146
+ "files_total": 8,
147
+ "files_done_list": ["src/auth/types.ts", "src/auth/session.ts", "src/auth/login.ts"],
148
+ "files_remaining_list": ["src/auth/middleware.ts", "src/auth/index.ts", "tests/auth/login.test.ts", "tests/auth/session.test.ts", "src/routes/auth.ts"],
149
+ "last_action": "Wrote src/auth/login.ts (87 lines)",
150
+ "resume_hint": "Continue /implement from src/auth/middleware.ts (5 files remaining)"
151
+ },
152
+ "decisions": [
153
+ {"at": "2026-05-25T14:05:00Z", "stage": 1, "by": "CEO", "decision": "edge-case #3 (race condition) is in scope"},
154
+ {"at": "2026-05-26T14:50:00Z", "stage": 4, "by": "MAGI Verdict", "decision": "CONCERNS — session_id needs index"},
155
+ {"at": "2026-05-26T15:00:00Z", "stage": 4, "by": "CEO", "decision": "accept index addition before commit"}
156
+ ],
157
+ "session_chain": [
158
+ {"session_id": "abc-123", "started": "2026-05-25T14:00:00Z", "ended": "2026-05-25T15:30:00Z"},
159
+ {"session_id": "def-456", "started": "2026-05-26T14:00:00Z", "ended": "2026-05-26T18:30:00Z"}
160
+ ]
161
+ }
162
+ ```
163
+
164
+ ## How checkpoints get written (built into stage skills)
165
+
166
+ Each stage skill writes/updates the checkpoint at its END:
167
+
168
+ | Stage skill | What it writes |
169
+ |---|---|
170
+ | `/feature-draft <name>` | Creates checkpoint. `current_stage = 1`, artifact.spec recorded |
171
+ | `/audit-spec <name>` | Creates or updates. `current_stage = 1` (audit mode) |
172
+ | `/spec-finalize <name>` | `current_stage = 2`, audit verdict appended |
173
+ | `/db-schema <name>` | `current_stage = 3`, audit verdict appended. Skipped → `stages_skipped += [3]` |
174
+ | `/execution-plan <name>` | `current_stage = 4`, audit verdict appended, artifact.plan recorded |
175
+ | `/implement <name>` | `current_stage = 5`. **Updates `stage_in_progress.files_done_list` after every Edit/Write tool use** (via PostToolUse hook) |
176
+ | `/test-fix` | `current_stage = 6`, audit verdict appended |
177
+ | `/commit <name>` | `current_stage = 8`, all stages marked complete, then checkpoint moved to `.harness/state/workflow-checkpoints/_archived/<feature>-<timestamp>.json` |
178
+
179
+ If you implement a new stage skill, follow the same pattern (see `/implement` for the reference implementation of mid-stage progress tracking).
180
+
181
+ ## How the welcome-back UX works
182
+
183
+ The SessionStart hook (`outcome/scripts/checkpoint-recall.sh` wired in `.claude/settings.json`) runs every time Claude Code opens:
184
+
185
+ 1. Reads current git branch (`git symbolic-ref HEAD`)
186
+ 2. Strips `feature/` / `feat/` / `fix/` prefix → feature slug
187
+ 3. Tests for `.harness/state/workflow-checkpoints/<slug>.json` — if exists, reads it
188
+ 4. Injects `additionalContext` to Claude: *"There's an in-progress feature `user-login` at Stage 5 (3/8 files done). The user may want to /pickup; surface it on first interaction."*
189
+ 5. Claude (acting as MAGI Core) greets the user with the resume offer at first response
190
+
191
+ This is the same pattern Continue.dev uses with `HistoryManager.loadLastSession()` but feature-scoped instead of session-scoped.
192
+
193
+ ## What this skill does NOT do
194
+
195
+ - **Doesn't roll back code** — if you have uncommitted changes that conflict with the checkpoint's expected state (e.g., you manually deleted a file the checkpoint says is done), `/pickup` warns but doesn't auto-fix. You decide.
196
+ - **Doesn't re-run MAGI Verdict automatically** — even if `last_activity_at` is months ago, prior verdicts still stand. Run `/audit-spec` to re-validate if you need a fresh judgment.
197
+ - **Doesn't handle multi-developer conflict** — checkpoint is gitignored, so two devs on the same feature have independent checkpoints. Git branch is the conflict resolution mechanism, not the checkpoint.
198
+ - **Doesn't replace `/next`** — `/next` is the workflow status inspector (which command should I run next?). `/pickup` is the state restoration mechanism (what was I doing?). Both are complementary.
199
+
200
+ ## Failure modes
201
+
202
+ | Symptom | Cause | Fix |
203
+ |---|---|---|
204
+ | "No checkpoint for current branch" | You're on a non-feature branch (e.g., `main`) or this feature was started without going through the standard skills | Start the feature via `/feature-draft <name>` to create a checkpoint |
205
+ | "Checkpoint references missing file `<path>`" | An artifact was manually deleted | Either restore the file from git or use `/feature-draft <name> --reset` to redo Stage 1 |
206
+ | "Multiple checkpoints found, ambiguous" | Branch name doesn't cleanly map to feature slug | Use explicit form: `/pickup <feature-slug>` |
207
+ | "Checkpoint schema version mismatch" | You upgraded CCC-MAGI to a newer schema | The harness offers `/pickup --migrate-checkpoint` to upgrade old checkpoints |
208
+
209
+ ## Completion criteria
210
+
211
+ - Checkpoint read successfully → MAGI Archivist surfaces full report
212
+ - User picks a continuation option → control hands to the appropriate stage skill (e.g., `/implement` for Stage 5 continuation)
213
+ - If no checkpoint exists → tell the user clearly + suggest `/feature-draft <name>` to start one