MemoryLake
Engineering & Developermemory for tree-of-thoughts agents

Give Tree-of-Thoughts Agents Branched Memory That Survives Every Exploration

Tree-of-Thoughts agents explore many reasoning branches in parallel. Without branched persistent memory, exploration produces ideas that vanish at run end and successful branches can't be reused. MemoryLake gives ToT agents Git-style branched memory with merge and rollback.

Day 1“Tree-of-Thoughts agents explore many reasoning branches in”“parallel.”✓ Got it, I will remember.Day 7 — new session“Same task again — can you keep the context?”× Sure — what was the context again?(forgot every detail you taught it)+ MEMORYLAKE LAYERMemory auto-loadedBranched memory per ToT pathMerge successful branchesRoll back failed branchesSESSION OUTPUT✓ Same prompt, on-brand answerNo re-briefing required.

Give Tree-of-Thoughts Agents Branched Memory That Survives Every Exploration

Get Started Free

Free forever · No credit card required

The problem: tree-of-thoughts explorations don't persist

The agent explored five branches; one worked. The branch was discarded at run end because there was no place to commit it. Next run, the same exploration happens from scratch. Branch reuse — the whole point of structured exploration — never materializes.

How MemoryLake supports Tree-of-Thoughts memory

Branched memory per ToT path

Branched memory per ToT path

Each branch becomes a memory branch.

MEMORYMerge successful branches

Merge successful branches

Winners get merged to main memory.

MEMORYRoll back failed branches

Roll back failed branches

Discard branches without polluting main.

Cross-run reuse

Cross-run reuse

Successful patterns from prior runs inform current exploration.

Get Started Free

Free forever · No credit card required

How it works for Tree-of-Thoughts memory

  1. Connect — Initialize branches as memory branches at exploration time.
  2. Structure — Each branch's thoughts, evaluations, and outcomes commit to its branch.
  3. Reuse — Winners merge; losers stay archived; cross-run learning compounds.

Before vs. after: Tree-of-Thoughts memory

Without MemoryLakeWith MemoryLake
Branch persistenceNonePer-branch commits
Successful branch reuseManualMerge to main memory
Failed branch isolationPollutes contextRolled back cleanly
Cross-run pattern learningNoneReflection memory

Who this is for

Researchers and engineering teams running Tree-of-Thoughts or similar structured exploration architectures where branch reuse and cross-run learning are core to the value.

Runnable demoabout 3 minutes

Try this use case on your own account

A fictional planning bot, Pathfinder, has to get checkout p95 below 300 ms. It opens three branches at once and keeps them in MemoryLake: each branch is its own project, its reasoning is stored in THINKING blocks that are replayed verbatim but never turned into memory, and all three explorers write to one shared trunk log. The winner and the reasons the others were pruned are merged into the trunk, the dead branches are rolled back, and a week later the next task reads the trunk first and opens one branch instead of three.

What you will see

  • Branch = project, checkout = search --projects <trunk>,<branch>, merge = promote the result to the trunk (fact add + metadata pointing back at the branch), rollback = proj delete (fact list → 404)
  • Chain-of-thought in THINKING blocks: conv msg list replays them byte for byte, and 0 of 70 reasoning-only details became memory across 6 fresh runs (the same text as TEXT is extracted)
  • Three explorers race for one trunk log: an append whose parent is no longer the head gets 409 "not the current head" and retries on current_message_id; the log stays gap-free with every entry once
  • The next task's plan skips the pruned branches, citing the trunk fact that says why, and starts from the branch that won. Plus a local web UI

You need: a MemoryLake API key · the memorylake CLI · Python 3.9+

Run it

git clone https://github.com/memorylake-ai/memorylake-usecases.git
cd memorylake-usecases/tot-branch-memory
export MEMORYLAKE_API_KEY=sk-…
python3 demo.py          # or: python3 web/server.py

Watch it run · real, unedited recordings

Related use cases

Frequently asked questions

Branch count limits?

Hundreds of concurrent branches supported.

Branch storage overhead?

Delta-encoded; minimal per branch.

Self-host?

Yes — enterprise tier deploys in your VPC.