Snapshots

Shadow-git snapshots capture your workspace at turn boundaries so you can review what an agent changed and undo it without touching your real git history.

Overview

When snapshots are enabled, docker-agent records the state of your working directory as the agent runs. Each checkpoint is stored in a shadow git repository kept under the docker-agent data directory — completely separate from your project’s own .git. This lets you:

Snapshots only ever touch files on disk. They never write commits to your repository, never move your HEAD, and never appear in git log or git status.

Git repositories only

The snapshot machinery is a no-op outside a git worktree. It needs a git repository to scope which files belong to your project and to mirror the repository's ignore rules.

Enabling Snapshots

The simplest way is to enable snapshots globally for every agent in your user config:

# ~/.config/cagent/config.yaml
settings:
  snapshot: true

Omit snapshot or set it to false to leave automatic snapshots off.

You can also wire the snapshot built-in hook into a single agent instead of enabling it globally:

hooks:
  turn_start:
    - type: builtin
      command: snapshot
  turn_end:
    - type: builtin
      command: snapshot
  session_end:
    - type: builtin
      command: snapshot

Manually configured snapshot hooks always run, even when settings.snapshot is unset. See examples/snapshot_hooks.yaml for a complete configuration.

Using Snapshots in the TUI

When snapshots are enabled, the TUI exposes two slash commands:

Neither command removes messages from the session transcript — they only touch files on disk. Both commands (and their command-palette entries) are hidden when snapshots are turned off.

How It Works

See Also