Quick Start
Overview
Checkpoints allow you to:- Save snapshots of your workspace before changes
- Restore files to any previous checkpoint
- Diff between checkpoints to see what changed
- Track all file modifications made by agents
In-session /undo and /revert
When praisonai code --checkpoints is active, the coding REPL gains turn-aware undo and revert commands.
/undo mode comparison:
| Mode | What /undo does |
|---|---|
| Checkpointing off (default) | Removes the last assistant + user message pair from history only. Workspace files are untouched. |
| Checkpointing on, session store not wired | Restores workspace files to the previous turn’s snapshot. Conversation history is left intact. (Legacy / file-only fallback.) |
Checkpointing on, session store wired (default in praisonai code) | Restores workspace files and rewinds chat_history to the message count captured at checkpoint_turn(), so the agent’s memory matches the workspace. Diff preview shown first. |
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
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.Low-level API Reference
CheckpointService Direct Usage
Methods
initialize()
Initialize the checkpoint service:save(message, allow_empty=False, quiet=False)
Save a checkpoint:| Parameter | Type | Default | Description |
|---|---|---|---|
message | str | — | Checkpoint message |
allow_empty | bool | False | Allow saving even when no files changed |
quiet | bool | False | Suppress output (used by machine-readable run modes) |
restore(checkpoint_id)
Restore to a checkpoint: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
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.

