hopsesh guide · Claude Code and Codex
Where Claude Code and Codex store sessions (and how to move them)
The exact paths on macOS, Linux and Windows, how Claude Code names project folders, what CLAUDE_CONFIG_DIR and CODEX_HOME change, and what to watch when you move them.
Claude Code
The transcript
~/.claude/projects/<project>/<session-id>.jsonl
Claude Code writes the transcript as you work, one JSON object per line: a message, a tool call or its result, or a metadata entry. <project> is the working directory’s path with every character that isn’t a letter or digit replaced by -:
| Working directory | Project folder |
|---|---|
/Users/alice/src/webapp |
-Users-alice-src-webapp |
/home/alice/src/web.app |
-home-alice-src-web-app |
C:\Users\alice\src\webapp |
C--Users-alice-src-webapp |
When the converted name would pass 200 characters, Claude Code cuts it to 200 and adds a hash of the full path. On Windows, ~/.claude is %USERPROFILE%\.claude.
The newest file in a project folder is usually the session you want:
ls -t ~/.claude/projects/-Users-alice-src-webapp/
The file name without .jsonl is the session id that claude --resume <id> takes.
What sits beside it
<session-id>/, a folder next to the transcript, can hold subagent transcripts (subagents/) and large tool outputs (tool-results/).~/.claude/projects/<project>/memory/is the project’s auto memory.~/.claude/file-history/<session-id>/holds the file checkpoints that rewind uses.
What changes the location and lifetime
CLAUDE_CONFIG_DIRmoves the whole tree. Each configuration folder has its own settings, session history and login, which is how people keep two Claude accounts on one computer.cleanupPeriodDaysinsettings.jsonsets how long transcripts are kept: 30 days by default.- The format is internal. Claude Code’s documentation says it changes between versions, and points scripts at
/export,claude -p --output-format jsonand hooks instead.
What isn’t there
Your login. On macOS Claude Code keeps it in the Keychain, on Linux and Windows in ~/.claude/.credentials.json. Sessions from Claude Code on the web aren’t local files either; claude --teleport brings one down.
Codex
The rollout
~/.codex/sessions/YYYY/MM/DD/rollout-<time>-<id>.jsonl
Codex keeps its state under CODEX_HOME, which is ~/.codex unless you set it. Each session is a rollout file, also JSON Lines, filed by the date it started rather than by project. The working directory is recorded in the file’s first record. Archived sessions move to ~/.codex/archived_sessions.
To find the newest:
ls -t ~/.codex/sessions/$(date +%Y/%m/%d)/
What that means in practice
- Codex doesn’t lose track of a session when you move a project folder, because the folder isn’t part of the path. But
codex resumeandcodex resume --lastonly offer sessions from the current directory;codex resume --allshows every directory. codex resume <id>takes the id at the end of the file name, or a session name.auth.jsonin the same folder can hold your login when Codex uses file-based credentials. Don’t copy it to another computer; sign in there instead.
The two side by side
| Claude Code | Codex | |
|---|---|---|
| Root | ~/.claude (CLAUDE_CONFIG_DIR) |
~/.codex (CODEX_HOME) |
| One session | projects/<project>/<id>.jsonl |
sessions/YYYY/MM/DD/rollout-<time>-<id>.jsonl |
| Filed by | Working directory | Date |
| Reasoning | Thinking blocks, signed for Anthropic | Stored encrypted for OpenAI |
| Resume | claude --resume <id> |
codex resume <id> |
The two formats are different enough that neither agent can open the other’s sessions as they are. Moving between them is a conversion: see continue a Claude Code session in Codex.
Moving them to another computer
Because both are plain files, you can copy them. What makes it fiddly:
- Claude Code files by path. The copy has to go in the project folder named after the repository’s path on the new computer, or
claude --continuewon’t find it. “No conversation found” after copying covers the errors. - The paths inside are the old ones. Every tool call names absolute paths; if the username or repository location differs, they need rewriting.
- The code doesn’t come with it. Commit, push and pull first.
- Copies drift. Keep using the session on both computers and you have two different conversations.
hopsesh is a free, open-source command-line tool, terminal UI and app for macOS and Windows that reads both stores on all your computers over SSH and moves sessions between them:
hopsesh ls # every session of both agents, grouped by repository
hopsesh ls --agent codex --json # one agent, for scripts
hopsesh pull studio:"fix flaky tests" # move one here
The list shows each session’s computer, agent, path, branch, worktree, last prompt, last activity and whether it’s running. A move finds or clones the repository, brings the code to the session’s commit, rewrites the paths for this computer, installs the file where the agent looks for it and prints the command to continue. Reading needs nothing installed on the other computer beyond an SSH server.
hopsesh is alpha software, and an independent project, not affiliated with Anthropic or OpenAI. More: move a Claude Code session to another computer and resume a Codex session on another machine.
Where sessions live
Where does Claude Code store conversation history?
In ~/.claude/projects/<project>/<session-id>.jsonl, one JSON Lines file per session, where <project> is the working directory with every non-alphanumeric character replaced by a dash. On Windows it is %USERPROFILE%\.claude\projects. CLAUDE_CONFIG_DIR moves the whole tree.
Where does Codex store sessions?
Under CODEX_HOME, ~/.codex unless you set it, as ~/.codex/sessions/YYYY/MM/DD/rollout-<time>-<id>.jsonl, filed by date with the working directory recorded inside. Archived sessions are in ~/.codex/archived_sessions.
How long does Claude Code keep sessions?
30 days by default. Claude Code deletes older transcripts at startup; cleanupPeriodDays in settings.json changes the period.
Can I open a Claude Code session in Codex by copying the file?
No. The formats, tools and reasoning differ, so a Claude Code session has to be converted for Codex. Codex’s /import does that on one computer, and hopsesh does it on one computer or across several, in both directions.
Use the method
Try it with hopsesh
Open-source CLI and desktop app: move a Claude Code or Codex session to another computer, into the other agent, or to the cloud, with undo built in.
See everything hopsesh does →brew install roeehrl/tap/hopsesh Without Homebrew: curl -fsSL https://raw.githubusercontent.com/roeehrl/hopsesh/main/scripts/install.sh | sh, which checks the download against the release’s checksums and signature.irm https://raw.githubusercontent.com/roeehrl/hopsesh/main/scripts/install.ps1 | iex Same checks as the macOS and Linux script. The Windows app installs this command as well.More ways to install
- Installer for Arm64 Windows 10 or 11 on Arm
- Portable .zip x64 or Arm64, no install, on the release page
- Command line with Scoop from the roeehrl bucket, without the app
scoop bucket add roeehrl https://github.com/roeehrl/scoop-bucket; scoop install hopsesh - Command line only in PowerShell, without the app
irm https://raw.githubusercontent.com/roeehrl/hopsesh/main/scripts/install.ps1 | iex