Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

codex-exporter

Export Codex session rollout files (rollout-*.jsonl) to Markdown or HTML.

Features

  • Scans the Codex sessions directory for exportable sessions.
  • By default, only lists and exports sessions matching the current working directory (cwd); use -all to disable this filter.
  • Opens the interactive session picker by default; use -last or -session-id to skip it.
  • By default, exports only user messages and the assistant final reply (final / final_answer).
  • Markdown exports use codex-exporter HTML comments as stable session/message boundaries instead of ### User / ### Assistant headings.
  • Internal <oai-mem-citation> blocks are stripped from exported assistant text.
  • HTML is the default output format; use -format markdown to export Markdown.
  • HTML exports include a local "Download Markdown" button for saving the same transcript as .md.
  • Use -full to export the complete conversation (including non-final assistant phases) and include full metadata at the top of the export.
  • Default output file is ./codex-session-<session-id>.html; Markdown exports use .md; existing files require -force to overwrite.

Requirements

  • Go 1.24.2 or later (as defined in go.mod).

Install and Run

Option 1: Install to local Go bin

go install github.com/faceair/codex-exporter@latest
codex-exporter

Option 2: Run directly

go run .

Option 3: Build then run

go build -o codex-exporter .
./codex-exporter

CLI Options

The following options are aligned with go run . -h:

Flag Type Default Description
-all bool false Show all sessions (disable current-cwd filter)
-force bool false Overwrite an existing output file
-format string html Output format: html / htm or markdown / md
-full bool false Export full conversation (include non-final assistant phases)
-last bool false Export latest session without picker
-output string empty Output file path
-session-id string empty Export by session ID without picker
-sessions-dir string ~/.codex/sessions Codex sessions directory

Usage Examples

# Interactively select a session for the current directory and export it
go run .

# Show sessions from all directories, then select one
go run . -all

# Export the latest session directly as HTML
go run . -last

# Export a specific session ID to a fixed file path and allow overwrite
go run . -session-id 11111111-1111-1111-1111-111111111111 -output ./session.html -force

# Export the latest session as Markdown
go run . -last -format markdown

# Export the full conversation (including non-final assistant phases)
go run . -last -full

Testing

go test ./...

Release CI

Release builds are triggered by pushing tags that match v*.

License

MIT. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages