[
    {
        "role": "user",
        "content": "when%20we%20reconnect%20to%20a%20session%20in%20claude%20code%2C%20is%20the%20context%20pulled%20from%20%7E%2F.claude%2Fprojects%20files%20or%20is%20there%20context%2Fhistory%20maintained%20in%20the%20cloud%20for%20the%20given%20session%20id%3F"
    },
    {
        "role": "assistant",
        "content": "Here\u2019s a breakdown of how **Claude Code** handles session context: what's stored locally, what\u2019s kept in the cloud, and how context/persistence works when you reconnect or resume a session.\n\n---\n\n## Where session data is stored\n\n- Claude Code **writes session transcripts locally**, in your home directory under `~/.claude/projects/<project>/<session-id>.jsonl`. Each JSONL file logs everything: user messages, tool uses, outputs, etc. ([code.claude.com](https://code.claude.com/docs/en/sessions?utm_source=openai))  \n- By default, these local transcripts are kept for **30 days**, after which they may be cleaned up. This retention period can be adjusted via the `cleanupPeriodDays` setting. ([code.claude.com](https://code.claude.com/docs/en/data-usage?utm_source=openai))  \n\n---\n\n## What happens when you reconnect / resume a session\n\n- When you use commands like `claude --continue` or `claude --resume <name or ID>`, Claude Code reloads the full conversation history from the local transcripts so you're picking back up where you left off. ([code.claude.com](https://code.claude.com/docs/en/sessions?utm_source=openai))  \n- The `--resume` picker shows you sessions from the current project\u2019s worktree by default (you can widen to include other worktrees or projects). ([code.claude.com](https://code.claude.com/docs/en/sessions?utm_source=openai))  \n- For **cloud sessions** (when using Claude Code on the web or remote VMs), they also have unique session IDs and history that's persisted in the cloud; you can teleport those sessions into your local CLI environment. When doing so, it pulls down the full conversation history associated with that session. ([code.claude.com](https://code.claude.com/docs/en/claude-code-on-the-web?utm_source=openai))  \n\n---\n\n## What is *not* happening\n\n- **No permanent cloud store** for your CLI session history by default. For local CLI usage, everything is stored on your machine. Your sessions are *not shared across devices or users*, unless you do something explicit like export the session. ([code.claude.com](https://code.claude.com/docs/en/sessions?utm_source=openai))  \n- CLAUDE.md and memory files are project-local and machine-local: they\u2019re loaded as part of your project\u2019s files. They provide persistent context *across* sessions, but only within that project on that machine. ([code.claude.com](https://code.claude.com/docs/en/memory?utm_source=openai))  \n- The session context window (what the model \u201cremembers\u201d during an ongoing conversation) *can be compacted* over time. Old messages/tool outputs may be summarized or pruned to stay within token/context limits. So while the transcript file has everything, not all of it may be loaded into the context when continuing a session. ([code.claude.com](https://code.claude.com/docs/en/how-claude-code-works?utm_source=openai))  \n\n---\n\n## TL;DR answer\n\nWhen you reconnect to a session in Claude Code, the tool pulls your *conversation context/history* from **local transcripts** stored under `~/.claude/projects/...`. Cloud storage comes into play only for sessions that are running on remote/Anthropic-managed VMs (i.e. when using \"Claude Code on the web\" or with `--remote` / teleport). But even for those, history is accessible so long as the session ID and workspace are correct. The `.claude` project folder + transcripts handles the persistence for most CLI workflows.  \n\nIf you want, I can map out what files/folders are involved and how to inspect them yourself."
    }
]