Quick Start
1
Attach checkpoints to an agent
2
Undo the last turn in one line
3
Save and restore from CLI
4
One-liner undo after a run
Overview
Checkpoints allow you to:- Save snapshots of your workspace before changes
- Restore files to any previous checkpoint
- Rewind N checkpoints back from the latest
- Diff between checkpoints to see what changed
- Track all file modifications made by agents
Rewind vs Restore
Both rewind the workspace, but they target checkpoints differently.How It Works
A user rewinds the workspace to a pre-turn state after a bad edit.A checkpoint is not guaranteed to map 1:1 with an agent turn — manual saves and auto-checkpoints both create checkpoints — so
rewind counts checkpoints, the closest turn-addressable primitive without a stored turn↔checkpoint map.In-session /undo and /revert
When praisonai code --checkpoints is active, the coding REPL gains turn-aware undo and revert commands.
/undo mode comparison:
Revert is best-effort. A file restore failure skips the conversation rewind. A conversation-revert failure leaves the already-restored files intact — you can retry from a clean workspace state.
preview(n) now returns dropped_message_count alongside the file diff, so the CLI can show how many chat turns would be discarded before you confirm. If the session store is not wired in, dropped_message_count is None.
/revert [n] rolls back n turns (default 1). After revert, the timeline drops the restored turns so the next /undo walks further back.
Project config:
PRAISONAI_CHECKPOINTS=on (or off).
Precedence: PRAISONAI_CHECKPOINTS (env) > checkpoints.auto (config) > default (off).
CLI Commands
One-liner undo after a bad
praisonai run: praisonai run --restore last. See Run — Checkpoint & Rewind for details.Automatic Checkpoints with praisonai run
praisonai run snapshots your workspace automatically before every YAML-file run.
- Default:
true— automatic checkpoints are on for all YAML-file runs. - Scoped to YAML runs: plain-prompt runs (
praisonai run "…") are skipped. - Workspace: the directory of the target YAML file, not the cwd.
- Label:
run:<run_id>(or"auto checkpoint before run"as a fallback). - Best-effort: failures are swallowed and never block the run.
- Per-run override:
praisonai run agents.yaml --no-checkpoint.
Configuration
workspace_dir: Directory to trackstorage_dir: Where to store checkpoint data (default:~/.praisonai/checkpoints)enabled: Enable/disable checkpointsauto_checkpoint: Auto-checkpoint before file modificationsmax_checkpoints: Maximum checkpoints to keep
Step-Indexed Checkpoints
Tag checkpoints with an agent step index so you can rewind back to a specific step by number instead of remembering a hash.[step-N]; no extra storage. Checkpoint.step is surfaced by list_checkpoints() for filtering.
Data Types
Checkpoint
CheckpointDiff
Best Practices
Checkpoint before major refactors
Checkpoint before major refactors
Save with a descriptive message before large edits so restore targets are obvious in
checkpoint list.Diff before restore
Diff before restore
Run
praisonai checkpoint diff last to confirm you are rewinding to the right snapshot.Cap stored checkpoints
Cap stored checkpoints
Set
max_checkpoints on CheckpointService to avoid unbounded shadow-git growth.Use --no-checkpoint for throwaway runs
Use --no-checkpoint for throwaway runs
Skip auto-checkpoints on YAML runs when you know the workspace is disposable.
Prefer /undo over /clear after a bad edit
Prefer /undo over /clear after a bad edit
With the session store wired in,
/undo rewinds files and chat history to the same turn boundary, so the agent’s memory stays consistent with the workspace. /clear only truncates history and leaves reverted edits invisible to the agent.Reach for rewind first, tag steps for precise jumps
Reach for rewind first, tag steps for precise jumps
rewind is the shortest path to undo the last change. When an agent loop wants to jump back to a specific point (e.g. “back to step 2”), tag checkpoints with save(step=N) and use restore(step=N).Low-level API Reference
CheckpointService Direct Usage
Methods
initialize()
Initialize the checkpoint service:save(message, allow_empty=False, step=None)
Save a checkpoint:restore(checkpoint_id=None, step=None)
Restore the workspace to a checkpoint by id or step index. Providing both is an error.rewind(steps=1)
Rewind the workspace backsteps checkpoints from the latest. This is a
convenience over list_checkpoints() + restore() — you don’t need the id.
Returns:
CheckpointResult with the checkpoint the workspace was restored to.
Failure modes:
rewind is not capped by max_checkpoints — pruning only trims the in-memory
listing, and shadow-git retains every commit, so older commits stay reachable.get_checkpoint_by_step(step)
Return the most recent checkpoint tagged with the given step index, orNone.
diff(from_id=None, to_id=None)
Get diff between checkpoints:list_checkpoints(limit=50)
List all checkpoints:Event Handlers
Subscribe to checkpoint events:Zero Performance Impact
The checkpoint system is designed for minimal overhead:- Lazy loading: All imports via
__getattr__ - Async operations: Non-blocking git operations
- Incremental commits: Only changed files are tracked
- Configurable limits: Control max checkpoints to manage storage
Using checkpoints with resumable runs
When a checkpoint is bound to a Run-State Journal entry viaset_checkpoint(run_id, checkpoint_id), a resume can restore the workspace to that checkpoint before replaying journalled steps — the prerequisite for safe replay of file-touching tool loops.
Related
CLI
praisonai checkpoint and praisonai run --restore commands.Code Execution
Agents that edit files benefit most from automatic checkpoints.
Context Files
Pair workspace snapshots with project context files.
Self-Reflection
Rewind bad reflection loops with a saved checkpoint.

