Repository avatar
Version Control
v0.7.1
active

devtape

io.github.sayyidsh/devtape

Read-only MCP tools to inspect scrubbed terminal, HTTP, MCP, Git, and span DAG session tapes.

Documentation

DevTape

CI Release Live Viewer License: Apache-2.0

Record what your AI coding agent or CI job actually did — terminal output, HTTP and MCP traffic, and git changes — into one secret-scrubbed .tape file you can sign, replay, diff, and share.

cargo install devtape-cli
devtape record --out session.tape -- cargo test   # or any command, shell, or agent CLI
devtape view session.tape

Known secret patterns are redacted while recording (add --net --mcp to capture HTTP and MCP traffic), and devtape export --review shows what was removed before you attach a .tape to a bug report. Anyone can open it in the browser viewer without installing anything.

Versions: the CLI is at v0.7.1; the on-disk format it implements is DevTape Protocol DTP v0.1. The two are versioned separately.

DevTape is the reference Rust implementation of the DevTape Protocol (DTP v0.1) — an open, local-first protocol for recording, scrubbing, signing, rewinding, replaying, importing, and inspecting developer and AI-agent execution sessions in a single portable .tape archive (spec/RFC-0001-dtp-v0.1.md & spec/dtp_v1.proto).

  • Try the Zero-Install Timeline Viewer (with WASM .tape decoder): https://sayyidsh.github.io/devtape/ (drag-and-drop any .tape file or click "Load Sample Failing Tape" to scrub through Timeline, Spans, HTTP, MCP, Git, and CI views immediately in your browser)

DevTape Terminal Demo — Record, Scrub, Rewind, View


Install

# Install via Homebrew Tap (macOS Apple Silicon / Intel & Linux prebuilt tarballs)
brew install sayyidsh/tap/devtape

# Or install from crates.io
cargo install devtape-cli

# Or download the prebuilt macOS Apple Silicon binary directly from GitHub Releases
curl -fsSL https://github.com/sayyidsh/devtape/releases/download/v0.7.1/devtape-aarch64-apple-darwin.tar.gz | tar -xz && chmod +x devtape

3-Step Quickstart

# 1. Record a command or interactive shell (with secret scrubbing, HTTP/MCP capture, per-command spans & auto-snapshots)
devtape record --net --mcp --shell-hooks --auto-snapshot --out session.tape -- cargo test

# 2. Sign & verify provenance, or export to reviewed diff-only .tape, standalone HTML, or sanitized asciicast (.cast)
devtape keygen --out-key ~/.devtape/signing.key --out-pub ~/.devtape/signing.pub
devtape sign session.tape --key ~/.devtape/signing.key
devtape verify session.tape --pub ~/.devtape/signing.pub --require-signature
devtape export <SESSION_ID> --profile diff-only --review --out bug-report.tape
devtape export <SESSION_ID> --profile full --format html --out bug-report.html
devtape export <SESSION_ID> --profile full --format asciicast --out demo.cast

# 3. Replay read-only, import external traces (asciinema/OTLP/MCP), rewind selectively, or serve MCP tools
devtape replay session.tape --speed 2.0 --headers
devtape import recording.cast --out imported.tape
devtape snapshots --json
devtape rewind --ago 5m --path src/lib.rs
devtape ps
devtape tail --latest --follow
devtape diff pass.tape fail.tape
devtape search "FAILED" session.tape
devtape view session.tape
devtape mcp --live
devtape gc --max-age 7d --max-sessions 50 --vacuum

GitHub Action (devtape-action — Automatic Failing CI .tape Artifacts)

Wrap any CI test or build step in 4 lines of YAML to automatically record ext.ci.v1 context, export a scrubbed --profile diff-only .tape archive on failure, and attach it to the workflow run with a direct link to the browser viewer:

- name: Run tests with DevTape failure capture
  uses: sayyidsh/devtape@v0.7.1
  with:
    command: cargo test --workspace

Custom Project Redaction & Entropy Rules (.devtape.toml)

Drop a .devtape.toml in your repository root (or pass --config <path>) to layer organization-specific regex redaction rules and opt-in Shannon entropy scanning on top of the built-in DTP v0.1 rules (PRIVATE_KEY, DB_URL, AWS_KEY, GITHUB_TOKEN, GITLAB_TOKEN, SLACK_TOKEN, ANTHROPIC_KEY, STRIPE_KEY, GOOGLE_API_KEY, API_KEY, BEARER, JWT, and sensitive ENV_SECRET assignments), attested deterministically as dtp-scrub-0.1+custom:<blake3_6>:

[entropy]
enabled = true
min_len = 24
threshold = 4.2

