Skip to main content

export_codex_chats

Export local Codex CLI sessions to a standalone HTML transcript.

The generated HTML includes:

  • user prompts
  • agent responses
  • visible error events
  • tool invocations and outputs
  • Markdown rendering
  • syntax-highlighted code blocks
  • client-side dark/light mode toggle
  • client-side show/hide tools toggle

Installation

pip install .

For development:

pip install ".[dev]"

Usage

export_codex_chats SESSION_UUID
export_codex_chats SESSION_UUID --dark
export_codex_chats SESSION_UUID --title "Shrinking review"
export_codex_chats SESSION_UUID -o existing_exports/
export_codex_chats SESSION_UUID -o report.html
export_codex_chats SESSION_UUID --from-msg 10 --to-msg 25
export_codex_chats SESSION_UUID --show-tools --collapse-codes
export_codex_chats SESSION_UUID --no-tools
export_codex_chats SESSION_UUID --plain-path
export_codex_chats --version
export_codex_chats

If SESSION_UUID is omitted, the tool opens an interactive selector showing recent local Codex sessions.

By default, the exporter reads sessions from ~/.codex/sessions/. It also uses ~/.codex/history.jsonl to derive friendlier session labels for interactive selection when they are available.

Useful options:

  • --title TITLE: use an explicit page title instead of Codex chat <UUID>
  • --from-msg N: export starting at message N
  • --to-msg N: export ending at message N
  • --plain-path: print the saved file as a plain path instead of a file:// URI
  • --dark: start in dark mode
  • --show-tools: make tool boxes visible on initial page load
  • --no-tools: omit tool invocations and outputs from the export entirely
  • --collapse-codes: collapse code blocks on initial page load
  • --version: print the installed version and exit

When --no-tools is used, tool cards are not written into the HTML at all, the tool-visibility button is omitted from the header, and visible message numbers are compacted to match the exported transcript. Each card still keeps its original transcript number in hidden metadata for stable internal reference.

Output path rules:

  • Omit --output to write <session_id>.html in the current directory.
  • If --output names an existing directory, the export is written there as <session_id>.html.
  • Otherwise, --output must be an explicit file path with an extension, and its parent directory must already exist.
  • The exporter does not create directories.

By default, the command prints the saved file as a file:// URI rather than a plain path. That makes the result clickable in many terminals while still being easy to copy and paste. Use --plain-path if you prefer the raw filesystem path for scripts or shell composition.

Development

Run the test suite from the repository root with:

./run_tests.sh

In CI-style environments, USE_INSTALLED_PACKAGE=1 makes the tests run against an installed package instead of directly from the checkout.

Remove generated artifacts with:

./clean.sh

Run the static checks with:

ruff check .
pyright

Build and verify release artifacts with:

python -m build --no-isolation
python -m twine check dist/*

Build OS packages with:

./package_os.sh

Note: installing the sdist in an isolated build environment may download the build backend (hatchling). For offline checks, preinstall the build backend and use --no-build-isolation.

OS Packages

This repository includes a helper for building .deb and .rpm packages using fpm.

The exporter intentionally does not try to generate an AI-derived title. If you want help naming a session, a simple workaround is to resume the chat with Codex and ask it for a concise title, then pass that title explicitly with --title.

Requirements:

  • fpm
  • dpkg-deb
  • rpmbuild
  • python -m build

The script builds a wheel, stages it into pkgroot/usr/, and emits both package formats into os-packages/.

The generated OS packages use distro-native Python package dependencies:

  • python3-markdown
  • python3-prompt-toolkit
  • python3-pygments

along with the base python3 runtime.

Metadata

Release files for export_codex_chats 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for export_codex_chats 1.0.2
File Size Uploaded Provenance Actions
export_codex_chats-1.0.2.tar.gz 39.5 kB Without provenance Details for export_codex_chats-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for export_codex_chats 1.0.2
File Interpreter ABI Platform Actions
export_codex_chats-1.0.2-py3-none-any.whl Python 3 none any Details for export_codex_chats-1.0.2-py3-none-any.whl

Total release size: 64.2 kB

Release files / export_codex_chats-1.0.2.tar.gz

Download URL export_codex_chats-1.0.2.tar.gz
Size 39.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f0ddeba814634c243bc2b26857a95dd8fa099cfc201fd6185ed706464e59ccda
BLAKE2b-256 checksum
How to use checksums
be192573e983b2ce18a0c8f645ea405fd11b8676390beab75c51eac048590b41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.16.5 cpython/3.14.3 HTTPX/0.28.1

Release files / export_codex_chats-1.0.2-py3-none-any.whl

Download URL export_codex_chats-1.0.2-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae97547020ea094daa9cf01a0cdfb8f373eab317175b620e2f65bb17ec59962c
BLAKE2b-256 checksum
How to use checksums
3a09b0d31406aa6b5133b9489617f92dd128fc5a99bd314f2d7e7b63f29b107d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.16.5 cpython/3.14.3 HTTPX/0.28.1

Security for export_codex_chats 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page