Git for what your agents know.
Fork an agent’s memory, try something, see the diff, then merge it or throw it away. The same four verbs you use on code, applied to everything an agent or robot has learned.
- › clawdb_search({ query: "refund policy" })→ "Refunds: 14-day window" (score 0.94)
Four verbs. Nothing else to learn.
Fork
Diff
Merge
Discard
Same flow from the SDK or any MCP client.
Branch IDs are ordinary values: pass them between agents, store them with an eval run, or put them in a log line.
const branch = await db.branch.fork('policy-v2');
// …the agent runs against the branch…
await db.memory.remember('Refunds: 30-day window', { tags: ['policy'] });
const diff = await db.branch.diff(branch, 'trunk');
// { added: 2, superseded: 1, conflicts: 0 }
if (evalPassed) await db.branch.merge(branch, 'trunk');
else await db.branch.discard(branch);// The same flow, as tool calls any MCP client can make
{ "tool": "clawdb_branch_fork", "arguments": { "name": "policy-v2" } }
{ "tool": "clawdb_branch_diff", "arguments": { "source_branch_id": "br_7f2c", "target_branch_id": "main" } }
{ "tool": "clawdb_branch_merge", "arguments": { "branch_id": "br_7f2c", "strategy": "source-wins" } }What teams branch memory for.
Eval runs that don’t pollute production
A/B two behaviours on identical memory
Sandbox risky multi-step work
Undo a bad batch of memories
Sim-to-real without risk
Per-agent scratch space
Branching, in detail.
Does forking duplicate all my memory?
No. Branches are copy-on-write: a fork records a pointer to main, and storage is only consumed for memories the branch adds or changes.
What happens when a merge conflicts?
You choose the strategy. last-write keeps whichever version was written most recently; source-wins lets the branch override main. The merge result lists what was applied, and reflection jobs can flag any contradictions left behind.
Can agents branch on their own?
Yes. Branching is exposed as MCP tools (clawdb_branch_list, clawdb_branch_get, clawdb_branch_trunk, clawdb_branch_fork, clawdb_branch_merge, clawdb_branch_diff, clawdb_branch_discard, clawdb_branch_archive), so an agent can fork before a risky step and merge or discard afterwards.
How does branching help robot fleets?
A simulator can fork live fleet memory, run high-density scenarios against it, and merge only the proven reroutes back. The physical fleet picks them up on its next sync.
Is branching available on the free tier?
Zero-copy branching is included from Starter; merging with strategies and knowledge-graph linking on branches are on Pro. The open-source engine includes branching when self-hosted.