[[redact]]
kind = "CORP_TOKEN"
pattern = '\bCORP_[0-9A-Z]{16}\b'

Use as an MCP server

devtape mcp serves a recorded session to any MCP client over stdio, read-only, so an agent can inspect what happened in a .tape (events, spans, HTTP and MCP exchanges) without re-running anything.

devtape mcp --tape session.tape          # serve one archive
devtape mcp --live --db sessions.db      # serve sessions still being recorded

Example client configuration (the mcpServers format used by Claude Code, Claude Desktop, and other MCP clients):

{
  "mcpServers": {
    "devtape": {
      "command": "devtape",
      "args": ["mcp", "--tape", "/absolute/path/to/session.tape"]
    }
  }
}

mcp-name: io.github.sayyidsh/devtape

Architecture Overview

Recording uses a dedicated PTY hot-path reader thread (< 2 ms passthrough budget) with a 16 MiB byte-bounded backpressure queue (QoS-0 ZeroStall emits normative DropMarker events under flood bursts) and streaming 128-byte sliding-window secret redaction (OverlapScrubber). Archives carry HLC-ordered causal events, a RedactionAttestation manifest, and a canonical Blake3 integrity hash. Events stream live into SQLite (PRAGMA journal_mode=WAL) during active sessions via RecordSink and the Single-Writer WAL actor (queryable mid-session via devtape ps, devtape tail --follow, and devtape mcp --live), and sessions can be replayed read-only in the terminal (devtape replay), compared (devtape diff), searched (devtape search), garbage-collected safely while protecting active recordings (devtape gc), exported by privacy profile (full, diff-only, trace-only) to .tape or self-contained .html reports (--format html), or viewed locally. Git shadow snapshots use an isolated temporary GIT_INDEX_FILE + FastCDC content-addressed storage, and devtape rewind creates a byte-exact pre-rewind safety backup before modifying the working tree.

