Files
msd-core/sdk/prompts/workflows/plan-phase.md
TÂCHES 89f95c43ba feat: auto --init flag, headless prompts, and prompt sanitizer (#1417)
* fix: Created 10 headless prompt files (5 workflows + 5 agents) in sdk/p…

- "sdk/prompts/workflows/execute-plan.md"
- "sdk/prompts/workflows/research-phase.md"
- "sdk/prompts/workflows/plan-phase.md"
- "sdk/prompts/workflows/verify-phase.md"
- "sdk/prompts/workflows/discuss-phase.md"
- "sdk/prompts/agents/gsd-executor.md"
- "sdk/prompts/agents/gsd-phase-researcher.md"
- "sdk/prompts/agents/gsd-planner.md"

GSD-Task: S01/T02

* feat: Created prompt-sanitizer.ts, wired headless prompt loading into P…

- "sdk/src/prompt-sanitizer.ts"
- "sdk/src/phase-prompt.ts"
- "sdk/src/gsd-tools.ts"
- "sdk/src/gsd-tools.test.ts"
- "sdk/src/phase-runner-types.test.ts"

GSD-Task: S01/T01

* test: Added 111 unit tests covering sanitizePrompt(), headless prompt l…

- "sdk/src/prompt-sanitizer.test.ts"
- "sdk/src/headless-prompts.test.ts"
- "sdk/src/phase-prompt.test.ts"

GSD-Task: S01/T03

* feat: Wired sdkPromptsDir preference and sanitizePrompt into InitRunner…

- "sdk/src/init-runner.ts"
- "sdk/package.json"

GSD-Task: S02/T01

* feat: add --init flag to auto command for single-command PRD-to-execution

gsd-sdk auto --init @path/to/prd.md now bootstraps the project (init)
then immediately runs the autonomous phase execution loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: add remaining headless prompt files and templates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: Extended init-runner.test.ts with 7 sdkPromptsDir preference and…

- "sdk/src/init-runner.test.ts"

GSD-Task: S02/T03

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 22:40:34 -06:00

3.1 KiB

Create executable phase plans (PLAN.md files) for a roadmap phase with integrated research and verification. Headless SDK variant — runs autonomously. Research, planning, and plan-checking proceed without user prompts. Default flow: Research (if needed) -> Plan -> Verify -> Done. Load all context from injected context files. Extract: phase directory, phase number, phase name, research status, context status, plan count, requirement IDs.

If planning directory is missing: report error via event stream.

Validate phase exists in roadmap. If not found: report error with available phases. Load CONTEXT.md if it exists. This contains user decisions that constrain planning.

If no CONTEXT.md exists: proceed without — plan using research and requirements only. In headless mode, there is no interactive discuss-phase; context comes from prior artifacts or is skipped.

If RESEARCH.md exists: use existing research.

If RESEARCH.md is missing and research is enabled:

  1. Execute research phase (spawn researcher agent)
  2. Researcher writes RESEARCH.md
  3. Continue to planning

If research is disabled: skip to planning step.

Execute planning with the planner agent definition. Provide: - Phase number, name, and goal - Context files: state, roadmap, requirements, context, research - Phase requirement IDs (every ID must appear in a plan's requirements field)

The planner creates PLAN.md files with task breakdown, dependency analysis, and verification criteria.

- **PLANNING COMPLETE** — Plans created. If plan checker is enabled: proceed to verification. - **PLANNING BLOCKED** — Log blocker, report via event stream. - **PLANNING INCONCLUSIVE** — Report with available context. If plan checker is enabled, execute verification with the plan-checker agent. Provide: - Phase number and goal - Plan files to verify - Roadmap, requirements, context, research files - Phase requirement IDs

The checker verifies plans will achieve the phase goal before execution.

- **VERIFICATION PASSED** — Plans ready for execution. - **ISSUES FOUND** — Enter revision loop (max 3 iterations): 1. Send issues back to planner for targeted revision 2. Re-run plan checker 3. If max iterations reached: proceed with current plans, log remaining issues After plans pass the checker (or checker is skipped), verify all phase requirements are covered: 1. Extract requirement IDs claimed by plans 2. Compare against phase requirements from roadmap 3. If gaps found: log as warning, continue (headless mode does not block for coverage gaps)

<success_criteria>

  • Phase validated against roadmap
  • Research completed (unless skipped or existing)
  • PLAN.md file(s) created with valid structure
  • Plan checker passed (or issues logged)
  • Requirements coverage verified </success_criteria>