Files
msd-core/commands/gsd/research-phase.md
Lex Christopherson 94f3083c78 refactor(14-02): convert /gsd:research-phase to thin orchestrator
- Reduce from ~540 lines (command + workflow) to 130 lines
- Delegate research methodology to gsd-researcher agent
- Keep phase validation, context gathering in orchestrator
- Add spawn and continuation patterns for agent
2026-01-15 17:03:18 -06:00

3.1 KiB

name, description, argument-hint, allowed-tools
name description argument-hint allowed-tools
gsd:research-phase Research how to implement a phase before planning [phase]
Read
Bash
Task
Research how to implement a phase. Spawns gsd-researcher agent with phase context.

Orchestrator role: Parse phase, validate against roadmap, check existing research, gather context, spawn researcher agent, present results.

Why subagent: Research burns context fast (WebSearch, Context7 queries, source verification). Fresh 200k context for investigation. Main context stays lean for user interaction.

Phase number: $ARGUMENTS (required)

Check for existing research:

ls .planning/phases/${PHASE}-*/*RESEARCH.md 2>/dev/null

1. Parse and Validate Phase

grep -A5 "Phase ${PHASE}:" .planning/ROADMAP.md 2>/dev/null

If not found: Error and exit. If found: Extract phase number, name, description.

2. Check Existing Research

ls .planning/phases/${PHASE}-*/RESEARCH.md 2>/dev/null

If exists: Offer: 1) Update research, 2) View existing, 3) Skip. Wait for response.

If doesn't exist: Continue.

3. Gather Phase Context

grep -A20 "Phase ${PHASE}:" .planning/ROADMAP.md
cat .planning/REQUIREMENTS.md 2>/dev/null
cat .planning/phases/${PHASE}-*/${PHASE}-CONTEXT.md 2>/dev/null
grep -A30 "### Decisions Made" .planning/STATE.md 2>/dev/null

Present summary with phase description, requirements, prior decisions.

4. Spawn gsd-researcher Agent

Research modes: ecosystem (default), feasibility, implementation, comparison.

<objective>
Research implementation approach for Phase {phase_number}: {phase_name}
Mode: ecosystem
</objective>

<context>
**Phase description:** {phase_description}
**Requirements:** {requirements_list}
**Prior decisions:** {decisions_if_any}
**Phase context:** {context_md_content}
</context>

<output>
Write to: .planning/phases/{phase}-{slug}/{phase}-RESEARCH.md
</output>
Task(
  prompt=filled_prompt,
  subagent_type="gsd-researcher",
  description="Research Phase {phase}"
)

5. Handle Agent Return

## RESEARCH COMPLETE: Display summary, offer: Plan phase, Dig deeper, Review full, Done.

## CHECKPOINT REACHED: Present to user, get response, spawn continuation.

## RESEARCH INCONCLUSIVE: Show what was attempted, offer: Add context, Try different mode, Manual.

6. Spawn Continuation Agent

<objective>
Continue research for Phase {phase_number}: {phase_name}
</objective>

<prior_state>
Research file: @.planning/phases/{phase}-{slug}/{phase}-RESEARCH.md
</prior_state>

<checkpoint_response>
**Type:** {checkpoint_type}
**Response:** {user_response}
</checkpoint_response>
Task(
  prompt=continuation_prompt,
  subagent_type="gsd-researcher",
  description="Continue research Phase {phase}"
)

<success_criteria>

  • Phase validated against roadmap
  • Existing research checked
  • gsd-researcher spawned with context
  • Checkpoints handled correctly
  • User knows next steps </success_criteria>