Skip to content

dschwen/codex_log_viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codex Log Viewer

A tiny Python tool that turns Codex JSONL session logs into a clean, self‑contained HTML page with a light pastel theme, Markdown rendering, collapsible sections, and a tiny inline code highlighter.

  • Input: JSONL logs with events like message, reasoning, function_call, function_call_output.
  • Output: One standalone HTML file with inline CSS/JS (UTF‑8, emoji safe).

Features

  • Markdown rendering for user, assistant, and reasoning text (markdown-it-py).
  • Collapsible panels for reasoning summaries and function outputs with a toolbar to collapse/expand all.
  • Fixed‑width blocks for function calls and outputs; long outputs scroll.
  • Tiny client‑side highlighter for code fences in Markdown (json, python, bash/sh, diff).
  • Hides encrypted reasoning content; shows only the summary text.
  • Supports both legacy JSONL events and the new wrapped format where each line is { "timestamp": ..., "payload": { ... } }. In the wrapped format, each block shows the event timestamp in the top‑right.
  • Handles new event kinds found in wrapped logs: user_message, agent_message, agent_reasoning, and token_count (token usage). Token usage renders as a structured block and can be toggled via the toolbar filter. The Token Usage filter is OFF by default.

Getting Started

  1. Install dependencies
pip install -r requirements.txt
  1. Render a log to HTML
# write to a file
python3 render_jsonl.py example.jsonl -o example.html

# or to stdout
python3 render_jsonl.py example.jsonl > example.html
  1. Batch convert all logs from ~/.codex/sessions
# mirrors the ~/.codex/sessions tree into the current directory,
# converts every .jsonl to .html, and writes a top-level index.html
python3 render_jsonl.py --all

# optional: point to a different sessions dir
python3 render_jsonl.py --all --sessions-dir /path/to/sessions
  1. Open the HTML in your browser
xdg-open example.html  # Linux
open example.html      # macOS

Example Files

Notes

  • Only reasoning and function output blocks are collapsible.
  • Function outputs are shown as plain mono text (not Markdown) to avoid accidental formatting.
  • The inline highlighter is intentionally minimal; it escapes HTML before injecting token spans.

License

LGPL 2.0

About

Convert Codex CLI session logs into readable HTML

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published