BuildGist

How do I export a Claude Code conversation?

Kayvan Zahiri ·

Type /export in Claude Code. It opens a menu to copy the current conversation to your clipboard or save it as a plain-text file, with messages and tool output rendered as readable text. Add a filename, as in /export auth-task.txt, to skip the menu and write the file directly. The raw session is also on disk as JSONL under ~/.claude/projects/, kept for 30 days by default. With BuildGist, each meaningful run is also explained in plain English in your Inbox, so you can share what changed without the whole transcript.

BuildGist is a Mac app for Claude Code, Cursor and Codex. Download for Mac.

1. Export the conversation you are in

/export
/export auth-task.txt

The first opens the menu: copy to clipboard, or save to a file. The second writes auth-task.txt straight away. The export is meant for a person to read. To export an older conversation, resume it first with claude --resume, which opens the session picker, then type /export.

Read it before you share it

The export includes tool output as well as messages, so it can hold whatever a command printed or a file contained: an environment variable, a token in a config file, a customer's data in a test fixture, an internal hostname. Search the file for keys and addresses before you paste it into an issue, a pull request or a chat. If you only need to show what changed, the diff and a short summary are smaller and safer than the whole conversation.

Claude Code's desktop app, claude.ai/code and the VS Code extension each keep their own session list. The commands on this page are the CLI's.

2. Find the raw transcript

Claude Code saves every session as it goes, one JSONL file per session:

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

<project> is your working directory's path with every character that is not a letter or digit replaced by -. Each line is one JSON entry: a message, a tool call or result, or metadata. Anthropic notes the format is internal and changes between releases, so a script that parses these files can break on any update. Claude Code session history covers browsing and resuming them.

3. Keep it longer than 30 days

Transcripts are cleaned up after 30 days by default. To keep them longer, set cleanupPeriodDays in settings.json. CLAUDE_CONFIG_DIR moves that storage off ~/.claude. For a single conversation you need to keep, /export it to a file you own.

4. Export for a script

For structured output instead of readable text, ask the session a question and read the answer as JSON:

claude -p --resume <session-id> --output-format json "summarize what we changed" | jq -r '.result'

Hooks and status line commands also receive a transcript_path field, so a SessionEnd hook can archive each transcript when the session ends.

Moving the conversation to another agent

Another agent does not need the whole transcript, and a long one costs it context. Give it the task instead: what you asked for, what is done, what failed, and the next step. Codex can also import Claude Code chats directly: /import in a local Codex CLI session brings up to 50 chats from the last 30 days. With BuildGist, start a new chat in Cursor or Codex in the same project and choose Continue on the card. The new chat starts with the task's context in your own words; Start fresh hands nothing over. Resume an agent session in another tool has both ways.

Questions

How do I export a Claude Code conversation to a file?

Type /export followed by a filename, for example /export auth-task.txt. Claude Code writes the conversation to that file as readable plain text. Plain /export opens a menu to copy it to the clipboard or save it.

Where does Claude Code store conversations?

As JSONL files at ~/.claude/projects/<project>/<session-id>.jsonl, where the project folder name is your working directory's path with other characters replaced by dashes.

How long does Claude Code keep conversation history?

30 days by default. Set cleanupPeriodDays in settings.json to change it, or export the conversations you want to keep.

Can I open an exported conversation in Claude Code again?

The /export text is for reading. To continue a session, resume its transcript instead: claude --resume with the session's name or ID, or with the absolute path to its .jsonl file.

Sources

What you need

Codex needs you to approve BuildGist once, in Codex. BuildGist shows the steps. Setup is in Getting started.

To explain a run, your computer sends BuildGist what that run needs, and BuildGist passes it to Anthropic. BuildGist does not keep this material. It does not send your whole repository, files the run did not change, or files named like secrets, such as .env files and keys. It keeps the explanation and short cited excerpts of changed code, at most 12 lines each. Secret masking is best-effort. Privacy has the full list.

Every account gets 7 days of BuildGist Pro free, with no card. The 7 days start at your first explanation or Continue handoff. Nobody is charged when the trial ends. After that, BuildGist Pro is $12 per month, plus any applicable tax shown at checkout. See pricing.

Try BuildGist Download for Mac

Apple silicon, macOS 12 or later. United States, 18 or older.

Related

Questions: kayvanandre@gmail.com.