codex-export
v0.1.0
Published
Export OpenAI Codex CLI sessions into human-readable Markdown, HTML, and JSON documents.
Maintainers
Readme
codex-export
codex-export exports OpenAI Codex CLI sessions from ~/.codex/sessions into readable Markdown, HTML, or JSON.
It is designed for engineering worklogs, retrospectives, GitHub discussions, Notion or Feishu docs, internal reports, and long-term archives of AI-assisted development.
Features
- Interactive terminal UI with fuzzy session search, arrow navigation, pagination, and latest-first sorting
- Command mode for scripts and CI workflows
- Markdown, HTML, and JSON output
- Clean conversation, full conversation, tool-call, and tool-result scopes
- Automatic session discovery from
~/.codex/sessions/**/*.jsonl - Secret redaction for API keys, bearer tokens, authorization headers, AWS credentials, and common
.envvalues - Session statistics and heuristic AI-worklog summary
- Batch exports, daily reports, weekly reports, and timeline reports
Install
npm install
npm run build
npm linkNode.js 20 or newer is required.
Interactive Usage
codex-exportThe interactive flow asks for:
- Session
- Export format
- Content scope
- Output location
Command Usage
codex-export --list
codex-export --last --output report.md
codex-export --id SESSION_ID --format html --output report.html
codex-export --file session.jsonl --format json --with-tool-results
codex-export --last --full --output full-session.md
codex-export --all --output exports
codex-export --daily --output daily.md
codex-export --weekly --with-tools --output weekly.md
codex-export --timeline --output timeline.mdContent Scopes
--clean: user and assistant conversation with internal metadata and noisy output removed- default command mode: same as
--clean --full: fuller user and assistant conversation with secrets redacted--with-tools: conversation plus tool calls and commands--with-tool-results: conversation plus tool calls and sanitized tool results
Interactive mode also exposes "Full Conversation"; the current parser still excludes system and developer instructions from exports to avoid leaking internal prompt context.
Output Formats
Markdown is the default:
codex-export --last --format md --output docs/codex-session.mdHTML:
codex-export --last --format html --output docs/codex-session.htmlJSON:
codex-export --last --format json --with-tool-results --output docs/codex-session.jsonDevelopment
npm install
npm run typecheck
npm testThe tests use Node's built-in test runner and import the compiled ESM output from dist.
Publish to npm
- Create an npm access token with publish permission.
- In GitHub repo settings, add
NPM_TOKENin Settings → Secrets and variables → Actions. - Bump
package.jsonversion (npm version patch|minor|major) before each release. - Publish from local:
npm run prepublishOnly
npm publish- Or publish from GitHub by creating and publishing a Release (triggers
.github/workflows/publish-npm.ymlviarelease.published). - If needed, manually trigger the same workflow from Actions → Publish to npm → Run workflow (
workflow_dispatch).
The publish workflow validates that package.json version is not already on npm before running npm publish.
Example
See examples/session.sample.jsonl for a minimal Codex session fixture.
