Skip to content
Notes

Short read · AI agents

Where Claude Code keeps your history — and how I switch accounts without losing 5 GB

Your Claude Code conversations live on your own disk, not in your account — and by default a cleanup can delete them after 30 days. The line I added to the settings, the two scripts I run, and what a switch of accounts actually broke.

Max Kiriienko
Tech Lead SEO & Marketing · 9 min read

On September 20 I decided to move to a new Claude account. My old one was tied to an email address I couldn’t keep using for it, and you can’t change the email on a Claude account — Anthropic’s help page says so plainly. So: a new account.

By then I had worked with Claude Code on 63 of the previous 76 days. My rules, my decisions and the reasons behind them were all in those conversations. I asked the agent whether the conversations could move to the new account at all. In the same message came a demand:

“Make sure nothing gets deleted, in any case, under any circumstances.” — what I told my agent on September 20.

Here is what we found, what I changed and what the move actually broke. One warning first. Part of this relies on how the desktop app works inside, and Anthropic doesn’t document that part. It worked for me on a Mac in September and October 2026. It may break after any update.

Where Claude Code stores your conversations

On your own computer. Every conversation is a file in ~/.claude/projects/: one folder for each project folder you worked in, one .jsonl file for each conversation. When the agent starts helper agents (subagents), their transcripts go into a subagents folder inside a folder named after the parent conversation. Anthropic’s docs describe the same layout.

So your history doesn’t live in your account. Your rules file, skills, memory notes and settings sit in ~/.claude too. Log in with another account on the same computer, and all of it is still there.

How much it is for me, counted on October 4:

  • 5.0 GB in 29 project folders, 7,879 files in total.
  • 18 main conversations, 1.95 GB. I keep few conversations and let them run long. The biggest single file is 0.83 GB — one conversation that has been going since July 10.
  • 3,027 subagent transcripts, 2.8 GB. The helpers take more space than the conversations themselves.

What my 4.9 GB of Claude Code history is made of

3,027 subagent transcripts 2.8 GB, 18 main conversations 1.95 GB, 1,401 large tool outputs 0.15 GB, everything else 0.03 GB.

File sizes add up to 4.9 GB; the disk reports 5.0 GB because of block overhead. Subagents are the helper agents Claude Code starts for parts of a task. Source: my ~/.claude/projects folder, counted on October 4, 2026

One thing to know before you copy this folder anywhere: it is plain text. Anything that passes through a tool is written into a transcript — file contents, command output, whatever you pasted. If you ever pasted an API key into a chat, it is in there. Anthropic’s docs say the same.

cleanupPeriodDays: why conversations can disappear after 30 days

This was the bigger surprise. By default, Claude Code deletes transcripts older than 30 days. The cleanup runs quietly in the background when a session starts, and subagent transcripts go together with their parent conversation. The setting is called cleanupPeriodDays.

Sessions started or last continued in the desktop app follow a different rule. Since version 2.1.248, the docs say, their transcripts are kept at any age, unless you set a separate limit for them, desktopSessionCleanupPeriodDays. Earlier versions deleted them after the same 30 days. I didn’t want my history to depend on that exception: anything started outside the desktop app still falls under the 30 days. So on September 20 I added one line to ~/.claude/settings.json:

{
  "cleanupPeriodDays": 36500
}

36,500 days is about 100 years. The docs give a minimum of 1 and mention no maximum.

I can’t tell whether anything had been deleted before that day. My oldest conversation, from my first day on July 7, is still there.

Keeping everything has a price, and it’s disk space. In September my history grew by 2.5 GB. About 0.4 GB of that was one long conversation copied into a new file; the other 2.1 GB was new. On the three days with the most new data, 83–91% of it came from subagents.

My Claude Code history on disk, GB

From almost nothing on July 7 to 4.8 GB on October 3: 0.15 GB at the end of July, 1.6 GB at the end of August, 2.7 GB on September 20, 4.1 GB at the end of September.

Transcripts only, each record counted on the day it was written to disk (UTC). The jump on September 3 is one long conversation copied into a new file, 0.4 GB. The whole folder is 5.0 GB with large tool outputs and disk overhead. Source: my ~/.claude/projects folder, counted on October 4, 2026

Why the sidebar is empty after you switch accounts

On September 30 I logged in to the desktop app with the new account and opened the Code tab. The sidebar was empty. Nothing had been deleted — more than 4 GB of history was still on the disk — but the app no longer listed any of it.

The reason: the sidebar isn’t built from the transcripts. It’s built from small pointer files, one per session, and they sit in a folder that belongs to one account. On a Mac it’s here:

~/Library/Application Support/Claude/claude-code-sessions/<account>/<organization>/

A pointer holds the session’s title, its project folder and the ID of the transcript it opens. A new account gets a new, empty folder. That’s the whole mystery.

On disk · shared

Every conversation and subagent transcript, plus rules, skills, memory and settings in ~/.claude. Every account on this computer sees the same files.

Per account

One small pointer file per session in the desktop app's own folder for this account. The sidebar reads only the folder of the account you are logged in with.

In the cloud

Published pages, connectors, cloud sessions. They stay with the account that created them.

Switching accounts swaps the middle row. The top row doesn't move, which is why the history survives.

