agent-undo

Docs

Command reference

`agent-undo` is intentionally small: one project-local watcher, one SQLite timeline, and a handful of commands for rollback, attribution, and inspection.

Who it is for

The tool is meant for local coding-agent workflows in terminals and editors: Codex, Claude Code, Cursor, Cline, Aider, and anything else you can either hook directly or wrap with au exec --agent ... or au wrap install --preset .... The happy path is broader than one vendor.

Install

curl -fsSL https://agent-undo.com/install.sh | sh
cargo install agent-undo

Quick start

cd my-project
au init
au serve --daemon

# optional: add built-in Claude Code hooks
au init --install-hooks

# optional: install a preset wrapper for a terminal agent
au wrap presets
au wrap auto
au wrap install --preset codex
eval "$(au wrap shellenv)"
codex run "..."

au log
au sessions
au oops

Commands

au init [--install-hooks|--uninstall-hooks] [--no-scan]

Initialize `.agent-undo/`, write default config, and optionally manage the built-in Claude hook.

au serve --daemon

Start the filesystem watcher in the background for the current project.

au stop

Stop the project daemon by pidfile.

au status [--json]

Show root, data directory, database path, and event count.

au log [--agent X] [--file Y] [--since 1h] [--json]

Inspect the event timeline in human or machine-readable form.

au sessions [--json]

List recent recorded agent sessions.

au session start --agent X [--metadata '{...}']

Open an explicit agent session and mark subsequent writes.

au session end <id>

Close an explicit session and clear the active marker.

au diff <event-id> | au diff --session <id>

Show a unified diff for an event or full session.

au show <event-id> [--before|--after]

Print stored file contents for one side of an event.

au restore <event-id> | --file <path> | --session <id>

Restore a single event, a file’s last change, or an explicit session.

au oops

Undo the latest explicit session when present, otherwise the latest recent burst.

au pin <label> | au pin --list [--json]

Create and inspect named restore points.

au unpin <label>

Restore the whole project to a named pin’s state.

au blame <file>

Show per-line attribution from the timeline, similar to `git blame`.

au tui

Browse the timeline interactively with a two-pane event/diff view.

au exec --agent X -- <command...>

Wrap a command in an explicit session without an editor integration.

au wrap presets

List the built-in presets for common terminal-agent CLIs.

au wrap auto

Detect known terminal-agent CLIs already on PATH and install wrappers for them.

au wrap install --preset X [--binary Y]

Create a project-local wrapper in `.agent-undo/bin/` from a built-in preset.

au wrap install --agent X [--binary Y]

Create a project-local wrapper in `.agent-undo/bin/` for a terminal agent CLI.

au wrap shellenv

Print the shell line that prepends `.agent-undo/bin/` to PATH.

au gc

Garbage-collect old events and orphaned blobs using `.agent-undo/config.toml`.

au doctor [--fix] [--json]

Diagnose local setup and optionally repair common issues.