checkpoint is a command-history rollback helper.
Instead of filesystem snapshots, it reads your shell history, matches commands against reversible rules, and builds inverse commands to undo what you did.
curl -fsSL https://raw.githubusercontent.com/zane-lang/checkpoint/main/install.sh | bashThe script:
- Clones the repo to
~/.checkpoint - Creates a Python virtual environment at
~/.checkpoint/.venvand installscoda-formatinto it - Prompts whether to add
checkpointtoPATHand write the shell history setup into your.bashrc/.zshrc
To add the shell setup manually, run:
checkpoint setup bash >> ~/.bashrc # or zsh- Reads command history from your shell history file.
- Matches commands against rules in
rules.coda. - Builds inverse commands.
- Executes inverses in reverse order (LIFO), so rollback order makes sense.
- Stores named checkpoint boundaries in
.checkpoints.coda.
checkpoint set "installing-llvm"
checkpoint restore installing-llvmcheckpoint set [description]
checkpoint list
checkpoint restore
checkpoint restore <N>
checkpoint restore <description>
checkpoint restore -t <timestamp>
checkpoint restore --time <timestamp>
checkpoint rules
checkpoint setup [shell]
checkpoint helpCreates a restore boundary at the current history index.
descriptionis optional.- Non-empty descriptions must be unique.
- Empty descriptions are allowed (restore these by timestamp).
Output includes:
time(ISO timestamp; acts as checkpoint identifier)descriptionhistory index
Shows all saved checkpoints from .checkpoints.coda.
Each row includes:
- checkpoint timestamp
- history index
- description
Restores commands since the latest checkpoint.
Restores from the last N commands in history.
Restores commands since the checkpoint with that description.
Restores commands since a specific checkpoint time.
Use this when:
- description is empty
- you want an exact checkpoint target
Prints loaded inverse rules from rules.coda.
Prints shell snippet to improve history behavior for checkpoint.
- auto-detects shell if omitted
- supports
bashandzsh
checkpoint restore ... first builds a restore plan from matching rules.
Commands with no matching rule are skipped and summarized.
Inverses run in reverse order of original commands.
That means rollback behaves like stack pop (last change undone first).
If the original command starts with sudo:
- matching ignores the leading
sudo - inverse command is re-prefixed with
sudo
Before execution, if any planned inverse needs sudo, checkpoint:
- asks for confirmation
- runs
sudo -vonce - aborts before running inverses if auth is denied
After restore runs, checkpoint:
- removes restored original commands from history file
- removes checkpoints created after the restore boundary
Rules live in rules.coda.
Each rule maps a match pattern to an inverse template.
Example:
rules [
key inverse
"apt install $$" "apt remove $$"
"brew install $$" "brew uninstall $$"
"mkdir $" "rmdir $"
"ln -s $src $dst" "unlink $dst"
]
$name: single named token$: single anonymous token$$: variadic capture (remaining tokens)
Checkpoints are stored in .checkpoints.coda as a keyed table.
Key = timestamp.
Example:
checkpoints [
key index description
"2026-04-09T20:31:16" 1313 "installing-llvm"
"2026-04-09T21:01:16" 1329 ""
]
# start risky set of changes
checkpoint set "before packages"
sudo apt install foo bar
brew install baz
# rollback to boundary
checkpoint restore "before packages"Or restore by exact time:
checkpoint list
checkpoint restore --time 2026-04-09T20:31:16- If no checkpoint exists,
checkpoint restorefalls back to last 50 commands. - History source is your shell history file; keeping shell history flushed helps accuracy.