feat(web): architect-backed AI drawer on /specs/$specName #1119

Open
opened 2026-05-11 23:39:02 +00:00 by claude-desktop · 0 comments
Collaborator

As an operator authoring a spec,
I want an AI assistant drawer on the spec editor that uses the architect agent and remembers my conversation per spec,
so that I can iterate on the spec body without leaving the editor or losing chat history.

Reuses MarkdownAssistantDrawer (already wired in skills tabs) and binds it to /architect/chat with the current spec body as context.

Acceptance criteria

Drawer integration

  • routes/specs.$specName.tsx toolbar has "Assistant" button (lucide Sparkles) that opens <MarkdownAssistantDrawer>.
  • ?assistant=open URL search param defaults the drawer open for share-links; toggling drawer updates the URL via navigate({ search, replace: true }).
  • buildMessage(userText) prefixes the architect prompt with the current spec body in a fenced block + filename header, then appends userText.
  • onApply(next) replaces the editor draft. When current draft is dirty, prompts a Base UI Dialog confirm before overwriting.
  • Drawer follows the project's slide-out drawer pattern (right-side, shadow-lifted, backdrop, focus trap from the <Drawer> primitive).

Session persistence per spec

  • On first successful postArchitectChat, write last_session_id to localStorage keyed specs:<repo>:<specName>:lastSession.
  • Opening the drawer on a spec with a stored session id hydrates MarkdownAssistantDrawer's session via fetchArchitectSession and shows the prior transcript.
  • "New chat" button inside the drawer clears the stored id and starts fresh.

A11y

  • Toolbar button: aria-label="Open assistant" + visible label.
  • Drawer header has a Cmd+Shift+A shortcut hint registered in SHORTCUTS (scope specs).

Tests

  • Drawer opens via button + URL search param.
  • Sending a message persists the session id to localStorage; reopening the drawer rehydrates.
  • onApply with dirty draft fires confirm dialog; declining preserves the draft.
  • "New chat" clears the localStorage key.

Out of scope

  • Server-side spec→session join table (operator decision: localStorage only).
  • Breakdown toolbar button (story wsplit-4).
  • Pruning dead localStorage keys on session delete (best-effort, follow-up).

Dependencies

  • Blocked by wsplit-2 (editor route must exist).

References

  • Spec: docs/specs/workspace-split.md § Editor anatomy + AI drawer.
  • Reference invocation: features/agent-config/skills-tab.tsx ~L649.
**As an** operator authoring a spec, **I want** an AI assistant drawer on the spec editor that uses the architect agent and remembers my conversation per spec, **so that** I can iterate on the spec body without leaving the editor or losing chat history. Reuses `MarkdownAssistantDrawer` (already wired in skills tabs) and binds it to `/architect/chat` with the current spec body as context. ## Acceptance criteria ### Drawer integration - [ ] `routes/specs.$specName.tsx` toolbar has "Assistant" button (lucide `Sparkles`) that opens `<MarkdownAssistantDrawer>`. - [ ] `?assistant=open` URL search param defaults the drawer open for share-links; toggling drawer updates the URL via `navigate({ search, replace: true })`. - [ ] `buildMessage(userText)` prefixes the architect prompt with the current spec body in a fenced block + filename header, then appends `userText`. - [ ] `onApply(next)` replaces the editor draft. When current draft is dirty, prompts a Base UI Dialog confirm before overwriting. - [ ] Drawer follows the project's slide-out drawer pattern (right-side, `shadow-lifted`, backdrop, focus trap from the `<Drawer>` primitive). ### Session persistence per spec - [ ] On first successful `postArchitectChat`, write `last_session_id` to `localStorage` keyed `specs:<repo>:<specName>:lastSession`. - [ ] Opening the drawer on a spec with a stored session id hydrates `MarkdownAssistantDrawer`'s session via `fetchArchitectSession` and shows the prior transcript. - [ ] "New chat" button inside the drawer clears the stored id and starts fresh. ### A11y - [ ] Toolbar button: `aria-label="Open assistant"` + visible label. - [ ] Drawer header has a `Cmd+Shift+A` shortcut hint registered in `SHORTCUTS` (scope `specs`). ### Tests - [ ] Drawer opens via button + URL search param. - [ ] Sending a message persists the session id to localStorage; reopening the drawer rehydrates. - [ ] `onApply` with dirty draft fires confirm dialog; declining preserves the draft. - [ ] "New chat" clears the localStorage key. ## Out of scope - Server-side spec→session join table (operator decision: localStorage only). - Breakdown toolbar button (story wsplit-4). - Pruning dead localStorage keys on session delete (best-effort, follow-up). ## Dependencies - Blocked by wsplit-2 (editor route must exist). ## References - Spec: `docs/specs/workspace-split.md` § Editor anatomy + AI drawer. - Reference invocation: `features/agent-config/skills-tab.tsx` ~L649.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
charles/claude-hooks#1119
No description provided.