@ktpartners/dgs-platform 2.6.2
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/LICENSE +38 -0
- package/README.md +851 -0
- package/agents/dgs-codebase-cross-analyzer.md +183 -0
- package/agents/dgs-codebase-mapper.md +782 -0
- package/agents/dgs-codebase-synthesizer.md +156 -0
- package/agents/dgs-debugger.md +1256 -0
- package/agents/dgs-executor.md +550 -0
- package/agents/dgs-integration-checker.md +481 -0
- package/agents/dgs-nyquist-auditor.md +178 -0
- package/agents/dgs-phase-researcher.md +563 -0
- package/agents/dgs-phase-verifier.md +450 -0
- package/agents/dgs-plan-checker.md +708 -0
- package/agents/dgs-planner.md +1324 -0
- package/agents/dgs-project-researcher.md +631 -0
- package/agents/dgs-research-synthesizer.md +249 -0
- package/agents/dgs-roadmapper.md +652 -0
- package/agents/dgs-verifier.md +607 -0
- package/bin/install.js +2073 -0
- package/commands/dgs/add-doc.md +45 -0
- package/commands/dgs/add-idea.md +38 -0
- package/commands/dgs/add-phase.md +43 -0
- package/commands/dgs/add-repo.md +54 -0
- package/commands/dgs/add-tests.md +41 -0
- package/commands/dgs/add-todo.md +47 -0
- package/commands/dgs/approve-spec.md +38 -0
- package/commands/dgs/audit-milestone.md +36 -0
- package/commands/dgs/audit-phase.md +37 -0
- package/commands/dgs/cancel-job.md +23 -0
- package/commands/dgs/capture-principle.md +143 -0
- package/commands/dgs/check-todos.md +45 -0
- package/commands/dgs/cleanup.md +18 -0
- package/commands/dgs/complete-milestone.md +136 -0
- package/commands/dgs/complete-project.md +70 -0
- package/commands/dgs/consolidate-ideas.md +50 -0
- package/commands/dgs/create-milestone-job.md +37 -0
- package/commands/dgs/debug.md +164 -0
- package/commands/dgs/develop-idea.md +53 -0
- package/commands/dgs/discuss-idea.md +41 -0
- package/commands/dgs/discuss-phase.md +83 -0
- package/commands/dgs/execute-phase.md +41 -0
- package/commands/dgs/fast.md +38 -0
- package/commands/dgs/find-related-ideas.md +43 -0
- package/commands/dgs/health.md +28 -0
- package/commands/dgs/help.md +22 -0
- package/commands/dgs/import-spec.md +36 -0
- package/commands/dgs/init-product.md +28 -0
- package/commands/dgs/insert-phase.md +32 -0
- package/commands/dgs/join-discord.md +18 -0
- package/commands/dgs/list-docs.md +40 -0
- package/commands/dgs/list-ideas.md +42 -0
- package/commands/dgs/list-jobs.md +22 -0
- package/commands/dgs/list-phase-assumptions.md +46 -0
- package/commands/dgs/list-projects.md +57 -0
- package/commands/dgs/list-specs.md +40 -0
- package/commands/dgs/map-codebase.md +92 -0
- package/commands/dgs/new-milestone.md +44 -0
- package/commands/dgs/new-project.md +42 -0
- package/commands/dgs/node-repair.md +26 -0
- package/commands/dgs/overlap-check.md +20 -0
- package/commands/dgs/pause-work.md +38 -0
- package/commands/dgs/plan-milestone-gaps.md +34 -0
- package/commands/dgs/plan-phase.md +44 -0
- package/commands/dgs/progress.md +24 -0
- package/commands/dgs/quick.md +41 -0
- package/commands/dgs/reactivate-project.md +70 -0
- package/commands/dgs/reapply-patches.md +110 -0
- package/commands/dgs/refine-spec.md +38 -0
- package/commands/dgs/reject-idea.md +43 -0
- package/commands/dgs/remove-doc.md +44 -0
- package/commands/dgs/remove-phase.md +31 -0
- package/commands/dgs/remove-repo.md +69 -0
- package/commands/dgs/research-idea.md +43 -0
- package/commands/dgs/research-phase.md +189 -0
- package/commands/dgs/restore-idea.md +45 -0
- package/commands/dgs/resume-work.md +40 -0
- package/commands/dgs/rollback-job.md +24 -0
- package/commands/dgs/run-job.md +35 -0
- package/commands/dgs/search.md +40 -0
- package/commands/dgs/set-profile.md +34 -0
- package/commands/dgs/settings.md +38 -0
- package/commands/dgs/switch-project.md +58 -0
- package/commands/dgs/undo-consolidation.md +42 -0
- package/commands/dgs/update-idea.md +44 -0
- package/commands/dgs/update.md +37 -0
- package/commands/dgs/validate-phase.md +35 -0
- package/commands/dgs/verify-work.md +39 -0
- package/commands/dgs/write-spec.md +49 -0
- package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-01-SUMMARY.md +84 -0
- package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-02-SUMMARY.md +86 -0
- package/deliver-great-systems/.planning/phases/10-v1-to-v2-migration-flow/10-01-SUMMARY.md +85 -0
- package/deliver-great-systems/bin/dgs-tools.cjs +1444 -0
- package/deliver-great-systems/bin/lib/auto-test.cjs +1365 -0
- package/deliver-great-systems/bin/lib/commands.cjs +570 -0
- package/deliver-great-systems/bin/lib/config.cjs +417 -0
- package/deliver-great-systems/bin/lib/conflict-agent.cjs +1063 -0
- package/deliver-great-systems/bin/lib/conflict-agent.test.cjs +554 -0
- package/deliver-great-systems/bin/lib/context.cjs +929 -0
- package/deliver-great-systems/bin/lib/context.test.cjs +693 -0
- package/deliver-great-systems/bin/lib/core.cjs +744 -0
- package/deliver-great-systems/bin/lib/core.test.cjs +822 -0
- package/deliver-great-systems/bin/lib/docs.cjs +919 -0
- package/deliver-great-systems/bin/lib/docs.test.cjs +211 -0
- package/deliver-great-systems/bin/lib/execution.cjs +705 -0
- package/deliver-great-systems/bin/lib/execution.test.cjs +1472 -0
- package/deliver-great-systems/bin/lib/frontmatter.cjs +324 -0
- package/deliver-great-systems/bin/lib/ideas.cjs +1406 -0
- package/deliver-great-systems/bin/lib/ideas.test.cjs +1417 -0
- package/deliver-great-systems/bin/lib/identity.cjs +125 -0
- package/deliver-great-systems/bin/lib/init.cjs +1114 -0
- package/deliver-great-systems/bin/lib/init.test.cjs +1271 -0
- package/deliver-great-systems/bin/lib/jobs.cjs +2015 -0
- package/deliver-great-systems/bin/lib/jobs.test.cjs +2619 -0
- package/deliver-great-systems/bin/lib/merge-conflicts.cjs +654 -0
- package/deliver-great-systems/bin/lib/merge-conflicts.test.cjs +370 -0
- package/deliver-great-systems/bin/lib/migration.cjs +352 -0
- package/deliver-great-systems/bin/lib/migration.test.cjs +582 -0
- package/deliver-great-systems/bin/lib/milestone.cjs +243 -0
- package/deliver-great-systems/bin/lib/overlap.cjs +437 -0
- package/deliver-great-systems/bin/lib/overlap.test.cjs +747 -0
- package/deliver-great-systems/bin/lib/path-audit.test.cjs +384 -0
- package/deliver-great-systems/bin/lib/paths.cjs +144 -0
- package/deliver-great-systems/bin/lib/paths.test.cjs +486 -0
- package/deliver-great-systems/bin/lib/phase.cjs +910 -0
- package/deliver-great-systems/bin/lib/projects.cjs +691 -0
- package/deliver-great-systems/bin/lib/projects.test.cjs +871 -0
- package/deliver-great-systems/bin/lib/repos.cjs +1432 -0
- package/deliver-great-systems/bin/lib/repos.test.cjs +1882 -0
- package/deliver-great-systems/bin/lib/roadmap.cjs +305 -0
- package/deliver-great-systems/bin/lib/search.cjs +570 -0
- package/deliver-great-systems/bin/lib/specs.cjs +1303 -0
- package/deliver-great-systems/bin/lib/state.cjs +893 -0
- package/deliver-great-systems/bin/lib/template.cjs +228 -0
- package/deliver-great-systems/bin/lib/test-helpers.cjs +291 -0
- package/deliver-great-systems/bin/lib/verify.cjs +796 -0
- package/deliver-great-systems/references/checkpoints.md +776 -0
- package/deliver-great-systems/references/conflict-resolution.md +66 -0
- package/deliver-great-systems/references/context-tiers.md +166 -0
- package/deliver-great-systems/references/continuation-format.md +249 -0
- package/deliver-great-systems/references/decimal-phase-calculation.md +67 -0
- package/deliver-great-systems/references/git-integration.md +250 -0
- package/deliver-great-systems/references/git-planning-commit.md +40 -0
- package/deliver-great-systems/references/model-profile-resolution.md +36 -0
- package/deliver-great-systems/references/model-profiles.md +95 -0
- package/deliver-great-systems/references/phase-argument-parsing.md +61 -0
- package/deliver-great-systems/references/planning-config.md +224 -0
- package/deliver-great-systems/references/questioning.md +162 -0
- package/deliver-great-systems/references/spec-review-loop.md +177 -0
- package/deliver-great-systems/references/tdd.md +265 -0
- package/deliver-great-systems/references/ui-brand.md +160 -0
- package/deliver-great-systems/references/verification-patterns.md +612 -0
- package/deliver-great-systems/templates/DEBUG.md +166 -0
- package/deliver-great-systems/templates/UAT.md +251 -0
- package/deliver-great-systems/templates/VALIDATION.md +95 -0
- package/deliver-great-systems/templates/claude-md.md +74 -0
- package/deliver-great-systems/templates/codebase/architecture.md +257 -0
- package/deliver-great-systems/templates/codebase/concerns.md +312 -0
- package/deliver-great-systems/templates/codebase/conventions.md +309 -0
- package/deliver-great-systems/templates/codebase/integrations.md +282 -0
- package/deliver-great-systems/templates/codebase/stack.md +188 -0
- package/deliver-great-systems/templates/codebase/structure.md +287 -0
- package/deliver-great-systems/templates/codebase/testing.md +482 -0
- package/deliver-great-systems/templates/config.json +38 -0
- package/deliver-great-systems/templates/context.md +354 -0
- package/deliver-great-systems/templates/continue-here.md +80 -0
- package/deliver-great-systems/templates/debug-subagent-prompt.md +93 -0
- package/deliver-great-systems/templates/discovery.md +148 -0
- package/deliver-great-systems/templates/milestone-archive.md +125 -0
- package/deliver-great-systems/templates/milestone.md +117 -0
- package/deliver-great-systems/templates/phase-prompt.md +615 -0
- package/deliver-great-systems/templates/planner-subagent-prompt.md +119 -0
- package/deliver-great-systems/templates/project.md +186 -0
- package/deliver-great-systems/templates/requirements.md +233 -0
- package/deliver-great-systems/templates/research-project/ARCHITECTURE.md +206 -0
- package/deliver-great-systems/templates/research-project/FEATURES.md +149 -0
- package/deliver-great-systems/templates/research-project/PITFALLS.md +202 -0
- package/deliver-great-systems/templates/research-project/STACK.md +122 -0
- package/deliver-great-systems/templates/research-project/SUMMARY.md +172 -0
- package/deliver-great-systems/templates/research.md +554 -0
- package/deliver-great-systems/templates/retrospective.md +54 -0
- package/deliver-great-systems/templates/roadmap.md +204 -0
- package/deliver-great-systems/templates/state.md +178 -0
- package/deliver-great-systems/templates/summary-complex.md +59 -0
- package/deliver-great-systems/templates/summary-minimal.md +41 -0
- package/deliver-great-systems/templates/summary-standard.md +48 -0
- package/deliver-great-systems/templates/summary.md +253 -0
- package/deliver-great-systems/templates/user-setup.md +313 -0
- package/deliver-great-systems/templates/verification-report.md +324 -0
- package/deliver-great-systems/workflows/add-doc.md +151 -0
- package/deliver-great-systems/workflows/add-idea.md +96 -0
- package/deliver-great-systems/workflows/add-phase.md +120 -0
- package/deliver-great-systems/workflows/add-tests.md +359 -0
- package/deliver-great-systems/workflows/add-todo.md +162 -0
- package/deliver-great-systems/workflows/approve-spec.md +194 -0
- package/deliver-great-systems/workflows/audit-milestone.md +364 -0
- package/deliver-great-systems/workflows/audit-phase.md +462 -0
- package/deliver-great-systems/workflows/cancel-job.md +108 -0
- package/deliver-great-systems/workflows/check-todos.md +181 -0
- package/deliver-great-systems/workflows/cleanup.md +247 -0
- package/deliver-great-systems/workflows/codereview.md +526 -0
- package/deliver-great-systems/workflows/complete-milestone.md +1298 -0
- package/deliver-great-systems/workflows/consolidate-ideas.md +365 -0
- package/deliver-great-systems/workflows/create-milestone-job.md +177 -0
- package/deliver-great-systems/workflows/develop-idea.md +544 -0
- package/deliver-great-systems/workflows/diagnose-issues.md +231 -0
- package/deliver-great-systems/workflows/discovery-phase.md +301 -0
- package/deliver-great-systems/workflows/discuss-idea.md +263 -0
- package/deliver-great-systems/workflows/discuss-phase.md +733 -0
- package/deliver-great-systems/workflows/execute-phase.md +571 -0
- package/deliver-great-systems/workflows/execute-plan.md +592 -0
- package/deliver-great-systems/workflows/find-related-ideas.md +271 -0
- package/deliver-great-systems/workflows/health.md +173 -0
- package/deliver-great-systems/workflows/help.md +997 -0
- package/deliver-great-systems/workflows/import-spec.md +381 -0
- package/deliver-great-systems/workflows/init-product.md +767 -0
- package/deliver-great-systems/workflows/insert-phase.md +138 -0
- package/deliver-great-systems/workflows/list-docs.md +119 -0
- package/deliver-great-systems/workflows/list-ideas.md +154 -0
- package/deliver-great-systems/workflows/list-jobs.md +89 -0
- package/deliver-great-systems/workflows/list-phase-assumptions.md +192 -0
- package/deliver-great-systems/workflows/list-specs.md +101 -0
- package/deliver-great-systems/workflows/map-codebase.md +621 -0
- package/deliver-great-systems/workflows/new-milestone.md +591 -0
- package/deliver-great-systems/workflows/new-project.md +1113 -0
- package/deliver-great-systems/workflows/node-repair.md +94 -0
- package/deliver-great-systems/workflows/overlap-check.md +86 -0
- package/deliver-great-systems/workflows/pause-work.md +134 -0
- package/deliver-great-systems/workflows/plan-milestone-gaps.md +306 -0
- package/deliver-great-systems/workflows/plan-phase.md +698 -0
- package/deliver-great-systems/workflows/progress.md +386 -0
- package/deliver-great-systems/workflows/quick.md +845 -0
- package/deliver-great-systems/workflows/refine-spec.md +275 -0
- package/deliver-great-systems/workflows/reject-idea.md +109 -0
- package/deliver-great-systems/workflows/remove-doc.md +117 -0
- package/deliver-great-systems/workflows/remove-phase.md +163 -0
- package/deliver-great-systems/workflows/research-idea.md +325 -0
- package/deliver-great-systems/workflows/research-phase.md +81 -0
- package/deliver-great-systems/workflows/restore-idea.md +101 -0
- package/deliver-great-systems/workflows/resume-project.md +311 -0
- package/deliver-great-systems/workflows/rollback-job.md +130 -0
- package/deliver-great-systems/workflows/run-job.md +498 -0
- package/deliver-great-systems/workflows/search.md +130 -0
- package/deliver-great-systems/workflows/set-profile.md +83 -0
- package/deliver-great-systems/workflows/settings.md +470 -0
- package/deliver-great-systems/workflows/transition.md +563 -0
- package/deliver-great-systems/workflows/undo-consolidation.md +155 -0
- package/deliver-great-systems/workflows/update-idea.md +157 -0
- package/deliver-great-systems/workflows/update.md +242 -0
- package/deliver-great-systems/workflows/validate-phase.md +177 -0
- package/deliver-great-systems/workflows/verify-phase.md +253 -0
- package/deliver-great-systems/workflows/verify-work.md +671 -0
- package/deliver-great-systems/workflows/write-spec.md +450 -0
- package/hooks/dist/dgs-check-update.js +62 -0
- package/hooks/dist/dgs-context-monitor.js +141 -0
- package/hooks/dist/dgs-statusline.js +115 -0
- package/package.json +60 -0
- package/scripts/build-hooks.js +43 -0
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Create executable phase prompts (PLAN.md files) for a roadmap phase with integrated research and verification. Default flow: Research (if needed) -> Plan -> Verify -> Done. Orchestrates dgs-phase-researcher, dgs-planner, and dgs-plan-checker agents with a revision loop (max 3 iterations).
|
|
3
|
+
</purpose>
|
|
4
|
+
|
|
5
|
+
<context_tier>planning</context_tier>
|
|
6
|
+
|
|
7
|
+
<required_reading>
|
|
8
|
+
Read all files referenced by the invoking prompt's execution_context before starting.
|
|
9
|
+
|
|
10
|
+
@~/.claude/deliver-great-systems/references/ui-brand.md
|
|
11
|
+
</required_reading>
|
|
12
|
+
|
|
13
|
+
<process>
|
|
14
|
+
|
|
15
|
+
## 1. Initialize
|
|
16
|
+
|
|
17
|
+
Load all context in one call (paths only to minimize orchestrator context):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
INIT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" init plan-phase "$PHASE")
|
|
21
|
+
if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_enabled`, `plan_checker_enabled`, `nyquist_validation_enabled`, `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `plan_count`, `planning_exists`, `roadmap_exists`, `phase_req_ids`.
|
|
25
|
+
|
|
26
|
+
Load planning-tier context files:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier planning --raw 2>/dev/null)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**File paths (for <files_to_read> blocks):** `state_path`, `roadmap_path`, `requirements_path`, `context_path`, `research_path`, `verification_path`, `uat_path`. These are null if files don't exist.
|
|
33
|
+
|
|
34
|
+
**If `planning_exists` is false:** Error — run `/dgs:new-project` first.
|
|
35
|
+
|
|
36
|
+
## 2. Parse and Normalize Arguments
|
|
37
|
+
|
|
38
|
+
Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`, `--prd <filepath>`).
|
|
39
|
+
|
|
40
|
+
Extract `--prd <filepath>` from $ARGUMENTS. If present, set PRD_FILE to the filepath.
|
|
41
|
+
|
|
42
|
+
**Auto-mode and non-interactive detection:**
|
|
43
|
+
Parse `--auto` and `--non-interactive` flags from $ARGUMENTS.
|
|
44
|
+
Read auto-advance config:
|
|
45
|
+
```bash
|
|
46
|
+
AUTO_CHAIN=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
|
|
47
|
+
AUTO_CFG=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
|
|
48
|
+
```
|
|
49
|
+
Set `AUTO_MODE = true` if `--auto` flag present OR `AUTO_CHAIN` is `"true"` OR `AUTO_CFG` is `"true"`.
|
|
50
|
+
Set `NON_INTERACTIVE = true` if `--non-interactive` flag present OR `--auto` flag present OR `AUTO_CHAIN` is `"true"` OR `AUTO_CFG` is `"true"`.
|
|
51
|
+
|
|
52
|
+
**If no phase number:** Detect next unplanned phase from roadmap.
|
|
53
|
+
|
|
54
|
+
**If `phase_found` is false:** Validate phase exists in ROADMAP.md. If valid, create the directory using `phase_slug` and `padded_phase` from init. Use `project_root` from init for the base path:
|
|
55
|
+
```bash
|
|
56
|
+
mkdir -p "${project_root}/phases/${padded_phase}-${phase_slug}"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Existing artifacts from init:** `has_research`, `has_plans`, `plan_count`.
|
|
60
|
+
|
|
61
|
+
## 3. Validate Phase
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
PHASE_INFO=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" roadmap get-phase "${PHASE}")
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**If `found` is false:** Error with available phases. **If `found` is true:** Extract `phase_number`, `phase_name`, `goal` from JSON.
|
|
68
|
+
|
|
69
|
+
## 3.5. Handle PRD Express Path
|
|
70
|
+
|
|
71
|
+
**Skip if:** No `--prd` flag in arguments.
|
|
72
|
+
|
|
73
|
+
**If `--prd <filepath>` provided:**
|
|
74
|
+
|
|
75
|
+
1. Read the PRD file:
|
|
76
|
+
```bash
|
|
77
|
+
PRD_CONTENT=$(cat "$PRD_FILE" 2>/dev/null)
|
|
78
|
+
if [ -z "$PRD_CONTENT" ]; then
|
|
79
|
+
echo "Error: PRD file not found: $PRD_FILE"
|
|
80
|
+
exit 1
|
|
81
|
+
fi
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
2. Display banner:
|
|
85
|
+
```
|
|
86
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
87
|
+
DGS ► PRD EXPRESS PATH
|
|
88
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
89
|
+
|
|
90
|
+
Using PRD: {PRD_FILE}
|
|
91
|
+
Generating CONTEXT.md from requirements...
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
3. Parse the PRD content and generate CONTEXT.md. The orchestrator should:
|
|
95
|
+
- Extract all requirements, user stories, acceptance criteria, and constraints from the PRD
|
|
96
|
+
- Map each to a locked decision (everything in the PRD is treated as a locked decision)
|
|
97
|
+
- Identify any areas the PRD doesn't cover and mark as "Claude's Discretion"
|
|
98
|
+
- **Extract canonical refs** from ROADMAP.md for this phase, plus any specs/ADRs referenced in the PRD — expand to full file paths (MANDATORY)
|
|
99
|
+
- Create CONTEXT.md in the phase directory
|
|
100
|
+
|
|
101
|
+
4. Write CONTEXT.md:
|
|
102
|
+
```markdown
|
|
103
|
+
# Phase [X]: [Name] - Context
|
|
104
|
+
|
|
105
|
+
**Gathered:** [date]
|
|
106
|
+
**Status:** Ready for planning
|
|
107
|
+
**Source:** PRD Express Path ({PRD_FILE})
|
|
108
|
+
|
|
109
|
+
<domain>
|
|
110
|
+
## Phase Boundary
|
|
111
|
+
|
|
112
|
+
[Extracted from PRD — what this phase delivers]
|
|
113
|
+
|
|
114
|
+
</domain>
|
|
115
|
+
|
|
116
|
+
<decisions>
|
|
117
|
+
## Implementation Decisions
|
|
118
|
+
|
|
119
|
+
{For each requirement/story/criterion in the PRD:}
|
|
120
|
+
### [Category derived from content]
|
|
121
|
+
- [Requirement as locked decision]
|
|
122
|
+
|
|
123
|
+
### Claude's Discretion
|
|
124
|
+
[Areas not covered by PRD — implementation details, technical choices]
|
|
125
|
+
|
|
126
|
+
</decisions>
|
|
127
|
+
|
|
128
|
+
<canonical_refs>
|
|
129
|
+
## Canonical References
|
|
130
|
+
|
|
131
|
+
**Downstream agents MUST read these before planning or implementing.**
|
|
132
|
+
|
|
133
|
+
[MANDATORY. Extract from ROADMAP.md and any docs referenced in the PRD.
|
|
134
|
+
Use full relative paths. Group by topic area.]
|
|
135
|
+
|
|
136
|
+
### [Topic area]
|
|
137
|
+
- `path/to/spec-or-adr.md` — [What it decides/defines]
|
|
138
|
+
|
|
139
|
+
[If no external specs: "No external specs — requirements fully captured in decisions above"]
|
|
140
|
+
|
|
141
|
+
</canonical_refs>
|
|
142
|
+
|
|
143
|
+
<specifics>
|
|
144
|
+
## Specific Ideas
|
|
145
|
+
|
|
146
|
+
[Any specific references, examples, or concrete requirements from PRD]
|
|
147
|
+
|
|
148
|
+
</specifics>
|
|
149
|
+
|
|
150
|
+
<deferred>
|
|
151
|
+
## Deferred Ideas
|
|
152
|
+
|
|
153
|
+
[Items in PRD explicitly marked as future/v2/out-of-scope]
|
|
154
|
+
[If none: "None — PRD covers phase scope"]
|
|
155
|
+
|
|
156
|
+
</deferred>
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
*Phase: XX-name*
|
|
161
|
+
*Context gathered: [date] via PRD Express Path*
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
5. Commit:
|
|
165
|
+
```bash
|
|
166
|
+
node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "docs(${padded_phase}): generate context from PRD" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
6. Set `context_content` to the generated CONTEXT.md content and continue to step 5 (Handle Research).
|
|
170
|
+
|
|
171
|
+
**Effect:** This completely bypasses step 4 (Load CONTEXT.md) since we just created it. The rest of the workflow (research, planning, verification) proceeds normally with the PRD-derived context.
|
|
172
|
+
|
|
173
|
+
## 4. Load CONTEXT.md
|
|
174
|
+
|
|
175
|
+
**Skip if:** PRD express path was used (CONTEXT.md already created in step 3.5).
|
|
176
|
+
|
|
177
|
+
Check `context_path` from init JSON.
|
|
178
|
+
|
|
179
|
+
If `context_path` is not null, display: `Using phase context from: ${context_path}`
|
|
180
|
+
|
|
181
|
+
**If `context_path` is null (no CONTEXT.md exists):**
|
|
182
|
+
|
|
183
|
+
**If `NON_INTERACTIVE` is true:**
|
|
184
|
+
Log: `[AUTO-RESOLVE] No CONTEXT.md — continuing with research and requirements only`
|
|
185
|
+
Continue to step 5 (skip the AskUserQuestion entirely).
|
|
186
|
+
|
|
187
|
+
**Otherwise (interactive mode):**
|
|
188
|
+
Use AskUserQuestion:
|
|
189
|
+
- header: "No context"
|
|
190
|
+
- question: "No CONTEXT.md found for Phase {X}. Plans will use research and requirements only — your design preferences won't be included. Continue or capture context first?"
|
|
191
|
+
- options:
|
|
192
|
+
- "Continue without context" — Plan using research + requirements only
|
|
193
|
+
- "Run discuss-phase first" — Capture design decisions before planning
|
|
194
|
+
|
|
195
|
+
If "Continue without context": Proceed to step 5.
|
|
196
|
+
If "Run discuss-phase first": Display `/dgs:discuss-phase {X}` and exit workflow.
|
|
197
|
+
|
|
198
|
+
## 5. Handle Research
|
|
199
|
+
|
|
200
|
+
**Skip if:** `--gaps` flag, `--skip-research` flag, or `research_enabled` is false (from init) without `--research` override.
|
|
201
|
+
|
|
202
|
+
**If `has_research` is true (from init) AND no `--research` flag:** Use existing, skip to step 6.
|
|
203
|
+
|
|
204
|
+
**If RESEARCH.md missing OR `--research` flag:**
|
|
205
|
+
|
|
206
|
+
Display banner:
|
|
207
|
+
```
|
|
208
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
209
|
+
DGS ► RESEARCHING PHASE {X}
|
|
210
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
211
|
+
|
|
212
|
+
◆ Spawning researcher...
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Spawn dgs-phase-researcher
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
PHASE_DESC=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" roadmap get-phase "${PHASE}" | jq -r '.section')
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Research prompt:
|
|
222
|
+
|
|
223
|
+
```markdown
|
|
224
|
+
<objective>
|
|
225
|
+
Research how to implement Phase {phase_number}: {phase_name}
|
|
226
|
+
Answer: "What do I need to know to PLAN this phase well?"
|
|
227
|
+
</objective>
|
|
228
|
+
|
|
229
|
+
<files_to_read>
|
|
230
|
+
- {context_path} (USER DECISIONS from /dgs:discuss-phase)
|
|
231
|
+
- {requirements_path} (Project requirements)
|
|
232
|
+
- {state_path} (Project decisions and history)
|
|
233
|
+
- ${project_root}/docs/product/*.md (Product-level documents — target architecture, product summary, if exist)
|
|
234
|
+
</files_to_read>
|
|
235
|
+
|
|
236
|
+
<additional_context>
|
|
237
|
+
**Phase description:** {phase_description}
|
|
238
|
+
**Phase requirement IDs (MUST address):** {phase_req_ids}
|
|
239
|
+
|
|
240
|
+
**Project instructions:** Read ./CLAUDE.md if exists — follow project-specific guidelines
|
|
241
|
+
**Project skills:** Check .claude/skills/ or .agents/skills/ directory (if either exists) — read SKILL.md files, research should account for project skill patterns
|
|
242
|
+
</additional_context>
|
|
243
|
+
|
|
244
|
+
<output>
|
|
245
|
+
Write to: {phase_dir}/{phase_num}-RESEARCH.md
|
|
246
|
+
</output>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
Task(
|
|
251
|
+
prompt=research_prompt,
|
|
252
|
+
subagent_type="dgs-phase-researcher",
|
|
253
|
+
model="{researcher_model}",
|
|
254
|
+
description="Research Phase {phase}"
|
|
255
|
+
)
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Handle Researcher Return
|
|
259
|
+
|
|
260
|
+
- **`## RESEARCH COMPLETE`:** Display confirmation, continue to step 6
|
|
261
|
+
- **`## RESEARCH BLOCKED`:**
|
|
262
|
+
**If `NON_INTERACTIVE` is true:**
|
|
263
|
+
Log: `[AUTO-RESOLVE] Research blocked — skipping research, planning from requirements only`
|
|
264
|
+
Continue to step 6 (skip the user prompt for blocker resolution).
|
|
265
|
+
|
|
266
|
+
**Otherwise (interactive mode):**
|
|
267
|
+
Display blocker, offer: 1) Provide context, 2) Skip research, 3) Abort
|
|
268
|
+
|
|
269
|
+
## 5.5. Create Validation Strategy
|
|
270
|
+
|
|
271
|
+
Skip if `nyquist_validation_enabled` is false OR `research_enabled` is false.
|
|
272
|
+
|
|
273
|
+
If `research_enabled` is false and `nyquist_validation_enabled` is true: warn "Nyquist validation enabled but research disabled — VALIDATION.md cannot be created without RESEARCH.md. Plans will lack validation requirements (Dimension 8)." Continue to step 6.
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
grep -l "## Validation Architecture" "${PHASE_DIR}"/*-RESEARCH.md 2>/dev/null
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**If found:**
|
|
280
|
+
1. Read template: `~/.claude/deliver-great-systems/templates/VALIDATION.md`
|
|
281
|
+
2. Write to `${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md` (use Write tool)
|
|
282
|
+
3. Fill frontmatter: `{N}` → phase number, `{phase-slug}` → slug, `{date}` → current date
|
|
283
|
+
4. Verify:
|
|
284
|
+
```bash
|
|
285
|
+
test -f "${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md" && echo "VALIDATION_CREATED=true" || echo "VALIDATION_CREATED=false"
|
|
286
|
+
```
|
|
287
|
+
5. If `VALIDATION_CREATED=false`: STOP — do not proceed to Step 6
|
|
288
|
+
6. If `commit_docs`: `commit-docs "docs(phase-${PHASE}): add validation strategy"`
|
|
289
|
+
|
|
290
|
+
**If not found:** Warn and continue — plans may fail Dimension 8.
|
|
291
|
+
|
|
292
|
+
## 6. Check Existing Plans
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
ls "${PHASE_DIR}"/*-PLAN.md 2>/dev/null
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**If exists:**
|
|
299
|
+
|
|
300
|
+
**If `NON_INTERACTIVE` is true:**
|
|
301
|
+
Log: `[AUTO-RESOLVE] Plans already exist ({plan_count} plans) — skipping planning`
|
|
302
|
+
Skip to step 13 (present final status / auto-advance). Do NOT regenerate plans.
|
|
303
|
+
|
|
304
|
+
**Otherwise (interactive mode):**
|
|
305
|
+
Offer: 1) Add more plans, 2) View existing, 3) Replan from scratch.
|
|
306
|
+
|
|
307
|
+
## 7. Use Context Paths from INIT
|
|
308
|
+
|
|
309
|
+
Extract from INIT JSON:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
STATE_PATH=$(printf '%s\n' "$INIT" | jq -r '.state_path // empty')
|
|
313
|
+
ROADMAP_PATH=$(printf '%s\n' "$INIT" | jq -r '.roadmap_path // empty')
|
|
314
|
+
REQUIREMENTS_PATH=$(printf '%s\n' "$INIT" | jq -r '.requirements_path // empty')
|
|
315
|
+
RESEARCH_PATH=$(printf '%s\n' "$INIT" | jq -r '.research_path // empty')
|
|
316
|
+
VERIFICATION_PATH=$(printf '%s\n' "$INIT" | jq -r '.verification_path // empty')
|
|
317
|
+
UAT_PATH=$(printf '%s\n' "$INIT" | jq -r '.uat_path // empty')
|
|
318
|
+
CONTEXT_PATH=$(printf '%s\n' "$INIT" | jq -r '.context_path // empty')
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## 7.5. Verify Nyquist Artifacts
|
|
322
|
+
|
|
323
|
+
Skip if `nyquist_validation_enabled` is false OR `research_enabled` is false.
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
VALIDATION_EXISTS=$(ls "${PHASE_DIR}"/*-VALIDATION.md 2>/dev/null | head -1)
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
If missing and Nyquist enabled — ask user:
|
|
330
|
+
1. Re-run with research: `/dgs:plan-phase {PHASE} --research`
|
|
331
|
+
2. Disable Nyquist: `node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-set workflow.nyquist_validation false`
|
|
332
|
+
3. Continue anyway (plans fail Dimension 8)
|
|
333
|
+
|
|
334
|
+
Proceed to Step 8 only if user selects 2 or 3.
|
|
335
|
+
|
|
336
|
+
## 8. Spawn dgs-planner Agent
|
|
337
|
+
|
|
338
|
+
Display banner:
|
|
339
|
+
```
|
|
340
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
341
|
+
DGS ► PLANNING PHASE {X}
|
|
342
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
343
|
+
|
|
344
|
+
◆ Spawning planner...
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Discover spec docs for spec-driven planning (GAP-10)
|
|
348
|
+
|
|
349
|
+
Before constructing the planner prompt, check if this phase references a specific spec:
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
# Check if this phase references a specific spec
|
|
353
|
+
SPEC_REF=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" roadmap get-phase "${PHASE}" 2>/dev/null | jq -r '.spec // empty')
|
|
354
|
+
SPEC_DOCS_PATHS=""
|
|
355
|
+
if [ -n "$SPEC_REF" ]; then
|
|
356
|
+
# Find spec file and its docs/ directory
|
|
357
|
+
SPEC_DIR=$(dirname "$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" specs find --id "$SPEC_REF" --raw 2>/dev/null | jq -r '.path // empty')")
|
|
358
|
+
if [ -d "${SPEC_DIR}/docs" ]; then
|
|
359
|
+
SPEC_DOCS_PATHS="- ${SPEC_DIR}/docs/*.md (Spec supporting documents)"
|
|
360
|
+
# Check for extracted text sidecars (PDF text extracts)
|
|
361
|
+
for SIDECAR in "${SPEC_DIR}/docs/"*.txt; do
|
|
362
|
+
[ -f "$SIDECAR" ] && SPEC_DOCS_PATHS="${SPEC_DOCS_PATHS}\n- ${SIDECAR} (Extracted text sidecar)"
|
|
363
|
+
done
|
|
364
|
+
# Check for image files (multimodal context via Read tool)
|
|
365
|
+
for IMG in "${SPEC_DIR}/docs/"*.{png,jpg,jpeg,gif,svg,webp}; do
|
|
366
|
+
[ -f "$IMG" ] && SPEC_DOCS_PATHS="${SPEC_DOCS_PATHS}\n- ${IMG} (Spec document image)"
|
|
367
|
+
done
|
|
368
|
+
fi
|
|
369
|
+
fi
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
If the spec doesn't exist, has no docs/ directory, or the CLI commands fail — silently skip. No warning needed.
|
|
373
|
+
|
|
374
|
+
Planner prompt:
|
|
375
|
+
|
|
376
|
+
```markdown
|
|
377
|
+
<planning_context>
|
|
378
|
+
**Phase:** {phase_number}
|
|
379
|
+
**Mode:** {standard | gap_closure}
|
|
380
|
+
|
|
381
|
+
<files_to_read>
|
|
382
|
+
- {state_path} (Project State)
|
|
383
|
+
- {roadmap_path} (Roadmap)
|
|
384
|
+
- {requirements_path} (Requirements)
|
|
385
|
+
- {context_path} (USER DECISIONS from /dgs:discuss-phase)
|
|
386
|
+
- {research_path} (Technical Research)
|
|
387
|
+
- {verification_path} (Verification Gaps - if --gaps)
|
|
388
|
+
- {uat_path} (UAT Gaps - if --gaps)
|
|
389
|
+
- ${project_root}/docs/product/*.md (Product-level documents — target architecture, product summary, if exist)
|
|
390
|
+
- ${project_root}/REPOS.md (Repo registry for multi-repo awareness, if exists)
|
|
391
|
+
- ${project_root}/codebase/*.md (All codebase analysis documents, if directory exists)
|
|
392
|
+
${SPEC_DOCS_PATHS}
|
|
393
|
+
</files_to_read>
|
|
394
|
+
|
|
395
|
+
**Phase requirement IDs (every ID MUST appear in a plan's `requirements` field):** {phase_req_ids}
|
|
396
|
+
|
|
397
|
+
**Project instructions:** Read ./CLAUDE.md if exists — follow project-specific guidelines
|
|
398
|
+
**Project skills:** Check .claude/skills/ or .agents/skills/ directory (if either exists) — read SKILL.md files, plans should account for project skill rules
|
|
399
|
+
</planning_context>
|
|
400
|
+
|
|
401
|
+
<downstream_consumer>
|
|
402
|
+
Output consumed by /dgs:execute-phase. Plans need:
|
|
403
|
+
- Frontmatter (wave, depends_on, files_modified, autonomous)
|
|
404
|
+
- Tasks in XML format with read_first and acceptance_criteria fields (MANDATORY on every task)
|
|
405
|
+
- Verification criteria
|
|
406
|
+
- must_haves for goal-backward verification
|
|
407
|
+
</downstream_consumer>
|
|
408
|
+
|
|
409
|
+
<deep_work_rules>
|
|
410
|
+
## Anti-Shallow Execution Rules (MANDATORY)
|
|
411
|
+
|
|
412
|
+
Every task MUST include these fields — they are NOT optional:
|
|
413
|
+
|
|
414
|
+
1. **`<read_first>`** — Files the executor MUST read before touching anything. Always include:
|
|
415
|
+
- The file being modified (so executor sees current state, not assumptions)
|
|
416
|
+
- Any "source of truth" file referenced in CONTEXT.md (reference implementations, existing patterns, config files, schemas)
|
|
417
|
+
- Any file whose patterns, signatures, types, or conventions must be replicated or respected
|
|
418
|
+
|
|
419
|
+
2. **`<acceptance_criteria>`** — Verifiable conditions that prove the task was done correctly. Rules:
|
|
420
|
+
- Every criterion must be checkable with grep, file read, test command, or CLI output
|
|
421
|
+
- NEVER use subjective language ("looks correct", "properly configured", "consistent with")
|
|
422
|
+
- ALWAYS include exact strings, patterns, values, or command outputs that must be present
|
|
423
|
+
- Examples:
|
|
424
|
+
- Code: `auth.py contains def verify_token(` / `test_auth.py exits 0`
|
|
425
|
+
- Config: `.env.example contains DATABASE_URL=` / `Dockerfile contains HEALTHCHECK`
|
|
426
|
+
- Docs: `README.md contains '## Installation'` / `API.md lists all endpoints`
|
|
427
|
+
- Infra: `deploy.yml has rollback step` / `docker-compose.yml has healthcheck for db`
|
|
428
|
+
|
|
429
|
+
3. **`<action>`** — Must include CONCRETE values, not references. Rules:
|
|
430
|
+
- NEVER say "align X with Y", "match X to Y", "update to be consistent" without specifying the exact target state
|
|
431
|
+
- ALWAYS include the actual values: config keys, function signatures, SQL statements, class names, import paths, env vars, etc.
|
|
432
|
+
- If CONTEXT.md has a comparison table or expected values, copy them into the action verbatim
|
|
433
|
+
- The executor should be able to complete the task from the action text alone, without needing to read CONTEXT.md or reference files (read_first is for verification, not discovery)
|
|
434
|
+
|
|
435
|
+
**Why this matters:** Executor agents work from the plan text. Vague instructions like "update the config to match production" produce shallow one-line changes. Concrete instructions like "add DATABASE_URL=postgresql://... , set POOL_SIZE=20, add REDIS_URL=redis://..." produce complete work. The cost of verbose plans is far less than the cost of re-doing shallow execution.
|
|
436
|
+
</deep_work_rules>
|
|
437
|
+
|
|
438
|
+
<quality_gate>
|
|
439
|
+
- [ ] PLAN.md files created in phase directory
|
|
440
|
+
- [ ] Each plan has valid frontmatter
|
|
441
|
+
- [ ] Tasks are specific and actionable
|
|
442
|
+
- [ ] Every task has `<read_first>` with at least the file being modified
|
|
443
|
+
- [ ] Every task has `<acceptance_criteria>` with grep-verifiable conditions
|
|
444
|
+
- [ ] Every `<action>` contains concrete values (no "align X with Y" without specifying what)
|
|
445
|
+
- [ ] Dependencies correctly identified
|
|
446
|
+
- [ ] Waves assigned for parallel execution
|
|
447
|
+
- [ ] must_haves derived from phase goal
|
|
448
|
+
</quality_gate>
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
```
|
|
452
|
+
Task(
|
|
453
|
+
prompt=filled_prompt,
|
|
454
|
+
subagent_type="dgs-planner",
|
|
455
|
+
model="{planner_model}",
|
|
456
|
+
description="Plan Phase {phase}"
|
|
457
|
+
)
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
## 9. Handle Planner Return
|
|
461
|
+
|
|
462
|
+
- **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): skip to step 13. Otherwise: step 10.
|
|
463
|
+
- **`## CHECKPOINT REACHED`:** Present to user, get response, spawn continuation (step 12)
|
|
464
|
+
- **`## PLANNING INCONCLUSIVE`:** Show attempts, offer: Add context / Retry / Manual
|
|
465
|
+
|
|
466
|
+
## 10. Spawn dgs-plan-checker Agent
|
|
467
|
+
|
|
468
|
+
### Discover prior phase SUMMARYs for continuity context (GAP-02)
|
|
469
|
+
|
|
470
|
+
Before constructing the checker prompt, discover up to 3 most recent completed phase SUMMARYs:
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
# Find SUMMARY files from completed phases, sorted by modification time (most recent first)
|
|
474
|
+
SUMMARY_FILES=$(ls -t ${project_root}/phases/*/[0-9]*-*-SUMMARY.md 2>/dev/null | head -9)
|
|
475
|
+
# Filter to only the 3 most recent unique phases (a phase may have multiple SUMMARYs)
|
|
476
|
+
SEEN_PHASES=""
|
|
477
|
+
SUMMARY_PATHS=""
|
|
478
|
+
for SFILE in $SUMMARY_FILES; do
|
|
479
|
+
SPHASE=$(basename "$(dirname "$SFILE")" | grep -o '^[0-9]*')
|
|
480
|
+
# Skip SUMMARYs from the current phase being planned
|
|
481
|
+
[ "$SPHASE" = "${PHASE_NUMBER}" ] && continue
|
|
482
|
+
# Skip if we already have a SUMMARY from this phase
|
|
483
|
+
echo "$SEEN_PHASES" | grep -q "$SPHASE" && continue
|
|
484
|
+
SEEN_PHASES="${SEEN_PHASES} ${SPHASE}"
|
|
485
|
+
SUMMARY_PATHS="${SUMMARY_PATHS}\n- ${SFILE} (Prior phase summary — continuity context)"
|
|
486
|
+
# Stop after 3 unique phases
|
|
487
|
+
PHASE_COUNT=$(echo "$SEEN_PHASES" | wc -w | tr -d ' ')
|
|
488
|
+
[ "$PHASE_COUNT" -ge 3 ] && break
|
|
489
|
+
done
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
If no completed phase SUMMARYs exist (normal for early phases), silently skip — no warning needed.
|
|
493
|
+
|
|
494
|
+
Display banner:
|
|
495
|
+
```
|
|
496
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
497
|
+
DGS ► VERIFYING PLANS
|
|
498
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
499
|
+
|
|
500
|
+
◆ Spawning plan checker...
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
Checker prompt:
|
|
504
|
+
|
|
505
|
+
```markdown
|
|
506
|
+
<verification_context>
|
|
507
|
+
**Phase:** {phase_number}
|
|
508
|
+
**Phase Goal:** {goal from ROADMAP}
|
|
509
|
+
|
|
510
|
+
<files_to_read>
|
|
511
|
+
- {PHASE_DIR}/*-PLAN.md (Plans to verify)
|
|
512
|
+
- {roadmap_path} (Roadmap)
|
|
513
|
+
- {requirements_path} (Requirements)
|
|
514
|
+
- {context_path} (USER DECISIONS from /dgs:discuss-phase)
|
|
515
|
+
- {research_path} (Technical Research — includes Validation Architecture)
|
|
516
|
+
${SUMMARY_PATHS}
|
|
517
|
+
${SPEC_DOCS_PATHS}
|
|
518
|
+
</files_to_read>
|
|
519
|
+
|
|
520
|
+
**Phase requirement IDs (MUST ALL be covered):** {phase_req_ids}
|
|
521
|
+
|
|
522
|
+
**Project instructions:** Read ./CLAUDE.md if exists — verify plans honor project guidelines
|
|
523
|
+
**Project skills:** Check .claude/skills/ or .agents/skills/ directory (if either exists) — verify plans account for project skill rules
|
|
524
|
+
</verification_context>
|
|
525
|
+
|
|
526
|
+
<expected_output>
|
|
527
|
+
- ## VERIFICATION PASSED — all checks pass
|
|
528
|
+
- ## ISSUES FOUND — structured issue list
|
|
529
|
+
</expected_output>
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
```
|
|
533
|
+
Task(
|
|
534
|
+
prompt=checker_prompt,
|
|
535
|
+
subagent_type="dgs-plan-checker",
|
|
536
|
+
model="{checker_model}",
|
|
537
|
+
description="Verify Phase {phase} plans"
|
|
538
|
+
)
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
## 11. Handle Checker Return
|
|
542
|
+
|
|
543
|
+
- **`## VERIFICATION PASSED`:** Display confirmation, proceed to step 13.
|
|
544
|
+
- **`## ISSUES FOUND`:** Display issues, check iteration count, proceed to step 12.
|
|
545
|
+
|
|
546
|
+
## 12. Revision Loop (Max 3 Iterations)
|
|
547
|
+
|
|
548
|
+
Track `iteration_count` (starts at 1 after initial plan + check).
|
|
549
|
+
|
|
550
|
+
**If iteration_count < 3:**
|
|
551
|
+
|
|
552
|
+
Display: `Sending back to planner for revision... (iteration {N}/3)`
|
|
553
|
+
|
|
554
|
+
Revision prompt:
|
|
555
|
+
|
|
556
|
+
```markdown
|
|
557
|
+
<revision_context>
|
|
558
|
+
**Phase:** {phase_number}
|
|
559
|
+
**Mode:** revision
|
|
560
|
+
|
|
561
|
+
<files_to_read>
|
|
562
|
+
- {PHASE_DIR}/*-PLAN.md (Existing plans)
|
|
563
|
+
- {context_path} (USER DECISIONS from /dgs:discuss-phase)
|
|
564
|
+
</files_to_read>
|
|
565
|
+
|
|
566
|
+
**Checker issues:** {structured_issues_from_checker}
|
|
567
|
+
</revision_context>
|
|
568
|
+
|
|
569
|
+
<instructions>
|
|
570
|
+
Make targeted updates to address checker issues.
|
|
571
|
+
Do NOT replan from scratch unless issues are fundamental.
|
|
572
|
+
Return what changed.
|
|
573
|
+
</instructions>
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
```
|
|
577
|
+
Task(
|
|
578
|
+
prompt=revision_prompt,
|
|
579
|
+
subagent_type="dgs-planner",
|
|
580
|
+
model="{planner_model}",
|
|
581
|
+
description="Revise Phase {phase} plans"
|
|
582
|
+
)
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
After planner returns -> spawn checker again (step 10), increment iteration_count.
|
|
586
|
+
|
|
587
|
+
**If iteration_count >= 3:**
|
|
588
|
+
|
|
589
|
+
Display: `Max iterations reached. {N} issues remain:` + issue list
|
|
590
|
+
|
|
591
|
+
**If `NON_INTERACTIVE` is true:**
|
|
592
|
+
Log: `[AUTO-RESOLVE] Plan verification max iterations reached ({N} issues remain) — force proceeding`
|
|
593
|
+
Force proceed to step 13 (do not abandon or prompt).
|
|
594
|
+
|
|
595
|
+
**Otherwise (interactive mode):**
|
|
596
|
+
Offer: 1) Force proceed, 2) Provide guidance and retry, 3) Abandon
|
|
597
|
+
|
|
598
|
+
## 13. Present Final Status
|
|
599
|
+
|
|
600
|
+
Route to `<offer_next>` OR `auto_advance` depending on flags/config.
|
|
601
|
+
|
|
602
|
+
## 14. Auto-Advance Check
|
|
603
|
+
|
|
604
|
+
Check `AUTO_MODE` (set in step 2).
|
|
605
|
+
|
|
606
|
+
**If `AUTO_MODE` is true:**
|
|
607
|
+
|
|
608
|
+
Display banner:
|
|
609
|
+
```
|
|
610
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
611
|
+
DGS ► AUTO-ADVANCING TO EXECUTE
|
|
612
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
613
|
+
|
|
614
|
+
Plans ready. Launching execute-phase...
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
Launch execute-phase using the Skill tool to avoid nested Task sessions (which cause runtime freezes due to deep agent nesting):
|
|
618
|
+
```
|
|
619
|
+
Skill(skill="dgs:execute-phase", args="${PHASE} --auto --no-transition")
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
The `--no-transition` flag tells execute-phase to return status after verification instead of chaining further. This keeps the auto-advance chain flat — each phase runs at the same nesting level rather than spawning deeper Task agents.
|
|
623
|
+
|
|
624
|
+
**Handle execute-phase return:**
|
|
625
|
+
- **PHASE COMPLETE** → Display final summary:
|
|
626
|
+
```
|
|
627
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
628
|
+
DGS ► PHASE ${PHASE} COMPLETE ✓
|
|
629
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
630
|
+
|
|
631
|
+
Auto-advance pipeline finished.
|
|
632
|
+
|
|
633
|
+
Next: /dgs:discuss-phase ${NEXT_PHASE} --auto
|
|
634
|
+
```
|
|
635
|
+
- **GAPS FOUND / VERIFICATION FAILED** → Display result, stop chain:
|
|
636
|
+
```
|
|
637
|
+
Auto-advance stopped: Execution needs review.
|
|
638
|
+
|
|
639
|
+
Review the output above and continue manually:
|
|
640
|
+
/dgs:execute-phase ${PHASE}
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
**If neither `--auto` nor config enabled:**
|
|
644
|
+
Route to `<offer_next>` (existing behavior).
|
|
645
|
+
|
|
646
|
+
</process>
|
|
647
|
+
|
|
648
|
+
<offer_next>
|
|
649
|
+
Output this markdown directly (not as a code block):
|
|
650
|
+
|
|
651
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
652
|
+
DGS ► PHASE {X} PLANNED ✓
|
|
653
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
654
|
+
|
|
655
|
+
**Phase {X}: {Name}** — {N} plan(s) in {M} wave(s)
|
|
656
|
+
|
|
657
|
+
| Wave | Plans | What it builds |
|
|
658
|
+
|------|-------|----------------|
|
|
659
|
+
| 1 | 01, 02 | [objectives] |
|
|
660
|
+
| 2 | 03 | [objective] |
|
|
661
|
+
|
|
662
|
+
Research: {Completed | Used existing | Skipped}
|
|
663
|
+
Verification: {Passed | Passed with override | Skipped}
|
|
664
|
+
|
|
665
|
+
───────────────────────────────────────────────────────────────
|
|
666
|
+
|
|
667
|
+
## ▶ Next Up
|
|
668
|
+
|
|
669
|
+
**Execute Phase {X}** — run all {N} plans
|
|
670
|
+
|
|
671
|
+
/dgs:execute-phase {X}
|
|
672
|
+
|
|
673
|
+
<sub>/clear first → fresh context window</sub>
|
|
674
|
+
|
|
675
|
+
───────────────────────────────────────────────────────────────
|
|
676
|
+
|
|
677
|
+
**Also available:**
|
|
678
|
+
- cat ${phase_dir}/*-PLAN.md — review plans
|
|
679
|
+
- /dgs:plan-phase {X} --research — re-research first
|
|
680
|
+
|
|
681
|
+
───────────────────────────────────────────────────────────────
|
|
682
|
+
</offer_next>
|
|
683
|
+
|
|
684
|
+
<success_criteria>
|
|
685
|
+
- [ ] Planning root directory validated
|
|
686
|
+
- [ ] Phase validated against roadmap
|
|
687
|
+
- [ ] Phase directory created if needed
|
|
688
|
+
- [ ] CONTEXT.md loaded early (step 4) and passed to ALL agents
|
|
689
|
+
- [ ] Research completed (unless --skip-research or --gaps or exists)
|
|
690
|
+
- [ ] dgs-phase-researcher spawned with CONTEXT.md
|
|
691
|
+
- [ ] Existing plans checked
|
|
692
|
+
- [ ] dgs-planner spawned with CONTEXT.md + RESEARCH.md
|
|
693
|
+
- [ ] Plans created (PLANNING COMPLETE or CHECKPOINT handled)
|
|
694
|
+
- [ ] dgs-plan-checker spawned with CONTEXT.md
|
|
695
|
+
- [ ] Verification passed OR user override OR max iterations with user decision
|
|
696
|
+
- [ ] User sees status between agent spawns
|
|
697
|
+
- [ ] User knows next steps
|
|
698
|
+
</success_criteria>
|