My agent found the fix in community reports. On GitHub, an open feature request has asked Anthropic since July to support exactly this. The fix is plain: quit the app completely, copy the pointer files into the new account’s folder without renaming them, and open the app again. I did that on September 30. All 16 sessions came back under the new account, with pinned and archived sessions where they had been.

If you’d rather not touch the app’s files, there is a documented way back to any conversation: the terminal version of Claude Code opens it with claude --resume <session-id>, from any folder. You lose the sidebar, not the history.

What the account switch did break

  • Logins in the app’s built-in browser. They were wiped the moment I switched accounts. Every site I had logged in to there needed a new login. The list of allowed sites and trusted folders stayed.
  • Published pages. Pages I had published as artifacts from the old account don’t open from the new one. Publishing again gives a new link.
  • Anything in the cloud. Cloud sessions and connectors belong to the account that created them. They don’t move.

Everything on the disk was untouched: conversations, memory, rules, skills, settings. So was everything outside Claude — git, my password manager, Cloudflare and the other services the agent works with.

Two scripts: a backup and a sidebar sync

The backup

Before touching the app’s files, the agent wrote a backup script. It packs each project folder into its own archive, adds the settings folder (without the transcripts and without the login file) and the desktop sidebar folders, then compares the file count of every project archive with its source. A mismatch is a failure, not a warning.

The backup sits outside ~/.claude/projects on purpose. When you resume a conversation by its ID from another folder, Claude Code searches all projects, and if it finds two copies, it answers “not found” — the docs describe this. The backup folder is readable only by me and never goes to a cloud drive or to git.

On September 30 the full backup was 29 archives: 4.2 GB of files packed into 2.2 GB, every count matching. A minimal version you can run yourself, from Terminal, while no session is working:

mkdir -p ~/Backups/claude-history
tar -czf ~/Backups/claude-history/projects-$(date +%F).tar.gz -C ~/.claude ./projects
tar -tzf ~/Backups/claude-history/projects-$(date +%F).tar.gz | grep -c '\.jsonl$'
find ~/.claude/projects -name '*.jsonl' | wc -l

The last two numbers must match.

The sidebar sync

The first version copied pointers one way. The same day it became a two-way sync, because I still switch between the two accounts now and then, and every switch hides what I did under the other one. Its rules:

SituationWhat the script does
A session exists in one folder onlyCopies it to the other.
It changed in one folder since the last syncThat version goes to the other folder.
It changed in both foldersTakes the version with the later activity and lists which fields differed.
It changed in both, with the same last activityLeaves both alone and says so. Send any message in the right version, run the sync again, and that version wins.
The two versions open different transcriptsLeaves both alone and says so.
It was deleted in one folderDoesn't bring it back, and doesn't delete it in the other folder.

The safety rules matter more than the logic. It never deletes a file. It takes a snapshot of the whole sidebar folder before any change. It refuses to change anything while the app is open, because the app would overwrite the folder from memory. And it compares what’s inside the pointers, not file times, ignoring the “last opened” field, which changes when you simply click a session.

Without flags it only shows the plan. On October 4 it printed this (translated, shortened, IDs hidden):

Account/organization folders: 3
  xxxxxxxx…/xxxxxxxx…  pointers:   0  (empty, not included)
  xxxxxxxx…/xxxxxxxx…  pointers:  17  ← active account  synced 03.10 15:13
  xxxxxxxx…/xxxxxxxx…  pointers:  17  synced 03.10 15:13

To copy: 0; to update: 7; conflicts: 1; unreadable: 0; deleted, not restored: 0
This was a preview. To run it: restore-desktop-sessions --apply (the app must be closed)

Seven sessions had changed under one account since the last sync. One had changed under both, and the script won’t guess which version is right. Both folders hold the same 17 sessions, and every pointer opens a transcript that exists on the disk.

Before its first real run, the sync passed 44 checks in 14 scenarios — switching back and forth, conflicts, deletions, a broken file, a third account — on a copy of my real sidebar, and a separate review tried to break it. That copy is also the weak spot: the checks depend on the live state. On October 4, with that one open conflict in it, 36 of the 44 passed. The test picked the conflicted session as the one to “delete”, and the session came back instead of staying deleted. It’s the safe direction — nothing was lost — but the checks need a fixed sample of their own.

I’m not publishing the scripts yet: they are written for my folders, and the tests contain real account IDs. The table is enough to rebuild them, or to ask your own agent to.

How to export a single conversation

Inside a session, type /export. It copies the conversation to the clipboard or saves it as a text file, with tool output turned into readable text (docs). That’s the clean way to hand one conversation to someone else. Check it for keys first.

You can also read the .jsonl files with your own scripts, but the format is internal and changes between versions — the docs warn about this. My backup copies the files as they are and doesn’t parse them, so a format change can’t break it.

The data export on claude.ai is a different thing. It’s for your chats in the Chat tab, and the download link is sent to the account’s email address. Your Claude Code conversations are already on your disk.

If you switch accounts: the order that worked for me

  1. Make a backup and check the counts.
  2. Log in with the new account and open the Code tab once, so its folder appears.
  3. Quit the app completely with ⌘Q. Closing the window isn’t enough.
  4. Copy the pointers, or run the sync, from Terminal — not from a terminal inside the app.
  5. Open the app and check the sidebar.
  6. Log in again to the sites you used in the built-in browser.

And whatever else you skip, set cleanupPeriodDays today. It takes one line, and it’s the only step here that works before you know you need it.