展示 HN:Claude-replay – Claude 代码会话的视频播放器
Show HN: Claude-replay – A video-like player for Claude Code sessions

原始链接: https://github.com/es617/claude-replay

## claude-replay: 分享你的 Claude 代码会话 **claude-replay** 是一个社区工具,可以将 Claude 代码会话日志(在 `~/.claude/projects/` 中找到的 JSONL 文件)转换为交互式、可分享的 HTML 重放。它不同于笨重的屏幕录像或难以导航的文本记录,而是创建一个单一的、自包含的 HTML 文件——无需外部依赖——非常适合嵌入到文档、博客文章、演示文稿或错误报告中。 重放模拟 Claude 代码终端,允许播放控制(速度、暂停/播放、向前/向后步进),折叠工具调用和思考块(Claude 的推理过程),书签,甚至秘密信息删除。它可以通过主题和 CSS 进行轻松自定义。 **主要特性:** * **交互式播放:** 控制速度,逐步浏览会话,并使用进度条导航。 * **自包含 HTML:** 可以通过电子邮件、托管或 iframe 嵌入进行分享。 * **可定制:** 主题、删除和标记选项。 * **易于安装:** `npm install -g claude-replay` 或使用 `npx`。 使用 `claude-replay --list-themes` 了解更多信息并探索可用主题。生成的 HTML 文件针对大小和浏览器兼容性进行了优化。

## Claude-replay:分享AI编程会话 一个新的CLI工具,**claude-replay** (https://github.com/es617),简化了分享Claude Code会话的过程。它不是将会话记录(Claude Code自动保存的JSONL文件)转换为截图或录屏,而是转换为交互式的、自包含的HTML回放。 这允许用户逐步浏览对话,检查提示词和工具调用,并跳转到特定时间点——提供比静态输出更详细的视图。生成的HTML文件可以轻松地通过电子邮件、托管或嵌入方式分享。 该工具解决了对更好协作和AI辅助编程知识分享的需求。讨论强调了它在入职新团队成员、展示有效的提示技巧以及快速传播最佳实践方面的潜力。虽然有些人质疑回放格式相对于简单文本转储的必要性,但许多人认为,可视化展示使用Claude Code实现结果的*过程*具有价值,尤其是在硬件交互或培训非技术同事等复杂任务中。进一步的开发想法包括改进会话搜索以及与Slack等平台的集成。
相关文章

原文

npm Claude Code License: MIT Node.js Zero Dependencies

Community tool — not affiliated with or endorsed by Anthropic.

Claude Code sessions are great for development, but hard to share. Screen recordings are bulky and transcripts are hard to navigate.

claude-replay turns Claude Code session logs into interactive, shareable HTML replays. The generated replay is a single self-contained HTML file with no external dependencies — you can email it, host it anywhere, or embed it in documentation.

Demo screenshot

Try the live demo

