Export Codex session rollout files (rollout-*.jsonl) to Markdown or HTML.
- Scans the Codex sessions directory for exportable sessions.
- By default, only lists and exports sessions matching the current working directory (
cwd); use-allto disable this filter. - Opens the interactive session picker by default; use
-lastor-session-idto skip it. - By default, exports only user messages and the assistant final reply (
final/final_answer). - Markdown exports use
codex-exporterHTML comments as stable session/message boundaries instead of### User/### Assistantheadings. - Internal
<oai-mem-citation>blocks are stripped from exported assistant text. - HTML is the default output format; use
-format markdownto export Markdown. - HTML exports include a local "Download Markdown" button for saving the same transcript as
.md. - Use
-fullto 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-forceto overwrite.
- Go
1.24.2or later (as defined ingo.mod).
go install github.com/faceair/codex-exporter@latest
codex-exportergo run .go build -o codex-exporter .
./codex-exporterThe 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 |
# 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 -fullgo test ./...Release builds are triggered by pushing tags that match v*.
MIT. See LICENSE.