Export a Claude Code conversation (to Markdown, or the whole transcript)
Claude Code's /export command writes the conversation you are in as a readable text file. The transcript is the saved record behind that conversation: it is not the same file, and /export output cannot be resumed.
The full record for a local CLI session is the JSONL file under ~/.claude/projects: one JSON object per line. This guide covers both, and how to find an old session.
Claude Code keeps local CLI transcripts for 30 days by default; the resume guide covers the sweep and what it deletes.
Checked against the documentation for Claude Code, Codex, Gemini CLI, Qwen Code, OpenCode, GitHub Copilot CLI and Cursor on 27 October 2026.
Status, 27 October 2026: the April 2026 empty-export report is closed. An open report says /export waits for the current turn to finish on v2.1.287 (#99452, open, 4 October 2026), and another says the desktop app's Export transcript action omits messages written after a fork (#95234, open, 17 September 2026). Both are covered below. In GitHub Copilot CLI, an open report says VS Code Copilot Chat cannot open a CLI session file (#2000, open, 12 March 2026).
What `/export` gives you#
Run the export command in the CLI and Claude Code opens a menu: copy the conversation to the clipboard, or save it as a plain-text file. Pass a filename to skip the menu:
/export notes.txtWith a filename it writes there; without one, the save dialog asks where. The output is the current conversation, with messages and tool outputs rendered as readable text. It is a rendering for reading, not the raw JSONL; the docs describe messages and tool outputs, not every internal record, and they do not list what /export leaves out. Auto memory, Claude's notes to itself, is a separate store under projects/<project>/memory/.
In the VS Code extension, the same /export is available from the prompt box, or as Export conversation in the Context section; it requires Claude Code v2.1.280 or later. The desktop app has its own Export transcript action; the desktop documentation checked for this page does not describe it in detail, and an open report covers a case where it omits messages (#95234).
It does not import a conversation back. In Claude Code, /import brings configuration from Codex, Gemini CLI, or Cursor, not a transcript. In the other direction, Codex CLI's /import can bring recent Claude Code chats from the last 30 days into Codex, but it reads Claude Code's local store, not an /export file. For a specific thread outside that window, a handoff file is the reliable route. And /export is not a resume file: claude --resume takes an ID, a name, or a .jsonl path, not the text file.
Why it can be empty, or seem to do nothing#
/export exports the conversation you are in. After /clear, that is a new conversation with empty context; the old one is still in /resume. Export the old one after resuming it, or export before you clear.
If the command is missing, check the surface and version. The VS Code extension needs v2.1.280 or later for Export conversation. claude -p is non-interactive and has no slash-command prompt; use claude -p --output-format json for a structured result, or read the transcript file. The commands reference also notes that availability depends on platform, plan, and environment.
If nothing happens, check whether Claude is still working. An open report on v2.1.287 says /export waits for the current turn instead of running immediately (#99452, open, 4 October 2026). Wait for the turn to finish, then run it again.
An April 2026 report described 0-byte files or empty clipboards on long conversations with large tool outputs. It was closed as not planned on 28 May 2026 (#47014). Update if you are on a version from April 2026; if the output is still empty, the JSONL below is the complete record.
In the desktop app, an open report describes the Export transcript action leaving out every message written after a fork, even though those rows are in the JSONL (#95234, open, 17 September 2026). Reading the file is the workaround.
Get the full transcript from the JSONL file#
Each Claude Code CLI session has one JSONL transcript under ~/.claude/projects/<project>/<session-id>.jsonl. <project> is the working directory path with non-alphanumeric characters replaced by -. If you set CLAUDE_CONFIG_DIR, the tree moves with it. On Windows the root is %USERPROFILE%\.claude.
To find the newest transcript in a project:
ls -lt ~/.claude/projects/*/*.jsonl | headThe newest file is usually the session you just finished. The JSONL is the complete local record: every message, tool call and result, and the request metadata Claude Code wrote. The format is internal and changes between versions, so treat a parser as something to maintain. Copy the file before you edit or move it:
cp ~/.claude/projects/<project>/<session-id>.jsonl ~/claude-session-backup.jsonlBecause it is the same file Claude Code resumes, a copy can be opened with claude --resume /path/to/session.jsonl. That is the route for a transcript you moved from another machine; /export output cannot be resumed.
For a readable text dump without the JSON, this jq command prints the user and assistant text. It drops tool calls and results on purpose:
jq -r '
select((.type == "user" and .isMeta != true) or .type == "assistant")
| .message.content
| if type == "string" then .
else [.[] | select(.type == "text") | .text] | join("\n")
end
' ~/.claude/projects/<project>/<session-id>.jsonlIf the command prints nothing, inspect one line with jq. before changing the filter.
For more than one session, copy the project folder or the whole projects tree. /export writes one conversation at a time; the backup guide covers copying on a schedule.
If you need Markdown#
The docs describe the output as plain text, not Markdown. If you need headings, code fences, and links, convert the JSONL. Claude Code Log is a Python CLI that reads Claude Code transcript files and writes HTML, Markdown, or JSON; its README documents --format md and -o for a single file. That is a third-party tool, not an Anthropic feature, and we have not run it.
A Markdown or HTML copy is easier to share than JSONL, which is the point and the risk. It is a plaintext copy of prompts, code, and tool output. Scrub it before it leaves your machine. The secrets guide covers what tends to end up in these files.
Read and search old sessions#
Start with the session picker. claude --resume or /resume opens it; press / or start typing to filter the list, and press Space to preview a conversation without resuming it. Ctrl+W widens to worktrees (second checkouts of the same repository), Ctrl+A to every project on the machine. The picker is for finding a session, not for reading matches inside one. If you want to know what was said, go to the file.
At the prompt, Ctrl+R searches prompt history, which is a different store: ~/.claude/history.jsonl holds the prompts you typed, with timestamp and project path. It does not hold Claude's replies. The file is kept until you delete it, except under the HIPAA configuration, where each sweep removes entries older than cleanupPeriodDays.
To search the transcripts themselves, run rg over the project tree:
rg -l --glob '*.jsonl' 'idempotency key' ~/.claude/projectsThat returns the files that contain the phrase. The match can come from your prompt, Claude's reply, a command output, or a file Claude read, because rg sees the raw JSON. To read the matching conversation, pass the file to the jq command above.
In the desktop app, Transcript view (Ctrl+O on macOS and Windows) cycles Normal, Thinking, and Verbose. It changes how much detail the open conversation shows; it is a display setting, not a different transcript.
If you want a browser or a searchable archive, two third-party projects are worth knowing. The notes below come from their READMEs, checked on 27 October 2026. Claude Code History Viewer is a desktop app and optional local web server for Claude Code, Codex CLI, OpenCode, and other histories. Its README calls desktop mode local-first, with no upload, analytics, or telemetry; server mode serves the files over HTTP, so keep it on 127.0.0.1 or keep authentication on. Claude Code Log converts transcripts to HTML or Markdown and can serve an archive with full-text search; the README describes local reads and writes, not an upload step. We have not run either tool. Both read the same unencrypted JSONL, and anything they generate is another plaintext copy. Check the repository and release before pointing either at transcripts with secrets.
GitHub Copilot CLI: `/share` writes a copy, the session folder is the record#
Run copilot --version first. /share arrived in 0.0.359 (November 2025), HTML export in 1.0.15, and the no-argument sharing menu in 1.0.100 (19 October 2026); the changelog is at 1.0.104 on 27 October 2026.
Inside a session, the sharing command /share with no argument opens a menu; /export is an alias. The forms that write a file are:
/share file [PATH]writes Markdown. Without a path it savescopilot-session-<session-id>.mdin the current working directory./share html [PATH]writes a self-contained interactive HTML file, with the same default name and an.htmlsuffix./share gistcreates a private gist./share linkpublishes the session on GitHub.com and prints the link;/share offstops sharing it.
The docs describe the export as the content of the current session, meaning your prompts and Copilot's responses. They do not list what it leaves out, so treat the Markdown or HTML as a reading copy. It is not a restore file: copilot --resume takes a session ID, an ID prefix, or an exact name, and does not take a file path. --session-id matches an exact ID only, not a prefix or a name. Keep the session folder if you want to resume.
For a non-interactive run, copilot -p "..." --share=notes.md writes the Markdown to notes.md after the session finishes; with no path, it defaults to ./copilot-session-<session-id>.md. --share-gist creates the gist. Prompt mode exits non-zero when the export fails (1.0.71). On builds before 1.0.85, --share=~/notes.md created a folder named ~ in the working directory instead of writing to your home; update, or pass the quoted absolute path.
If an export is missing earlier turns, check the build. Before 1.0.83 (4 September 2026), --share and --share-gist wrote only the latest run when the session had been resumed; 1.0.83 changed them to write the whole transcript.
The record behind all of this is a folder per session under the session-state directory, ~/.copilot/session-state/, named by the session ID. Inside are events.jsonl — an event log with one JSON object per line for each message, tool call and result — plus workspace artifacts the docs list as plans, checkpoints and tracked files. ~/.copilot/session-store.db is the SQLite index over those folders for checkpoint lookup and search, not the transcript. Both move together if COPILOT_HOME is set.
To find an old session, open the Sessions tab with Tab or /session, press / and type. a cycles the list between local, remote and all sessions, and the tab scans the complete session store rather than the recent list in the sidebar. /resume opens the picker; s cycles its sort order, including last used, created and name. /chronicle search authentication searches session content directly — the docs describe it as a keyword search, not a semantic one. To search the raw files:
rg -l 'idempotency key' ~/.copilot/session-stateThat finds the session folder, not a readable line. Resume it and run /share file for the readable copy. The event names and payloads in events.jsonl are internal and have changed between releases: a strict schema check rejected older compaction events in 1.0.35-3, and the issue was closed on 23 April 2026 with a reply saying 1.0.35-4 fixed it (#2899, closed). Don't build a parser you can't maintain.
Copilot CLI sessions are also synced to your GitHub account by default, subject to your organization's policy, so the local folder is not the only copy. The session data page covers what syncs and who can see it; the backup guide covers copying and restoring the local store.
Gemini CLI: `/chat share` writes Markdown or JSON#
Run gemini --version first. This section describes v0.65.0, the stable release at the time of writing (released 20 October 2026).
Inside a session, the share command writes the current conversation to a file. /chat share notes.md and /resume share notes.md are the same command; the extension picks the format:
.mdwrites a readable transcript, with each turn under a role heading and tool calls and responses as JSON blocks..jsonwrites the chat history as a JSON array.- With no filename, it writes
gemini-conversation-<timestamp>.jsonin the current directory.
Only .md and .json are accepted. Another extension returns "Invalid file format", and an empty conversation returns "No conversation found to share."
The export is a copy of the conversation as the CLI holds it, not the session file. It is not a restore file, and there is no import command for it: gemini --resume reads the JSONL under ~/.gemini/tmp/<project-id>/chats/, and gemini --session-file <path> imports a session file, not a /chat share export.
That JSONL is also the fuller record. Its first line is a metadata record with the session UUID, project hash and start time; the lines after it are messages, tool activity and token counts. To find the newest transcript in any project, and to search the transcript text:
ls -lt ~/.gemini/tmp/*/chats/*.jsonl | head
rg -l 'idempotency key' ~/.gemini/tmp/*/chatsThe resume guide covers the project ID, the picker, and why a resume can remove the file you meant to keep.
Qwen Code: `/export` writes HTML unless you ask for another format#
Run qwen --version first. This section describes 0.26.x; v0.26.2 was the stable release on 27 October 2026.
The export command is /export [md|html|json|jsonl] [path]. A bare /export writes HTML; add md, json or jsonl for another format. The second argument is an output directory, not a filename, and it has to sit inside the project's working directory. Qwen creates the directory if it is missing and writes qwen-code-export-<timestamp>.<extension> into it, so /export md notes.md creates a directory named notes.md rather than a file by that name (source, checked at commit 32f6713).
The HTML file is not self-contained. It loads the renderer and stylesheet for that exact Qwen Code version from unpkg.com, so an offline machine, or a build that was never published there, shows a load error. Markdown, JSON and JSONL are self-contained.
/export reloads the current session from its JSONL before it writes, so it also fails when there is no transcript to read. The general.chatRecording setting is on by default; turning it off also stops --continue and --resume. If /export says "No active session found to export" while you are in a session, check that setting.
The full record is ~/.qwen/projects/<sanitized-cwd>/chats/<session-id>.jsonl (session data). <sanitized-cwd> is the absolute working directory with every character that is not a letter or digit replaced by -; on Windows it is also lowercased (source). QWEN_HOME or QWEN_RUNTIME_DIR can move the tree, so ask the CLI for the path instead of assuming ~/.qwen:
qwen sessions list --json --limit 50Each JSON line has sessionId, startTime, mtime, prompt, gitBranch, customTitle, titleSource, filePath and cwd (commands). The listing is directory-scoped: qwen sessions list reads the store for the working directory you run it in, so cd back to the directory where the session was started when the list is empty. qwen sessions ps is a different command: it lists live and managed session records on the machine, not saved history.
To find the newest file, or search the raw records:
ls -lt ~/.qwen/projects/*/chats/*.jsonl | head
rg -l 'idempotency key' ~/.qwen/projects/*/chatsThe raw file is what the CLI resumes, and its record format is internal; do not build a parser you cannot maintain. A copy of it is a backup. /export output is a reading copy and cannot be imported. qwen --resume <session-id-or-title> reads the current project's store, not a path (resume docs), and the picker filters as you type; Space previews the transcript without resuming the session (source).
One surface-specific limit: the Web Shell and the daemon API refuse to index a transcript over 256 MiB, with an error beginning Transcript snapshot for session <id> is too large to index, while the CLI's /export reads the file directly. An open report describes long sessions reaching that limit through file-history snapshots and UI telemetry rather than conversation text (#13113, open, 30 September 2026). Export from the CLI before a session gets that large, and keep the JSONL.
Cursor: Share makes a link, Export Transcript makes a reading copy#
Run Cursor → About Cursor first. Checked against Cursor's documentation and release notes for 3.27 on 27 October 2026. Export Transcript is not documented; the details below come from a Cursor staff reply.
Share is the documented route, and it makes a link, not a file. The Share icon in the chat header creates a Team share link for signed-in team members or a Public share link for anyone who has it. The Help page says the full conversation is shared, including code snippets, tool calls and their results, and that redaction of known secret patterns is best effort. Shared transcripts are Teams and Enterprise only (Enterprise defaults to Team links), are not available in No Storage privacy mode, and are limited to 50 shares a day. A link is not a backup you control; the delete guide covers deleting it from the dashboard's Shared Transcripts tab.
Export Transcript is the local reading copy. Cursor's documentation does not describe the action; a Cursor staff reply in #150214 (21 May 2026, Cursor 2.4.21 and later) says thinking blocks and collapsed items such as terminal input/output and tool calls are left out on purpose because they are not chat messages. Text replies and file changes should be there. Compare the file with the chat before treating it as complete.
Neither is a restore file. Cursor's docs describe no import for an exported transcript, and a share link is a copy for someone else, not a restore of your chat. The full local record is the JSONL transcript that staff replies and reports place under ~/.cursor/projects/<encoded-path>/agent-transcripts/ (#162757, 10 June 2026); that path is staff-reported, not documented, so check it on your build. The Cursor chat history guide covers the workspace identity and the index behind the sidebar; the backup guide covers copying both.
Codex and OpenCode, briefly#
The Codex CLI has its own export command. It writes the complete conversation as Markdown; /export session.md saves directly to a file, and without a filename it offers Copy to clipboard or Save to file. Wait for the current turn to finish before exporting. Codex CLI sessions live under $CODEX_HOME/sessions; resume a Codex session covers the store and the picker.
OpenCode's command depends on the version. Run opencode --version: 1.x is V1 and 2.x is V2. V1 uses opencode export [sessionID]; V2 uses opencode session export <id>. Both write JSON to standard output, and both accept --sanitize to redact sensitive transcript and file data. Redirect the output to a file:
opencode session export ses_abc123 > session.jsonV1 imports with opencode import <file>; V2 uses opencode session import <file> and can import from a URL. Import takes JSON, not Markdown. The V1 TUI writes the current conversation as Markdown when you run /export, and opens it in $EDITOR; the CLI export above is JSON. V2's TUI lists an Export session action (<leader>x, "Export session to editor"), but its docs do not state the format. Resume an OpenCode session covers where the database lives and how to find the ID.
Where to go next#
- Resume a Claude Code session — the picker, retention, and what a resumed transcript restores.
- Back up coding-agent sessions — a copy that survives the sweep.
- Delete session history — remove sessions on purpose, including what the vendor keeps.
- What agent memory tools capture — what tends to end up in a transcript.
- Where did my Copilot CLI session go? — the picker, the store, and what makes a session disappear.
- Where did my Cursor chat go? — workspace history, the Agents Window, forks and the separate CLI history.
- Claude Code guides — the rest of the set.
- GitHub Copilot CLI guides — instructions, sessions, permissions and hooks.
- Gemini CLI guides — instructions, sessions, permissions and hooks.
- Qwen Code guides — instructions, sessions, permissions and hooks in the Gemini CLI fork.