Export Codex chat sessions as standalone HTML transcripts.
Project description
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
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 ofCodex chat <UUID>--from-msg N: export starting at messageN--to-msg N: export ending at messageN--plain-path: print the saved file as a plain path instead of afile://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
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
--outputto write<session_id>.htmlin the current directory. - If
--outputnames an existing directory, the export is written there as<session_id>.html. - Otherwise,
--outputmust 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:
fpmdpkg-debrpmbuildpython -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-markdownpython3-prompt-toolkitpython3-pygments
along with the base python3 runtime.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file export_codex_chats-1.0.0.tar.gz.
File metadata
- Download URL: export_codex_chats-1.0.0.tar.gz
- Upload date:
- Size: 39.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.14.3 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
158b8ed9061592961071fc391fecc3bf7ec8d641bb1c002207c28f42fd504153
|
|
| MD5 |
cc0559526d215e98ccc80faa63024748
|
|
| BLAKE2b-256 |
affd43eab09a83d033eb1258a9c45339de5ea7da9b7cc1f64db4c8595715d545
|
File details
Details for the file export_codex_chats-1.0.0-py3-none-any.whl.
File metadata
- Download URL: export_codex_chats-1.0.0-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.14.3 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e38a77300124d15befc17790b6bcfd1a3eb0adc4b8086d9cc2e2c5cf4651c786
|
|
| MD5 |
5c6ef07dbc365a624b787cd6bcfe53dd
|
|
| BLAKE2b-256 |
157eca5bbac1f92d2f50c42ec1b6df0a8012f1e40a01b0578f0d049f9c36fa7e
|