- Add context_complete scenario for discuss mode
- Add breakdown_complete scenario for breakdown mode
- Import Decision and PhaseBreakdown types from schema
- Handle context_complete status with decisions array
- Handle breakdown_complete status with phases array
- Extend AgentStoppedEvent reason type for new completion reasons
- Export questionItemSchema and add QuestionItem type
- Add Decision type for discuss mode (topic/decision/reason)
- Add PhaseBreakdown type for breakdown mode
- Create discussOutputSchema (questions/context_complete/error)
- Create breakdownOutputSchema (questions/breakdown_complete/error)
- Add discussOutputJsonSchema for Claude CLI --json-schema
- Add breakdownOutputJsonSchema for Claude CLI --json-schema
- Add findByNumber method to lookup phase by initiative and number
- Add getNextNumber method to get next available phase number
- Implement both methods in DrizzlePhaseRepository adapter
- Use drizzle-orm max() and and() for query construction
- Add AgentMode type: 'execute' | 'discuss' | 'breakdown'
- Add mode column to agents table with 'execute' default
- Update SpawnAgentOptions to accept optional mode
- Update AgentInfo interface to include mode field
- Update ClaudeAgentManager.toAgentInfo to map mode
- Fix MockAgentManager to include mode in spawn
- Fix dispatch manager tests to include mode
- Add findByStatus method to InitiativeRepository port interface
- Implement findByStatus in DrizzleInitiativeRepository adapter
- Filter initiatives by status (active/completed/archived)
- Add prompts.ts module with mode-specific agent prompts
- Discuss prompt includes question categories and output format
- Breakdown prompt includes phase design rules
- Execute prompt for standard worker agents
- Tests agent asking two questions at once
- Verifies both questions present in pending questions
- Validates resume with answers for all questions
- Confirms task completes after batched answer resume
- Change resume() signature from (agentId, prompt) to (agentId, answers)
- Accept Record<string, string> mapping question IDs to user answers
- Clear pendingQuestions on resume
- Update mock-manager tests for new signature
- Change resume() signature from (agentId, prompt) to (agentId, answers)
- Accept Record<string, string> mapping question IDs to user answers
- Format answers as structured prompt for Claude CLI
- Update AgentManager interface in types.ts
- Update manager tests for new signature
- Change status from 'question' to 'questions' (plural)
- Add QuestionItem with id field for answer matching
- Update PendingQuestion to PendingQuestions with questions array
- Update AgentWaitingEvent payload to questions array
- Update ClaudeAgentManager and MockAgentManager adapters
- Update TestHarness and all test files
- Created MILESTONES.md with v1.0 and v1.1 entries
- Evolved PROJECT.md with validated requirements and current state
- Reorganized ROADMAP.md with collapsed v1.1 milestone
- Created milestone archive: milestones/v1.1-ROADMAP.md
- Updated STATE.md for next milestone planning
- Queue state survives in database (source of truth)
- In-progress task recoverable after agent crash
- Blocked task state persists and can be unblocked
- Merge queue state recoverable
- Question enters waiting state and completes after resume
- Question surfaces as structured PendingQuestion
- Agent resumes with answer and completes successfully
- Waiting agent status transitions correctly through full cycle
- Multiple agents complete tasks in parallel
- Parallel merges process in correct dependency order
- Parallel dispatch with mixed outcomes (success + crash)
- 3 parallel work tests passing
- Update MockAgentManager tests to use status-based scenarios
- Change outcome:'crash' to status:'unrecoverable_error' with error field
- Change outcome:'waiting_for_input' to status:'question' with question field
- Change outcome:'success' to status:'done' with result field
- Add tests for structured question data (options, multiSelect)
- Add tests for getPendingQuestion and resume clearing pending question
- Update E2E edge-cases tests with new scenario format
- Update harness tests with new scenario format
- Add setAgentDone() for done status scenarios
- Add setAgentQuestion() for question status scenarios
- Add setAgentError() for unrecoverable_error scenarios
- Add getPendingQuestion() to harness interface
- Import PendingQuestion type from agent/types
- Change MockAgentScenario from outcome-based to status-based discriminated union
- Align with agent output schema: done/question/unrecoverable_error
- Update completeAgent() to handle new status types
- Update resume() to use new scenario format
Tasks completed: 3/3
- Define agent output schema with Zod
- Update ClaudeAgentManager to use schema and handle question flow
- Update AgentWaitingEvent to include structured question data
SUMMARY: .planning/phases/08.1-agent-output-schema/08.1-01-SUMMARY.md
- Pass --json-schema flag to Claude CLI for validated output
- Parse discriminated union (done/question/unrecoverable_error) in handleAgentCompletion
- Add getPendingQuestion method to AgentManager interface
- Add PendingQuestion type for structured question data
- Store pending question in ActiveAgent for later retrieval
- Remove hacky string matching for waiting_for_input detection
- Update MockAgentManager with getPendingQuestion and options support
- Update tests for new CLI arguments and result format
- Discriminated union with done/question/unrecoverable_error status
- Options schema for structured question choices
- JSON schema export for Claude CLI --json-schema flag
- Type export for runtime validation
Phase 8.1: Agent Output Schema (INSERTED)
- 2 plans in 2 waves (sequential)
- Defines discriminated union schema (done/question/error)
- Updates ClaudeAgentManager to use --json-schema flag
- Aligns MockAgentManager with new schema
Phase 9: Extended Scenarios (updated)
- 2 plans in 1 wave (parallel)
- Now depends on Phase 8.1
- Updated scenario format references
- Merge conflict detection with merge:conflicted event
- Conflict appears in queue state as conflicted
- handleConflict creates conflict-resolution task
- Successful merge after separate task without conflict