Stanford's Shepherd makes every AI agent write a reversible proposal, not a direct edit. The copy-on-write fork runs five times faster than docker commit and reuses 95% of the KV cache.
Key facts
- Copy-on-write fork 5x faster than docker commit
- 95% KV cache reused on replay
- CooperBench pass rate 28.8% to 54.7% with supervisor
- MIT-licensed, pip install shepherd-ai
- Enforced via macOS Seatbelt or Linux Landlock
Key Takeaways
- Stanford's Shepherd makes agent runs reversible via Git-like commits and syscall-level permissions.
- Copy-on-write forks are 5x faster than docker commit with 95% KV cache reuse.
Reversibility as a first-class primitive

Stanford researchers built Shepherd to treat a live agent run like a Git branch. According to @hasantoxr, every agent-environment interaction becomes a typed commit capturing both the process and the filesystem, copy-on-write. Nothing touches the working directory until the user accepts it. You can execute the proposal in isolation, inspect what it does, then keep, merge, or discard it — the trace records the outcome either way.
This is a structural departure from the standard harness. Most agent frameworks log messages and leave filesystem mutations in place. Shepherd makes the filesystem itself part of the versioned state. Reverting to a prior step is a single fork call that restores the exact live state, not just the files on disk.
The performance claims are specific: the copy-on-write fork is roughly five times faster than docker commit, and because the prompt prefix through that step is unchanged, over 95% of the KV cache is reused on replay. Early steps aren't reprocessed, which matters for long-horizon tasks where recompute dominates wall-clock time.
Permission at the syscall, not the merge gate
The permission model flows through the function signature. Write repo: sp.GitRepo and the agent gets a writable handle; write May[GitRepo, ReadOnly] and the same repo is read-only for that run. On a jailed device, those grants compile down to the run's writable roots and are enforced by the operating system — macOS Seatbelt or Linux Landlock in a privileged container. A write to a read-only repo is refused at the syscall, before the agent's edit reaches disk. This is more robust than a post-hoc merge gate because it blocks the mutation at the kernel boundary.
Supervision via trace replay

Because every run is reversible, a meta-agent can sit on top and watch the trace. The moment a step looks wrong, it reverts before the bad write is committed. In practice, this is Python calling fork, replay, and revert on the trace, not a separate control plane wired into the harness. On CooperBench, where two agents work on the same codebase, adding a live supervisor took the pair-coding pass rate from 28.8% to 54.7%.
There are limits. Files and sandbox changes undo themselves, but a database write needs a matching undo step set up in advance. External actions like a sent email or a real charge can't be undone at all — the supervisor's job there is to catch them before they fire. The project is labeled alpha, MIT-licensed, and installable via pip install shepherd-ai.
If Git made file changes reversible, Shepherd is trying to do the same for a live agent run, from the process and the KV cache down to the syscall itself.
What to watch
Watch for the first real-world adoption reports from the GitHub repo and whether the KV cache reuse claim holds on long-horizon tasks beyond CooperBench. Also track whether the syscall-level permission model gets adopted by mainstream agent frameworks like LangChain or AutoGen as a safety default.








