Commit Graph

342 Commits

Author SHA1 Message Date
Lukas May
8da4e71075 feat(12-01): extend AgentMode with 'decompose'
- Add 'decompose' to AgentMode union type
- Update agents table mode column enum in database schema
- Update test-helpers.ts CREATE_TABLES_SQL with CHECK constraint
- Add missing getNextNumber implementation (blocking fix)
2026-02-01 11:32:18 +01:00
Lukas May
3187e2ab01 feat(12-02): implement getNextNumber in DrizzlePlanRepository
- Import max from drizzle-orm for aggregate query
- Query MAX(number) where phase_id matches
- Return max + 1, or 1 if no plans exist
- Pattern follows DrizzlePhaseRepository.getNextNumber
2026-02-01 11:31:30 +01:00
Lukas May
0044fbfc6e feat(12-02): add getNextNumber to PlanRepository interface
- Add getNextNumber(phaseId) method signature
- Returns MAX(number) + 1, or 1 if no plans exist
- Following pattern from PhaseRepository.getNextNumber
2026-02-01 11:30:27 +01:00
Lukas May
41f868294b docs(12): create phase plan
Phase 12: Phase-Task Decomposition
- 8 plans in 4 waves
- 4 parallel, 4 sequential
- Ready for execution
2026-01-31 21:03:07 +01:00
Lukas May
ec9e6043a2 docs(11): complete architect agent phase 2026-01-31 19:30:40 +01:00
Lukas May
47b462362a test(11-08): add E2E tests for breakdown mode and full workflow
Add architect workflow E2E tests:
- Breakdown mode: spawn architect, complete with phases
- Phase persistence: create and retrieve phases from breakdown output
- Full workflow: discuss -> breakdown -> phase persistence
2026-01-31 19:28:22 +01:00
Lukas May
ae130e919f test(11-08): add E2E tests for architect discuss mode
Add architect workflow E2E tests for discuss mode:
- Test spawning architect in discuss mode with context_complete
- Test pause on questions and resume with answers flow
2026-01-31 19:27:26 +01:00
Lukas May
021937c28d feat(test): add TestHarness architect mode helpers and tRPC caller
Add convenience methods for architect mode testing:
- setArchitectDiscussComplete for context_complete scenarios
- setArchitectDiscussQuestions for discuss mode questions
- setArchitectBreakdownComplete for breakdown_complete scenarios
- getInitiative, getPhases, createInitiative, createPhasesFromBreakdown
- mockAgentManager alias, advanceTimers, getEmittedEvents helpers
- Wire up initiative/phase repositories and tRPC caller to harness

Also fix pre-existing test issues with dependencies and type casting.
2026-01-31 19:26:46 +01:00
Lukas May
4230e171f5 docs(11-07): complete unit tests for modes and repositories
- All tasks completed with atomic commits
- Test count: 397 passing
2026-01-31 19:25:05 +01:00
Lukas May
1f4a95df4a test(db): add PhaseRepository findByNumber and getNextNumber tests
- Test findByNumber with matching/non-matching initiative and number
- Test getNextNumber returns 1 for empty initiative
- Test getNextNumber returns max + 1 with existing phases
- Test getNextNumber handles gaps in numbering
2026-01-31 19:24:09 +01:00
Lukas May
de57c15666 test(db): add InitiativeRepository findByStatus tests
- Test empty array for no matches
- Test filtering by active/completed/archived status
2026-01-31 19:23:44 +01:00
Lukas May
567d863a4a test(agent): add MockAgentManager mode tests
- Test default execute mode on spawn
- Test discuss mode with context_complete scenario
- Test breakdown mode with breakdown_complete scenario
- Verify stopped event reasons for each mode
2026-01-31 19:23:22 +01:00
Lukas May
28b8921735 docs(11-06): complete CLI commands plan
Add summary for initiative and architect CLI commands.
Update STATE.md with plan 6 completion.
2026-01-31 19:21:54 +01:00
Lukas May
173ed57d2c feat(cli): add initiative phases command
Add cw initiative phases <initiativeId> to list phases for an initiative.
Displays phase number, name, status, and description.
2026-01-31 19:20:38 +01:00
Lukas May
1165697e91 feat(cli): add architect commands (discuss, breakdown)
Add CLI commands for architect workflow:
- cw architect discuss <initiativeId> - start discuss mode
- cw architect breakdown <initiativeId> - start breakdown mode

Both require --name for agent name, with optional context flags.
2026-01-31 19:20:16 +01:00
Lukas May
2cdc1544ef feat(cli): add initiative commands (create, list, get)
Add CLI commands for initiative management:
- cw initiative create <name> - create with optional description
- cw initiative list - list all with optional status filter
- cw initiative get <id> - get details by ID
2026-01-31 19:19:51 +01:00
Lukas May
8d90a55f45 docs(11-05): complete agent prompts plan
Tasks completed: 3/3
- Update spawnAgent to support mode
- Create comprehensive agent prompts module
- Add spawnArchitect tRPC procedures

