Terminal Session Replay
What This Does
A CLI tool to record, replay, and export terminal sessions. Captures commands, outputs, and timing for later review, documentation, or sharing with teammates. Wraps the standard script command with a simpler interface and additional features.
Key features:
- - Record sessions - Start recording terminal session with a simple command
- Replay sessions - Play back recorded sessions with original timing
- Export to markdown - Convert sessions to readable documentation
- Session management - List, view, and delete recorded sessions
- Metadata support - Add titles, descriptions, and tags to sessions
- Timing control - Adjust playback speed or skip timing for quick review
How To Use
Record a session:
CODEBLOCK0
Replay a session:
CODEBLOCK1
Export to markdown:
CODEBLOCK2
List recorded sessions:
CODEBLOCK3
Full command reference:
CODEBLOCK4
Commands
- -
record: Start recording a terminal session
-
--output: Session name (default: timestamp-based)
-
--title: Session title for metadata
-
--desc: Session description
-
--tags: Comma-separated tags
- -
replay: Replay a recorded session
-
--input: Session name to replay
-
--speed: Playback speed multiplier (default: 1.0)
-
--no-timing: Skip timing, display immediately
- -
export: Export session to markdown
-
--input: Session name to export
-
--output: Output markdown file (default: session_name.md)
-
--include-timing: Include timing information in export
- -
list: List all recorded sessions
-
--filter-tags: Filter by tags
- -
info: Show session metadata
-
--input: Session name
- -
delete: Delete a session
-
--input: Session name to delete
Output
Sessions are stored in ~/.terminal-sessions/ by default:
- -
session_name.typescript: Raw terminal recording (script output) - INLINECODE22 : Timing data for replay
- INLINECODE23 : Metadata (title, description, tags, timestamp)
Export produces markdown like:
# Terminal Session: Setting up Project
**Recorded:** 2026-03-11 10:30:00
**Duration:** 2 minutes 15 seconds
bash
$ git clone https://github.com/example/project
Cloning into 'project'...
remote: Enumerating objects: 100, done.
remote: Counting objects: 100% (100/100), done.
remote: Compressing objects: 100% (80/80), done.
remote: Total 100 (delta 20), reused 80 (delta 15), pack-reused 0
Receiving objects: 100% (100/100), 1.5 MiB | 3.5 MiB/s, done.
Resolving deltas: 100% (20/20), done.
$ cd project
$ npm install
...
## Limitations
- Requires `script` command (available on Linux/macOS, not on Windows without WSL/Cygwin)
- Cannot record GUI applications or mouse interactions
- Very fast terminal output may not be captured perfectly
- Sessions can be large if recording for long periods
- Color and formatting may not be preserved in markdown export
- Requires terminal with proper support for script command
## Examples
Record a debugging session:
bash
./scripts/main.py record --output debug-session --title "Debugging API issue" --tags "debug,api"
... work in terminal ...
exit # or Ctrl+D to end recording
Replay at 2x speed:
bash
./scripts/main.py replay --input debug-session --speed 2.0
Export for documentation:
bash
./scripts/main.py export --input debug-session --output DEBUGGING.md
``
## Installation Notes
The script
command is typically pre-installed on Linux and macOS systems. On Windows, use WSL or Cygwin.
The tool creates ~/.terminal-sessions/` directory to store recordings.
终端会话回放
功能说明
一款用于录制、回放和导出终端会话的命令行工具。可捕获命令、输出及时间信息,便于后续审查、文档编写或与团队成员共享。该工具封装了标准script命令,提供更简洁的界面和附加功能。
主要特性:
- - 录制会话 - 通过简单命令开始录制终端会话
- 回放会话 - 按原始时间轴回放录制的会话
- 导出为Markdown - 将会话转换为可读文档
- 会话管理 - 列出、查看和删除录制的会话
- 元数据支持 - 为会话添加标题、描述和标签
- 时间控制 - 调整回放速度或跳过时间轴快速浏览
使用方法
录制会话:
bash
./scripts/main.py record --output session1
回放会话:
bash
./scripts/main.py replay --input session1
导出为Markdown:
bash
./scripts/main.py export --input session1 --output session1.md
列出已录制会话:
bash
./scripts/main.py list
完整命令参考:
bash
./scripts/main.py help
命令说明
- --output:会话名称(默认基于时间戳)
- --title:会话元数据标题
- --desc:会话描述
- --tags:逗号分隔的标签
- --input:要回放的会话名称
- --speed:回放速度倍率(默认:1.0)
- --no-timing:跳过时间轴,立即显示
- --input:要导出的会话名称
- --output:输出Markdown文件(默认:session_name.md)
- --include-timing:导出时包含时间信息
- --filter-tags:按标签筛选
- --input:会话名称
- --input:要删除的会话名称
输出说明
会话默认存储在~/.terminal-sessions/目录:
- - sessionname.typescript:原始终端录制文件(script输出)
- sessionname.timing:回放时间数据
- session_name.meta.json:元数据(标题、描述、标签、时间戳)
导出生成的Markdown格式示例:
markdown
终端会话:项目配置
录制时间: 2026-03-11 10:30:00
持续时间: 2分15秒
bash
$ git clone https://github.com/example/project
正在克隆到project...
远程:枚举对象:100,完成。
远程:计数对象:100% (100/100),完成。
远程:压缩对象:100% (80/80),完成。
远程:总计100(增量20),复用80(增量15),包复用0
接收对象:100% (100/100),1.5 MiB | 3.5 MiB/s,完成。
解析增量:100% (20/20),完成。
$ cd project
$ npm install
...
局限性
- - 需要script命令(适用于Linux/macOS,Windows需WSL或Cygwin)
- 无法录制GUI应用程序或鼠标交互
- 极快的终端输出可能无法完美捕获
- 长时间录制会导致会话文件较大
- Markdown导出可能无法保留颜色和格式
- 需要终端正确支持script命令
示例
录制调试会话:
bash
./scripts/main.py record --output debug-session --title 调试API问题 --tags debug,api
... 在终端中操作 ...
exit # 或按Ctrl+D结束录制
以2倍速回放:
bash
./scripts/main.py replay --input debug-session --speed 2.0
导出为文档:
bash
./scripts/main.py export --input debug-session --output DEBUGGING.md
安装说明
script命令通常预装在Linux和macOS系统中。Windows用户请使用WSL或Cygwin。
该工具会自动创建~/.terminal-sessions/目录用于存储录制文件。