diff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.md index a9823f18..34da8356 100644 --- a/.planning/ROADMAP.md +++ b/.planning/ROADMAP.md @@ -76,11 +76,11 @@ Plans: 3. When the user clicks "Send to PM," a handoff indicator appears in the chat showing "Brainstormer → PM" with the spec content 4. The PM agent creates one or more Nexus issues from the spec; the user can see task IDs referenced in the PM's reply 5. When an Engineer or Generalist completes a task, a status update message appears in the relevant chat conversation -**Plans:** 2/4 plans executed +**Plans:** 3/4 plans executed Plans: - [x] 23-00-PLAN.md — DB migration (message_type column), shared types/validators, Wave 0 test stubs -- [ ] 23-01-PLAN.md — Server: addSystemMessage helper, handoff route, status-update route +- [x] 23-01-PLAN.md — Server: addSystemMessage helper, handoff route, status-update route - [x] 23-02-PLAN.md — UI: ChatSpecCard, ChatHandoffIndicator, ChatTaskCreatedBadge, ChatStatusUpdateBadge, useBrainstormerDefault - [ ] 23-03-PLAN.md — Wiring: ChatMessage dispatch, ChatMessageList propagation, ChatPanel brainstormer default, chatApi handoff **UI hint**: yes @@ -206,7 +206,7 @@ All 65 v1 requirements are mapped to exactly one phase. No orphans. |-------|-----------|----------------|--------|-----------| | 21. Chat Foundation | v1.3 | 7/7 | Complete | 2026-04-01 | | 22. Agent Streaming | v1.3 | 6/6 | Complete | 2026-04-01 | -| 23. Brainstormer Flow | v1.3 | 2/4 | In Progress| | +| 23. Brainstormer Flow | v1.3 | 3/4 | In Progress| | | 24. Search, History & Branching | v1.3 | 0/? | Not started | - | | 25. File System | v1.3 | 0/? | Not started | - | | 26. PWA & Performance | v1.3 | 0/? | Not started | - | diff --git a/.planning/STATE.md b/.planning/STATE.md index d033f265..f480be2b 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -3,14 +3,14 @@ gsd_state_version: 1.0 milestone: v1.3 milestone_name: milestone status: executing -stopped_at: Completed 23-brainstormer-flow-23-02-PLAN.md -last_updated: "2026-04-01T21:44:52.218Z" +stopped_at: Completed 23-brainstormer-flow-23-01-PLAN.md +last_updated: "2026-04-01T21:52:25.549Z" last_activity: 2026-04-01 progress: total_phases: 6 completed_phases: 2 total_plans: 17 - completed_plans: 15 + completed_plans: 16 percent: 100 --- @@ -26,7 +26,7 @@ See: .planning/PROJECT.md (updated 2026-03-30) ## Current Position Phase: 23 (brainstormer-flow) — EXECUTING -Plan: 3 of 4 +Plan: 4 of 4 Status: Ready to execute Last activity: 2026-04-01 @@ -72,6 +72,7 @@ Progress: [██████████] 100% | Phase 22-agent-streaming P05 | 20min | 3 tasks | 6 files | | Phase 23-brainstormer-flow P00 | 3min | 2 tasks | 11 files | | Phase 23-brainstormer-flow P02 | 5min | 2 tasks | 6 files | +| Phase 23-brainstormer-flow P01 | 10min | 2 tasks | 2 files | ## Accumulated Context @@ -113,6 +114,7 @@ Recent decisions affecting current work: - [Phase 23-brainstormer-flow]: Added journal entries for idx 47 (nebulous_klaw) and 48 (add_chat_messages_updated_at) retroactively to keep journal consistent with files on disk - [Phase 23-brainstormer-flow]: Used @/lib/router Link abstraction (not react-router-dom) for ChatTaskCreatedBadge and ChatStatusUpdateBadge — consistent with all other link components in the codebase - [Phase 23-brainstormer-flow]: ChatSpecCardInner extracted as inner component to avoid conditional hook calls after JSON.parse error path in ChatSpecCard +- [Phase 23-brainstormer-flow]: issueService imported directly in chatRoutes(db) — option (a) from plan, simplest approach matching heartbeat.ts pattern ### Pending Todos @@ -125,6 +127,6 @@ None yet. ## Session Continuity -Last session: 2026-04-01T21:44:52.215Z -Stopped at: Completed 23-brainstormer-flow-23-02-PLAN.md +Last session: 2026-04-01T21:52:25.546Z +Stopped at: Completed 23-brainstormer-flow-23-01-PLAN.md Resume file: None diff --git a/.planning/phases/23-brainstormer-flow/23-01-SUMMARY.md b/.planning/phases/23-brainstormer-flow/23-01-SUMMARY.md new file mode 100644 index 00000000..b2749291 --- /dev/null +++ b/.planning/phases/23-brainstormer-flow/23-01-SUMMARY.md @@ -0,0 +1,68 @@ +--- +phase: 23-brainstormer-flow +plan: "01" +subsystem: api, chat-service +tags: [express, drizzle, chat, handoff, issue-creation, system-messages] +dependency_graph: + requires: + - phase: 23-00 + provides: messageType column in chat_messages, handoffSchema validator + - phase: 21-chat-foundation + provides: chatService, chatRoutes, addMessage, getConversation + provides: + - addSystemMessage helper in chatService + - messageType support in addMessage + - POST /conversations/:id/handoff route + - POST /conversations/:id/status-update route + affects: + - server/src/services/chat.ts + - server/src/routes/chat.ts +tech_stack: + added: [] + patterns: + - addSystemMessage encapsulates system-role message insertion with typed messageType + - handoff route creates 3 artifacts atomically (handoff msg, issue, task_created msg) + - companyId resolved from conversation row — not passed in request body +key_files: + created: + - server/src/services/chat.ts + - server/src/routes/chat.ts + modified: [] +decisions: + - "Import issueService from ../services/issues.js directly (not via index.js) — matches plan guidance and local instantiation pattern used in heartbeat.ts" + - "issueSvc instantiated inside chatRoutes(db) — option (a) from plan, simplest approach" + - "Handoff content uses arrow character (→) in system message; spec fields assembled into markdown description" +requirements-completed: [AGENT-03, AGENT-06, AGENT-07, CHAT-09] +metrics: + duration: "8 minutes" + completed_date: "2026-04-01" + tasks_completed: 2 + files_changed: 2 +--- + +# Phase 23 Plan 01: Chat Service Extension — handoff + status-update Routes Summary + +**Extended chatService with addSystemMessage helper and messageType support, and added POST handoff and status-update routes that insert typed system messages and create issues from brainstormer specs.** + +## Tasks Completed + +| Task | Name | Commit | Files | +|------|------|--------|-------| +| 1 | Extend chat service with messageType support and addSystemMessage | 0a1b3dc0 | server/src/services/chat.ts | +| 2 | Add handoff and status-update routes | 241e418a | server/src/routes/chat.ts | + +## Verification + +- `pnpm exec tsc --noEmit -p server/tsconfig.json` passes for chat files (pre-existing plugin-sdk errors unrelated) +- `pnpm vitest run` — same failures as baseline (6 pre-existing, none new) +- All 5 acceptance criteria pass for both tasks + +## Deviations from Plan + +None — plan executed exactly as written. + +## Known Stubs + +None — both routes are fully implemented. The `streamEcho` stub in chatService is pre-existing from Phase 22 (to be replaced with real LLM adapter in a future phase). + +## Self-Check: PASSED