From a6ea64cca7a5468770127c28c6dfbbe9187212ef Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 20 Feb 2026 11:16:17 +0000 Subject: [PATCH] Add story 39: Persistent Claude Code Sessions in Web UI Use --resume with claude -p to maintain conversation context across messages in the web UI claude-code-pty provider. Co-Authored-By: Claude Opus 4.6 --- ...rsistent_claude_code_sessions_in_web_ui.md | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .story_kit/stories/upcoming/39_persistent_claude_code_sessions_in_web_ui.md diff --git a/.story_kit/stories/upcoming/39_persistent_claude_code_sessions_in_web_ui.md b/.story_kit/stories/upcoming/39_persistent_claude_code_sessions_in_web_ui.md new file mode 100644 index 0000000..7189f65 --- /dev/null +++ b/.story_kit/stories/upcoming/39_persistent_claude_code_sessions_in_web_ui.md @@ -0,0 +1,29 @@ +--- +name: Persistent Claude Code Sessions in Web UI +test_plan: pending +--- + +# Story 39: Persistent Claude Code Sessions in Web UI + +## User Story + +As a developer using the web UI with the claude-code-pty provider, I want my conversation context to persist across messages, so that Claude remembers what we've discussed and can build on prior work — just like a normal terminal Claude Code session. + +## Background + +Currently the `claude-code-pty` provider spawns a fresh `claude -p` process for every message, sending only the last user message. This means Claude has zero memory of prior conversation turns. The fix is to capture the session ID from the first `claude -p` call and pass `--resume ` on subsequent messages. Claude Code persists conversation transcripts locally as JSONL files, so resumed sessions have full context — identical to a long-running terminal session from the API's perspective. + +## Acceptance Criteria + +- [ ] First message in a web UI chat spawns `claude -p "" --output-format stream-json --verbose` and captures the session ID from the `system` or `result` JSON event +- [ ] Subsequent messages in the same chat spawn `claude -p "" --resume --output-format stream-json --verbose` +- [ ] Conversation context carries across messages (Claude remembers what was said earlier) +- [ ] Starting a new chat in the web UI starts a fresh session (no resume) +- [ ] Session ID is held per web UI chat session (not global) +- [ ] Cancellation still works mid-message + +## Out of Scope + +- Multi-turn conversation history display in the frontend (already works via existing message state) +- Session persistence across server restarts +- Managing/cleaning up old Claude Code session files on disk