Skip to content

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

codex-export

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.jsonl

Why

AI 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

Supported agents

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

Install

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.


Quick start

# 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 txt

Use cases

Switch from Codex to Claude Code (or vice versa)

Export 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 | pbcopy

Now open Claude Code (or any other agent) and paste — it has the full conversation history.

Export a readable HTML report

codex-export -f html -o session-report.html session.jsonl

Standalone HTML with dark mode, collapsible tool call sections, and print-friendly CSS. Share with teammates or clients.

Archive your entire sessions directory

codex-export -o ~/exports/ --filename '{date}-{name}.{ext}' ~/.codex/sessions/

One .md file per session, named by date.

Find sessions where a specific file was edited

codex-export stats ~/.codex/sessions/**/*.jsonl | grep "components/Button"

Feed into another tool

# 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.csv

Live export a running session

codex-export watch session.jsonl

Streams new events to stdout as the agent writes them — useful for monitoring a long-running session.


Formats

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

All flags

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

Filtering examples

# 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.jsonl

Subcommands

stats — session analytics

codex-export stats session.jsonl
codex-export stats --json *.jsonl

Shows: event counts, user/agent message counts, tool calls, duration, all tools used, files edited, full type breakdown.

list — browse sessions

codex-export list                          # defaults to ~/.codex/sessions
codex-export list ~/.codex/sessions/2026

Lists .jsonl files sorted by modification time with sizes.

watch — live export

codex-export watch session.jsonl                        # stream to stdout
codex-export watch -f txt -o live.txt --interval 1s session.jsonl

completion — shell autocomplete

codex-export completion fish | source
codex-export completion zsh > ~/.zsh/completions/_codex-export

Filename pattern variables

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)

Custom templates

Write any output format with a Go template:

codex-export --format template --template my.tmpl session.jsonl

Template 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}}

Event types

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.


License

MIT

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages