Problem
Users can't cancel an untitled (new story) session. If they started a session but don't want to continue, there's no way to discard it cleanly.
Solution
Two ways to cancel an untitled session:
1. Close tab with confirmation popup
When user clicks the × on an "Untitled" tab and structure.md doesn't exist yet, show a confirmation popup:
┌────────────────────────────────────────────┐
│ Discard this session? │
│ │
│ This session will be lost — your AI │
│ hasn't created a story structure yet. │
│ │
│ [Cancel] [Discard] │
└────────────────────────────────────────────┘
2. Cancel button on top-right of terminal
Display a cancel/discard button on the top-right corner of the terminal session area (next to the tab bar). Only visible for untitled sessions.
┌─────────────────────────────────────────────┐
│ ● Untitled × [Cancel ×] │
│─────────────────────────────────────────────│
│ Claude Code v2.1.92 │
│ ... │
Clicking triggers the same confirmation popup.
On discard:
- Send
exit command to the Claude terminal session (graceful shutdown)
- Remove the terminal session (kill PTY)
- Remove the "Untitled" entry from the sidebar
- Clean up any session data (IndexedDB scrollback, etc.)
Files
app/web/components/TerminalPanel.tsx — cancel button, close tab handler
app/web/components/StoriesPage.tsx — remove untitled session state
app/routes/terminal.ts — may need endpoint to kill a specific session
Acceptance Criteria
Problem
Users can't cancel an untitled (new story) session. If they started a session but don't want to continue, there's no way to discard it cleanly.
Solution
Two ways to cancel an untitled session:
1. Close tab with confirmation popup
When user clicks the × on an "Untitled" tab and
structure.mddoesn't exist yet, show a confirmation popup:2. Cancel button on top-right of terminal
Display a cancel/discard button on the top-right corner of the terminal session area (next to the tab bar). Only visible for untitled sessions.
Clicking triggers the same confirmation popup.
On discard:
exitcommand to the Claude terminal session (graceful shutdown)Files
app/web/components/TerminalPanel.tsx— cancel button, close tab handlerapp/web/components/StoriesPage.tsx— remove untitled session stateapp/routes/terminal.ts— may need endpoint to kill a specific sessionAcceptance Criteria