docs(21-06): complete chat search and Cmd+K gap closure plan

- Add 21-06-SUMMARY.md documenting search filtering and keyboard shortcut
- Advance STATE.md to ready_for_verification, 100% progress
- ROADMAP.md phase 21 marked Complete (7/7 summaries)
This commit is contained in:
Nexus Dev 2026-04-01 17:16:36 +00:00
parent 0406362e04
commit f7ab686a45
3 changed files with 83 additions and 12 deletions

View file

@ -10,7 +10,7 @@
## Phases
- [ ] **Phase 21: Chat Foundation** — Persistent conversation storage, sidebar, CRUD, markdown rendering, theme integration, keyboard shortcuts
- [x] **Phase 21: Chat Foundation** — Persistent conversation storage, sidebar, CRUD, markdown rendering, theme integration, keyboard shortcuts (completed 2026-04-01)
- [ ] **Phase 22: Agent Streaming** — Real-time streaming via SSE/WebSocket, agent selector, agent identity on messages, stop/edit/regenerate, slash commands and @mentions
- [ ] **Phase 23: Brainstormer Flow** — Brainstormer agent persona, structured questioning flow, spec generation, PM handoff, task creation from chat, agent status updates in chat
- [ ] **Phase 24: Search, History & Branching** — Full-text search across all conversations, export, conversation branching, message bookmarks
@ -31,7 +31,7 @@
3. Agent messages render with full markdown: code blocks with syntax highlighting and a copy button, tables, lists, headings, links, and inline images
4. Conversations and all messages are stored in libSQL and survive a server restart
5. The chat interface applies Catppuccin Mocha, Tokyo Night, and Catppuccin Latte themes correctly; code block highlighting matches the active theme
**Plans:** 7 plans (6 complete + 1 gap closure)
**Plans:** 7/7 plans complete
Plans:
- [x] 21-00-PLAN.md — Wave 0 test stubs (chat-service, chat-routes, ChatMarkdownMessage, ChatInput)
@ -40,7 +40,7 @@ Plans:
- [x] 21-03-PLAN.md — Server chat service and REST API routes (CRUD + pagination)
- [x] 21-04-PLAN.md — ChatPanel shell, ChatPanelContext, ChatInput, Layout integration
- [x] 21-05-PLAN.md — Full UI wiring: API client, conversation list, message thread, infinite scroll
- [ ] 21-06-PLAN.md — Gap closure: conversation search/filter (HIST-02) + Cmd+K shortcut (INPUT-07)
- [x] 21-06-PLAN.md — Gap closure: conversation search/filter (HIST-02) + Cmd+K shortcut (INPUT-07)
**UI hint**: yes
@ -190,7 +190,7 @@ All 65 v1 requirements are mapped to exactly one phase. No orphans.
| Phase | Milestone | Plans Complete | Status | Completed |
|-------|-----------|----------------|--------|-----------|
| 21. Chat Foundation | v1.3 | 6/7 | Gap closure | - |
| 21. Chat Foundation | v1.3 | 7/7 | Complete | 2026-04-01 |
| 22. Agent Streaming | v1.3 | 0/? | Not started | - |
| 23. Brainstormer Flow | v1.3 | 0/? | Not started | - |
| 24. Search, History & Branching | v1.3 | 0/? | Not started | - |

View file

@ -2,15 +2,15 @@
gsd_state_version: 1.0
milestone: v1.3
milestone_name: milestone
status: executing
stopped_at: Completed 21-chat-foundation-21-05-PLAN.md
last_updated: "2026-04-01T17:00:47.388Z"
status: verifying
stopped_at: Completed 21-chat-foundation-21-06-PLAN.md
last_updated: "2026-04-01T17:16:25.961Z"
last_activity: 2026-04-01
progress:
total_phases: 6
completed_phases: 1
total_plans: 6
completed_plans: 6
total_plans: 7
completed_plans: 7
percent: 0
---
@ -27,7 +27,7 @@ See: .planning/PROJECT.md (updated 2026-03-30)
Phase: 21 (chat-foundation) — EXECUTING
Plan: 6 of 6
Status: Ready to execute
Status: Phase complete — ready for verification
Last activity: 2026-04-01
Progress: [░░░░░░░░░░] 0%
@ -65,6 +65,7 @@ Progress: [░░░░░░░░░░] 0%
| Phase 21-chat-foundation P04 | 4min | 2 tasks | 7 files |
| Phase 21-chat-foundation P03 | 6 | 2 tasks | 6 files |
| Phase 21-chat-foundation P05 | 4 | 3 tasks | 8 files |
| Phase 21-chat-foundation P06 | 10min | 2 tasks | 7 files |
## Accumulated Context
@ -94,6 +95,8 @@ Recent decisions affecting current work:
- [Phase 21-03]: Missing export fix: createConversationSchema/updateConversationSchema/createMessageSchema were in validators/chat.ts but not re-exported from shared/src/index.ts
- [Phase 21-chat-foundation]: Two-path handleSend in ChatPanel: direct chatApi for path 1 (no active conversation) avoids hook mutation needing a conversationId that does not exist yet
- [Phase 21-chat-foundation]: messages array in useChatMessages flattened from pages and reversed so display is chronological (API returns desc by createdAt)
- [Phase 21-chat-foundation]: Custom window event (nexus:focus-chat-search) used instead of forwardRef drilling to focus search input from Cmd+K
- [Phase 21-chat-foundation]: Cmd+K handler placed before input-guard early return in useKeyboardShortcuts so it fires globally even from input/textarea
### Pending Todos
@ -106,6 +109,6 @@ None yet.
## Session Continuity
Last session: 2026-04-01T17:00:47.384Z
Stopped at: Completed 21-chat-foundation-21-05-PLAN.md
Last session: 2026-04-01T17:16:25.958Z
Stopped at: Completed 21-chat-foundation-21-06-PLAN.md
Resume file: None

