@bhargavvc/sdd-cc 1.30.0 → 1.35.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.ja-JP.md +144 -110
- package/README.ko-KR.md +143 -107
- package/README.md +183 -112
- package/README.pt-BR.md +90 -52
- package/README.zh-CN.md +141 -101
- package/agents/sdd-advisor-researcher.md +23 -0
- package/agents/sdd-ai-researcher.md +133 -0
- package/agents/sdd-code-fixer.md +516 -0
- package/agents/sdd-code-reviewer.md +355 -0
- package/agents/sdd-codebase-mapper.md +3 -3
- package/agents/sdd-debugger.md +17 -5
- package/agents/sdd-doc-verifier.md +201 -0
- package/agents/sdd-doc-writer.md +602 -0
- package/agents/sdd-domain-researcher.md +153 -0
- package/agents/sdd-eval-auditor.md +164 -0
- package/agents/sdd-eval-planner.md +154 -0
- package/agents/sdd-executor.md +87 -4
- package/agents/sdd-framework-selector.md +160 -0
- package/agents/sdd-intel-updater.md +314 -0
- package/agents/sdd-nyquist-auditor.md +1 -1
- package/agents/sdd-phase-researcher.md +71 -4
- package/agents/sdd-plan-checker.md +100 -6
- package/agents/sdd-planner.md +145 -206
- package/agents/sdd-project-researcher.md +25 -2
- package/agents/sdd-research-synthesizer.md +3 -3
- package/agents/sdd-roadmapper.md +6 -6
- package/agents/sdd-security-auditor.md +128 -0
- package/agents/sdd-ui-auditor.md +43 -3
- package/agents/sdd-ui-checker.md +5 -5
- package/agents/sdd-ui-researcher.md +27 -4
- package/agents/sdd-user-profiler.md +2 -2
- package/agents/sdd-verifier.md +142 -22
- package/bin/install.js +2151 -551
- package/commands/sdd/add-backlog.md +5 -5
- package/commands/sdd/add-tests.md +2 -2
- package/commands/sdd/ai-integration-phase.md +36 -0
- package/commands/sdd/analyze-dependencies.md +34 -0
- package/commands/sdd/audit-fix.md +33 -0
- package/commands/sdd/autonomous.md +7 -2
- package/commands/sdd/cleanup.md +5 -0
- package/commands/sdd/code-review-fix.md +52 -0
- package/commands/sdd/code-review.md +55 -0
- package/commands/sdd/complete-milestone.md +6 -6
- package/commands/sdd/debug.md +22 -9
- package/commands/sdd/discuss-phase.md +7 -2
- package/commands/sdd/do.md +1 -1
- package/commands/sdd/docs-update.md +48 -0
- package/commands/sdd/eval-review.md +32 -0
- package/commands/sdd/execute-phase.md +4 -0
- package/commands/sdd/explore.md +27 -0
- package/commands/sdd/fast.md +2 -2
- package/commands/sdd/from-sdd2.md +45 -0
- package/commands/sdd/help.md +2 -0
- package/commands/sdd/import.md +36 -0
- package/commands/sdd/intel.md +179 -0
- package/commands/sdd/join-discord.md +2 -1
- package/commands/sdd/manager.md +1 -0
- package/commands/sdd/map-codebase.md +3 -3
- package/commands/sdd/new-milestone.md +1 -1
- package/commands/sdd/new-project.md +5 -1
- package/commands/sdd/new-workspace.md +1 -1
- package/commands/sdd/next.md +2 -0
- package/commands/sdd/plan-milestone-gaps.md +2 -2
- package/commands/sdd/plan-phase.md +6 -1
- package/commands/sdd/plant-seed.md +1 -1
- package/commands/sdd/profile-user.md +1 -1
- package/commands/sdd/quick.md +5 -3
- package/commands/sdd/reapply-patches.md +230 -42
- package/commands/sdd/research-phase.md +3 -3
- package/commands/sdd/review-backlog.md +1 -0
- package/commands/sdd/review.md +6 -3
- package/commands/sdd/scan.md +26 -0
- package/commands/sdd/secure-phase.md +35 -0
- package/commands/sdd/ship.md +1 -1
- package/commands/sdd/thread.md +5 -5
- package/commands/sdd/undo.md +34 -0
- package/commands/sdd/verify-work.md +1 -1
- package/commands/sdd/workstreams.md +17 -11
- package/hooks/dist/sdd-check-update.js +33 -8
- package/hooks/dist/sdd-context-monitor.js +17 -8
- package/hooks/dist/sdd-phase-boundary.sh +27 -0
- package/hooks/dist/sdd-prompt-guard.js +1 -0
- package/hooks/dist/sdd-read-guard.js +82 -0
- package/hooks/dist/sdd-session-state.sh +33 -0
- package/hooks/dist/sdd-statusline.js +137 -15
- package/hooks/dist/sdd-validate-commit.sh +47 -0
- package/hooks/dist/sdd-workflow-guard.js +4 -4
- package/hooks/sdd-check-update.js +139 -0
- package/hooks/sdd-context-monitor.js +165 -0
- package/hooks/sdd-phase-boundary.sh +27 -0
- package/hooks/sdd-prompt-guard.js +97 -0
- package/hooks/sdd-read-guard.js +82 -0
- package/hooks/sdd-session-state.sh +33 -0
- package/hooks/sdd-statusline.js +241 -0
- package/hooks/sdd-validate-commit.sh +47 -0
- package/hooks/sdd-workflow-guard.js +94 -0
- package/package.json +3 -3
- package/scripts/build-hooks.js +18 -7
- package/scripts/prompt-injection-scan.sh +1 -0
- package/scripts/rebrand-gsd-to-sdd.sh +221 -220
- package/scripts/run-tests.cjs +5 -1
- package/scripts/sync-upstream.sh +1 -1
- package/sdd/bin/lib/commands.cjs +79 -17
- package/sdd/bin/lib/config.cjs +90 -48
- package/sdd/bin/lib/core.cjs +452 -87
- package/sdd/bin/lib/docs.cjs +267 -0
- package/sdd/bin/lib/frontmatter.cjs +381 -336
- package/sdd/bin/lib/init.cjs +110 -16
- package/sdd/bin/lib/intel.cjs +660 -0
- package/sdd/bin/lib/learnings.cjs +378 -0
- package/sdd/bin/lib/milestone.cjs +42 -11
- package/sdd/bin/lib/model-profiles.cjs +17 -15
- package/sdd/bin/lib/phase.cjs +367 -288
- package/sdd/bin/lib/profile-output.cjs +106 -10
- package/sdd/bin/lib/roadmap.cjs +146 -115
- package/sdd/bin/lib/schema-detect.cjs +238 -0
- package/sdd/bin/lib/sdd2-import.cjs +511 -0
- package/sdd/bin/lib/security.cjs +124 -3
- package/sdd/bin/lib/state.cjs +648 -264
- package/sdd/bin/lib/template.cjs +8 -4
- package/sdd/bin/lib/verify.cjs +209 -28
- package/sdd/bin/lib/workstream.cjs +7 -3
- package/sdd/bin/sdd-tools.cjs +184 -12
- package/sdd/contexts/dev.md +21 -0
- package/sdd/contexts/research.md +22 -0
- package/sdd/contexts/review.md +22 -0
- package/sdd/references/agent-contracts.md +79 -0
- package/sdd/references/ai-evals.md +156 -0
- package/sdd/references/ai-frameworks.md +186 -0
- package/sdd/references/artifact-types.md +113 -0
- package/sdd/references/common-bug-patterns.md +114 -0
- package/sdd/references/context-budget.md +49 -0
- package/sdd/references/continuation-format.md +25 -25
- package/sdd/references/domain-probes.md +125 -0
- package/sdd/references/few-shot-examples/plan-checker.md +73 -0
- package/sdd/references/few-shot-examples/verifier.md +109 -0
- package/sdd/references/gate-prompts.md +100 -0
- package/sdd/references/gates.md +70 -0
- package/sdd/references/git-integration.md +1 -1
- package/sdd/references/ios-scaffold.md +123 -0
- package/sdd/references/model-profile-resolution.md +2 -0
- package/sdd/references/model-profiles.md +24 -18
- package/sdd/references/planner-gap-closure.md +62 -0
- package/sdd/references/planner-reviews.md +39 -0
- package/sdd/references/planner-revision.md +87 -0
- package/sdd/references/planning-config.md +252 -0
- package/sdd/references/revision-loop.md +97 -0
- package/sdd/references/thinking-models-debug.md +44 -0
- package/sdd/references/thinking-models-execution.md +50 -0
- package/sdd/references/thinking-models-planning.md +62 -0
- package/sdd/references/thinking-models-research.md +50 -0
- package/sdd/references/thinking-models-verification.md +55 -0
- package/sdd/references/thinking-partner.md +96 -0
- package/sdd/references/ui-brand.md +4 -4
- package/sdd/references/universal-anti-patterns.md +63 -0
- package/sdd/references/verification-overrides.md +227 -0
- package/sdd/references/workstream-flag.md +56 -3
- package/sdd/templates/AI-SPEC.md +246 -0
- package/sdd/templates/DEBUG.md +1 -1
- package/sdd/templates/SECURITY.md +61 -0
- package/sdd/templates/UAT.md +4 -4
- package/sdd/templates/VALIDATION.md +4 -4
- package/sdd/templates/claude-md.md +32 -9
- package/sdd/templates/config.json +4 -0
- package/sdd/templates/debug-subagent-prompt.md +1 -1
- package/sdd/templates/dev-preferences.md +1 -1
- package/sdd/templates/discovery.md +2 -2
- package/sdd/templates/phase-prompt.md +1 -1
- package/sdd/templates/planner-subagent-prompt.md +3 -3
- package/sdd/templates/project.md +1 -1
- package/sdd/templates/research.md +1 -1
- package/sdd/templates/state.md +2 -2
- package/sdd/workflows/add-phase.md +8 -8
- package/sdd/workflows/add-tests.md +12 -9
- package/sdd/workflows/add-todo.md +5 -3
- package/sdd/workflows/ai-integration-phase.md +284 -0
- package/sdd/workflows/analyze-dependencies.md +96 -0
- package/sdd/workflows/audit-fix.md +157 -0
- package/sdd/workflows/audit-milestone.md +11 -11
- package/sdd/workflows/audit-uat.md +2 -2
- package/sdd/workflows/autonomous.md +195 -27
- package/sdd/workflows/check-todos.md +12 -10
- package/sdd/workflows/cleanup.md +2 -0
- package/sdd/workflows/code-review-fix.md +497 -0
- package/sdd/workflows/code-review.md +515 -0
- package/sdd/workflows/complete-milestone.md +56 -22
- package/sdd/workflows/diagnose-issues.md +10 -3
- package/sdd/workflows/discovery-phase.md +5 -3
- package/sdd/workflows/discuss-phase-assumptions.md +24 -6
- package/sdd/workflows/discuss-phase-power.md +291 -0
- package/sdd/workflows/discuss-phase.md +173 -21
- package/sdd/workflows/do.md +23 -21
- package/sdd/workflows/docs-update.md +1155 -0
- package/sdd/workflows/eval-review.md +155 -0
- package/sdd/workflows/execute-phase.md +594 -38
- package/sdd/workflows/execute-plan.md +67 -96
- package/sdd/workflows/explore.md +139 -0
- package/sdd/workflows/fast.md +5 -5
- package/sdd/workflows/forensics.md +2 -2
- package/sdd/workflows/health.md +4 -4
- package/sdd/workflows/help.md +122 -119
- package/sdd/workflows/import.md +276 -0
- package/sdd/workflows/inbox.md +387 -0
- package/sdd/workflows/insert-phase.md +7 -7
- package/sdd/workflows/list-phase-assumptions.md +4 -4
- package/sdd/workflows/list-workspaces.md +2 -2
- package/sdd/workflows/manager.md +35 -32
- package/sdd/workflows/map-codebase.md +7 -5
- package/sdd/workflows/milestone-summary.md +2 -2
- package/sdd/workflows/new-milestone.md +17 -9
- package/sdd/workflows/new-project.md +50 -25
- package/sdd/workflows/new-workspace.md +7 -5
- package/sdd/workflows/next.md +67 -11
- package/sdd/workflows/note.md +9 -7
- package/sdd/workflows/pause-work.md +75 -12
- package/sdd/workflows/plan-milestone-gaps.md +8 -8
- package/sdd/workflows/plan-phase.md +294 -42
- package/sdd/workflows/plant-seed.md +6 -3
- package/sdd/workflows/pr-branch.md +42 -14
- package/sdd/workflows/profile-user.md +9 -7
- package/sdd/workflows/progress.md +45 -45
- package/sdd/workflows/quick.md +195 -47
- package/sdd/workflows/remove-phase.md +6 -6
- package/sdd/workflows/remove-workspace.md +3 -1
- package/sdd/workflows/research-phase.md +2 -2
- package/sdd/workflows/resume-project.md +12 -12
- package/sdd/workflows/review.md +109 -9
- package/sdd/workflows/scan.md +102 -0
- package/sdd/workflows/secure-phase.md +166 -0
- package/sdd/workflows/session-report.md +2 -2
- package/sdd/workflows/settings.md +38 -12
- package/sdd/workflows/ship.md +21 -9
- package/sdd/workflows/stats.md +1 -1
- package/sdd/workflows/transition.md +23 -23
- package/sdd/workflows/ui-phase.md +15 -7
- package/sdd/workflows/ui-review.md +29 -4
- package/sdd/workflows/undo.md +314 -0
- package/sdd/workflows/update.md +171 -20
- package/sdd/workflows/validate-phase.md +6 -4
- package/sdd/workflows/verify-phase.md +210 -6
- package/sdd/workflows/verify-work.md +83 -9
- package/sdd/commands/sdd/workstreams.md +0 -63
|
@@ -55,6 +55,12 @@ gaps = [
|
|
|
55
55
|
</step>
|
|
56
56
|
|
|
57
57
|
<step name="report_plan">
|
|
58
|
+
**Read worktree config:**
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
USE_WORKTREES=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.use_worktrees 2>/dev/null || echo "true")
|
|
62
|
+
```
|
|
63
|
+
|
|
58
64
|
**Report diagnosis plan to user:**
|
|
59
65
|
|
|
60
66
|
```
|
|
@@ -82,6 +88,7 @@ This runs in parallel - all gaps investigated simultaneously.
|
|
|
82
88
|
|
|
83
89
|
```bash
|
|
84
90
|
AGENT_SKILLS_DEBUGGER=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" agent-skills sdd-debugger 2>/dev/null)
|
|
91
|
+
EXPECTED_BASE=$(git rev-parse HEAD)
|
|
85
92
|
```
|
|
86
93
|
|
|
87
94
|
**Spawn debug agents in parallel:**
|
|
@@ -90,9 +97,9 @@ For each gap, fill the debug-subagent-prompt template and spawn:
|
|
|
90
97
|
|
|
91
98
|
```
|
|
92
99
|
Task(
|
|
93
|
-
prompt=filled_debug_subagent_prompt + "\n\n<files_to_read>\n- {phase_dir}/{phase_num}-UAT.md\n- .planning/STATE.md\n</files_to_read>\n${AGENT_SKILLS_DEBUGGER}",
|
|
100
|
+
prompt=filled_debug_subagent_prompt + "\n\n<worktree_branch_check>\nFIRST ACTION: run git merge-base HEAD {EXPECTED_BASE} — if result differs from {EXPECTED_BASE}, run git reset --hard {EXPECTED_BASE} to correct the branch base (safe — runs before any agent work). Then verify: if [ \"$(git rev-parse HEAD)\" != \"{EXPECTED_BASE}\" ]; then echo \"ERROR: Could not correct worktree base\"; exit 1; fi. Fixes EnterWorktree creating branches from main on all platforms.\n</worktree_branch_check>\n\n<files_to_read>\n- {phase_dir}/{phase_num}-UAT.md\n- .planning/STATE.md\n</files_to_read>\n${AGENT_SKILLS_DEBUGGER}",
|
|
94
101
|
subagent_type="sdd-debugger",
|
|
95
|
-
isolation="worktree",
|
|
102
|
+
${USE_WORKTREES !== "false" ? 'isolation="worktree",' : ''}
|
|
96
103
|
description="Debug: {truth_short}"
|
|
97
104
|
)
|
|
98
105
|
```
|
|
@@ -213,7 +220,7 @@ Agents only diagnose—plan-phase --gaps handles fixes (no fix application).
|
|
|
213
220
|
|
|
214
221
|
**Agent times out:**
|
|
215
222
|
- Check DEBUG-{slug}.md for partial progress
|
|
216
|
-
- Can resume with /sdd
|
|
223
|
+
- Can resume with /sdd-debug
|
|
217
224
|
|
|
218
225
|
**All agents fail:**
|
|
219
226
|
- Something systemic (permissions, git, etc.)
|
|
@@ -4,7 +4,7 @@ Produces DISCOVERY.md (for Level 2-3) that informs PLAN.md creation.
|
|
|
4
4
|
|
|
5
5
|
Called from plan-phase.md's mandatory_discovery step with a depth parameter.
|
|
6
6
|
|
|
7
|
-
NOTE: For comprehensive ecosystem research ("how do experts build this"), use /sdd
|
|
7
|
+
NOTE: For comprehensive ecosystem research ("how do experts build this"), use /sdd-research-phase instead, which produces RESEARCH.md.
|
|
8
8
|
</purpose>
|
|
9
9
|
|
|
10
10
|
<depth_levels>
|
|
@@ -214,6 +214,8 @@ Write `.planning/phases/XX-name/DISCOVERY.md`:
|
|
|
214
214
|
After creating DISCOVERY.md, check confidence level.
|
|
215
215
|
|
|
216
216
|
If confidence is LOW:
|
|
217
|
+
|
|
218
|
+
**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.
|
|
217
219
|
Use AskUserQuestion:
|
|
218
220
|
|
|
219
221
|
- header: "Low Conf."
|
|
@@ -252,8 +254,8 @@ Confidence: [level]
|
|
|
252
254
|
|
|
253
255
|
What's next?
|
|
254
256
|
|
|
255
|
-
1. Discuss phase context (/sdd
|
|
256
|
-
2. Create phase plan (/sdd
|
|
257
|
+
1. Discuss phase context (/sdd-discuss-phase [current-phase])
|
|
258
|
+
2. Create phase plan (/sdd-plan-phase [current-phase])
|
|
257
259
|
3. Refine discovery (dig deeper)
|
|
258
260
|
4. Review discovery
|
|
259
261
|
|
|
@@ -77,7 +77,7 @@ Parse JSON for: `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phas
|
|
|
77
77
|
```
|
|
78
78
|
Phase [X] not found in roadmap.
|
|
79
79
|
|
|
80
|
-
Use /sdd
|
|
80
|
+
Use /sdd-progress to see available phases.
|
|
81
81
|
```
|
|
82
82
|
Exit workflow.
|
|
83
83
|
|
|
@@ -186,6 +186,24 @@ Parse JSON for: `todo_count`, `matches[]`.
|
|
|
186
186
|
**Auto mode (`--auto`):** Fold all todos with score >= 0.4 automatically. Log the selection.
|
|
187
187
|
</step>
|
|
188
188
|
|
|
189
|
+
<step name="load_methodology">
|
|
190
|
+
Read the project-level methodology file if it exists. This must happen before assumption analysis
|
|
191
|
+
so that active lenses shape how assumptions are generated and evaluated.
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
cat .planning/METHODOLOGY.md 2>/dev/null || true
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**If METHODOLOGY.md exists:**
|
|
198
|
+
- Parse each named lens: its diagnoses, recommendations, and triggering conditions
|
|
199
|
+
- Store as internal `<active_lenses>` for use in deep_codebase_analysis and present_assumptions
|
|
200
|
+
- When spawning the sdd-assumptions-analyzer, pass the lens list so it can flag which lenses apply
|
|
201
|
+
- When presenting assumptions, append a "Methodology" section showing which lenses were applied
|
|
202
|
+
and what they flagged (if anything)
|
|
203
|
+
|
|
204
|
+
**If METHODOLOGY.md does not exist:** Skip silently. This artifact is optional.
|
|
205
|
+
</step>
|
|
206
|
+
|
|
189
207
|
<step name="scout_codebase">
|
|
190
208
|
Lightweight scan of existing code to inform assumption generation.
|
|
191
209
|
|
|
@@ -579,15 +597,15 @@ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
|
|
|
579
597
|
|
|
580
598
|
**Phase ${PHASE}: {phase_name}** — {Goal from ROADMAP.md}
|
|
581
599
|
|
|
582
|
-
`/
|
|
600
|
+
`/clear` then:
|
|
583
601
|
|
|
584
|
-
|
|
602
|
+
`/sdd-plan-phase ${PHASE}`
|
|
585
603
|
|
|
586
604
|
---
|
|
587
605
|
|
|
588
606
|
**Also available:**
|
|
589
|
-
- `/sdd
|
|
590
|
-
- `/sdd
|
|
607
|
+
- `/sdd-plan-phase ${PHASE} --skip-research` — plan without research
|
|
608
|
+
- `/sdd-ui-phase ${PHASE}` — generate UI design contract (if frontend work)
|
|
591
609
|
- Review/edit CONTEXT.md before continuing
|
|
592
610
|
|
|
593
611
|
---
|
|
@@ -626,7 +644,7 @@ Display banner:
|
|
|
626
644
|
Context captured (assumptions mode). Launching plan-phase...
|
|
627
645
|
```
|
|
628
646
|
|
|
629
|
-
Launch: `Skill(skill="sdd
|
|
647
|
+
Launch: `Skill(skill="sdd-plan-phase", args="${PHASE} --auto")`
|
|
630
648
|
|
|
631
649
|
Handle return: PHASE COMPLETE / PLANNING COMPLETE / INCONCLUSIVE / GAPS FOUND
|
|
632
650
|
(identical handling to discuss-phase.md auto_advance step)
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Power user mode for discuss-phase. Generates ALL questions upfront into a JSON state file and an HTML companion UI, then waits for the user to answer at their own pace. When the user signals readiness, processes all answers in one pass and generates CONTEXT.md.
|
|
3
|
+
|
|
4
|
+
**When to use:** Large phases with many gray areas, or when users prefer to answer questions offline / asynchronously rather than interactively in the chat session.
|
|
5
|
+
</purpose>
|
|
6
|
+
|
|
7
|
+
<trigger>
|
|
8
|
+
This workflow executes when `--power` flag is present in ARGUMENTS to `/sdd-discuss-phase`.
|
|
9
|
+
|
|
10
|
+
The caller (discuss-phase.md) has already:
|
|
11
|
+
- Validated the phase exists
|
|
12
|
+
- Provided init context: `phase_dir`, `padded_phase`, `phase_number`, `phase_name`, `phase_slug`
|
|
13
|
+
|
|
14
|
+
Begin at **Step 1** immediately.
|
|
15
|
+
</trigger>
|
|
16
|
+
|
|
17
|
+
<step name="analyze">
|
|
18
|
+
Run the same gray area identification as standard discuss-phase mode.
|
|
19
|
+
|
|
20
|
+
1. Load prior context (PROJECT.md, REQUIREMENTS.md, STATE.md, prior CONTEXT.md files)
|
|
21
|
+
2. Scout codebase for reusable assets and patterns relevant to this phase
|
|
22
|
+
3. Read the phase goal from ROADMAP.md
|
|
23
|
+
4. Identify ALL gray areas — specific implementation decisions the user should weigh in on
|
|
24
|
+
5. For each gray area, generate 2–4 concrete options with tradeoff descriptions
|
|
25
|
+
|
|
26
|
+
Group questions by topic into sections (e.g., "Visual Style", "Data Model", "Interactions", "Error Handling"). Each section should have 2–6 questions.
|
|
27
|
+
|
|
28
|
+
Do NOT ask the user anything at this stage. Capture everything internally, then proceed to generate.
|
|
29
|
+
</step>
|
|
30
|
+
|
|
31
|
+
<step name="generate_json">
|
|
32
|
+
Write all questions to:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
{phase_dir}/{padded_phase}-QUESTIONS.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**JSON structure:**
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"phase": "{padded_phase}-{phase_slug}",
|
|
43
|
+
"generated_at": "ISO-8601 timestamp",
|
|
44
|
+
"stats": {
|
|
45
|
+
"total": 0,
|
|
46
|
+
"answered": 0,
|
|
47
|
+
"chat_more": 0,
|
|
48
|
+
"remaining": 0
|
|
49
|
+
},
|
|
50
|
+
"sections": [
|
|
51
|
+
{
|
|
52
|
+
"id": "section-slug",
|
|
53
|
+
"title": "Section Title",
|
|
54
|
+
"questions": [
|
|
55
|
+
{
|
|
56
|
+
"id": "Q-01",
|
|
57
|
+
"title": "Short question title",
|
|
58
|
+
"context": "Codebase info, prior decisions, or constraints relevant to this question",
|
|
59
|
+
"options": [
|
|
60
|
+
{
|
|
61
|
+
"id": "a",
|
|
62
|
+
"label": "Option label",
|
|
63
|
+
"description": "Tradeoff or elaboration for this option"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "b",
|
|
67
|
+
"label": "Another option",
|
|
68
|
+
"description": "Tradeoff or elaboration"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"id": "c",
|
|
72
|
+
"label": "Custom",
|
|
73
|
+
"description": ""
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"answer": null,
|
|
77
|
+
"chat_more": "",
|
|
78
|
+
"status": "unanswered"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Field rules:**
|
|
87
|
+
- `stats.total`: count of all questions across all sections
|
|
88
|
+
- `stats.answered`: count where `answer` is not null and not empty string
|
|
89
|
+
- `stats.chat_more`: count where `chat_more` has content
|
|
90
|
+
- `stats.remaining`: `total - answered`
|
|
91
|
+
- `question.id`: sequential across all sections — Q-01, Q-02, Q-03, ...
|
|
92
|
+
- `question.context`: concrete codebase or prior-decision annotation (not generic)
|
|
93
|
+
- `question.answer`: null until user sets it; once answered, the selected option id or free-text
|
|
94
|
+
- `question.status`: "unanswered" | "answered" | "chat-more" (has chat_more but no answer yet)
|
|
95
|
+
</step>
|
|
96
|
+
|
|
97
|
+
<step name="generate_html">
|
|
98
|
+
Write a self-contained HTML companion file to:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
{phase_dir}/{padded_phase}-QUESTIONS.html
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The file must be a single self-contained HTML file with inline CSS and JavaScript. No external dependencies.
|
|
105
|
+
|
|
106
|
+
**Layout:**
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
┌─────────────────────────────────────────────────────┐
|
|
110
|
+
│ Phase {N}: {phase_name} — Discussion Questions │
|
|
111
|
+
│ ┌──────────────────────────────────────────────┐ │
|
|
112
|
+
│ │ 12 total | 3 answered | 9 remaining │ │
|
|
113
|
+
│ └──────────────────────────────────────────────┘ │
|
|
114
|
+
├─────────────────────────────────────────────────────┤
|
|
115
|
+
│ ▼ Visual Style (3 questions) │
|
|
116
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
|
117
|
+
│ │ Q-01 │ │ Q-02 │ │ Q-03 │ │
|
|
118
|
+
│ │ Layout │ │ Density │ │ Colors │ │
|
|
119
|
+
│ │ ... │ │ ... │ │ ... │ │
|
|
120
|
+
│ └──────────┘ └──────────┘ └──────────┘ │
|
|
121
|
+
│ ▼ Data Model (2 questions) │
|
|
122
|
+
│ ... │
|
|
123
|
+
└─────────────────────────────────────────────────────┘
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Stats bar:**
|
|
127
|
+
- Total questions, answered count, remaining count
|
|
128
|
+
- A simple CSS progress bar (green fill = answered / total)
|
|
129
|
+
|
|
130
|
+
**Section headers:**
|
|
131
|
+
- Collapsible via click — show/hide questions in the section
|
|
132
|
+
- Show answered count for the section (e.g., "2/4 answered")
|
|
133
|
+
|
|
134
|
+
**Question cards (3-column grid):**
|
|
135
|
+
Each card contains:
|
|
136
|
+
- Question ID badge (e.g., "Q-01") and title
|
|
137
|
+
- Context annotation (gray italic text)
|
|
138
|
+
- Option list: radio buttons with bold label + description text
|
|
139
|
+
- Chat more textarea (orange border when content present)
|
|
140
|
+
- Card highlighted green when answered
|
|
141
|
+
|
|
142
|
+
**JavaScript behavior:**
|
|
143
|
+
- On radio button select: mark question as answered in page state; update stats bar
|
|
144
|
+
- On textarea input: update chat_more content in page state; show orange border if content present
|
|
145
|
+
- "Save answers" button at top and bottom: serializes page state back to the JSON file path
|
|
146
|
+
|
|
147
|
+
**Save mechanism:**
|
|
148
|
+
The Save button writes the updated JSON back using the File System Access API if available, otherwise generates a downloadable JSON file the user can save over the original. Include clear instructions in the UI:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
After answering, click "Save answers" — or download the JSON and replace the original file.
|
|
152
|
+
Then return to Claude and say "refresh" to process your answers.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Answered question styling:**
|
|
156
|
+
- Card border: `2px solid #22c55e` (green)
|
|
157
|
+
- Card background: `#f0fdf4` (light green tint)
|
|
158
|
+
|
|
159
|
+
**Unanswered question styling:**
|
|
160
|
+
- Card border: `1px solid #e2e8f0` (gray)
|
|
161
|
+
- Card background: `white`
|
|
162
|
+
|
|
163
|
+
**Chat more textarea:**
|
|
164
|
+
- Placeholder: "Add context, nuance, or clarification for this question..."
|
|
165
|
+
- Normal border: `1px solid #e2e8f0`
|
|
166
|
+
- Active (has content) border: `2px solid #f97316` (orange)
|
|
167
|
+
</step>
|
|
168
|
+
|
|
169
|
+
<step name="notify_user">
|
|
170
|
+
After writing both files, print this message to the user:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
Questions ready for Phase {N}: {phase_name}
|
|
174
|
+
|
|
175
|
+
HTML (open in browser/IDE): {phase_dir}/{padded_phase}-QUESTIONS.html
|
|
176
|
+
JSON (state file): {phase_dir}/{padded_phase}-QUESTIONS.json
|
|
177
|
+
|
|
178
|
+
{total} questions across {section_count} topics.
|
|
179
|
+
|
|
180
|
+
Open the HTML file, answer the questions at your own pace, then save.
|
|
181
|
+
|
|
182
|
+
When ready, tell me:
|
|
183
|
+
"refresh" — process your answers and update the file
|
|
184
|
+
"finalize" — generate CONTEXT.md from all answered questions
|
|
185
|
+
"explain Q-05" — elaborate on a specific question
|
|
186
|
+
"exit power mode" — return to standard one-by-one discussion (answers carry over)
|
|
187
|
+
```
|
|
188
|
+
</step>
|
|
189
|
+
|
|
190
|
+
<step name="wait_loop">
|
|
191
|
+
Enter wait mode. Claude listens for user commands and handles each:
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
**"refresh"** (or "process answers", "update", "re-read"):
|
|
196
|
+
|
|
197
|
+
1. Read `{phase_dir}/{padded_phase}-QUESTIONS.json`
|
|
198
|
+
2. Recalculate stats: count answered, chat_more, remaining
|
|
199
|
+
3. Write updated stats back to the JSON
|
|
200
|
+
4. Re-generate the HTML file with the updated state (answered cards highlighted green, progress bar updated)
|
|
201
|
+
5. Report to user:
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
Refreshed. Updated state:
|
|
205
|
+
Answered: {answered} / {total}
|
|
206
|
+
Remaining: {remaining}
|
|
207
|
+
Chat-more: {chat_more}
|
|
208
|
+
|
|
209
|
+
{phase_dir}/{padded_phase}-QUESTIONS.html updated.
|
|
210
|
+
|
|
211
|
+
Answer more questions, then say "refresh" again, or say "finalize" when done.
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
**"finalize"** (or "done", "generate context", "write context"):
|
|
217
|
+
|
|
218
|
+
Proceed to the **finalize** step.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
**"explain Q-{N}"** (or "more info on Q-{N}", "elaborate Q-{N}"):
|
|
223
|
+
|
|
224
|
+
1. Find the question by ID in the JSON
|
|
225
|
+
2. Provide a detailed explanation: why this decision matters, how it affects the downstream plan, what additional context from the codebase is relevant
|
|
226
|
+
3. Return to wait mode
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
**"exit power mode"** (or "switch to interactive"):
|
|
231
|
+
|
|
232
|
+
1. Read all currently answered questions from JSON
|
|
233
|
+
2. Load answers into the internal accumulator as if they were answered interactively
|
|
234
|
+
3. Continue with standard `discuss_areas` step from discuss-phase.md for any unanswered questions
|
|
235
|
+
4. Generate CONTEXT.md as normal
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
**Any other message:**
|
|
240
|
+
Respond helpfully, then remind the user of available commands:
|
|
241
|
+
```
|
|
242
|
+
(Power mode active — say "refresh", "finalize", "explain Q-N", or "exit power mode")
|
|
243
|
+
```
|
|
244
|
+
</step>
|
|
245
|
+
|
|
246
|
+
<step name="finalize">
|
|
247
|
+
Process all answered questions from the JSON file and generate CONTEXT.md.
|
|
248
|
+
|
|
249
|
+
1. Read `{phase_dir}/{padded_phase}-QUESTIONS.json`
|
|
250
|
+
2. Filter to questions where `answer` is not null/empty
|
|
251
|
+
3. Group decisions by section
|
|
252
|
+
4. For each answered question, format as a decision entry:
|
|
253
|
+
- Decision: the selected option label (or custom text if free-form answer)
|
|
254
|
+
- Rationale: the option description, plus `chat_more` content if present
|
|
255
|
+
- Status: "Decided" if fully answered, "Needs clarification" if only chat_more with no option selected
|
|
256
|
+
|
|
257
|
+
5. Write CONTEXT.md using the standard context template format:
|
|
258
|
+
- `<decisions>` section with all answered questions grouped by section
|
|
259
|
+
- `<deferred_ideas>` section for unanswered questions (carry forward for future discussion)
|
|
260
|
+
- `<specifics>` section for any chat_more content that adds nuance
|
|
261
|
+
- `<code_context>` section with reusable assets found during analysis
|
|
262
|
+
- `<canonical_refs>` section (MANDATORY — paths to relevant specs/docs)
|
|
263
|
+
|
|
264
|
+
6. If fewer than 50% of questions were answered, warn the user:
|
|
265
|
+
```
|
|
266
|
+
Warning: Only {answered}/{total} questions answered ({pct}%).
|
|
267
|
+
CONTEXT.md generated with available decisions. Unanswered questions listed as deferred.
|
|
268
|
+
Consider running /sdd-discuss-phase {N} again to refine before planning.
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
7. Print completion message:
|
|
272
|
+
```
|
|
273
|
+
CONTEXT.md written: {phase_dir}/{padded_phase}-CONTEXT.md
|
|
274
|
+
|
|
275
|
+
Decisions captured: {answered}
|
|
276
|
+
Deferred: {remaining}
|
|
277
|
+
|
|
278
|
+
Next step: /sdd-plan-phase {N}
|
|
279
|
+
```
|
|
280
|
+
</step>
|
|
281
|
+
|
|
282
|
+
<success_criteria>
|
|
283
|
+
- Questions generated into well-structured JSON covering all identified gray areas
|
|
284
|
+
- HTML companion file is self-contained and usable without a server
|
|
285
|
+
- Stats bar accurately reflects answered/remaining counts after each refresh
|
|
286
|
+
- Answered questions highlighted green in HTML
|
|
287
|
+
- CONTEXT.md generated in the same format as standard discuss-phase output
|
|
288
|
+
- Unanswered questions preserved as deferred items (not silently dropped)
|
|
289
|
+
- `canonical_refs` section always present in CONTEXT.md (MANDATORY)
|
|
290
|
+
- User knows how to refresh, finalize, explain, or exit power mode
|
|
291
|
+
</success_criteria>
|