Skip to main content
Track file changes in a hidden git repo so agents can snapshot, diff, and restore workspace files without touching your real repository.
The user approves autonomous edits; shadow-git snapshots let the agent diff, undo, or redo workspace changes safely.

Quick Start

1

Simple Usage

Enable change tracking on an autonomous agent — full_auto turns on snapshots automatically:
2

With Configuration

Use AutonomyConfig for explicit control, or call FileSnapshot directly:

How It Works

Git must be available on PATH. If shadow-repo init fails, tracking is skipped silently and undo() returns False.

Common Patterns

Selective restore

List recent snapshots


Best Practices

When using autonomy="full_auto", call agent.undo() rather than manual restore() — the agent maintains an undo/redo stack across iterations.
Call track(message=...) (or run the agent once) before bulk refactors so you have a named rollback point.
The shadow repo honours .gitignore patterns — build artefacts and secrets ignored by git are not snapshotted.
Call snapshot.cleanup() to remove the shadow repository if you no longer need history for a project.

File Editing

Safe find-and-replace tools agents use before snapshots capture the result

Autonomy Loop

Configure track_changes and autonomous file-editing levels