A CLI tool to record, replay and export terminal sessions: every command captured by shell hooks, replayed with safety controls, exported to scripts and CI.
rec records the commands you run in a shell session, then replays them with safety controls or exports them to scripts, CI configs and docs. The idea is that the deploy you just did by hand is already a runbook, you only need to have been recording.
I made it after writing the same "how to deploy" doc for the third time, each one slightly out of date. Shell hooks capture every command with its working directory, exit code and timing, with nothing running when you're not recording. Bash, Zsh and Fish are supported natively, storage is crash-safe NDJSON with a per-command fsync, sessions from a crashed process are recovered on the next start, and every session has a name, generated if you don't give one.
# 1. Set up shell hooks (add to your .bashrc, .zshrc, or config.fish)
The dry run and the step mode are the safety controls: you see what would run before it runs, one command at a time if you want. It's Rust, MSRV 1.85, MIT licensed, and it's in maintenance now rather than active development, it does what I needed.
eval
"
$(
rec
init
bash
)
"
#
or: zsh, fish
# 2. Record a session
rec start deploy-server
echo "deploying..."
git pull origin main
docker compose up -d
rec stop
# 3. Replay it
rec replay deploy-server # interactive replay
rec replay deploy-server --dry-run # preview without executing
rec replay deploy-server --step # one command at a time