---
name: "Persist chat history to localStorage across rebuilds"
---

# Story 145: Persist chat history to localStorage across rebuilds

## User Story

As a developer using the Story Kit web UI, I want my chat history to persist across page reloads and Vite HMR rebuilds, so that I don't lose my conversation context during development.

## Acceptance Criteria

- [ ] AC1: Chat messages are restored from localStorage on component mount (surviving page reload / HMR rebuild)
- [ ] AC2: Chat messages are saved to localStorage whenever the message history updates (via WebSocket `onUpdate` or user sending a message)
- [ ] AC3: Clearing the session via "New Session" button also removes persisted messages from localStorage
- [ ] AC4: localStorage quota errors are handled gracefully (fail silently with console.warn, never crash the app)
- [ ] AC5: Messages are stored under a key scoped to the project path so different projects have separate histories

## Out of Scope

- Server-side persistence of chat history
- Multi-tab synchronization of chat state
- Compression or size management of stored messages
- Persisting streaming content or loading state
