Codonic

hopsesh guide · Claude Code

How to export and import a Claude Code conversation

/export makes a document, the .jsonl is the session. What exists for importing, where each way stops, and moving the session to another computer or into Codex.

Export a Claude Code conversation

Inside a session, run:

/export

It opens a menu to copy the conversation to the clipboard or save it as a plain-text file, with messages and tool output rendered as readable text. /export notes.txt skips the menu and writes straight to that file.

That’s a document, not a session. Good for a bug report, a code review, keeping a record, or pasting into a chat.

For scripts, Claude Code’s documentation points elsewhere, because the transcript format is internal and changes between versions:

  • claude -p --resume <id> --output-format json "summarize what we changed" asks an existing session a question and returns JSON.
  • Hooks and status line commands receive the session’s transcript_path; a SessionEnd hook can archive it.
  • The Agent SDK gives you each message as it happens.

The real export: the .jsonl

The complete conversation, every message, tool call and result, is the transcript file Claude Code writes as you go:

~/.claude/projects/<project>/<session-id>.jsonl

<project> is the working directory with every character that isn’t a letter or digit replaced by -, such as -Users-alice-src-webapp. Copy that file and you have the session, ready to resume. Where Claude Code and Codex store sessions covers the side folders and the 30-day cleanup.

Is there an import?

Not as a command. Claude Code’s documentation describes no importer, for its own exports or for another agent’s sessions. What exists:

Resume a transcript file directly

claude --resume takes the absolute path of a .jsonl file and resumes the session stored there:

claude --resume /Users/alice/Downloads/<id>.jsonl

That’s the closest thing to an import of a session someone, or another computer, gave you. It doesn’t change the file: the working directory and every path in it stay what they were where the session ran.

Put the file where Claude Code looks

Copy the .jsonl into ~/.claude/projects/<project>/ for the repository’s path on this computer, and claude --resume <id> and the picker find it. Keep exactly one copy: if an id turns up in two other project folders, Claude Code reports No conversation found with session ID rather than pick one.

Start fresh from the export

Paste the /export text, or better a summary of it, into a new session: “Here’s where we got to in an earlier session. Continue from here.” It always works, but the new session has a different id and knows only what you pasted, and a long paste costs context on every request.

Import Claude Code chats into Codex

Codex has an importer for this direction. In a local Codex CLI session, type /import, choose Claude Code and pick the setup, project files and recent chats; the CLI imports up to 50 chats from the last 30 days, and the ChatGPT desktop app has the same under Settings › Import. It reads the Claude Code data on the computer it runs on, and it only goes into Codex. Continue a Claude Code session in Codex covers what survives.

Why a straight copy often isn’t enough

Copying the .jsonl to another computer is where it gets fiddly:

  • Wrong folder. Filed under the old computer’s path, claude --continue says No conversation found to continue. See “No conversation found” after copying.
  • Old paths inside. Every tool call names absolute paths from the old computer. If the username or repository location differs, Claude starts out in a folder that doesn’t exist here.
  • Missing code. The conversation refers to commits and files; push and pull them first.
  • Drift. Keep using the original and you have two different conversations with one id.
  • Secrets. Transcripts often hold tokens you pasted or a tool printed. Read before you send one to anyone.

Move the session instead

hopsesh is a free, open-source command-line tool, terminal UI and app for macOS and Windows that moves the session itself between your computers over SSH, or converts it for Codex, instead of exporting text:

hopsesh plan studio:"fix flaky tests"             # what would happen; changes nothing
hopsesh pull studio:"fix flaky tests"             # move it here
hopsesh pull studio:"fix flaky tests" --in codex  # or continue it in Codex
hopsesh pull studio:"fix flaky tests" --redact    # redact likely secrets in the copy

It installs the copy under the folder name Claude Code expects, rewrites the paths for this computer without touching ids or signed thinking blocks, brings the repository to the session’s commit and prints the command to continue. It scans for likely secrets while moving, and --redact masks them in the copy. Continued in Codex, the plan shows a loss report first, and hopsesh pull <id> --in claude later adds only the new work back to the original.

hopsesh has no server and no telemetry, and never calls the Anthropic or OpenAI API. It is alpha software, and an independent project, not affiliated with Anthropic or OpenAI.

Exporting and importing

How do I export a Claude Code conversation?

Run /export in the session to copy it to the clipboard or save it as a plain-text file; /export <file> writes straight to a file. For scripts, use claude -p --resume <id> --output-format json, or the transcript_path that hooks receive.

Can I import a conversation into Claude Code?

There is no import command. claude --resume takes the absolute path of a session’s .jsonl file and resumes it, or you can copy the file into ~/.claude/projects for the repository’s path. An /export text file can only be pasted into a new session.

How do I import Claude Code chats into Codex?

In a local Codex CLI session, type /import and choose Claude Code; it imports up to 50 chats from the last 30 days on that computer. The ChatGPT desktop app has the same under Settings › Import.

Is it safe to share an exported conversation?

Read it first. Transcripts often hold tokens you pasted or a tool printed. hopsesh scans for likely secrets when it moves a session, and --redact masks them in the copy.

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 →
Install the CLI Terminal macOS and Linux · Command line and terminal UI 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.
Install the CLI Terminal Windows, in PowerShell · Command line and terminal UI 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.
hopsesh for Mac .dmg macOS app · macOS 13 or later · Apple silicon and Intel Download Signed and notarized by BlueGuru LLC. Updates itself from Settings → Updates.
hopsesh for Windows .exe Windows app · Windows 10 or 11 · x64 Download Not code-signed yet: at SmartScreen, click More info, then Run anyway. Smart App Control, if on, blocks it.
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
Linux packages and all files GitHub Latest release · .deb, .rpm and .apk for amd64 and arm64, a portable Windows app .zip, plus archives Open on GitHub Release notes, checksums and every build of the current version. Source on GitHub GitHub Apache-2.0 · Go 1.26 or later to build Open on GitHub From source: go install github.com/roeehrl/hopsesh/cmd/hopsesh@latest