Export AI agent session logs to Markdown, HTML, JSON, plain text, CSV, or your own template — in milliseconds.
Works with OpenAI Codex, Claude Code, Aider, Continue, and any agent that writes .jsonl session logs.
# Export a Codex session to Markdown
codex-export session.jsonl
# Export a Claude Code session to HTML
codex-export -f html -o report.html session.jsonl
# Just the conversation — no tool noise
codex-export --include user_message,agent_message session.jsonlAI coding agents write everything to local .jsonl logs, but reading them raw is painful. codex-export turns them into something useful:
- Switch agents without losing context — export your Codex session to Markdown, paste it as context when switching to Claude Code, Aider, or any other agent
- Share sessions with your team as readable HTML reports
- Search and filter — find every time the agent touched a specific file, or extract only the conversation turns
- Archive long sessions — compress a multi-hour session into a clean summary
- Feed into other tools — output JSON or CSV for analysis, or pipe to
grep,jq,fzf
| Agent | Log location | Notes |
|---|---|---|
| OpenAI Codex | ~/.codex/sessions/ |
Full support |
| Claude Code | ~/.claude/projects/ |
Full support |
| Aider | .aider.chat.history.md / .jsonl |
JSONL sessions supported |
| Continue | ~/.continue/ |
JSONL sessions supported |
Any agent writing .jsonl |
— | Works if format matches |
From source (requires Go 1.22+):
git clone https://github.com/ezyyeah/codex-export
cd codex-export
go build -o codex-export .
mv codex-export /usr/local/bin/No runtime dependencies. Single static binary.
# Markdown to stdout
codex-export session.jsonl
# HTML report
codex-export -f html -o report.html session.jsonl
# Conversation only (great for pasting into a new agent session)
codex-export --include user_message,agent_message session.jsonl
# Pipe-friendly
cat session.jsonl | codex-export -f txtExport your session as plain text and paste it as context when you start a new agent session:
codex-export --include user_message,agent_message session.jsonl | pbcopyNow open Claude Code (or any other agent) and paste — it has the full conversation history.
codex-export -f html -o session-report.html session.jsonlStandalone HTML with dark mode, collapsible tool call sections, and print-friendly CSS. Share with teammates or clients.
codex-export -o ~/exports/ --filename '{date}-{name}.{ext}' ~/.codex/sessions/One .md file per session, named by date.
codex-export stats ~/.codex/sessions/**/*.jsonl | grep "components/Button"# JSON for jq
codex-export -f json session.jsonl | jq '.[] | select(.type == "user_message") | .message'
# CSV for spreadsheet analysis
codex-export -f csv session.jsonl > session.csvcodex-export watch session.jsonlStreams new events to stdout as the agent writes them — useful for monitoring a long-running session.
| Format | Flag | Description |
|---|---|---|
| Markdown | md (default) |
GFM with collapsible tool call blocks |
| Plain text | txt |
Clean, readable anywhere |
| HTML | html |
Standalone with dark mode CSS |
| JSON | json |
Structured array of normalised events |
| CSV | csv |
timestamp,type,name,message,file_path,output |
| Template | template |
Your own Go template |
Usage:
codex-export [flags] [files...]
codex-export [command]
Flags:
-o, --output string Output: "-" stdout, file path, or "dir/" for batch
-f, --format string md|txt|json|html|csv|template (default "md")
--filename string Batch filename pattern (default "{name}.{ext}")
Variables: {name} {date} {time} {datetime} {id} {ext} {n}
--include strings Event types to include (comma-separated)
--exclude strings Event types to exclude (comma-separated)
--filter string Regex filter on event content
--from string Start time: RFC3339 | 2006-01-02 | 2h | 30m | 7d
--to string End time (same formats)
--max-chars int Truncate messages at N chars (0 = unlimited)
--max-tool int Truncate tool output at N chars (default 3000)
--no-tool-output Omit tool call outputs
--no-reasoning Omit reasoning/thinking blocks
--no-files Omit file-edit annotations
--timestamps Include timestamps in output
--merge Merge all inputs into one output
-q, --quiet Suppress progress output
# Only conversation turns (user + agent)
codex-export --include user_message,agent_message session.jsonl
# Strip all tool noise
codex-export --exclude function_call,function_call_output,reasoning session.jsonl
# Search for a keyword across events
codex-export --filter "authentication" session.jsonl
# Last 2 hours only
codex-export --from 2h session.jsonl
# Specific date range
codex-export --from 2026-05-23 --to 2026-05-24 session.jsonl
# Truncate long outputs for a compact summary
codex-export --max-chars 300 --no-tool-output session.jsonlcodex-export stats session.jsonl
codex-export stats --json *.jsonlShows: event counts, user/agent message counts, tool calls, duration, all tools used, files edited, full type breakdown.
codex-export list # defaults to ~/.codex/sessions
codex-export list ~/.codex/sessions/2026Lists .jsonl files sorted by modification time with sizes.
codex-export watch session.jsonl # stream to stdout
codex-export watch -f txt -o live.txt --interval 1s session.jsonlcodex-export completion fish | source
codex-export completion zsh > ~/.zsh/completions/_codex-export| Variable | Value |
|---|---|
{name} |
Source filename without extension |
{date} |
Date of first event (2026-05-23) |
{time} |
Time of first event (15-04-05) |
{datetime} |
2026-05-23T15-04-05 |
{id} |
UUID from filename (if present) |
{ext} |
Format extension (md, html, …) |
{n} |
Sequential index (1-based) |
Write any output format with a Go template:
codex-export --format template --template my.tmpl session.jsonlTemplate data:
.Events []*Event filtered events
.EventCount int
.GeneratedAt time.Time
Each Event: .Timestamp .Type .Message .Name .FilePath .Output .Arguments .File
Built-in functions: truncate shortPath upper lower trim join replace hasPrefix hasSuffix contains formatTime isUser isAgent isTool isFileEdit isReasoning codeBlock
Example:
{{range .Events}}{{if isUser .}}**You:** {{truncate .Message 300}}
{{else if isAgent .}}**Agent:** {{truncate .Message 300}}
{{end}}{{end}}
user_message agent_message agent_reasoning
reasoning function_call function_call_output
task_complete task_start error
Run codex-export types to print this list.
MIT