claude-code-pilot 3.1.1 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +16 -11
  3. package/bin/install.js +127 -11
  4. package/manifest.json +20 -1
  5. package/package.json +4 -3
  6. package/src/agents/a11y-architect.md +141 -0
  7. package/src/agents/code-architect.md +71 -0
  8. package/src/agents/code-explorer.md +69 -0
  9. package/src/agents/code-simplifier.md +47 -0
  10. package/src/agents/comment-analyzer.md +45 -0
  11. package/src/agents/csharp-reviewer.md +101 -0
  12. package/src/agents/dart-build-resolver.md +201 -0
  13. package/src/agents/django-build-resolver.md +252 -0
  14. package/src/agents/django-reviewer.md +169 -0
  15. package/src/agents/fastapi-reviewer.md +79 -0
  16. package/src/agents/fsharp-reviewer.md +109 -0
  17. package/src/agents/pr-test-analyzer.md +45 -0
  18. package/src/agents/silent-failure-hunter.md +50 -0
  19. package/src/agents/swift-build-resolver.md +170 -0
  20. package/src/agents/swift-reviewer.md +116 -0
  21. package/src/agents/type-design-analyzer.md +41 -0
  22. package/src/available-rules/README.md +3 -1
  23. package/src/available-rules/dart/coding-style.md +159 -0
  24. package/src/available-rules/dart/hooks.md +66 -0
  25. package/src/available-rules/dart/patterns.md +261 -0
  26. package/src/available-rules/dart/security.md +135 -0
  27. package/src/available-rules/dart/testing.md +215 -0
  28. package/src/available-rules/web/coding-style.md +105 -0
  29. package/src/available-rules/web/design-quality.md +72 -0
  30. package/src/available-rules/web/hooks.md +129 -0
  31. package/src/available-rules/web/patterns.md +88 -0
  32. package/src/available-rules/web/performance.md +73 -0
  33. package/src/available-rules/web/security.md +66 -0
  34. package/src/available-rules/web/testing.md +64 -0
  35. package/src/commands/ccp/ai-integration-phase.md +36 -0
  36. package/src/commands/ccp/audit-fix.md +33 -0
  37. package/src/commands/ccp/code-review-fix.md +52 -0
  38. package/src/commands/ccp/cost-report.md +107 -0
  39. package/src/commands/ccp/eval-review.md +32 -0
  40. package/src/commands/ccp/extract_learnings.md +22 -0
  41. package/src/commands/ccp/import.md +37 -0
  42. package/src/commands/ccp/ingest-docs.md +42 -0
  43. package/src/commands/ccp/intel.md +179 -0
  44. package/src/commands/ccp/mvp-phase.md +45 -0
  45. package/src/commands/ccp/plan-prd.md +160 -0
  46. package/src/commands/ccp/plan-review-convergence.md +58 -0
  47. package/src/commands/ccp/pr-ecc.md +184 -0
  48. package/src/commands/ccp/scan.md +26 -0
  49. package/src/commands/ccp/security-scan.md +74 -0
  50. package/src/commands/ccp/sketch-wrap-up.md +31 -0
  51. package/src/commands/ccp/sketch.md +54 -0
  52. package/src/commands/ccp/spec-phase.md +62 -0
  53. package/src/commands/ccp/spike-wrap-up.md +31 -0
  54. package/src/commands/ccp/spike.md +51 -0
  55. package/src/commands/ccp/ultraplan-phase.md +33 -0
  56. package/src/hooks/ccp-bash-hook-dispatcher.js +96 -0
  57. package/src/hooks/ccp-context-monitor.js +23 -0
  58. package/src/hooks/ccp-doc-file-warning.js +93 -0
  59. package/src/hooks/ccp-pre-bash-dispatcher.js +24 -0
  60. package/src/hooks/ccp-read-injection-scanner.js +152 -0
  61. package/src/hooks/ccp-write-gateguard.js +868 -0
  62. package/src/hooks/kit-check-update.js +59 -7
  63. package/src/hooks/run-with-flags-shell.sh +1 -0
  64. package/src/hooks/run-with-flags.js +48 -1
  65. package/src/hooks/session-end.js +88 -1
  66. package/src/lib/hook-flags.js +14 -0
  67. package/src/lib/project-detect.js +0 -2
  68. package/src/lib/shell-substitution.js +499 -0
  69. package/src/pilot/references/agent-contracts.md +79 -0
  70. package/src/pilot/references/ai-evals.md +156 -0
  71. package/src/pilot/references/ai-frameworks.md +186 -0
  72. package/src/pilot/references/doc-conflict-engine.md +91 -0
  73. package/src/pilot/references/execute-mvp-tdd.md +81 -0
  74. package/src/pilot/references/gate-prompts.md +100 -0
  75. package/src/pilot/references/gates.md +70 -0
  76. package/src/pilot/references/mandatory-initial-read.md +2 -0
  77. package/src/pilot/references/mvp-concepts.md +49 -0
  78. package/src/pilot/references/planner-graphify-auto-update.md +67 -0
  79. package/src/pilot/references/planner-human-verify-mode.md +57 -0
  80. package/src/pilot/references/planner-mvp-mode.md +53 -0
  81. package/src/pilot/references/project-skills-discovery.md +19 -0
  82. package/src/pilot/references/revision-loop.md +97 -0
  83. package/src/pilot/references/skeleton-template.md +48 -0
  84. package/src/pilot/references/sketch-interactivity.md +41 -0
  85. package/src/pilot/references/sketch-theme-system.md +94 -0
  86. package/src/pilot/references/sketch-tooling.md +45 -0
  87. package/src/pilot/references/sketch-variant-patterns.md +81 -0
  88. package/src/pilot/references/spidr-splitting.md +69 -0
  89. package/src/pilot/references/thinking-models-debug.md +44 -0
  90. package/src/pilot/references/thinking-models-execution.md +50 -0
  91. package/src/pilot/references/thinking-models-planning.md +62 -0
  92. package/src/pilot/references/thinking-models-research.md +50 -0
  93. package/src/pilot/references/thinking-models-verification.md +55 -0
  94. package/src/pilot/references/user-story-template.md +58 -0
  95. package/src/pilot/references/verify-mvp-mode.md +85 -0
  96. package/src/pilot/references/worktree-path-safety.md +89 -0
  97. package/src/pilot/templates/AI-SPEC.md +246 -0
  98. package/src/pilot/templates/spec.md +307 -0
  99. package/src/pilot/workflows/ai-integration-phase.md +284 -0
  100. package/src/pilot/workflows/audit-fix.md +175 -0
  101. package/src/pilot/workflows/code-review-fix.md +497 -0
  102. package/src/pilot/workflows/eval-review.md +155 -0
  103. package/src/pilot/workflows/extract_learnings.md +242 -0
  104. package/src/pilot/workflows/help.md +5 -0
  105. package/src/pilot/workflows/import.md +246 -0
  106. package/src/pilot/workflows/ingest-docs.md +328 -0
  107. package/src/pilot/workflows/mvp-phase.md +199 -0
  108. package/src/pilot/workflows/plan-review-convergence.md +329 -0
  109. package/src/pilot/workflows/scan.md +102 -0
  110. package/src/pilot/workflows/sketch-wrap-up.md +285 -0
  111. package/src/pilot/workflows/sketch.md +360 -0
  112. package/src/pilot/workflows/spec-phase.md +262 -0
  113. package/src/pilot/workflows/spike-wrap-up.md +306 -0
  114. package/src/pilot/workflows/spike.md +452 -0
  115. package/src/pilot/workflows/ultraplan-phase.md +189 -0
  116. package/src/skills/accessibility/SKILL.md +146 -0
  117. package/src/skills/agent-architecture-audit/SKILL.md +256 -0
  118. package/src/skills/agent-eval/SKILL.md +145 -0
  119. package/src/skills/agent-harness-design/SKILL.md +73 -0
  120. package/src/skills/agent-introspection-debugging/SKILL.md +153 -0
  121. package/src/skills/android-clean-architecture/SKILL.md +339 -0
  122. package/src/skills/angular-developer/SKILL.md +154 -0
  123. package/src/skills/angular-developer/references/angular-animations.md +160 -0
  124. package/src/skills/angular-developer/references/angular-aria.md +410 -0
  125. package/src/skills/angular-developer/references/cli.md +86 -0
  126. package/src/skills/angular-developer/references/component-harnesses.md +59 -0
  127. package/src/skills/angular-developer/references/component-styling.md +91 -0
  128. package/src/skills/angular-developer/references/components.md +117 -0
  129. package/src/skills/angular-developer/references/creating-services.md +97 -0
  130. package/src/skills/angular-developer/references/data-resolvers.md +69 -0
  131. package/src/skills/angular-developer/references/define-routes.md +67 -0
  132. package/src/skills/angular-developer/references/defining-providers.md +72 -0
  133. package/src/skills/angular-developer/references/di-fundamentals.md +120 -0
  134. package/src/skills/angular-developer/references/e2e-testing.md +56 -0
  135. package/src/skills/angular-developer/references/effects.md +83 -0
  136. package/src/skills/angular-developer/references/hierarchical-injectors.md +43 -0
  137. package/src/skills/angular-developer/references/host-elements.md +80 -0
  138. package/src/skills/angular-developer/references/injection-context.md +63 -0
  139. package/src/skills/angular-developer/references/inputs.md +101 -0
  140. package/src/skills/angular-developer/references/linked-signal.md +59 -0
  141. package/src/skills/angular-developer/references/loading-strategies.md +61 -0
  142. package/src/skills/angular-developer/references/mcp.md +108 -0
  143. package/src/skills/angular-developer/references/navigate-to-routes.md +69 -0
  144. package/src/skills/angular-developer/references/outputs.md +86 -0
  145. package/src/skills/angular-developer/references/reactive-forms.md +122 -0
  146. package/src/skills/angular-developer/references/rendering-strategies.md +44 -0
  147. package/src/skills/angular-developer/references/resource.md +77 -0
  148. package/src/skills/angular-developer/references/route-animations.md +56 -0
  149. package/src/skills/angular-developer/references/route-guards.md +52 -0
  150. package/src/skills/angular-developer/references/router-lifecycle.md +45 -0
  151. package/src/skills/angular-developer/references/router-testing.md +87 -0
  152. package/src/skills/angular-developer/references/show-routes-with-outlets.md +68 -0
  153. package/src/skills/angular-developer/references/signal-forms.md +795 -0
  154. package/src/skills/angular-developer/references/signals-overview.md +94 -0
  155. package/src/skills/angular-developer/references/tailwind-css.md +69 -0
  156. package/src/skills/angular-developer/references/template-driven-forms.md +114 -0
  157. package/src/skills/angular-developer/references/testing-fundamentals.md +65 -0
  158. package/src/skills/api-connector-builder/SKILL.md +120 -0
  159. package/src/skills/code-tour/SKILL.md +236 -0
  160. package/src/skills/compose-multiplatform-patterns/SKILL.md +299 -0
  161. package/src/skills/csharp-testing/SKILL.md +321 -0
  162. package/src/skills/dart-flutter-patterns/SKILL.md +563 -0
  163. package/src/skills/dashboard-builder/SKILL.md +108 -0
  164. package/src/skills/dotnet-patterns/SKILL.md +321 -0
  165. package/src/skills/error-handling/SKILL.md +376 -0
  166. package/src/skills/fastapi-patterns/SKILL.md +327 -0
  167. package/src/skills/flox-environments/SKILL.md +496 -0
  168. package/src/skills/frontend-design/SKILL.md +145 -0
  169. package/src/skills/frontend-slides/SKILL.md +184 -0
  170. package/src/skills/frontend-slides/STYLE_PRESETS.md +330 -0
  171. package/src/skills/fsharp-testing/SKILL.md +280 -0
  172. package/src/skills/gateguard/SKILL.md +121 -0
  173. package/src/skills/github-ops/SKILL.md +144 -0
  174. package/src/skills/hookify-rules/SKILL.md +128 -0
  175. package/src/skills/ios-icon-gen/SKILL.md +157 -0
  176. package/src/skills/ios-icon-gen/scripts/generate_icons.swift +258 -0
  177. package/src/skills/ios-icon-gen/scripts/iconify_gen.sh +235 -0
  178. package/src/skills/knowledge-ops/SKILL.md +154 -0
  179. package/src/skills/liquid-glass-design/SKILL.md +279 -0
  180. package/src/skills/make-interfaces-feel-better/SKILL.md +151 -0
  181. package/src/skills/mysql-patterns/SKILL.md +412 -0
  182. package/src/skills/nestjs-patterns/SKILL.md +230 -0
  183. package/src/skills/plan-orchestrate/SKILL.md +220 -0
  184. package/src/skills/prisma-patterns/SKILL.md +371 -0
  185. package/src/skills/production-audit/SKILL.md +206 -0
  186. package/src/skills/security-bounty-hunter/SKILL.md +99 -0
  187. package/src/skills/security-scan/references/agentshield-policy-exception/candidate-playbook.md +49 -0
  188. package/src/skills/security-scan/references/agentshield-policy-exception/report.json +35 -0
  189. package/src/skills/security-scan/references/agentshield-policy-exception/scenario.json +62 -0
  190. package/src/skills/security-scan/references/agentshield-policy-exception/trace.json +45 -0
  191. package/src/skills/security-scan/references/agentshield-policy-exception/verifier-result.json +35 -0
  192. package/src/skills/swift-actor-persistence/SKILL.md +143 -0
  193. package/src/skills/swift-protocol-di-testing/SKILL.md +190 -0
  194. package/src/skills/swiftui-patterns/SKILL.md +259 -0
  195. package/src/skills/terminal-ops/SKILL.md +109 -0
  196. package/src/skills/ui-demo/SKILL.md +465 -0
  197. package/src/skills/vite-patterns/SKILL.md +449 -0
  198. package/src/skills/windows-desktop-e2e/SKILL.md +887 -0
