What Is Brain CMS?
Brain CMS (Continuum Memory System) is a neuroscience-inspired memory
architecture for OpenClaw agents that replaces traditional flat file injection
with a sophisticated multi-layer memory system. This approach dramatically
improves context efficiency while reducing token costs for long-running
agents.
Core Architecture
The system organizes memory into distinct layers based on how human brains
store and retrieve information:
- Working Memory : The lean core (MEMORY.md) plus today's daily log, loaded every session
- Episodic Memory : Daily logs stored as memory/YYYY-MM-DD.md, loaded during boot
- Semantic Memory : Domain-specific schemas loaded on trigger
- Anchors : High-significance events in memory/ANCHORS.md, loaded for critical topics
- Vector Store : LanceDB-powered semantic search for ambiguous queries
Key Components
The Brain CMS installation creates a structured directory system:
memory/
├── INDEX.md # Hippocampus: topic router + cross-links
├── ANCHORS.md # Permanent high-significance event store
└── schemas/ # Domain-specific semantic schemas
memory_brain/
├── index_memory.py # Embeds schemas into LanceDB vector store
├── query_memory.py # Semantic similarity search
├── nrem.py # NREM sleep cycle (compression + anchor promotion)
├── rem.py # REM sleep cycle (LLM consolidation via Ollama)
└── vectorstore/ # LanceDB database (auto-created)
How It Works
The system follows a sophisticated retrieval pattern:
- Boot Sequence : Load MEMORY.md (lean core) + today's daily log
- Topic Detection : When a topic appears, read memory/INDEX.md to find relevant schemas
- Spreading Activation : Load only the schemas related to the detected topic
- : Check memory/ANCHORS.md for high-significance events
- Ambiguous Topics : Run semantic search using the vector store
Automated Sleep Cycles
The system mimics biological sleep processes:
NREM Sleep Cycle
Run on shutdown (approximately 30 seconds, no LLM required):
cd ~/.openclaw/workspace/memory_brain && .venv/bin/python3 nrem.py
This compresses memories and promotes anchors to permanent storage.
REM Sleep Cycle
Run weekly (2-5 minutes, uses local llama3.2:3b model):
cd ~/.openclaw/workspace/memory_brain && .venv/bin/python3 rem.py
This performs LLM-based consolidation of memories.
Setup and Installation
Setting up Brain CMS requires a one-time installation process:
- Run the installer : python3 ~/.openclaw/workspace/skills/brain-cms/install.py
- Index your schemas : cd ~/.openclaw/workspace/memory_brain && .venv/bin/python3 index_memory.py
- Test retrieval : .venv/bin/python3 query_memory.py "your topic here" --sources-only
Semantic Schemas
When new significant projects or domains appear, create memory/.md
files and add them to INDEX.md with triggers, priority, and cross-links. The
system automatically re-indexes when schemas change.
Performance Benefits
Brain CMS offers substantial performance improvements:
- Typical MEMORY.md : 150-300 lines injected every session
- With Brain CMS : ~50-line core + schemas loaded only when relevant
- Estimated savings : 40-60% reduction in context tokens per session
Technical Requirements
The system requires:
- Python 3.10+
- Ollama (for embeddings + REM consolidation)
- 500MB+ storage for vector store and models
- Python packages: lancedb, numpy, pyarrow, requests (auto-installed)
Tagging Anchors
In daily logs, tag high-significance events using the [ANCHOR] tag:
[ANCHOR] Major demo success — full pipeline working end-to-end
The NREM cycle automatically promotes these to ANCHORS.md on next shutdown.
Why Choose Brain CMS?
Brain CMS is ideal when you need:
- Persistent agent memory across sessions
- Improved context efficiency for long-running agents
- Reduced token costs through selective memory loading
- Semantic search capabilities for ambiguous queries
- A neuroscience-based approach to memory management
By implementing Brain CMS, you transform your agent's memory from a simple
file dump into a sophisticated, efficient, and intelligent system that mimics
how biological brains actually process and store information.
Skill can be found at:
cms/SKILL.md>
Top comments (0)