- Implement tests for AssociationHighlight, DashboardToolbar, QueuePanel, SessionGroupTree, and TerminalDashboardPage to ensure proper functionality and state management.
- Create tests for cliSessionStore, issueQueueIntegrationStore, queueExecutionStore, queueSchedulerStore, sessionManagerStore, and terminalGridStore to validate state resets and workspace scoping.
- Mock necessary dependencies and state management hooks to isolate tests and ensure accurate behavior.
Structured specification document generator producing a complete specification package (Product Brief, PRD, Architecture, Epics, Issues) through 7 sequential phases with multi-CLI analysis, Codex review gates, and interactive refinement. Heavy document phases are delegated to doc-generator agents to minimize main context usage. Document generation only - execution handoff via issue export to team-planex or existing workflows.
Document Chain: Each phase builds on previous outputs, creating a traceable specification chain from idea to executable issues
Agent-Delegated: Heavy document phases (2-5, 6.5) run in doc-generator agents, keeping main context lean (summaries only)
Multi-Perspective Analysis: CLI tools (Gemini/Codex/Claude) provide product, technical, and user perspectives in parallel
Codex Review Gates: Phases 3, 5, 6 include Codex CLI review for quality validation before output
Interactive by Default: Each phase offers user confirmation points; -y flag enables full auto mode
Resumable Sessions: spec-config.json tracks completed phases; -c flag resumes from last checkpoint
Template-Driven: All documents generated from standardized templates with YAML frontmatter
Pure Documentation: No code generation or execution - clean handoff via issue export to execution workflows
Spec Type Specialization: Templates adapt to spec type (service/api/library/platform) via profiles for domain-specific depth
Iterative Quality: Phase 6.5 auto-fix loop repairs issues found in readiness check (max 2 iterations)
Terminology Consistency: glossary.json generated in Phase 2, injected into all subsequent phases
Mandatory Prerequisites
Do NOT skip: Before performing any operations, you must completely read the following documents. Proceeding without reading the specifications will result in outputs that do not meet quality standards.
Resume mechanism: -c|--continue flag reads spec-config.json.phasesCompleted, resumes from first incomplete phase.
Core Rules
Start Immediately: 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 7-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)
Agent Delegation: Phase 2-5 and 6.5 MUST be delegated to doc-generator agents via Task tool — never execute inline
Lean Context: Orchestrator only sees agent return summaries (JSON), never the full document content
Validate Agent Output: After each agent returns, verify files exist on disk and spec-config.json was updated
Agent Delegation Protocol
For Phase 2-5 and 6.5, the orchestrator delegates to a doc-generator agent via the Task tool. The orchestrator builds a lean context envelope — passing only paths, never file content.
Context Envelope Template
Task({subagent_type:"doc-generator",run_in_background:false,description:`Spec Phase ${N}: ${phaseName}`,prompt:`
## Spec Generator - Phase ${N}: ${phaseName}### Session
- ID: ${sessionId}- Work Dir: ${workDir}- Auto Mode: ${autoMode}- Spec Type: ${specType}### Input (read from disk)
${inputFilesList} // Only file paths — agent reads content itself
### Instructions
Read: ${skillDir}/phases/${phaseFile} // Agent reads the phase doc for full instructions
Apply template: ${skillDir}/templates/${templateFile}### Glossary (Phase 3+ only)
Read: ${workDir}/glossary.json
### Output
Write files to: ${workDir}/${outputPath}Update: ${workDir}/spec-config.json (phasesCompleted)
Return: JSON summary { files_created, quality_notes, key_decisions }
`});
Orchestrator Post-Agent Validation
After each agent returns:
// 1. Parse agent return summary
constsummary=JSON.parse(agentResult);// 2. Validate files exist
summary.files_created.forEach(file=>{constexists=Glob(`${workDir}/${file}`);if(!exists.length)thrownewError(`Agent claimed to create ${file} but file not found`);});// 3. Verify spec-config.json updated
constconfig=JSON.parse(Read(`${workDir}/spec-config.json`));constphaseComplete=config.phasesCompleted.some(p=>p.phase===N);if(!phaseComplete)thrownewError(`Agent did not update phasesCompleted for Phase ${N}`);// 4. Store summary for downstream context (do NOT read full documents)
phasesSummaries[N]=summary;