1 / 28
F = fullscreen
OPENCLAW MEMORY:
LEVELS UNLOCKED
Barron Roth · 2026
PRESS START
→ or SPACE to advance
MY STORY
Deep in a
Cubby
coding session one weekend — building a new feature, making architectural decisions, debugging edge cases. Real flow state.
My AI assistant remembered every decision, every constraint, every thread. It felt like having a
genius collaborator
.
Monday through Friday — other things. Come back next weekend...
"Hey, let's pick up where we left off on Cubby."
CONTEXT LOST
Architecture decisions, debugging context, the whole thread —
vaporized.
✈️
PREFERENCE AMNESIA
"Every time I asked for flights: nonstop, United, no red-eyes. Every. Single. Time. Like onboarding a new hire every session."
🎵
CONTRADICTED DECISION
"I spent 30 minutes picking a wedding DJ. A week later my agent pitched me the one I explicitly rejected."
💡
"The system didn't get worse — my bar got higher. The more I relied on it, the more the cracks showed."
HOW MEMORY
ACTUALLY WORKS
"Most people think memory is one thing.
It's actually four different systems."
LAYER 1: BOOTSTRAP FILES
✅ LOADED FROM DISK EVERY TURN — SURVIVE COMPACTION
📕 MEMORY.md
Curated long-term memory. Decisions, project status, vendor contacts, lessons learned. Main session only.
📜 AGENTS.md
Operating instructions. "Search memory before acting." Rules, workflows, safety constraints.
📅 memory/YYYY-MM-DD.md
Daily logs. Append-only. Today + yesterday loaded at session start. Raw context, not curated.
🔧 SOUL / USER / TOOLS.md
Personality, human profile, tool configs. Stable reference files. Also loaded every turn.
THE 4 LAYERS
✅
LAYER 1: BOOTSTRAP FILES
SOUL.md, AGENTS.md, MEMORY.md — loaded from disk every turn
❌
LAYER 2: SESSION TRANSCRIPT
Compaction summarizes it. Detail evaporates.
⚠️
LAYER 3: PRE-COMPACTION FLUSH
Safety net — but most people never check if it's working
⚠️
LAYER 4: RETRIEVAL INDEX
Stock: auto-selects OpenAI → Gemini → Voyage → local embeddings.
No API key = no search.
Only indexes MEMORY.md by default.
NUCLEAR COMPACTION
💣
▼
ONE-WAY DOOR. DETAIL GONE FOREVER.
"If it's not written to a file,
it doesn't exist."
That magic I felt when I first set up OpenClaw —
zapped away.
It's not magic. It still has limitations.
Memory might be the biggest one.
LEVEL UP!
LEVEL 2
CONTEXT ISOLATION
THE PROBLEM
One context window doing everything.
💒
📱
💰
✈️
🏋️
📧
Wedding vendors polluting Cubby coding sessions. Tax questions muddying travel planning.
THE UPGRADE: TOPIC ISOLATION
💒
WEDDING TOPIC
Vendors, planning, budget
📱
CUBBY TOPIC
Code, architecture, bugs
💰
FINANCE TOPIC
Taxes, investments, bills
Each topic = its own session with its own context window
PER-TOPIC SYSTEM PROMPTS
📱
cubby
→
reads
cubby.md
💒
wedding
→
reads
wedding.md
🍽️
maître d
→
reads
maitred.md
✈️
travel
→
reads
travel/*.md
💳
credit cards
→
reads
credit-cards.md
💰
finances
→
reads
budget.md
channels.telegram.groups.<id>.topics.<threadId>.
systemPrompt
LEVEL UP!
LEVEL 3
RETRIEVAL (QMD)
WHAT IS QMD?
🔍📜📜📜
On-device semantic search
over session transcripts
638
transcripts
68K
vectors
ZERO
cloud
THE HIDDEN SWITCH
sessions.enabled
ON
OFF by default.
Without this, QMD only indexes MEMORY.md.
You miss 99% of searchable history.
RAG-TYPE FLAWS
✨📜
✨📜
📜
📜
❌📜
🎲
Probabilistic, not deterministic.
Embedding similarity isn't the same as understanding.
📡
Signal-to-noise at 600+ transcripts.
Mentions in passing vs. deep discussions.
🤷
Reactive — agent must KNOW it forgot.
If it doesn't realize it's missing context, it guesses confidently.
QMD = "I forgot, let me look it up."
Cross-session recall unlocked. But it's a
search engine
, not a
memory system
.
LEVEL UP!
LEVEL 4
LOSSLESS CONTEXT MANAGEMENT
THE KEY DISTINCTION
QMD
"I forgot, let me
look it up."
REACTIVE
LCM
"I never fully
forget."
PROACTIVE
STOCK COMPACTION
💣
ONE-WAY DOOR
LCM
▼
▼
BRANCH
▼
CANOPY ✦
TWO-WAY DOOR
THE DAG
Condensed Summaries (Canopy)
Navigation layer
▲
Condensed Branch
Meso-compaction
▲
Leaf Summary
Leaf Summary
Leaf Summary
Micro-compaction
▲
Raw Messages (never deleted)
Ground truth
⬇️
lcm_expand — drill back down to recover detail anytime
CHARACTER STATS
SETTING
VALUE
EFFECT
session.reset.mode
idle (7 days)
Sessions survive restarts
freshTailCount
128
Protect last 128 messages
contextThreshold
0.75
Compact at 75% full
incrementalMaxDepth
-1
Unlimited DAG depth
QMD + LCM TOGETHER
LCM
Within-session
memory
DAG compaction
Micro-summaries
lcm_expand
BOTH ACTIVE
Complementary,
not competing
QMD
Cross-session
memory
638 transcripts
Semantic search
memory_search
"Nothing is ever deleted
from the database.
The summaries are a navigation layer,
not a replacement."
STAGE CLEAR!
THREE RULES
THREE RULES
🏆
RULE 1
Put durable rules in files, not chat. MEMORY.md, AGENTS.md — these survive everything. Chat instructions vanish.
🏆
RULE 2
Check that safety nets work. Memory flush, embed intervals, session reset settings. Most people never verify.
🏆
RULE 3
Make retrieval mandatory — add "search memory before acting" to AGENTS.md. Without it, the agent guesses instead of checking.
"The system keeps evolving. My job is to keep raising the bar."
alfred.barronroth.com/guide-to-alfred
GAME OVER
THANK YOU