session-export
Produces a one-page, fully offline HTML view of a Claude Code or OpenAI Codex session — user/assistant turns, thinking/reasoning, tool calls and results, and any subagent transcripts rendered inline.
When to invoke
- User asks to "export the current session", "save this chat", "make an HTML of this conversation".
- User wants to share a session with someone who doesn't have the CLI installed.
How to run
Two exporters sit next to this SKILL.md — use the one matching the CLI you're
running in. Use that directory's path (it may be project-local or under
~/.claude/ or ~/.codex/, so don't hardcode a project-relative path):
# Claude Code
node <this-skill-dir>/export.js [session-id-or-path] [--no-redact]
# OpenAI Codex
node <this-skill-dir>/codex-export.js [session-id-or-path] [--no-redact]
Run from the working directory of the session you want to export. Auto-detection:
- Claude Code (
export.js): newest main session jsonl under<configDir>/projects/<encoded-cwd>/, where configDir is$CLAUDE_CONFIG_DIRif set, else~/.claude(skipsagent-*.jsonlsiblings and empty stubs). - OpenAI Codex (
codex-export.js): newestrollout-*.jsonlunder<codexHome>/sessions/, where codexHome is$CODEX_HOMEif set, else~/.codex.
Both accept a session id or an explicit path as the argument, and --no-redact
to disable the secret-redaction pass (see below).
The script writes claude-session-… / codex-session-…_<sessionId>.html to the current working directory and prints the absolute path. When secrets are redacted, a one-line summary is also written to stderr.
Secret redaction
Before the HTML is written, every message text/thinking block, every tool input (recursively), and every tool result is scanned for well-known credential shapes and matches are replaced with [REDACTED:<kind>]:
sk-ant-…(Anthropic),sk-…/sk-proj-…(OpenAI),sk_live_…/pk_live_…/sk_test_…(Stripe)AKIA…/ASIA…/AIDA…(AWS access keys)ghp_…/ghs_…/gho_…/ghu_…/ghr_…(GitHub PATs)xoxb-…/xoxp-…/xoxa-…/xoxs-…(Slack)AIza…(Google API keys),eyJ…eyJ….…(JWTs)-----BEGIN … PRIVATE KEY-----blocks
Counts per kind are stored on header.redactions and surfaced as a yellow redacted:<n> chip in the exported header (hover for the breakdown). This is a heuristic pass — review your exports before sharing.
Output
Single HTML file with:
- Embedded JSON payload (
<script id="session-data" type="application/json">), no base64. - Inline CSS supporting light + dark themes (16px base, em-based), respects
prefers-color-scheme, manual toggle persisted in localStorage. - Sidebar tree of turns with live search and filter chips.
- Collapsible thinking blocks, collapsible tool outputs.
- Subagent (Task/Agent) cards that expand to show the nested subagent transcript (loaded from sibling
agent-<id>.jsonlfiles when present, falls back to inlineprogressrecords). - Keyboard shortcuts:
/focus search,ttoggle thinking,otoggle tool outputs,btoggle sidebar,a/zexpand/collapse all,Escclear search,[/]navigate entries.
No network access required to view.