Workspace Crates (#![forbid(unsafe_code)])

  • dtp-codec: DTAP01 container encoding, 1:100 decompression-bomb guard, HLC, event types, and stateful replay ANSI filtering (OSC 52 stripping).
  • devtape-scrub: Streaming secret scrubbing with sliding-window overlap, .devtape.toml custom [[redact]] rules, and <DTP:REDACTED:KIND:hash6> placeholders.
  • devtape-pty: Cross-platform PTY capture, byte-bounded QoS backpressure, and live RecordSink streaming.
  • devtape-git: Non-destructive shadow snapshots, FastCDC CAS, byte-exact pre-rewind raw backups, rewind, and undo-rewind.
  • devtape-core: Single-writer SQLite WAL session store (with live mid-session streaming, ps/tail/live-MCP read-only queries, replay planner, diff, search, gc, Ed25519 provenance signing/verification, shell-hook span collector, and asciinema/OTLP/MCP trace importers) and privacy-profile exporter.
  • devtape-mcp: Read-only JSON-RPC 2.0 MCP server (8 tools including tape_get_spans causal span DAG inspection for .tape archives and --live SQLite WAL stores) and ext.mcp.v1 stdio proxy (devtape mcp-proxy).
  • devtape-net: Opt-in child-only loopback HTTP & HTTPS (CONNECT MITM) capture proxy (--net) with ephemeral rcgen session CA, dynamic per-host leaf certificates, Transfer-Encoding: chunked request body capture + split-chunk secret redaction, and 1 MiB body truncation.
  • devtape-ui: Loopback-only (127.0.0.1) read-only timeline server (Viewer v2 with Timeline, Spans, HTTP, MCP, Git, and CI tabs) and standalone offline HTML report generator.
  • dtp-wasm: Per-span/channel incremental ANSI replay sanitizer and wasm32-unknown-unknown .tape browser decoder.
  • devtape-cli: Reference devtape command-line interface (~5.1 MiB stripped release binary).

Full CLI Reference

devtape doctor
devtape demo-tape --out sample.tape
devtape inspect sample.tape
devtape keygen --out-key ~/.devtape/ci.key --out-pub ~/.devtape/ci.pub
devtape sign sample.tape --key ~/.devtape/ci.key
devtape verify sample.tape --pub ~/.devtape/ci.pub --require-signature --json
devtape shell-hook zsh
devtape record --out session.tape --qos zero-stall --db sessions.db -- sh -c 'echo hello'
devtape record --net --mcp --shell-hooks --auto-snapshot --out agent.tape -- claude -p "fix failing test"
devtape mcp-proxy --name repo-tools -- npx -y @modelcontextprotocol/server-filesystem .
devtape replay session.tape --speed 2.0 --headers
devtape ps --db sessions.db --json
devtape tail --latest --follow --filter pty --db sessions.db
devtape diff pass.tape fail.tape --json
devtape search "502|503" network.tape --regex --stream http --json
devtape snapshot --repo . --label before-change
devtape snapshots --repo . --json
devtape snapshot-diff SNAPSHOT_ID --repo . --stat
devtape rewind --repo . --to SNAPSHOT_ID
devtape rewind --repo . --ago 5m --path src/lib.rs
devtape undo-rewind --repo .
devtape sessions --db sessions.db
devtape gc --max-age 7d --max-sessions 50 --vacuum --db sessions.db
devtape import session.cast --out imported.tape
devtape import trace.otlp.json --format otlp --out otel.tape
devtape export SESSION_ID --db sessions.db --profile full --review --out exported.tape
devtape export SESSION_ID --db sessions.db --profile diff-only --review --out diff.tape
devtape export SESSION_ID --db sessions.db --profile trace-only --review --out trace.tape
devtape export SESSION_ID --db sessions.db --profile full --format html --out report.html
devtape export SESSION_ID --db sessions.db --profile full --format asciicast --out session.cast
devtape view session.tape --port 0
devtape mcp --tape session.tape
devtape mcp --live --db sessions.db
printf 'Bearer example-token\n' | devtape scrub-check

view prints a loopback URL (http://127.0.0.1:<port>) and runs until interrupted. It sanitizes dangerous terminal control sequences for display; its displayed integrity hash is that of the original archive. crates/devtape-ui/index.html (also hosted at https://sayyidsh.github.io/devtape/) includes a one-click sample failing session, displays JSON exports locally, and decodes binary .tape files natively in the browser via the compiled dtp-wasm WebAssembly module.

--net captures both plain HTTP and decrypted HTTPS (CONNECT TLS termination via tokio-rustls + dynamic per-host leaf certificates signed by the session's ephemeral rcgen CA) as well as Transfer-Encoding: chunked request bodies via a child-only loopback proxy (127.0.0.1:0) without modifying the host environment or system trust store. --mcp sets DTP_MCP_TRACE_DIR so child devtape mcp-proxy invocations capture scrubbed ext.mcp.v1 tool exchanges with latency and error metadata.

Record local agent sessions on macOS

Build the CLI and set up recording launchers for Claude Code, Codex CLI, Antigravity CLI (agy), and TruFlow CLI. Run these commands from the DevTape checkout with Python 3 and the agent CLIs on PATH.

CARGO_INCREMENTAL=0 cargo build --locked --release -p devtape-cli
scripts/devtape-agents setup
eval "$(scripts/devtape-agents env)"

Launch the agents as usual from that shell. Interactive sessions use a PTY. Redirected commands forward the original stdin and keep stdout and stderr separate. Their tapes are indexed after the command exits, with up to 2 MiB of text captured per output stream. Archives are stored under .devtape/agent-sessions/tapes/ in the DevTape checkout. Use DEVTAPE_RECORD=off to launch a single task without recording.

Run bash scripts/devtape-agents enable-user from your account's terminal to install the launchers, CLI, recordings directory and SQLite index under ${XDG_STATE_HOME:-$HOME/.local/state}/devtape/agent-sessions. This activates recording in new Bash and zsh terminals and registers the read-only DevTape MCP server with Claude Code, Codex, and agy. The user installation runs from the local disk after setup. Claude Code and Codex CLI can also connect to the server through the project launchers before user-level setup.

Run a shell step on a TruFlow Desk by calling scripts/devtape-agents run -- COMMAND [ARGS...] using the absolute path to the DevTape checkout on that desk. For desk-managed MCP access, the generated .devtape/agent-sessions/mcp.json contains the devtape entry for the desk's workspace MCP registry. Desk jobs need the launcher and recording directory to be accessible on the desk that runs the job.

SDKs & Language Bindings

  • Rust (dtp-codec on crates.io):
    cargo add dtp-codec
    
  • JavaScript / TypeScript (devtape-dtp-wasm on npm, published with provenance):
    npm install devtape-dtp-wasm
    
    Initialize the WebAssembly decoder and call decodeTape(bytes); see the npm package guide.
  • Python (devtape-dtp on PyPI):
    pip install devtape-dtp
    
    Use decode_tape_json and sanitize_ansi; see the Python binding guide.

Verification

CARGO_INCREMENTAL=0 cargo fmt --all -- --check
CARGO_INCREMENTAL=0 cargo clippy --workspace --all-targets -- -D warnings
CARGO_INCREMENTAL=0 cargo test --workspace

License

Apache-2.0. The protocol specification in spec/ is open and vendor-neutral.

CARGO
devtape-cli
Install Command
cargo install devtape-cli