First action is TaskCreate initialization, then Phase 0 (spec study), then Phase 1
Progressive Phase Loading
Read phase docs ONLY when that phase is about to execute
Auto-Continue
All phases run autonomously; check TaskList to execute next pending phase
Parse Every Output
Extract required data from each phase for next phase context
DO NOT STOP
Continuous 6-phase pipeline until all phases complete or user exits
Respect -y Flag
When auto mode, skip all AskUserQuestion calls, use recommended defaults
Respect -c Flag
When continue mode, load spec-config.json and resume from checkpoint
Inject Glossary
From Phase 3 onward, inject glossary.json terms into every CLI prompt
Load Profile
Read templates/profiles/{spec_type}-profile.md and inject requirements into Phase 2-5 prompts
Iterate on Failure
When Phase 6 score < 60%, auto-trigger Phase 6.5 (max 2 iterations)
Reference Documents by Phase
Phase 1: Discovery
Document
Purpose
When to Use
phases/01-discovery.md
Seed analysis and session setup
Phase start
templates/profiles/
Spec type profiles
Spec type selection
specs/document-standards.md
Frontmatter format for spec-config.json
Config generation
Phase 1.5: Requirement Expansion & Clarification
Document
Purpose
When to Use
phases/01-5-requirement-clarification.md
Interactive requirement discussion workflow
Phase start
specs/quality-gates.md
Quality criteria for refined requirements
Validation
Phase 2: Product Brief
Document
Purpose
When to Use
phases/02-product-brief.md
Multi-CLI analysis orchestration
Phase start
templates/product-brief.md
Document template
Document generation
specs/glossary-template.json
Glossary schema
Glossary generation
Phase 3: Requirements
Document
Purpose
When to Use
phases/03-requirements.md
PRD generation workflow
Phase start
templates/requirements-prd.md
Document template
Document generation
Phase 4: Architecture
Document
Purpose
When to Use
phases/04-architecture.md
Architecture decision workflow
Phase start
templates/architecture-doc.md
Document template
Document generation
Phase 5: Epics & Stories
Document
Purpose
When to Use
phases/05-epics-stories.md
Epic/Story decomposition
Phase start
templates/epics-template.md
Document template
Document generation
Phase 6: Readiness Check
Document
Purpose
When to Use
phases/06-readiness-check.md
Cross-document validation
Phase start
specs/quality-gates.md
Quality scoring criteria
Validation
Phase 6.5: Auto-Fix
Document
Purpose
When to Use
phases/06-5-auto-fix.md
Auto-fix workflow for readiness issues
When Phase 6 score < 60%
specs/quality-gates.md
Iteration exit criteria
Validation
Debugging & Troubleshooting
Issue
Solution Document
Phase execution failed
Refer to the relevant Phase documentation
Output does not meet expectations
specs/quality-gates.md
Document format issues
specs/document-standards.md
Error Handling
Phase
Error
Blocking?
Action
Phase 1
Empty input
Yes
Error and exit
Phase 1
CLI seed analysis fails
No
Use basic parsing fallback
Phase 1.5
Gap analysis CLI fails
No
Skip to user questions with basic prompts
Phase 1.5
User skips discussion
No
Proceed with seed_analysis as-is
Phase 1.5
Max rounds reached (5)
No
Force confirmation with current state
Phase 2
Single CLI perspective fails
No
Continue with available perspectives
Phase 2
All CLI calls fail
No
Generate basic brief from seed analysis
Phase 3
Gemini CLI fails
No
Use codex fallback
Phase 4
Architecture review fails
No
Skip review, proceed with initial analysis
Phase 5
Story generation fails
No
Generate epics without detailed stories
Phase 6
Validation CLI fails
No
Generate partial report with available data
Phase 6.5
Auto-fix CLI fails
No
Log failure, proceed to handoff with Review status
Phase 6.5
Max iterations reached
No
Force handoff, report remaining issues
CLI Fallback Chain
Gemini -> Codex -> Claude -> degraded mode (local analysis only)