View file

@ -0,0 +1,68 @@
---
phase: 21-chat-foundation
plan: "06"
subsystem: chat
tags: [chat, search, keyboard-shortcuts, filtering]
dependency_graph:
requires: []
provides: [HIST-02, INPUT-07]
affects: [ChatConversationList, useChatConversations, chatApi, chatService, chatRoutes, useKeyboardShortcuts, Layout]
tech_stack:
added: []
patterns: [custom-event-bus, debounced-input, ilike-filter, global-keyboard-shortcut]
key_files:
created: []
modified:
- server/src/services/chat.ts
- server/src/routes/chat.ts
- ui/src/api/chat.ts
- ui/src/hooks/useChatConversations.ts
- ui/src/components/ChatConversationList.tsx
- ui/src/hooks/useKeyboardShortcuts.ts
- ui/src/components/Layout.tsx
decisions:
- "Used custom window event (nexus:focus-chat-search) instead of forwardRef drilling to focus search input from Cmd+K — avoids threading refs through ChatPanel"
- "Debounce search at 300ms via useEffect+setTimeout pattern to avoid flooding the server with requests on every keystroke"
- "Cmd+K handler placed before the input-guard early return in useKeyboardShortcuts so it fires even when typing in inputs/textareas"
metrics:
duration: "~10 min"
completed: "2026-04-01"
tasks: 2
files: 7
---
# Phase 21 Plan 06: Chat Search and Cmd+K Shortcut Summary
Gap closure for HIST-02 (conversation search) and INPUT-07 (Cmd+K keyboard shortcut): server-side ilike filtering on conversation titles with a debounced search input, plus Cmd+K to open chat panel and focus search.
## What Was Built
### Task 1: Server-side search and agentId filtering
- `chatService.listConversations` extended with `search?: string` and `agentId?: string` opts; adds `ilike(chatConversations.title, '%term%')` and `eq(chatConversations.agentId, id)` conditions when provided
- `GET /companies/:companyId/conversations` route extracts `search` and `agentId` from `req.query`
- `chatApi.listConversations` serializes `search` and `agentId` as URL query params
- `useChatConversations` accepts `opts?: { search?: string }`, includes search in queryKey (triggers refetch on change), passes to API
### Task 2: Search input UI and Cmd+K shortcut
- `ChatConversationList` renders a search input with Search icon (left) and clear X button (right); 300ms debounce; passes debouncedSearch to `useChatConversations`
- `ChatConversationList` listens for `nexus:focus-chat-search` custom window event to focus the input
- `useKeyboardShortcuts` adds `onSearch?: () => void` to `ShortcutHandlers`; Cmd+K/Ctrl+K handler is placed BEFORE the input-guard early return (fires globally)
- `Layout` wires `onSearch` to open chat panel if closed, then dispatches `nexus:focus-chat-search` via `requestAnimationFrame`
## Verification Results
- TypeScript: no new chat-related errors in server or UI (pre-existing plugin-sdk errors in plugins.ts are out of scope)
- All tests pass: chat-service (21), chat-routes (11), ChatMarkdownMessage (4), ChatInput (6) — 42 total
- Search input present with placeholder "Search conversations..."
- Cmd+K handler on `metaKey || ctrlKey` + `k` in useKeyboardShortcuts
- Route passes search/agentId params
## Deviations from Plan
None — plan executed exactly as written. Used the simpler custom-event approach (suggested as ALTERNATIVE in plan) rather than forwardRef/useImperativeHandle, as plan explicitly recommended this path.
## Known Stubs
None.
## Self-Check: PASSED