claude-code-pilot 3.1.0 → 3.2.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.
- package/README.md +11 -11
- package/bin/install.js +20 -2
- package/manifest.json +5 -1
- package/package.json +18 -6
- package/src/agents/a11y-architect.md +141 -0
- package/src/agents/code-architect.md +71 -0
- package/src/agents/code-explorer.md +69 -0
- package/src/agents/code-simplifier.md +47 -0
- package/src/agents/comment-analyzer.md +45 -0
- package/src/agents/csharp-reviewer.md +101 -0
- package/src/agents/dart-build-resolver.md +201 -0
- package/src/agents/pr-test-analyzer.md +45 -0
- package/src/agents/silent-failure-hunter.md +50 -0
- package/src/agents/type-design-analyzer.md +41 -0
- package/src/available-rules/README.md +3 -1
- package/src/available-rules/dart/coding-style.md +159 -0
- package/src/available-rules/dart/hooks.md +66 -0
- package/src/available-rules/dart/patterns.md +261 -0
- package/src/available-rules/dart/security.md +135 -0
- package/src/available-rules/dart/testing.md +215 -0
- package/src/available-rules/web/coding-style.md +105 -0
- package/src/available-rules/web/design-quality.md +72 -0
- package/src/available-rules/web/hooks.md +129 -0
- package/src/available-rules/web/patterns.md +88 -0
- package/src/available-rules/web/performance.md +73 -0
- package/src/available-rules/web/security.md +66 -0
- package/src/available-rules/web/testing.md +64 -0
- package/src/commands/ccp/ai-integration-phase.md +36 -0
- package/src/commands/ccp/audit-fix.md +33 -0
- package/src/commands/ccp/code-review-fix.md +52 -0
- package/src/commands/ccp/eval-review.md +32 -0
- package/src/commands/ccp/extract_learnings.md +22 -0
- package/src/commands/ccp/import.md +37 -0
- package/src/commands/ccp/ingest-docs.md +42 -0
- package/src/commands/ccp/intel.md +179 -0
- package/src/commands/ccp/plan-review-convergence.md +58 -0
- package/src/commands/ccp/scan.md +26 -0
- package/src/commands/ccp/sketch-wrap-up.md +31 -0
- package/src/commands/ccp/sketch.md +54 -0
- package/src/commands/ccp/spec-phase.md +62 -0
- package/src/commands/ccp/spike-wrap-up.md +31 -0
- package/src/commands/ccp/spike.md +51 -0
- package/src/commands/ccp/ultraplan-phase.md +33 -0
- package/src/hooks/ccp-read-injection-scanner.js +152 -0
- package/src/hooks/kit-check-update.js +59 -7
- package/src/hooks/run-with-flags-shell.sh +1 -0
- package/src/hooks/run-with-flags.js +48 -1
- package/src/hooks/session-end.js +88 -1
- package/src/lib/hook-flags.js +14 -0
- package/src/pilot/references/agent-contracts.md +79 -0
- package/src/pilot/references/ai-evals.md +156 -0
- package/src/pilot/references/ai-frameworks.md +186 -0
- package/src/pilot/references/doc-conflict-engine.md +91 -0
- package/src/pilot/references/gate-prompts.md +100 -0
- package/src/pilot/references/gates.md +70 -0
- package/src/pilot/references/mandatory-initial-read.md +2 -0
- package/src/pilot/references/project-skills-discovery.md +19 -0
- package/src/pilot/references/revision-loop.md +97 -0
- package/src/pilot/references/sketch-interactivity.md +41 -0
- package/src/pilot/references/sketch-theme-system.md +94 -0
- package/src/pilot/references/sketch-tooling.md +45 -0
- package/src/pilot/references/sketch-variant-patterns.md +81 -0
- package/src/pilot/references/thinking-models-debug.md +44 -0
- package/src/pilot/references/thinking-models-execution.md +50 -0
- package/src/pilot/references/thinking-models-planning.md +62 -0
- package/src/pilot/references/thinking-models-research.md +50 -0
- package/src/pilot/references/thinking-models-verification.md +55 -0
- package/src/pilot/templates/AI-SPEC.md +246 -0
- package/src/pilot/templates/spec.md +307 -0
- package/src/pilot/workflows/ai-integration-phase.md +284 -0
- package/src/pilot/workflows/audit-fix.md +175 -0
- package/src/pilot/workflows/code-review-fix.md +497 -0
- package/src/pilot/workflows/eval-review.md +155 -0
- package/src/pilot/workflows/extract_learnings.md +242 -0
- package/src/pilot/workflows/import.md +246 -0
- package/src/pilot/workflows/ingest-docs.md +328 -0
- package/src/pilot/workflows/plan-review-convergence.md +329 -0
- package/src/pilot/workflows/scan.md +102 -0
- package/src/pilot/workflows/sketch-wrap-up.md +285 -0
- package/src/pilot/workflows/sketch.md +360 -0
- package/src/pilot/workflows/spec-phase.md +262 -0
- package/src/pilot/workflows/spike-wrap-up.md +306 -0
- package/src/pilot/workflows/spike.md +452 -0
- package/src/pilot/workflows/ultraplan-phase.md +189 -0
- package/src/skills/accessibility/SKILL.md +146 -0
- package/src/skills/agent-eval/SKILL.md +145 -0
- package/src/skills/agent-introspection-debugging/SKILL.md +153 -0
- package/src/skills/android-clean-architecture/SKILL.md +339 -0
- package/src/skills/api-connector-builder/SKILL.md +120 -0
- package/src/skills/code-tour/SKILL.md +236 -0
- package/src/skills/compose-multiplatform-patterns/SKILL.md +299 -0
- package/src/skills/csharp-testing/SKILL.md +321 -0
- package/src/skills/dart-flutter-patterns/SKILL.md +563 -0
- package/src/skills/dashboard-builder/SKILL.md +108 -0
- package/src/skills/dotnet-patterns/SKILL.md +321 -0
- package/src/skills/frontend-design/SKILL.md +145 -0
- package/src/skills/frontend-slides/SKILL.md +184 -0
- package/src/skills/frontend-slides/STYLE_PRESETS.md +330 -0
- package/src/skills/gateguard/SKILL.md +121 -0
- package/src/skills/github-ops/SKILL.md +144 -0
- package/src/skills/hookify-rules/SKILL.md +128 -0
- package/src/skills/knowledge-ops/SKILL.md +154 -0
- package/src/skills/liquid-glass-design/SKILL.md +279 -0
- package/src/skills/nestjs-patterns/SKILL.md +230 -0
- package/src/skills/security-bounty-hunter/SKILL.md +99 -0
- package/src/skills/swift-actor-persistence/SKILL.md +143 -0
- package/src/skills/swift-protocol-di-testing/SKILL.md +190 -0
- package/src/skills/swiftui-patterns/SKILL.md +259 -0
- package/src/skills/terminal-ops/SKILL.md +109 -0
- package/src/skills/ui-demo/SKILL.md +465 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Extract decisions, lessons learned, patterns discovered, and surprises encountered from completed phase artifacts into a structured LEARNINGS.md file. Captures institutional knowledge that would otherwise be lost between phases.
|
|
3
|
+
</purpose>
|
|
4
|
+
|
|
5
|
+
<required_reading>
|
|
6
|
+
Read all files referenced by the invoking prompt's execution_context before starting.
|
|
7
|
+
</required_reading>
|
|
8
|
+
|
|
9
|
+
<objective>
|
|
10
|
+
Analyze completed phase artifacts (PLAN.md, SUMMARY.md, VERIFICATION.md, UAT.md, STATE.md) and extract structured learnings into 4 categories: decisions, lessons, patterns, and surprises. Each extracted item includes source attribution. The output is a LEARNINGS.md file with YAML frontmatter containing metadata about the extraction.
|
|
11
|
+
</objective>
|
|
12
|
+
|
|
13
|
+
<process>
|
|
14
|
+
|
|
15
|
+
<step name="initialize">
|
|
16
|
+
Parse arguments and load project state:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}")
|
|
20
|
+
if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Parse from init JSON: `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `padded_phase`.
|
|
24
|
+
|
|
25
|
+
If phase not found, exit with error: "Phase {PHASE_ARG} not found."
|
|
26
|
+
</step>
|
|
27
|
+
|
|
28
|
+
<step name="collect_artifacts">
|
|
29
|
+
Read the phase artifacts. PLAN.md and SUMMARY.md are required; VERIFICATION.md, UAT.md, and STATE.md are optional.
|
|
30
|
+
|
|
31
|
+
**Required artifacts:**
|
|
32
|
+
- `${PHASE_DIR}/*-PLAN.md` — all plan files for the phase
|
|
33
|
+
- `${PHASE_DIR}/*-SUMMARY.md` — all summary files for the phase
|
|
34
|
+
|
|
35
|
+
If PLAN.md or SUMMARY.md files are not found or missing, exit with error: "Required artifacts missing. PLAN.md and SUMMARY.md are required for learning extraction."
|
|
36
|
+
|
|
37
|
+
**Optional artifacts (read if available, skip if not found):**
|
|
38
|
+
- `${PHASE_DIR}/*-VERIFICATION.md` — verification results
|
|
39
|
+
- `${PHASE_DIR}/*-UAT.md` — user acceptance test results
|
|
40
|
+
- `.planning/STATE.md` — project state with decisions and blockers
|
|
41
|
+
|
|
42
|
+
Track which optional artifacts are missing for the `missing_artifacts` frontmatter field.
|
|
43
|
+
</step>
|
|
44
|
+
|
|
45
|
+
<step name="extract_learnings">
|
|
46
|
+
Analyze all collected artifacts and extract learnings into 4 categories:
|
|
47
|
+
|
|
48
|
+
### 1. Decisions
|
|
49
|
+
Technical and architectural decisions made during the phase. Look for:
|
|
50
|
+
- Explicit decisions documented in PLAN.md or SUMMARY.md
|
|
51
|
+
- Technology choices and their rationale
|
|
52
|
+
- Trade-offs that were evaluated
|
|
53
|
+
- Design decisions recorded in STATE.md
|
|
54
|
+
|
|
55
|
+
Each decision entry must include:
|
|
56
|
+
- **What** was decided
|
|
57
|
+
- **Why** it was decided (rationale)
|
|
58
|
+
- **Source:** attribution to the artifact where the decision was found (e.g., "Source: 03-01-PLAN.md")
|
|
59
|
+
|
|
60
|
+
### 2. Lessons
|
|
61
|
+
Things learned during execution that were not known beforehand. Look for:
|
|
62
|
+
- Unexpected complexity in SUMMARY.md
|
|
63
|
+
- Issues discovered during verification in VERIFICATION.md
|
|
64
|
+
- Failed approaches documented in SUMMARY.md
|
|
65
|
+
- UAT feedback that revealed gaps
|
|
66
|
+
|
|
67
|
+
Each lesson entry must include:
|
|
68
|
+
- **What** was learned
|
|
69
|
+
- **Context** for the lesson
|
|
70
|
+
- **Source:** attribution to the originating artifact
|
|
71
|
+
|
|
72
|
+
### 3. Patterns
|
|
73
|
+
Reusable patterns, approaches, or techniques discovered. Look for:
|
|
74
|
+
- Successful implementation patterns in SUMMARY.md
|
|
75
|
+
- Testing patterns from VERIFICATION.md or UAT.md
|
|
76
|
+
- Workflow patterns that worked well
|
|
77
|
+
- Code organization patterns from PLAN.md
|
|
78
|
+
|
|
79
|
+
Each pattern entry must include:
|
|
80
|
+
- **Pattern** name/description
|
|
81
|
+
- **When to use** it
|
|
82
|
+
- **Source:** attribution to the originating artifact
|
|
83
|
+
|
|
84
|
+
### 4. Surprises
|
|
85
|
+
Unexpected findings, behaviors, or outcomes. Look for:
|
|
86
|
+
- Things that took longer or shorter than estimated
|
|
87
|
+
- Unexpected dependencies or interactions
|
|
88
|
+
- Edge cases not anticipated in planning
|
|
89
|
+
- Performance or behavior that differed from expectations
|
|
90
|
+
|
|
91
|
+
Each surprise entry must include:
|
|
92
|
+
- **What** was surprising
|
|
93
|
+
- **Impact** of the surprise
|
|
94
|
+
- **Source:** attribution to the originating artifact
|
|
95
|
+
</step>
|
|
96
|
+
|
|
97
|
+
<step name="capture_thought_integration">
|
|
98
|
+
**What this step is:** `capture_thought` is an **optional convention**, not a bundled GSD tool. GSD does not ship one and does not require one. The step is a hook for users who run a memory / knowledge-base MCP server (for example ExoCortex-style servers, `claude-mem`, or `mem0`-style servers) that exposes a tool with this exact name. If any MCP server in the current session provides a `capture_thought` tool with the signature below, each extracted learning is routed through it with metadata. If no such tool is present, the step is a silent no-op — `LEARNINGS.md` is always the primary output.
|
|
99
|
+
|
|
100
|
+
**Detection:** Check whether a tool named `capture_thought` is available in the current session. Do not assume any specific MCP server is connected.
|
|
101
|
+
|
|
102
|
+
**If available**, call once per extracted learning:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
capture_thought({
|
|
106
|
+
category: "decision" | "lesson" | "pattern" | "surprise",
|
|
107
|
+
phase: PHASE_NUMBER,
|
|
108
|
+
content: LEARNING_TEXT,
|
|
109
|
+
source: ARTIFACT_NAME
|
|
110
|
+
})
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**If not available** (no MCP server in the session exposes this tool, or the runtime does not support it), skip the step silently and continue. The workflow must not fail or warn — this is expected behavior for users who do not run a knowledge-base MCP.
|
|
114
|
+
</step>
|
|
115
|
+
|
|
116
|
+
<step name="write_learnings">
|
|
117
|
+
Write the LEARNINGS.md file to the phase directory. If a previous LEARNINGS.md exists, overwrite it (replace the file entirely).
|
|
118
|
+
|
|
119
|
+
Output path: `${PHASE_DIR}/${PADDED_PHASE}-LEARNINGS.md`
|
|
120
|
+
|
|
121
|
+
The file must have YAML frontmatter with these fields:
|
|
122
|
+
```yaml
|
|
123
|
+
---
|
|
124
|
+
phase: {PHASE_NUMBER}
|
|
125
|
+
phase_name: "{PHASE_NAME}"
|
|
126
|
+
project: "{PROJECT_NAME}"
|
|
127
|
+
generated: "{ISO_DATE}"
|
|
128
|
+
counts:
|
|
129
|
+
decisions: {N}
|
|
130
|
+
lessons: {N}
|
|
131
|
+
patterns: {N}
|
|
132
|
+
surprises: {N}
|
|
133
|
+
missing_artifacts:
|
|
134
|
+
- "{ARTIFACT_NAME}"
|
|
135
|
+
---
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Individual items may carry an optional `graduated:` annotation (added by `graduation.md` when a cluster is promoted):
|
|
139
|
+
```markdown
|
|
140
|
+
**Graduated:** {target-file}:{ISO_DATE}
|
|
141
|
+
```
|
|
142
|
+
This annotation is appended after the item's existing fields and prevents the item from being re-surfaced in future graduation scans. Do not add this field during extraction — it is written only by the graduation workflow.
|
|
143
|
+
|
|
144
|
+
The body follows this structure:
|
|
145
|
+
```markdown
|
|
146
|
+
# Phase {PHASE_NUMBER} Learnings: {PHASE_NAME}
|
|
147
|
+
|
|
148
|
+
## Decisions
|
|
149
|
+
|
|
150
|
+
### {Decision Title}
|
|
151
|
+
{What was decided}
|
|
152
|
+
|
|
153
|
+
**Rationale:** {Why}
|
|
154
|
+
**Source:** {artifact file}
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Lessons
|
|
159
|
+
|
|
160
|
+
### {Lesson Title}
|
|
161
|
+
{What was learned}
|
|
162
|
+
|
|
163
|
+
**Context:** {context}
|
|
164
|
+
**Source:** {artifact file}
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Patterns
|
|
169
|
+
|
|
170
|
+
### {Pattern Name}
|
|
171
|
+
{Description}
|
|
172
|
+
|
|
173
|
+
**When to use:** {applicability}
|
|
174
|
+
**Source:** {artifact file}
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Surprises
|
|
179
|
+
|
|
180
|
+
### {Surprise Title}
|
|
181
|
+
{What was surprising}
|
|
182
|
+
|
|
183
|
+
**Impact:** {impact description}
|
|
184
|
+
**Source:** {artifact file}
|
|
185
|
+
```
|
|
186
|
+
</step>
|
|
187
|
+
|
|
188
|
+
<step name="update_state">
|
|
189
|
+
Update STATE.md to reflect the learning extraction:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
gsd-sdk query state.update "Last Activity" "$(date +%Y-%m-%d)"
|
|
193
|
+
```
|
|
194
|
+
</step>
|
|
195
|
+
|
|
196
|
+
<step name="report">
|
|
197
|
+
```
|
|
198
|
+
---------------------------------------------------------------
|
|
199
|
+
|
|
200
|
+
## Learnings Extracted: Phase {X} — {Name}
|
|
201
|
+
|
|
202
|
+
Decisions: {N}
|
|
203
|
+
Lessons: {N}
|
|
204
|
+
Patterns: {N}
|
|
205
|
+
Surprises: {N}
|
|
206
|
+
Total: {N}
|
|
207
|
+
|
|
208
|
+
Output: {PHASE_DIR}/{PADDED_PHASE}-LEARNINGS.md
|
|
209
|
+
|
|
210
|
+
Missing artifacts: {list or "none"}
|
|
211
|
+
|
|
212
|
+
Next steps:
|
|
213
|
+
- Review extracted learnings for accuracy
|
|
214
|
+
- /ccp:progress — see overall project state
|
|
215
|
+
- /ccp:execute-phase {next} — continue to next phase
|
|
216
|
+
|
|
217
|
+
---------------------------------------------------------------
|
|
218
|
+
```
|
|
219
|
+
</step>
|
|
220
|
+
|
|
221
|
+
</process>
|
|
222
|
+
|
|
223
|
+
<success_criteria>
|
|
224
|
+
- [ ] Phase artifacts located and read successfully
|
|
225
|
+
- [ ] All 4 categories extracted: decisions, lessons, patterns, surprises
|
|
226
|
+
- [ ] Each extracted item has source attribution
|
|
227
|
+
- [ ] LEARNINGS.md written with correct YAML frontmatter
|
|
228
|
+
- [ ] Missing optional artifacts tracked in frontmatter
|
|
229
|
+
- [ ] capture_thought integration attempted if tool available
|
|
230
|
+
- [ ] STATE.md updated with extraction activity
|
|
231
|
+
- [ ] User receives summary report
|
|
232
|
+
</success_criteria>
|
|
233
|
+
|
|
234
|
+
<critical_rules>
|
|
235
|
+
- PLAN.md and SUMMARY.md are required — exit with clear error if missing
|
|
236
|
+
- VERIFICATION.md, UAT.md, and STATE.md are optional — extract from them if present, skip gracefully if not found
|
|
237
|
+
- Every extracted learning must have source attribution back to the originating artifact
|
|
238
|
+
- Running extract-learnings twice on the same phase must overwrite (replace) the previous LEARNINGS.md, not append
|
|
239
|
+
- Do not fabricate learnings — only extract what is explicitly documented in artifacts
|
|
240
|
+
- If capture_thought is unavailable, the workflow must not fail — graceful degradation to file-only output
|
|
241
|
+
- LEARNINGS.md frontmatter must include counts for all 4 categories and list any missing_artifacts
|
|
242
|
+
</critical_rules>
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# Import Workflow
|
|
2
|
+
|
|
3
|
+
External plan ingestion with conflict detection and agent delegation.
|
|
4
|
+
|
|
5
|
+
- **--from**: Import external plan → conflict detection → write PLAN.md → validate via gsd-plan-checker
|
|
6
|
+
|
|
7
|
+
Future: `--prd` mode (PRD extraction into PROJECT.md + REQUIREMENTS.md + ROADMAP.md) is planned for a follow-up PR.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<step name="banner">
|
|
12
|
+
|
|
13
|
+
Display the stage banner:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
17
|
+
GSD ► IMPORT
|
|
18
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
</step>
|
|
22
|
+
|
|
23
|
+
<step name="parse_arguments">
|
|
24
|
+
|
|
25
|
+
Parse `$ARGUMENTS` to determine the execution mode:
|
|
26
|
+
|
|
27
|
+
- If `--from` is present: extract FILEPATH (the next token after `--from`), set MODE=plan
|
|
28
|
+
- If `--prd` is present: display message that `--prd` is not yet implemented and exit:
|
|
29
|
+
```
|
|
30
|
+
GSD > --prd mode is planned for a future release. Use --from to import plan files.
|
|
31
|
+
```
|
|
32
|
+
- If neither flag is found: display usage and exit:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
Usage: /ccp:import --from <path>
|
|
36
|
+
|
|
37
|
+
--from <path> Import an external plan file into GSD format
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Validate the file path:**
|
|
41
|
+
|
|
42
|
+
Verify the path does not contain traversal sequences and the file exists:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
case "{FILEPATH}" in
|
|
46
|
+
*..* ) echo "SECURITY_ERROR: path contains traversal sequence"; exit 1 ;;
|
|
47
|
+
esac
|
|
48
|
+
test -f "{FILEPATH}" || echo "FILE_NOT_FOUND"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If FILE_NOT_FOUND: display error and exit:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
55
|
+
║ ERROR ║
|
|
56
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
57
|
+
|
|
58
|
+
File not found: {FILEPATH}
|
|
59
|
+
|
|
60
|
+
**To fix:** Verify the file path and try again.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
</step>
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Path A: MODE=plan (--from)
|
|
68
|
+
|
|
69
|
+
<step name="plan_load_context">
|
|
70
|
+
|
|
71
|
+
Load project context for conflict detection:
|
|
72
|
+
|
|
73
|
+
1. Read `.planning/ROADMAP.md` — extract phase structure, phase numbers, dependencies
|
|
74
|
+
2. Read `.planning/PROJECT.md` — extract project constraints, tech stack, scope boundaries.
|
|
75
|
+
**If PROJECT.md does not exist:** skip constraint checks that rely on it and display:
|
|
76
|
+
```
|
|
77
|
+
GSD > Note: No PROJECT.md found. Conflict checks against project constraints will be skipped.
|
|
78
|
+
```
|
|
79
|
+
3. Read `.planning/REQUIREMENTS.md` — extract existing requirements for overlap and contradiction checks.
|
|
80
|
+
**If REQUIREMENTS.md does not exist:** skip requirement conflict checks and continue.
|
|
81
|
+
4. Glob for all CONTEXT.md files across phase directories:
|
|
82
|
+
```bash
|
|
83
|
+
find .planning/phases/ -name "*-CONTEXT.md" -o -name "CONTEXT.md" 2>/dev/null
|
|
84
|
+
```
|
|
85
|
+
Read each CONTEXT.md found — extract locked decisions (any decision in a `<decisions>` block)
|
|
86
|
+
|
|
87
|
+
Store loaded context for conflict detection in the next step.
|
|
88
|
+
|
|
89
|
+
</step>
|
|
90
|
+
|
|
91
|
+
<step name="plan_read_input">
|
|
92
|
+
|
|
93
|
+
Read the imported file at FILEPATH.
|
|
94
|
+
|
|
95
|
+
Determine the format:
|
|
96
|
+
- **GSD PLAN.md format**: Has YAML frontmatter with `phase:`, `plan:`, `type:` fields
|
|
97
|
+
- **Freeform document**: Any other format (markdown spec, design doc, task list, etc.)
|
|
98
|
+
|
|
99
|
+
Extract from the imported content:
|
|
100
|
+
- **Phase target**: Which phase this plan belongs to (from frontmatter or inferred from content)
|
|
101
|
+
- **Plan objectives**: What the plan aims to accomplish
|
|
102
|
+
- **Tasks listed**: Individual work items described in the plan
|
|
103
|
+
- **Files modified**: Any files mentioned as targets
|
|
104
|
+
- **Dependencies**: Any referenced prerequisites
|
|
105
|
+
|
|
106
|
+
</step>
|
|
107
|
+
|
|
108
|
+
<step name="plan_conflict_detection">
|
|
109
|
+
|
|
110
|
+
Run conflict checks against the loaded project context. The report format, severity semantics, and safety-gate behavior are defined by `references/doc-conflict-engine.md` — read it and apply it here. Operation noun: `import`.
|
|
111
|
+
|
|
112
|
+
### BLOCKER checks (any one prevents import):
|
|
113
|
+
|
|
114
|
+
- Plan targets a phase number that does not exist in ROADMAP.md → [BLOCKER]
|
|
115
|
+
- Plan specifies a tech stack that contradicts PROJECT.md constraints → [BLOCKER]
|
|
116
|
+
- Plan contradicts a locked decision in any CONTEXT.md `<decisions>` block → [BLOCKER]
|
|
117
|
+
- Plan contradicts an existing requirement in REQUIREMENTS.md → [BLOCKER]
|
|
118
|
+
|
|
119
|
+
### WARNING checks (user confirmation required):
|
|
120
|
+
|
|
121
|
+
- Plan partially overlaps existing requirement coverage in REQUIREMENTS.md → [WARNING]
|
|
122
|
+
- Plan has `depends_on` referencing plans that are not yet complete → [WARNING]
|
|
123
|
+
- Plan modifies files that overlap with existing incomplete plans → [WARNING]
|
|
124
|
+
- Plan phase number conflicts with existing phase numbering in ROADMAP.md → [WARNING]
|
|
125
|
+
|
|
126
|
+
### INFO checks (informational, no action needed):
|
|
127
|
+
|
|
128
|
+
- Plan uses a library not currently in the project tech stack → [INFO]
|
|
129
|
+
- Plan adds a new phase to the ROADMAP.md structure → [INFO]
|
|
130
|
+
|
|
131
|
+
Render the full Conflict Detection Report using the format in `references/doc-conflict-engine.md`.
|
|
132
|
+
|
|
133
|
+
**If any [BLOCKER] exists:** apply the safety gate from the reference — exit WITHOUT writing any files. No PLAN.md is written when blockers exist.
|
|
134
|
+
|
|
135
|
+
**If only WARNINGS and/or INFO (no blockers):**
|
|
136
|
+
|
|
137
|
+
**Text mode (`workflow.text_mode: true` in config or `--text` flag):** 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. This is required for non-Claude runtimes (OpenAI Codex, Gemini CLI, etc.) where `AskUserQuestion` is not available.
|
|
138
|
+
|
|
139
|
+
Ask via AskUserQuestion using the approve-revise-abort pattern (see `references/gate-prompts.md`):
|
|
140
|
+
- question: "Review the warnings above. Proceed with import?"
|
|
141
|
+
- header: "Approve?"
|
|
142
|
+
- options: Approve | Abort
|
|
143
|
+
|
|
144
|
+
If user selects "Abort": exit cleanly with message "Import cancelled."
|
|
145
|
+
|
|
146
|
+
</step>
|
|
147
|
+
|
|
148
|
+
<step name="plan_convert">
|
|
149
|
+
|
|
150
|
+
Convert the imported content to GSD PLAN.md format.
|
|
151
|
+
|
|
152
|
+
Ensure the PLAN.md has all required frontmatter fields:
|
|
153
|
+
```yaml
|
|
154
|
+
---
|
|
155
|
+
phase: "{NN}-{slug}"
|
|
156
|
+
plan: "{NN}-{MM}"
|
|
157
|
+
type: "feature|refactor|config|test|docs"
|
|
158
|
+
wave: 1
|
|
159
|
+
depends_on: []
|
|
160
|
+
files_modified: []
|
|
161
|
+
autonomous: true
|
|
162
|
+
must_haves:
|
|
163
|
+
truths: []
|
|
164
|
+
artifacts: []
|
|
165
|
+
---
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Reject PBR naming conventions in source content:**
|
|
169
|
+
If the imported plan references PBR plan naming (e.g., `PLAN-01.md`, `plan-01.md`), rename all references to GSD `{NN}-{MM}-PLAN.md` convention during conversion.
|
|
170
|
+
|
|
171
|
+
Apply GSD naming convention for the output filename:
|
|
172
|
+
- Format: `{NN}-{MM}-PLAN.md` (e.g., `04-01-PLAN.md`)
|
|
173
|
+
- NEVER use `PLAN-01.md`, `plan-01.md`, or any other format
|
|
174
|
+
- NN = phase number (zero-padded), MM = plan number within the phase (zero-padded)
|
|
175
|
+
|
|
176
|
+
Determine the target directory:
|
|
177
|
+
```
|
|
178
|
+
.planning/phases/{NN}-{slug}/
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
If the directory does not exist, create it:
|
|
182
|
+
```bash
|
|
183
|
+
mkdir -p ".planning/phases/{NN}-{slug}/"
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Write the PLAN.md file to the target directory.
|
|
187
|
+
|
|
188
|
+
</step>
|
|
189
|
+
|
|
190
|
+
<step name="plan_validate">
|
|
191
|
+
|
|
192
|
+
Delegate validation to gsd-plan-checker:
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
Task({
|
|
196
|
+
subagent_type: "gsd-plan-checker",
|
|
197
|
+
prompt: "Validate: .planning/phases/{phase}/{plan}-PLAN.md — check frontmatter completeness, task structure, and GSD conventions. Report any issues."
|
|
198
|
+
})
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
If the checker returns errors:
|
|
202
|
+
- Display the errors to the user
|
|
203
|
+
- Ask the user to resolve issues before the plan is considered imported
|
|
204
|
+
- Do not delete the written file — the user can fix and re-validate manually
|
|
205
|
+
|
|
206
|
+
If the checker returns clean:
|
|
207
|
+
- Display: "Plan validation passed"
|
|
208
|
+
|
|
209
|
+
</step>
|
|
210
|
+
|
|
211
|
+
<step name="plan_finalize">
|
|
212
|
+
|
|
213
|
+
Update `.planning/ROADMAP.md` to reflect the new plan:
|
|
214
|
+
- Add the plan to the Plans list under the correct phase section
|
|
215
|
+
- Include the plan name and description
|
|
216
|
+
|
|
217
|
+
Update `.planning/STATE.md` if appropriate (e.g., increment total plan count).
|
|
218
|
+
|
|
219
|
+
Commit the imported plan and updated files:
|
|
220
|
+
```bash
|
|
221
|
+
gsd-sdk query commit "docs({phase}): import plan from {basename FILEPATH}" .planning/phases/{phase}/{plan}-PLAN.md .planning/ROADMAP.md
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Display completion:
|
|
225
|
+
```
|
|
226
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
227
|
+
GSD ► IMPORT COMPLETE
|
|
228
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Show: plan filename written, phase directory, validation result, next steps.
|
|
232
|
+
|
|
233
|
+
</step>
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Anti-Patterns
|
|
238
|
+
|
|
239
|
+
Do NOT:
|
|
240
|
+
- 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)
|
|
241
|
+
- Write PLAN.md files as `PLAN-01.md` or `plan-01.md` — always use `{NN}-{MM}-PLAN.md`
|
|
242
|
+
- Use `pbr:plan-checker` or `pbr:planner` — use `gsd-plan-checker` and `gsd-planner`
|
|
243
|
+
- Write `.planning/.active-skill` — this is a PBR pattern with no GSD equivalent
|
|
244
|
+
- Reference `pbr-tools`, `pbr:`, or `PLAN-BUILD-RUN` anywhere
|
|
245
|
+
- Write any PLAN.md file when blockers exist — the safety gate must hold
|
|
246
|
+
- Skip path validation on the --from file argument
|