@@ -0,0 +1,328 @@
1
+ # Ingest Docs Workflow
2
+
3
+ Scan a repo for mixed planning documents (ADR, PRD, SPEC, DOC), synthesize them into a consolidated context, and bootstrap or merge into `.planning/`.
4
+
5
+ - `[path]` — optional target directory to scan (defaults to repo root)
6
+ - `--mode new|merge` — override auto-detect (defaults: `new` if `.planning/` absent, `merge` if present)
7
+ - `--manifest <file>` — YAML file listing `{path, type, precedence?}` per doc; overrides heuristic classification
8
+ - `--resolve auto|interactive` — conflict resolution (v1: only `auto` is supported; `interactive` is reserved)
9
+
10
+ ---
11
+
12
+ <step name="banner">
13
+
14
+ Display the stage banner:
15
+
16
+ ```
17
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
18
+ GSD ► INGEST DOCS
19
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
20
+ ```
21
+
22
+ </step>
23
+
24
+ <step name="parse_arguments">
25
+
26
+ Parse `$ARGUMENTS`:
27
+
28
+ - First positional token (if not a flag) → `SCAN_PATH` (default: `.`)
29
+ - `--mode new|merge` → `MODE` (default: auto-detect)
30
+ - `--manifest <file>` → `MANIFEST_PATH` (optional)
31
+ - `--resolve auto|interactive` → `RESOLVE_MODE` (default: `auto`; reject `interactive` in v1 with message "interactive resolution is planned for a future release")
32
+
33
+ **Validate paths:**
34
+
35
+ ```bash
36
+ case "{SCAN_PATH}" in *..*) echo "SECURITY_ERROR: path contains traversal sequence"; exit 1 ;; esac
37
+ test -d "{SCAN_PATH}" || echo "PATH_NOT_FOUND"
38
+ if [ -n "{MANIFEST_PATH}" ]; then
39
+ case "{MANIFEST_PATH}" in *..*) echo "SECURITY_ERROR: manifest path contains traversal"; exit 1 ;; esac
40
+ test -f "{MANIFEST_PATH}" || echo "MANIFEST_NOT_FOUND"
41
+ fi
42
+ ```
43
+
44
+ **Containment (required):** After resolving `SCAN_PATH` and `MANIFEST_PATH` relative to the repo root, canonicalize each with `realpath` (or platform equivalent) and assert the result is under `realpath("$REPO_ROOT")`. Reject absolute paths outside the repo (e.g. `/tmp`, `C:\Windows`) even when they do not contain `..`.
45
+
46
+ If `PATH_NOT_FOUND` or `MANIFEST_NOT_FOUND`: display error and exit.
47
+
48
+ </step>
49
+
50
+ <step name="init_and_mode_detect">
51
+
52
+ Run the init query:
53
+
54
+ ```bash
55
+ INIT=$(gsd-sdk query init.ingest-docs)
56
+ ```
57
+
58
+ Parse `project_exists`, `planning_exists`, `has_git`, `project_path` from INIT.
59
+
60
+ **Auto-detect MODE** if not set:
61
+ - `planning_exists: true` → `MODE=merge`
62
+ - `planning_exists: false` → `MODE=new`
63
+
64
+ If user passed `--mode new` but `.planning/` already exists: display warning and require explicit confirm via `AskUserQuestion` (approve-revise-abort from `references/gate-prompts.md`) before overwriting.
65
+
66
+ If `has_git: false` and `MODE=new`: initialize git:
67
+ ```bash
68
+ git init
69
+ ```
70
+
71
+ **Detect runtime** using the same pattern as `new-project.md`:
72
+ - execution_context path `/.codex/` → `RUNTIME=codex`
73
+ - `/.gemini/` → `RUNTIME=gemini`
74
+ - `/.opencode/` or `/.config/opencode/` → `RUNTIME=opencode`
75
+ - else → `RUNTIME=claude`
76
+
77
+ Fall back to env vars (`CODEX_HOME`, `GEMINI_CONFIG_DIR`, `OPENCODE_CONFIG_DIR`) if execution_context is unavailable.
78
+
79
+ </step>
80
+
81
+ <step name="discover_docs">
82
+
83
+ Build the doc list from three sources, in order:
84
+
85
+ **1. Manifest (if provided)** — authoritative:
86
+
87
+ Read `MANIFEST_PATH`. Expected YAML shape:
88
+
89
+ ```yaml
90
+ docs:
91
+ - path: docs/adr/0001-db.md
92
+ type: ADR
93
+ precedence: 0 # optional, lower = higher precedence
94
+ - path: docs/prd/auth.md
95
+ type: PRD
96
+ ```
97
+
98
+ Each entry provides `path` (required, relative to repo root) + `type` (required, one of ADR|PRD|SPEC|DOC) + `precedence` (optional integer).
99
+
100
+ **2. Directory conventions** (skipped when manifest is provided):
101
+
102
+ ```bash
103
+ # ADRs
104
+ find {SCAN_PATH} -type f \( -path '*/adr/*' -o -path '*/adrs/*' -o -name 'ADR-*.md' -o -regex '.*/[0-9]\{4\}-.*\.md' \) 2>/dev/null
105
+
106
+ # PRDs
107
+ find {SCAN_PATH} -type f \( -path '*/prd/*' -o -path '*/prds/*' -o -name 'PRD-*.md' \) 2>/dev/null
108
+
109
+ # SPECs / RFCs
110
+ find {SCAN_PATH} -type f \( -path '*/spec/*' -o -path '*/specs/*' -o -path '*/rfc/*' -o -path '*/rfcs/*' -o -name 'SPEC-*.md' -o -name 'RFC-*.md' \) 2>/dev/null
111
+
112
+ # Generic docs (fall-through candidates)
113
+ find {SCAN_PATH} -type f -path '*/docs/*' -name '*.md' 2>/dev/null
114
+ ```
115
+
116
+ De-duplicate the union (a file matched by multiple patterns is one doc).
117
+
118
+ **3. Content heuristics** (run during classification, not here) — the classifier handles frontmatter `type:` and H1 inspection for docs that didn't match a convention.
119
+
120
+ **Cap:** hard limit of 50 docs per invocation (documented v1 constraint). If the discovered set exceeds 50:
121
+
122
+ ```
123
+ GSD > Discovered {N} docs, which exceeds the v1 cap of 50.
124
+ Use --manifest to narrow the set to ≤ 50 files, or run
125
+ /ccp:ingest-docs again with a narrower <path>.
126
+ ```
127
+
128
+ Exit without proceeding.
129
+
130
+ **Display discovered set** and request approval (see `references/gate-prompts.md` — `yes-no-pick` pattern works; or `approve-revise-abort`):
131
+
132
+ ```
133
+ Discovered {N} documents:
134
+ {N} ADR | {N} PRD | {N} SPEC | {N} DOC | {N} unclassified
135
+
136
+ docs/adr/0001-architecture.md [ADR] (from manifest|directory|heuristic)
137
+ docs/adr/0002-database.md [ADR] (directory)
138
+ docs/prd/auth.md [PRD] (manifest)
139
+ ...
140
+ ```
141
+
142
+ **Text mode:** apply the same `--text`/`text_mode` rule as other workflows — replace `AskUserQuestion` with a numbered list.
143
+
144
+ Use `AskUserQuestion` (approve-revise-abort):
145
+ - question: "Proceed with classification of these {N} documents?"
146
+ - header: "Approve?"
147
+ - options: Approve | Revise | Abort
148
+
149
+ On Abort: exit cleanly with "Ingest cancelled."
150
+ On Revise: exit with guidance to re-run with `--manifest` or a narrower path.
151
+
152
+ </step>
153
+
154
+ <step name="classify_parallel">
155
+
156
+ Create staging directory:
157
+
158
+ ```bash
159
+ mkdir -p .planning/intel/classifications/
160
+ ```
161
+
162
+ For each discovered doc, spawn `gsd-doc-classifier` in parallel. In Claude Code, issue all Task calls in a single message with multiple tool uses so the harness runs them concurrently. For Copilot / sequential runtimes, fall back to sequential dispatch.
163
+
164
+ Per-spawn prompt fields:
165
+ - `FILEPATH` — absolute path to the doc
166
+ - `OUTPUT_DIR` — `.planning/intel/classifications/`
167
+ - `MANIFEST_TYPE` — the type from the manifest if present, else omit
168
+ - `MANIFEST_PRECEDENCE` — the precedence integer from the manifest if present, else omit
169
+ - `<required_reading>` — `agents/ccp:doc-classifier.md` (the agent definition itself)
170
+
171
+ Collect the one-line confirmations from each classifier. If any classifier errors out, surface the error and abort without touching `.planning/` further.
172
+
173
+ </step>
174
+
175
+ <step name="synthesize">
176
+
177
+ Spawn `gsd-doc-synthesizer` once:
178
+
179
+ ```
180
+ Task({
181
+ subagent_type: "gsd-doc-synthesizer",
182
+ prompt: "
183
+ CLASSIFICATIONS_DIR: .planning/intel/classifications/
184
+ INTEL_DIR: .planning/intel/
185
+ CONFLICTS_PATH: .planning/INGEST-CONFLICTS.md
186
+ MODE: {MODE}
187
+ EXISTING_CONTEXT: {paths to existing .planning files if MODE=merge, else empty}
188
+ PRECEDENCE: {array from manifest defaults or default ['ADR','SPEC','PRD','DOC']}
189
+
190
+ <required_reading>
191
+ - agents/ccp:doc-synthesizer.md
192
+ - get-shit-done/references/doc-conflict-engine.md
193
+ </required_reading>
194
+ "
195
+ })
196
+ ```
197
+
198
+ The synthesizer writes:
199
+ - `.planning/intel/decisions.md`, `.planning/intel/requirements.md`, `.planning/intel/constraints.md`, `.planning/intel/context.md`
200
+ - `.planning/intel/SYNTHESIS.md`
201
+ - `.planning/INGEST-CONFLICTS.md`
202
+
203
+ </step>
204
+
205
+ <step name="conflict_gate">
206
+
207
+ Read `.planning/INGEST-CONFLICTS.md`. Count entries in each bucket (the synthesizer always writes the three-bucket header; parse the `### BLOCKERS ({N})`, `### WARNINGS ({N})`, `### INFO ({N})` lines).
208
+
209
+ Apply the safety semantics from `references/doc-conflict-engine.md`. Operation noun: `ingest`.
210
+
211
+ **If BLOCKERS > 0:**
212
+
213
+ Render the report to the user, then display:
214
+
215
+ ```
216
+ GSD > BLOCKED: {N} blockers must be resolved before ingest can proceed.
217
+ ```
218
+
219
+ Exit WITHOUT writing PROJECT.md, REQUIREMENTS.md, ROADMAP.md, or STATE.md. The staging intel files remain for inspection. The safety gate holds — no destination files are written when blockers exist.
220
+
221
+ **If WARNINGS > 0 and BLOCKERS = 0:**
222
+
223
+ Render the report, then ask via AskUserQuestion (approve-revise-abort):
224
+ - question: "Review the competing variants above. Resolve manually and proceed, or abort?"
225
+ - header: "Approve?"
226
+ - options: Approve | Abort
227
+
228
+ On Abort: exit cleanly with "Ingest cancelled. Staged intel preserved at `.planning/intel/`."
229
+
230
+ **If BLOCKERS = 0 and WARNINGS = 0:**
231
+
232
+ Proceed to routing silently, or optionally display `GSD > No conflicts. Auto-resolved: {N}.`
233
+
234
+ </step>
235
+
236
+ <step name="route_new_mode">
237
+
238
+ **Applies only when MODE=new.**
239
+
240
+ Audit PROJECT.md field requirements that `gsd-roadmapper` expects. For fields derivable from `.planning/intel/SYNTHESIS.md` (project scope, goals/non-goals, constraints, locked decisions), synthesize from the intel. For fields NOT derivable (project name, developer-facing success metric, target runtime), prompt via `AskUserQuestion` one at a time — minimal question set, no interrogation.
241
+
242
+ Delegate to `gsd-roadmapper`:
243
+
244
+ ```
245
+ Task({
246
+ subagent_type: "gsd-roadmapper",
247
+ prompt: "
248
+ Mode: new-project-from-ingest
249
+ Intel: .planning/intel/SYNTHESIS.md (entry point)
250
+ Per-type intel: .planning/intel/{decisions,requirements,constraints,context}.md
251
+ User-supplied fields: {collected in previous step}
252
+
253
+ Produce:
254
+ - .planning/PROJECT.md
255
+ - .planning/REQUIREMENTS.md
256
+ - .planning/ROADMAP.md
257
+ - .planning/STATE.md
258
+
259
+ Treat ADR-locked decisions as locked in PROJECT.md <decisions> blocks.
260
+ "
261
+ })
262
+ ```
263
+
264
+ </step>
265
+
266
+ <step name="route_merge_mode">
267
+
268
+ **Applies only when MODE=merge.**
269
+
270
+ Load existing `.planning/ROADMAP.md`, `.planning/PROJECT.md`, `.planning/REQUIREMENTS.md`, all `CONTEXT.md` files under `.planning/phases/`.
271
+
272
+ The synthesizer has already hard-blocked on any LOCKED-in-ingest vs LOCKED-in-existing contradiction; if we reach this step, no such blockers remain.
273
+
274
+ Plan the merge:
275
+ - **New requirements** from synthesized `.planning/intel/requirements.md` that do not overlap existing REQUIREMENTS.md entries → append to REQUIREMENTS.md
276
+ - **New decisions** from synthesized `.planning/intel/decisions.md` that do not overlap existing CONTEXT.md `<decisions>` blocks → write to a new phase's CONTEXT.md or append to the next milestone's requirements
277
+ - **New scope** → derive phase additions following the `new-milestone.md` pattern; append phases to `.planning/ROADMAP.md`
278
+
279
+ Preview the merge diff to the user and gate via approve-revise-abort before writing.
280
+
281
+ </step>
282
+
283
+ <step name="finalize">
284
+
285
+ Commit the ingest results:
286
+
287
+ ```bash
288
+ gsd-sdk query commit "docs: ingest {N} docs from {SCAN_PATH} (#2387)" \
289
+ .planning/PROJECT.md \
290
+ .planning/REQUIREMENTS.md \
291
+ .planning/ROADMAP.md \
292
+ .planning/STATE.md \
293
+ .planning/intel/ \
294
+ .planning/INGEST-CONFLICTS.md
295
+ ```
296
+
297
+ (For merge mode, substitute the actual set of modified files.)
298
+
299
+ Display completion:
300
+
301
+ ```
302
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
303
+ GSD ► INGEST DOCS COMPLETE
304
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
305
+ ```
306
+
307
+ Show:
308
+ - Mode ran (new or merge)
309
+ - Docs ingested (count + type breakdown)
310
+ - Decisions locked, requirements created, constraints captured
311
+ - Conflict report path (`.planning/INGEST-CONFLICTS.md`)
312
+ - Next step: `/ccp:plan-phase 1` (new mode) or `/ccp:plan-phase N` (merge, pointing at the first newly-added phase)
313
+
314
+ </step>
315
+
316
+ ---
317
+
318
+ ## Anti-Patterns
319
+
320
+ Do NOT:
321
+ - Violate the shared conflict-engine contract in `references/doc-conflict-engine.md` (no markdown tables, no new severity labels, no bypass of the BLOCKER gate)
322
+ - Write PROJECT.md, REQUIREMENTS.md, ROADMAP.md, or STATE.md when BLOCKERs exist in the conflict report
323
+ - Skip the 50-doc cap — larger sets must use `--manifest` to narrow the scope
324
+ - Auto-resolve LOCKED-vs-LOCKED ADR contradictions — those are BLOCKERs in both modes
325
+ - Merge competing PRD acceptance variants into a combined criterion — preserve all variants for user resolution
326
+ - Bypass the discovery approval gate — users must see the classified doc list before classifiers spawn
327
+ - Skip path validation on `SCAN_PATH` or `MANIFEST_PATH`
328
+ - Implement `--resolve interactive` in this v1 — the flag is reserved; reject with a future-release message
@@ -0,0 +1,199 @@
1
+ <purpose>
2
+ Guide the user through MVP-mode planning for a phase. Prompts for an "As a / I want to / So that" user story, runs SPIDR splitting check on the story, writes the result to ROADMAP.md, and delegates to `/ccp:plan-phase` (which auto-detects MVP via the roadmap mode field shipped in PRD Phase 1).
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ @~/.claude/pilot/references/user-story-template.md
7
+ @~/.claude/pilot/references/spidr-splitting.md
8
+ @~/.claude/pilot/references/planner-mvp-mode.md
9
+ </required_reading>
10
+
11
+ <runtime_note>
12
+ **Copilot (VS Code):** Use `vscode_askquestions` wherever this workflow calls `AskUserQuestion`. They are equivalent.
13
+
14
+ **TEXT_MODE fallback:** Set TEXT_MODE=true if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is true. When TEXT_MODE is active, replace every AskUserQuestion call with a plain-text numbered list and ask the user to type their choice number.
15
+ </runtime_note>
16
+
17
+ <process>
18
+
19
+ ## 1. Parse and validate phase argument
20
+
21
+ Extract the phase number from `$ARGUMENTS` (integer or decimal like `2.1`). Optional flag: `--force` (allow operating on `in_progress` / `completed` phases).
22
+
23
+ If no argument:
24
+ ```
25
+ ERROR: Phase number required
26
+ Usage: /ccp:mvp-phase <phase-number>
27
+ Example: /ccp:mvp-phase 1
28
+ Example: /ccp:mvp-phase 2.1
29
+ ```
30
+ Exit.
31
+
32
+ Normalize per `@~/.claude/pilot/references/phase-argument-parsing.md` (zero-pad integer phases to two digits).
33
+
34
+ ## 2. Validate phase exists and check status
35
+
36
+ Read `.planning/ROADMAP.md` and extract the Phase `${PHASE}` block: locate the `### Phase ${PHASE}:` heading, then capture the `**Goal**:`, `**Mode**:` (if present), `**Depends on**:`, and `**Requirements**:` lines that follow. Record the phase name from the heading, the goal text, and the mode (empty string if no `**Mode**:` line exists).
37
+
38
+ To compute disk status, list the contents of `.planning/phases/` and check whether a directory matching `${PHASE}-*` exists, and whether it contains an `XX-SUMMARY.md` summary file alongside `XX-PLAN.md` files. Apply this mapping:
39
+
40
+ - If a `phase-complete` summary or all plan summaries are present, treat status as `completed`.
41
+ - If any `XX-PLAN.md` file exists for the phase but the phase is not complete, treat status as `in_progress`.
42
+ - Otherwise, treat status as `not_started`.
43
+
44
+ If the phase was not found in ROADMAP.md: error and exit. Suggest `/ccp:add-phase` or `/ccp:insert-phase` to create the phase first.
45
+
46
+ **Status guard.** If the phase is `in_progress` (has plans but not complete) or `completed`, refuse unless `--force` is in `$ARGUMENTS`:
47
+
48
+ ```text
49
+ ERROR: Phase ${PHASE} is currently ${STATUS}.
50
+ Converting an active or completed phase to MVP mode mid-flight will
51
+ invalidate any existing plans and summaries.
52
+
53
+ To proceed anyway: /ccp:mvp-phase ${PHASE} --force
54
+ ```
55
+
56
+ **Already-MVP guard.** If `PHASE_MODE` is already `mvp`, surface this and ask whether to re-prompt the user story or abort:
57
+
58
+ > "Phase ${PHASE} is already in MVP mode with goal: «${PHASE_GOAL}». Re-run user-story prompts and SPIDR check?"
59
+
60
+ Use `AskUserQuestion` with options [Re-prompt / Abort]. On Abort, exit cleanly. On Re-prompt, proceed.
61
+
62
+ ## 3. User story prompts
63
+
64
+ Run three sequential `AskUserQuestion` calls. Each is free-text. After all three, assemble into the canonical sentence per `@~/.claude/pilot/references/user-story-template.md`:
65
+
66
+ **Prompt 1 — As a:**
67
+ > "As a [user role]?"
68
+ > (Examples: "new user", "admin", "signed-in customer", "API consumer")
69
+
70
+ **Prompt 2 — I want to:**
71
+ > "I want to [capability]?"
72
+ > (Examples: "register and log in", "upload a CSV", "see my dashboard")
73
+
74
+ **Prompt 3 — So that:**
75
+ > "So that [outcome]?"
76
+ > (Examples: "I can access my account", "I can bulk-import contacts", "I can see at a glance what needs attention")
77
+
78
+ Assemble:
79
+
80
+ ```
81
+ USER_STORY="As a ${ROLE}, I want to ${CAPABILITY}, so that ${OUTCOME}."
82
+ ```
83
+
84
+ If any of the three answers is empty or whitespace-only, error and re-prompt that single field. Do NOT proceed with a partial story.
85
+
86
+ **Validate the assembled story against the canonical regex** `/^As a .+, I want to .+, so that .+\.$/`. The verb owns this regex and surfaces per-error guidance:
87
+
88
+ - If the story does not match, identify which clause is missing or malformed (`As a ...`, `I want to ...`, `so that ...`, trailing period) and re-prompt only the offending field(s).
89
+ - Rebuild `USER_STORY` and re-validate before continuing.
90
+ - Do not abort the workflow on first invalid draft.
91
+
92
+ This guarantees the goal stored in ROADMAP.md will satisfy the same guard the verifier applies later.
93
+
94
+ ## 4. SPIDR splitting check
95
+
96
+ Run the SPIDR rules from `@~/.claude/pilot/references/spidr-splitting.md`. Briefly:
97
+
98
+ **Trigger evaluation.** Check the assembled `USER_STORY` against the four size signals from the reference (compound capabilities, multi-actor, length > 120 chars, vague capability). If none fire, **skip SPIDR** entirely — go to step 5.
99
+
100
+ **If SPIDR triggers.**
101
+
102
+ a) Restate the story to the user:
103
+
104
+ > "Your story: «${USER_STORY}»
105
+ >
106
+ > This story has [signal description, e.g., 'two compound capabilities joined by and']. Splitting it into multiple phases will produce a cleaner Walking Skeleton and reduce the risk of mid-phase scope creep.
107
+ >
108
+ > Want to walk through SPIDR splitting?"
109
+
110
+ Use `AskUserQuestion` with options [Yes, walk through SPIDR / No, proceed with the story as-is].
111
+
112
+ If "No": skip SPIDR, go to step 5.
113
+
114
+ If "Yes": continue to (b).
115
+
116
+ b) Ask which SPIDR axis fits best:
117
+
118
+ > "Which axis best fits how to split this story?"
119
+
120
+ Use `AskUserQuestion` with the five options from `spidr-splitting.md` (Spike / Paths / Interfaces / Data / Rules). Each option includes its targeted question as the description so the user can pick by understanding what each axis means.
121
+
122
+ c) Walk through the chosen axis with **one** targeted question (not all five). For example, if the user picked "Paths":
123
+
124
+ > "Does this feature have a happy path and one or more error/edge paths?"
125
+
126
+ Free-text response. Workflow parses to identify the split.
127
+
128
+ d) Produce a split proposal. Example:
129
+
130
+ > "Proposed split (Paths axis):
131
+ > - **Phase ${PHASE} (this one):** Happy path — ${HAPPY_STORY}
132
+ > - **Phase ${PHASE+1} (new):** Edge case — ${EDGE_STORY}
133
+ >
134
+ > Accept this split?"
135
+
136
+ Use `AskUserQuestion` [Accept / Modify / Reject].
137
+
138
+ - **Accept**: `USER_STORY` becomes the first split's story (`${HAPPY_STORY}` in the example). Surface the remaining splits as a list of `/ccp:add-phase` invocations the user can run after this command completes — do NOT auto-create the new phases (preserve user control over numbering).
139
+ - **Modify**: re-prompt the splits one more time, then accept or reject.
140
+ - **Reject**: revert `USER_STORY` to the original, proceed without splitting.
141
+
142
+ ## 5. Update ROADMAP.md
143
+
144
+ Read `ROADMAP.md`. Find the section for `Phase ${PHASE}`. Apply two edits:
145
+
146
+ **Edit 1 — Update Goal line.**
147
+
148
+ Find: `**Goal:** ${OLD_GOAL_TEXT}`
149
+ Replace with: `**Goal:** ${USER_STORY}`
150
+
151
+ **Edit 2 — Insert Mode line.**
152
+
153
+ If `**Mode:**` already exists in the section (replacing or re-running), update it to `**Mode:** mvp`.
154
+ If `**Mode:**` does not exist, insert `**Mode:** mvp` on the line immediately after `**Goal:**`.
155
+
156
+ Show the user a unified diff (lines being changed) and ask:
157
+
158
+ > "Apply these changes to ROADMAP.md?"
159
+
160
+ Use `AskUserQuestion` [Apply / Cancel]. On Cancel, exit without writing.
161
+
162
+ On Apply, write the updated `ROADMAP.md` atomically (read-edit-write).
163
+
164
+ ## 6. Verify the write
165
+
166
+ Re-read `.planning/ROADMAP.md` and re-extract the Phase `${PHASE}` block: locate the `### Phase ${PHASE}:` heading and capture the `**Goal**:` and `**Mode**:` lines that follow.
167
+
168
+ Assert:
169
+ - The new `**Mode**:` value equals `mvp`
170
+ - The new `**Goal**:` value equals the assembled user story
171
+
172
+ If either assertion fails, surface the discrepancy to the user and exit. Do not proceed to plan-phase delegation with a half-applied write.
173
+
174
+ ## 7. Delegate to /ccp:plan-phase
175
+
176
+ Invoke `/ccp:plan-phase ${PHASE}` (no flags). Phase 1's MVP_MODE resolution chain (CLI flag → roadmap mode → config → false) will detect the new `**Mode:** mvp` line and run plan-phase in vertical-slice mode automatically.
177
+
178
+ The Walking Skeleton gate (also from Phase 1) will fire automatically if `${PHASE} == "01"` and there are zero prior phase summaries.
179
+
180
+ ## 8. Surface deferred phase splits (if any)
181
+
182
+ If SPIDR produced a split in step 4, append a final user-facing message:
183
+
184
+ > "**SPIDR split deferred phases.**
185
+ >
186
+ > Your original story was split. The first slice is now planned via plan-phase.
187
+ > To create the remaining slice(s) as new phases, run:
188
+ >
189
+ > - `/ccp:add-phase` — for the next slice: «${SPLIT_2_STORY}»
190
+ > - `/ccp:add-phase` — for the next slice: «${SPLIT_3_STORY}»
191
+ >
192
+ > Each will be added to the end of the current milestone. You can then run
193
+ > `/ccp:mvp-phase <new-phase-number>` on each to plan them as MVP slices."
194
+
195
+ ## 9. Exit
196
+
197
+ Workflow ends. The phase is now in MVP mode with a planned PLAN.md, optionally with deferred follow-up phases surfaced for the user.
198
+
199
+ </process>