SUMMARY: .planning/phases/11-architect-agent/11-05-SUMMARY.md
2026-01-31 19:18:28 +01:00
Lukas May
c13985909a feat(11-05): add spawnArchitect tRPC procedures
- Add spawnArchitectDiscuss for context-gathering mode
- Add spawnArchitectBreakdown for phase decomposition mode
- Both procedures validate initiative exists before spawning
- Use comprehensive prompts from agent/prompts module
2026-01-31 19:16:50 +01:00
Lukas May
773f6f92ac feat(11-05): create comprehensive agent prompts module
- Add buildDiscussPrompt for context gathering mode
- Add buildBreakdownPrompt for phase decomposition mode
- Add buildExecutePrompt for standard task execution
- Export prompts from agent module index
2026-01-31 19:15:58 +01:00
Lukas May
4843b95a7c feat(11-05): add mode parameter to spawnAgent procedure
- Update spawnAgentInputSchema to include optional mode field
- Pass mode through to agentManager.spawn() for mode-aware spawning
2026-01-31 19:15:09 +01:00
Lukas May
7abbfb4da1 docs(11-03): complete mode-aware agent spawning plan
Tasks completed: 3/3
- Update AgentRepository for mode field
- Update ClaudeAgentManager for mode-specific schemas
- Add mode to AgentStoppedEvent reasons (already done in 11-01)

SUMMARY: .planning/phases/11-architect-agent/11-03-SUMMARY.md
2026-01-31 19:13:50 +01:00
Lukas May
b17806aba2 docs(11-04): complete initiative & phase tRPC procedures plan
Tasks completed: 3/3
- Add repositories to tRPC context
- Add Initiative tRPC procedures
- Add Phase tRPC procedures

SUMMARY: .planning/phases/11-architect-agent/11-04-SUMMARY.md
2026-01-31 19:12:58 +01:00
Lukas May
937d24eca5 feat(11-03): update ClaudeAgentManager for mode-specific schemas
- Import all mode-specific JSON schemas (discuss, breakdown)
- Add getJsonSchemaForMode() helper to select schema by mode
- Update spawn() to pass mode to repository and use mode-specific schema
- Refactor handleAgentCompletion() to route to mode-specific handlers
- Add handleExecuteOutput() for execute mode (existing behavior)
- Add handleDiscussOutput() for discuss mode (context_complete status)
- Add handleBreakdownOutput() for breakdown mode (breakdown_complete status)
- Update resume() to use mode-specific JSON schema
2026-01-31 19:12:31 +01:00
Lukas May
d865330f85 feat(11-04): add phase tRPC procedures
- Add requirePhaseRepository helper function
- Add createPhase mutation with auto-numbering
- Add listPhases query by initiative ID
- Add getPhase query with NOT_FOUND error handling
- Add updatePhase mutation procedure
- Add createPhasesFromBreakdown bulk create mutation
2026-01-31 19:12:02 +01:00
Lukas May
4d42da9496 feat(11-04): add initiative tRPC procedures
- Add requireInitiativeRepository helper function
- Add createInitiative mutation procedure
- Add listInitiatives query with optional status filter
- Add getInitiative query with NOT_FOUND error handling
- Add updateInitiative mutation procedure
2026-01-31 19:11:23 +01:00
Lukas May
75f8887b53 feat(11-03): add mode field to AgentRepository
- Add AgentMode import to agent-repository.ts
- Add mode optional field to CreateAgentData interface
- Update DrizzleAgentRepository.create() to handle mode (default 'execute')
2026-01-31 19:11:12 +01:00
Lukas May
3bf7e2c9cb feat(11-04): add initiative and phase repositories to tRPC context
- Import InitiativeRepository and PhaseRepository types
- Add optional initiativeRepository to TRPCContext interface
- Add optional phaseRepository to TRPCContext interface
- Update CreateContextOptions and createContext function
2026-01-31 19:10:51 +01:00
Lukas May
00990de661 docs(11-01): complete agent mode schema extension plan
Tasks completed: 3/3
- Add AgentMode type and database column
- Create mode-specific output schemas
- Update MockAgentManager for mode support

SUMMARY: .planning/phases/11-architect-agent/11-01-SUMMARY.md
2026-01-31 19:09:37 +01:00
Lukas May
f7edac7a5c fix(11-01): add mode column to test database schema
- Add mode column to agents table in test-helpers CREATE_TABLES_SQL
- Generate drizzle migration for mode column
2026-01-31 19:07:54 +01:00
Lukas May
131a97e1c5 docs(11-02): complete Initiative & Phase Repositories plan
Tasks completed: 3/3
- Add findByStatus to InitiativeRepository
- Add findByNumber and getNextNumber to PhaseRepository
- Verify repository exports