Claude Code stores full conversation transcripts as JSONL files on disk in ~/.claude/projects/. These contain every user message, assistant response, tool call, tool result, and thinking block — with timestamps. claude-replay converts them into visual replays that look like a Claude Code terminal session, suitable for blog posts, demos, and documentation.

  • Self-contained HTML output (no dependencies)
  • Interactive playback with speed control
  • Collapse/expand tool calls and thinking blocks (Claude's internal reasoning traces)
  • Bookmarks / chapters
  • Secret redaction before export
  • Multiple color themes
  • Terminal-style bottom-to-top scroll
  • Embeddable via iframe

claude-replay is useful for:

  • Blog posts — show AI-assisted development sessions interactively
  • Documentation — embed AI debugging sessions or code walkthroughs
  • Demos — share reproducible sessions without video
  • Bug reports — attach a replay instead of long logs
  • Teaching — step through AI reasoning and tool usage
npm install -g claude-replay

Or run directly with npx (zero install):

npx claude-replay session.jsonl -o replay.html
# Find your session transcripts
ls ~/.claude/projects/*/

# Generate a replay
claude-replay ~/.claude/projects/-Users-me-myproject/session-id.jsonl -o replay.html

# Open it
open replay.html
claude-replay <input.jsonl> [options]
Flag Description
-o, --output FILE Output HTML file (default: stdout)
--turns N-M Only include turns N through M
--from TIMESTAMP Start time filter (ISO 8601)
--to TIMESTAMP End time filter (ISO 8601)
--speed N Initial playback speed, e.g. 2.0 (default: 1.0)
--no-thinking Hide thinking blocks by default
--no-tool-calls Hide tool call blocks by default
--mark "N:Label" Add a bookmark/chapter at turn N (repeatable)
--bookmarks FILE JSON file with bookmarks [{turn, label}]
--no-redact Disable automatic secret redaction
--title TEXT Page title (default: derived from input path)
--user-label NAME Label for user messages (default: User)
--assistant-label NAME Label for assistant messages (default: Claude)
--theme NAME Built-in theme (default: tokyo-night)
--theme-file FILE Custom theme JSON file (overrides --theme)
--no-minify Use unminified template (default: minified if available)
--no-compress Embed raw JSON instead of compressed data (for older browsers)
--list-themes List available built-in themes and exit
# Replay turns 5 through 15 at 2x speed
claude-replay session.jsonl --turns 5-15 --speed 2.0 -o replay.html

# Filter by time range
claude-replay session.jsonl --from "2026-02-26T02:00" --to "2026-02-26T03:00" -o replay.html

# Clean output: no thinking, no tools
claude-replay session.jsonl --no-thinking --no-tool-calls -o replay.html

# Use a different theme
claude-replay session.jsonl --theme dracula -o replay.html

# Pipe to stdout for further processing
claude-replay session.jsonl --turns 1-5 > snippet.html

The generated HTML file is a fully self-contained interactive player:

  • Play/Pause — auto-advances through turns with block-by-block animation
  • Step forward/back — navigate one block at a time within turns
  • Progress bar — click to jump to any point; session timer shows elapsed/total time
  • Speed control — 0.5x to 5x playback speed
  • Toggle checkboxes — show/hide thinking blocks and tool calls
Key Action
Space / K Play / Pause
/ L Step forward
/ H Step back
claude-replay --list-themes

Available themes: tokyo-night (default), monokai, solarized-dark, github-light, dracula, bubbles.

Create a JSON file with CSS color values:

{
  "bg": "#0d1117",
  "bg-surface": "#161b22",
  "bg-hover": "#1c2128",
  "text": "#e6edf3",
  "text-dim": "#7d8590",
  "text-bright": "#ffffff",
  "accent": "#ff7b72",
  "accent-dim": "#c9514a",
  "green": "#3fb950",
  "blue": "#58a6ff",
  "orange": "#d29922",
  "red": "#f85149",
  "cyan": "#39d2c0",
  "border": "#30363d",
  "tool-bg": "#0d1117",
  "thinking-bg": "#0b0f14"
}
claude-replay session.jsonl --theme-file my-theme.json -o replay.html

Any missing keys are filled from the tokyo-night defaults, so you only need to specify the colors you want to change.

For advanced customization, add an extraCss key with arbitrary CSS rules to override layout, fonts, or any other styles:

{
  "bg": "#ffffff",
  "text": "#1c1e21",
  "extraCss": ".assistant-text { border-radius: 12px; border: 1px solid #ddd; }"
}

See the built-in bubbles theme for an example of a fully custom layout using extraCss.

Theme variables reference
Variable Used for
bg Main background
bg-surface Controls bar, elevated surfaces
bg-hover Hover states
text Primary text
text-dim Secondary text, timestamps, labels
text-bright User input, emphasized text
accent Prompt symbol, progress bar, active states
accent-dim Active button backgrounds
green Tool results
blue Tool call indicators
orange (reserved for warnings)
red (reserved for errors)
cyan Tool names
border Borders and separators
tool-bg Tool call block background
thinking-bg Thinking block background

The output is a single HTML file with no external dependencies. Embed it in blog posts or docs with an iframe:

<iframe src="replay.html" width="100%" height="600" style="border: 1px solid #333; border-radius: 8px;"></iframe>
  1. Parser reads the JSONL transcript line by line, handling Claude Code's streaming format (where a single assistant message appears as multiple lines with incremental content blocks)
  2. Turns are grouped as: user message + assistant response (text, tool calls, thinking blocks) + tool results
  3. Renderer compresses the parsed turns (deflate + base64) and injects them into the HTML template
  4. The player is vanilla JS — no frameworks, no external requests. Data is decompressed at load time using the browser-native DecompressionStream API

Generated HTML files use two layers of optimization (zero external dependencies):

  • Minified CSS/JS — the player template is minified with esbuild (mangled variable names, whitespace removed). Use --no-minify for readable output.
  • Compressed data — transcript JSON is deflate-compressed and base64-encoded, typically reducing output size by ~60-70%. The browser decompresses it natively at load time using DecompressionStream (Chrome 80+, Firefox 113+, Safari 16.4+). For older browsers, use --no-compress to embed raw JSON.

To rebuild the minified template after editing template/player.html:

npm install    # installs esbuild (devDependency)
npm run build  # generates template/player.min.html

The minified template is built in CI and included in npm releases. Without it, the CLI falls back to the unminified template automatically.

By default, claude-replay scans all embedded text for common secret patterns and replaces them with [REDACTED] before they are written into the output HTML. This means secrets from your session (API keys, tokens, connection strings, etc.) never end up in the generated file.

Detected patterns include:

  • API keys (sk-..., sk-ant-..., key-...)
  • AWS access key IDs (AKIA...)
  • Bearer and JWT tokens
  • Database connection strings (postgres://..., mongodb://..., etc.)
  • Private key blocks (-----BEGIN ... PRIVATE KEY-----)
  • Generic key/value secrets (api_key=..., auth_token: ...)
  • Environment variable secrets (PASSWORD=..., TOKEN=...)
  • Long hex tokens (40+ characters)

Important: Pattern-based redaction is a best-effort safety net — it cannot catch every possible secret format. Always review the generated HTML before sharing publicly.

To disable redaction (e.g. for internal/private replays):

claude-replay session.jsonl --no-redact -o replay.html

Claude Code transcripts use one JSON object per line with a type field:

Type Content
user User messages (plain text or tool result arrays)
assistant Assistant responses (text, tool_use, thinking blocks)
system System metadata (skipped)
progress Progress updates (skipped)
file-history-snapshot File state snapshots (skipped)
  • Node.js 18+
  • Zero runtime dependencies (esbuild is a dev-only dependency for building the minified template)

MIT

联系我们 contact @ memedata.com