Claude Code and Codex sessions after an account ban
Published · Updated · Checked against Claude Code .claude directory docs and Codex config-advanced page, 10 Nov 2026
Mostly yes. Claude Code writes its transcripts to ~/.claude/projects/ on your machine, and Codex writes its session files under ~/.codex/, and neither location depends on your account being in good standing. The risk is not the ban, it is Claude Code's age-based cleanup, which deletes transcripts after 30 days by default. Copy the folders first, then change the setting.
What the documentation confirms
The Claude Code .claude directory page, as of 10 November 2026, says ~/.claude holds "transcripts, prompt history, file snapshots, caches, and logs", and that these files are plaintext. The paths it lists:
Path under ~/.claude/ | What it holds |
|---|---|
projects/<project>/<session>.jsonl | The conversation transcript |
projects/<project>/<session>/subagents/ | Subagent transcripts |
projects/<project>/<session>/tool-results/ | Large tool outputs |
file-history/<session>/ | Snapshots of files before Claude edited them |
projects/<project>/memory/ | Auto memory, exempt from the age sweep |
history.jsonl | Prompts you typed |
Nothing on that page ties these files to account status. It does not say what happens when authentication fails, and whether the cleanup still runs then is not documented. Do not assume it does not.
For Codex, the advanced config page (the old developers.openai.com address redirects there) says state lives under CODEX_HOME, which defaults to ~/.codex. It lists config.toml, auth.json "if you use file-based credential storage" or your OS keychain, history.jsonl "if history persistence is enabled", and "Other per-user state such as logs and caches". That page does not name the sessions folder. The session files in practice sit at ~/.codex/sessions/YYYY/MM/DD/, which comes from Codex GitHub issues rather than an official page. See where Codex stores sessions for that evidence.
The cleanup trap
Claude Code "deletes the files in the paths below once they're older than cleanupPeriodDays". The page gives the default as 30 days, the minimum as 1, and says 0 fails with a validation error. The sweep covers the transcripts, subagent transcripts, tool results and file-history rows above. Auto memory is exempt. So if you were banned and stopped using Claude Code, a transcript from five weeks ago may already be gone The docs do not say when the sweep runs, so treat anything older than the period as at risk. history.jsonl is listed as kept until you delete it. The full story is in Claude Code deletes transcripts after 30 days.
Order matters. Copy first, then set the longer period.
Step 1: copy before anything else
On macOS or Linux, make a dated copy outside ~/.claude:
mkdir -p ~/ai-session-backup
cp -a ~/.claude/projects ~/ai-session-backup/claude-projects-$(date +%F)
cp -a ~/.claude/file-history ~/ai-session-backup/claude-file-history-$(date +%F)
cp -a ~/.claude/history.jsonl ~/ai-session-backup/claude-history-$(date +%F).jsonl
If you set CLAUDE_CONFIG_DIR, every path above lives under that directory, as the docs say. On Windows, ~/.claude is %USERPROFILE%\.claude.
For Codex, exclude the credential file. auth.json is a login token in plaintext, and a backup folder is the wrong place for it:
rsync -a --exclude 'auth.json' --exclude 'auth.json.lock' ~/.codex/ ~/ai-session-backup/codex-$(date +%F)/
Check that the result has your sessions in it (ls ~/ai-session-backup/codex-*/sessions). If you use the OS keychain instead of a file, nothing is copied from it by this command, which is what you want.
Then make the copies read-only so a later cleanup, a mistaken command or a reinstall cannot touch them:
chmod -R a-w ~/ai-session-backup
The files can contain source code and anything pasted in a session, including secrets, because the docs say tool output is written to the transcript. Keep the backup folder private. See secrets in Claude Code transcripts before you sync it anywhere.
Step 2: stop the 30-day sweep
Claude Code reads cleanupPeriodDays from settings. User settings live in ~/.claude/settings.json. If you cannot start Claude Code, edit the file directly:
{
"cleanupPeriodDays": 3650
}
If the file already has other keys, add this line to the existing object and do not replace the file. A malformed settings file can pause the sweep and show a warning in /status according to the docs, but do not rely on a broken file as a safeguard. The copy from step 1 is the safeguard.
Step 3: read what you need
The transcripts are JSONL, one JSON object per line. To find the work you cannot lose, search before you sort:
grep -rl "migration" ~/ai-session-backup/claude-projects-*/ | head
You can search past Claude Code conversations, and export a conversation to readable text. The point is to pull out decisions, prompts and file changes into a plain note that the next tool can read, such as a CLAUDE.md or AGENTS.md. See AGENTS.md vs CLAUDE.md.
What does not survive
Server-side data is a different matter. Claude Code on the web and Codex cloud sessions run elsewhere, and claude.ai or ChatGPT chat history sits on the vendor's servers. For those, see the Claude export guide and the ChatGPT export guide. The Claude Code docs say attachments to a cloud session are saved in that cloud environment, not on your machine.
Sealkeep can seal and search these local sessions without any vendor account, but only for Claude Code and Codex on machines that run it. A plain copy is enough for today. A routine for later is in backup Claude Code and Codex sessions.
FAQ
Does a ban delete my Claude Code transcripts?
Nothing in the Claude Code documentation says so. The files are on your disk and are removed by age through cleanupPeriodDays, not by account state. Copy them regardless.
Can I still resume a session if I cannot log in?
The transcript is readable as a plain file whether or not you can sign in. Whether Claude Code will resume a session while its account is banned is not documented, and no confirmed case was found.
Should I copy auth.json?
No. The Codex docs describe it as cached login details. A backup does not need it, and a stolen copy is a credential.
What if I use Cursor or Copilot?
Local locations for those were not verified here, so this article covers Claude Code and Codex only.