Branches: git for memory
ThinkingRoot treats memory like a versioned tree. You can fork a branch, do work
ThinkingRoot treats memory like a versioned tree. You can fork a branch, do work or reason in isolation, and merge it back only if it verifies — exactly like git, but for a cognition graph instead of files.
Why branch memory
- Speculative reasoning — explore an idea, a what-if, or a risky write without
polluting the trusted
mainmemory. - Verify before keep — a function or agent can fork, do work, check the result, and merge only on success (or roll back).
- Isolation — each session, dream, or experiment gets its own branch, so nothing leaks into shared memory until it's earned its place.
Core operations
await brain.branch.fork("experiment/pricing-v2"); // create a branch off main
await brain.branch.diff("experiment/pricing-v2"); // what changed vs main
await brain.branch.merge("experiment/pricing-v2"); // fold verified work into main
await brain.branch.rollback("experiment/pricing-v2"); // discard it
await brain.branch.checkout("experiment/pricing-v2"); // read/write against it
await brain.branch.lineage(); // the branch treeInside a Root Function the same is available as ctx.branch.fork(...) and
ctx.branch.merge(...), journaled for durable replay.
Streaming session branches
Every interactive session automatically gets its own branch (for example
stream/{session_id}) with an auto-merge-on-session-end policy. So a conversation's
writes accumulate safely on a session branch and fold into shared memory when the
session closes — no manual bookkeeping. This ships in the engine by default.
Merge policies and verification
A merge can be gated: branch-scoped work (a dream, a forged capability, a speculative
write) is only merged after a verification check passes. This is the substrate behind
verify-before-keep, quarantined dreaming, and self-extension — risky
knowledge lives on a branch until it is proven, then merges into main.
The bigger idea
Branching makes memory safe to experiment with. Combined with provenance and "verified or silent" recall, it means you can let an agent think, dream, and self-extend aggressively — because nothing it produces reaches trusted memory until it survives a merge gate. That is git's workflow, applied to a living Mind.