Skip to content

Checkpoints

Before every agent turn, CodeBuddy snapshots the affected files. If you don’t like where the turn went, revert atomically. Captures on-disk content, not just editor buffers — files you haven’t opened are protected too.

graph TB A[Agent turn starts] --> B[CheckpointService.createCheckpoint<br/>Snapshots all tracked + extra files] B --> C[Agent executes<br/>Edits / creates / deletes files] C --> D[User reviews] D -->|Happy| E[Continue] D -->|Revert| F[revertToCheckpoint id<br/>Restore every file to snapshot state<br/>Delete files that didn't exist yet] F --> G[Checkpoints after this point discarded]

Before writing any file, the agent calls trackFile() to register the path. createCheckpoint() reads every tracked file from disk and stores it in memory. Files that don’t exist yet are recorded with didNotExist: true — reverting deletes them.

FieldMeaning
idUnique ID (ckpt-{timestamp}-{random})
labelHuman-readable label (e.g. “Before turn 3”)
timestampUnix timestamp of creation
conversationIdThread ID the checkpoint belongs to
filesFile snapshots — path, content, existence flag

When you revert:

  1. Files that existed at checkpoint time → content restored.
  2. Files that didn’t exist at checkpoint time → deleted (the agent created them).
  3. All checkpoints created after the target → discarded (no redo across a revert).
  4. Parent directories re-created as needed if a restored file’s parent was deleted.
  • 50 checkpoints per session. Cap reached → oldest evicted.
  • In-memory only. Don’t survive editor restarts — keeps the feature lightweight, avoids disk bloat.
  • Agent-touched files only. Your own manual edits outside the agent flow aren’t captured.
CommandEffect
Revert to CheckpointList checkpoints, revert to the selected one

Checkpoints are separate from Cmd/Ctrl+Z. Use editor undo for single-file undo of your own edits. Use checkpoints to revert multi-file agent changes atomically.