SUMMARY: .planning/phases/11-architect-agent/11-02-SUMMARY.md
2026-01-31 19:06:55 +01:00
Lukas May
0abf02ac14 feat(11-01): update MockAgentManager for mode support
- 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
2026-01-31 19:06:40 +01:00
Lukas May
3f8d6d5357 feat(11-01): create mode-specific output schemas
- 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
2026-01-31 19:05:27 +01:00
Lukas May
67cfd4d201 feat(11-02): add findByNumber and getNextNumber to PhaseRepository
- 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
2026-01-31 19:05:04 +01:00
Lukas May
91e57c66eb feat(11-01): add AgentMode type and database column
- 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
2026-01-31 19:03:42 +01:00
Lukas May
768c4d265e feat(11-02): add findByStatus method to InitiativeRepository
- Add findByStatus method to InitiativeRepository port interface
- Implement findByStatus in DrizzleInitiativeRepository adapter
- Filter initiatives by status (active/completed/archived)
2026-01-31 19:03:26 +01:00
Lukas May
1942d98ebb docs(11-01): expand schemas with prompt alignment
- Add Decision and PhaseBreakdown reusable types
- Add complete JSON schemas for Claude CLI --json-schema
- Add comments explaining prompt-schema contract
- Schemas match what prompts tell agent to output
2026-01-31 19:00:34 +01:00
Lukas May
93a939ea99 docs(11-05): add comprehensive agent prompts
- 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
2026-01-31 18:59:19 +01:00
Lukas May
934373bf68 docs(11): create phase plan
Phase 11: Architect Agent
- 8 plans in 4 waves
- 6 parallel (Wave 1-2), 2 sequential (Wave 3-4)
- Ready for execution
2026-01-31 18:21:39 +01:00
Lukas May
8c93ce24c9 docs(10-04): complete E2E test updates plan
Tasks completed: 2/2
- Verified existing E2E tests use questions array format
- Added multi-question E2E test

Phase 10: Multi-Question Schema complete (4/4 plans)
SUMMARY: .planning/phases/10-multi-question-schema/10-04-SUMMARY.md
2026-01-31 18:09:27 +01:00
Lukas May
cd840929c4 test(10-04): add multi-question E2E test
- 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
2026-01-31 18:08:30 +01:00
Lukas May
7c02b85974 docs(10-03): complete TestHarness & test updates plan
Tasks completed: 2/2
- Update TestHarness convenience methods
- Update all tests for questions array

SUMMARY: .planning/phases/10-multi-question-schema/10-03-SUMMARY.md
2026-01-31 18:06:30 +01:00
Lukas May
e1827865d9 docs(10-02): complete manager implementation plan
Tasks completed: 2/2
- Update ClaudeAgentManager for batched answers
- Update MockAgentManager for batched answers

SUMMARY: .planning/phases/10-multi-question-schema/10-02-SUMMARY.md
2026-01-31 18:04:28 +01:00
Lukas May
2c41e52029 fix(10-02): update downstream code for batched answers API
- Update resumeAgentInputSchema: prompt → answers (Record<string, string>)
- Update tRPC router to pass answers map
- Update CLI to accept JSON or single answer (fallback to q1 key)
- Update E2E tests for new resume signature
2026-01-31 18:03:00 +01:00
Lukas May
a9e46a2843 feat(10-02): update MockAgentManager for batched answers
- 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
2026-01-31 18:02:54 +01:00
Lukas May
d012680dbe feat(10-02): update ClaudeAgentManager for batched answers
- 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
2026-01-31 18:02:51 +01:00
Lukas May
185a125307 feat(10-03): add setAgentQuestion convenience helper
- Add single-question convenience method to TestHarness
- Wraps question in array for questions scenario
- Keeps setAgentQuestions for multi-question cases
2026-01-31 18:01:45 +01:00
Lukas May
d3bdeda12a docs(10-01): complete multi-question schema plan
Tasks completed: 3/3
- Update agent output schema to questions array
- Update PendingQuestion type to PendingQuestions
- Update AgentWaitingEvent payload

SUMMARY: .planning/phases/10-multi-question-schema/10-01-SUMMARY.md
2026-01-31 17:58:50 +01:00
Lukas May
151a4c99f7 feat(10-01): extend agent schema to multi-question array
- 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
2026-01-31 17:57:34 +01:00
Lukas May
9dd0e46060 docs(10): create phase plan
Phase 10: Multi-Question Schema
- 4 plans in 3 waves
- Wave 1: Schema & types (01)
- Wave 2: Manager implementations + unit tests (02, 03 parallel)
- Wave 3: E2E tests (04)
- Ready for execution
2026-01-31 17:51:18 +01:00
Lukas May
b3941e5431 docs: create milestone v1.2 Architect & Multi-Question (4 phases)
Phases:
- 10. multi-question-schema: Extend agent output schema to return multiple questions
- 11. architect-agent: Agent modes for concept refinement and phase breakdown
- 12. phase-task-decomposition: Agents break phases into tasks with questions
- 13. real-claude-e2e-tests: Verify flows with actual Claude CLI
2026-01-31 17:47:28 +01:00