Does logging out of Claude Code delete your chats?
No: logging out of Claude Code removes the stored login and resets first-launch setup, but your chats stay on disk in ~/.claude/projects. They go missing only when Claude Code reads a different config folder or project folder, or when the 30-day cleanup has deleted old transcripts.
Contents
No. Logging out of Claude Code removes your login, not your chat history. Per Anthropic's authentication docs, /logout signs you out and resets first-launch setup, and the next claude walks you through login again. Each conversation is a .jsonl file under ~/.claude/projects, still there when you sign back in.
History that seems to vanish after a logout or an account switch has one of three causes we know of. Claude Code is reading a different config folder, you started it in a different project folder, or the 30-day cleanup deleted the old transcripts. Only the last one deletes anything.
What /logout removes, and what it leaves#
We read Anthropic's pages on 24 October 2026 and listed everything they say a logout touches.
| Removed when you log out | Not on any logout list in the docs |
|---|---|
Your login: the macOS Keychain entry, or .credentials.json on Linux and Windows |
Every transcript in ~/.claude/projects/ |
| Saved MCP server logins and plugin secrets (troubleshooting page) | history.jsonl, your typed prompts for up-arrow and Ctrl+R |
remote-settings.json and policy-limits.json, two caches for your organisation |
settings.json, CLAUDE.md, skills, agents and plugins |
| First-launch setup state | Auto memory in projects/<project>/memory/ |
Transcripts appear in no list of what a logout removes. Apart from deleting the files yourself, Anthropic names two things that remove them: the age-based cleanup, and claude purge, which you run on purpose and which asks before it deletes (.claude directory reference).
Where Claude Code chats are saved after logout#
Each chat is a JSONL file at ~/.claude/projects/<project>/<session-id>.jsonl. The <project> part is your working folder's path with every character that isn't a letter or digit turned into a dash, so /Users/you/code/my-app becomes -Users-you-code-my-app (Manage sessions). On Windows the folder is %USERPROFILE%\.claude\projects.
To check that your history survived:
- Run
ls ~/.claude/projectsand find the folder named after your project. - Look inside it. The newest
.jsonlfile is usually the last chat you had there. - Sign in again with
/loginorclaude auth login. - From the same project folder, run
claude --continuefor the latest chat orclaude --resumeto pick one.
A transcript doesn't belong to an account. Whoever is logged in when you resume gets the whole conversation, and the next message runs on that login. Every way back into a chat, and what a resume restores, is in resuming a Claude Code session.
Logged in with another account and your sessions are gone?#
When the .jsonl files are there but /resume lists nothing, Claude Code is looking in another folder. We'd check the three cases in this order.
1. You're in a different config folder#
CLAUDE_CONFIG_DIR moves everything Claude Code keeps in ~/.claude to another folder. Anthropic suggests it for staying signed in to two accounts at once, and its authentication page says each directory has its own settings, session history and login. If claude-work is an alias for CLAUDE_CONFIG_DIR=~/.claude-work claude, it reads ~/.claude-work/projects and never sees a chat you had under plain claude.
Nothing was deleted; the two folders don't know about each other. claude auth status prints JSON with a configDirectory field that names the folder a session uses (Claude Code v2.1.268 or later, per the CLI reference). To open a chat from the other folder, pass its file path:
cd ~/code/my-app
CLAUDE_CONFIG_DIR=~/.claude-work claude --resume ~/.claude/projects/-Users-you-code-my-app/<session-id>.jsonl
CLAUDE_CONFIG_DIR profiles shows how the two folders split everything else and how to share parts of them by hand. Keeping the same chat across Claude accounts lists what breaks when a chat changes accounts this way.
2. You started Claude Code in another folder#
Sessions are stored per project directory, and the picker opens on the current one. Starting claude in ~/code instead of ~/code/my-app gives you a different, possibly empty, list. In the picker, Ctrl+W widens it to every worktree of the repository and Ctrl+A to every project on the machine.
With the session ID, claude --resume <session-id> works from any directory: it searches the current project first, then all the others. Versions before v2.1.223 stopped at the current project, so update if that search comes back with No conversation found (error reference).
3. The 30-day cleanup deleted them#
This case does delete chats, and logging out plays no part in it. Claude Code deletes transcripts older than cleanupPeriodDays, which is 30 by default. The settings reference says the sweep runs in the background after a session starts and shows no message, so an old session just drops out of /resume.
The minimum is 1. Setting 0 fails validation rather than turning cleanup off, and Anthropic suggests a large value such as 3650 instead. Because the sweep runs when a session starts, typing claude after two months away is what deletes every chat older than 30 days. To keep those chats, add this key to ~/.claude/settings.json before you start a session:
{
"cleanupPeriodDays": 3650
}
Once a transcript is gone, Claude Code can't resume it. Our cleanupPeriodDays guide lists what the sweep takes with each transcript and what survives it.
When your plan lapses or you change organisation#
The files on your disk don't depend on your plan; only the next message does. Anthropic's help centre says a cancelled Pro or Max subscription keeps working until the end of the billing period (Cancel your Pro or Max subscription). After that, you need one of the logins the authentication docs list for Claude Code: Pro or Max, Team or Enterprise, a Console account, or a cloud provider or gateway. A free claude.ai plan isn't on that list.
If a Team or Enterprise organisation removes your access, requests fail with API Error: 401 Invalid authentication credentials. If that error comes back after one /login with the same account, the error reference says that account or organisation is no longer active.
In both cases, run /logout, then /login with a plan you can use (or set an API key), and resume as before. Switching between Team and personal orgs covers picking the right organisation at that login. The chat comes back with its full history. On a work machine, an organisation can set cleanupPeriodDays in managed settings, and then its value wins over yours.
How Shuriken keeps one history across accounts#
Shuriken is a harness that runs Claude Code and other coding agents on your own computers. Each Claude account you add is a source with its own config home and its own sign-in, so you don't log out and in to switch. Case 1 doesn't come up, because every Claude home links the same projects folder from your main ~/.claude. On Windows the link is a junction, which needs neither Developer Mode nor an admin. A chat's transcript is the same file whichever account runs it.
settings.json, CLAUDE.md, agents, commands, skills and plugins are linked the same way, so a cleanupPeriodDays you set applies under every account. Sign-ins are never shared. Removing an account deletes its link, never the folder it points to. If a disk can't hold links, that home keeps its own projects folder, and when you remove the account Shuriken copies those transcripts into the main folder first.
The shared folder is also why hot swapping keeps one history. Hot swapping is Shuriken moving a running chat to another of your accounts when one nears its limit, or when an account's sign-in is refused, for example after a plan was cancelled. Only add accounts you own and are entitled to use; providers' terms may not allow sharing a subscription sign-in. The source switching page has the switch point (99% of a window until you change it) and how the next account is picked. To try it, download Shuriken and add each Claude account as a source.
Sources
- Claude Code docs: Authentication (accessed 24 October 2026)
- Claude Code docs: Manage sessions (accessed 24 October 2026)
- Claude Code docs: Explore the .claude directory (accessed 24 October 2026)
- Claude Code docs: All settings (cleanupPeriodDays) (accessed 24 October 2026)
- Claude Code docs: Troubleshoot installation and login (accessed 24 October 2026)
- Claude Code docs: Error reference (accessed 24 October 2026)
- Claude Code docs: CLI reference (accessed 24 October 2026)
- Claude Help Center: Cancel your Pro or Max subscription (accessed 24 October 2026)
Frequently asked questions
Does /logout remove my MCP server logins?
Yes. Anthropic's troubleshooting page says logging out removes all stored credentials, including saved MCP server logins and plugin secrets, so you authorize those servers again after the next /login. Your chats are not credentials and stay where they are.
Can I resume an old chat after logging in with a different account?
Yes, as long as Claude Code reads the same config folder. The transcript is a .jsonl file on your disk, not something stored with the account, and claude --continue or claude --resume opens it under whichever login is active. Check that the new plan can use the model the chat was on.
What happens to my Claude Code history if I cancel my subscription?
The transcripts stay on your computer. Anthropic says a cancelled Pro or Max plan keeps working until the end of the billing period; after that you need another login that includes Claude Code, or an API key, to send the next message in an old chat.
Can I set cleanupPeriodDays to 0 to keep chats forever?
No. The settings reference says 0 fails validation and the minimum is 1. For long retention it suggests a large number such as 3650, set in ~/.claude/settings.json.
Does logging out clear my up-arrow prompt history?
Anthropic lists history.jsonl, the file behind up-arrow recall and Ctrl+R search, among the files Claude Code keeps until you delete them. Logout isn't named as removing it.