Skip to main content
AgentFS uses an overlay filesystem to provide copy-on-write isolation. This lets agents freely modify files while keeping your original data safe.

How Overlay Works

An overlay filesystem combines two layers:
Reading a file:
  1. Check delta layer first
  2. If not found, read from base layer
Writing a file:
  1. Copy file to delta layer (if from base)
  2. Write changes to delta layer
  3. Base layer is never modified
Deleting a file:
  1. Create a “whiteout” marker in delta layer
  2. File appears deleted in merged view
  3. Original file in base layer is untouched

Creating an Overlay Filesystem

With agentfs run

The simplest way - automatically creates an overlay over your current directory:

With agentfs init --base

Create an overlay explicitly:
Then mount it:
Or run a command in it:

Viewing Changes

See what’s different from the base:

Practical Examples

Safe Refactoring

Let an agent refactor your code without risk:

Testing Destructive Operations

Try something dangerous safely:

Parallel Experiments

Run multiple experiments on the same codebase:

Storage Efficiency

The overlay only stores:
  • Modified files - Full copy after first write
  • New files - Stored entirely in delta
  • Deleted files - Small whiteout marker
Original files are never duplicated. A 10GB project with 1MB of changes only uses ~1MB in the delta layer.

Technical Details

File Operations

Whiteouts

When you delete a base file, AgentFS creates a “whiteout” - a marker that hides the file:

Database Schema

The delta layer is stored in SQLite:
See the AgentFS Specification for the complete schema.

Next Steps

Sessions

Share state between agents

Syncing

Sync overlays to Turso Cloud