Where the Brain Lives
Where the Brain Lives
Let's be precise about what "the brain" means.
The Agent Has No Persistent Brain
This is important to understand:
The LLM itself doesn't remember anything.
Every time you start a conversation:
- OpenClaw loads your workspace files
- These become the "system prompt"
- The LLM sees them as context
- The LLM generates responses
- Important info must be saved back to files
The "brain" is the files, not the model.
What Gets Loaded
At session start, OpenClaw injects:
[System Prompt]
├── SOUL.md content
├── USER.md content
├── AGENTS.md content
├── MEMORY.md content
├── Current date/time
├── Tool definitions
└── Channel contextThis is your agent's "consciousness" for this session.
What Gets Saved
During/after a session, the agent can:
- Write to memory/daily/*.md
- Update MEMORY.md
- Modify any workspace file
- Create new files
This is how memory persists.
The Context Window
The LLM has a context window — maximum tokens it can process.
| Model | Context Window |
|---|---|
| Claude Sonnet | ~200K tokens |
| Claude Opus | ~200K tokens |
| GPT-4 | ~128K tokens |
Your loaded files + conversation must fit in this window.
If it fills up, compaction happens — old messages get summarized.
Practical Implications
- Keep MEMORY.md small (under 3KB)
- Load details on demand (not everything at once)
- Save before compaction (or lose information)
- Structure matters (well-organized files = better retrieval)
The Mental Model
Think of it like this:
YOUR FILES (SOUL, MEMORY, daily logs) ⬇️ loaded into ⬇️
CONTEXT WINDOW (what the LLM can "see") ⬇️ generates ⬇️
RESPONSE (text, tool calls, etc.) ⬇️ saved back to ⬇️
YOUR FILES (updated with new info)
The files are the persistent brain. The LLM is the thinking engine.