Description
Claude Code incorrectly writes summaries from previous sessions into the current session's JSONL file when starting a new conversation in the same directory.
Steps to Reproduce
- Have a conversation in a project directory (Session A)
- Close Claude Code before summaries are generated for Session A
- Later (hours or days), start a new Claude Code session in the same directory (Session B)
- Check Session B's JSONL file (
~/.claude/projects/<project-name>/<session-id>.jsonl)
- Observe that Session B's file contains summary entries from Session A
Expected Behavior
- Summaries should be written to their original session files
- Each session's JSONL file should only contain summaries for its own conversations
Actual Behavior
- On startup, Claude Code scans all session files in the current directory
- For any conversation chains lacking summaries, it generates them
- These summaries are incorrectly appended to the CURRENT session file instead of their original files
- This causes session files to contain unrelated summaries with
leafUuid values pointing to messages in other sessions
Impact
- Confuses session history and makes it difficult to understand conversation flow
- Pollutes session files with unrelated content
- The leafUuid values in summaries reference messages that don't exist in the current session
Additional Context
- This appears to be caused by a delayed summary generation feature that runs on startup
- The global session singleton writes all generated summaries to the current session file
- Message UUIDs are reused across sessions (each appears exactly twice), which may be related to the session continuation feature
Environment
- Claude Code version: 1.0.34
- Platform: macOS Darwin 24.5.0
Description
Claude Code incorrectly writes summaries from previous sessions into the current session's JSONL file when starting a new conversation in the same directory.
Steps to Reproduce
~/.claude/projects/<project-name>/<session-id>.jsonl)Expected Behavior
Actual Behavior
leafUuidvalues pointing to messages in other sessionsImpact
Additional Context
Environment