Why File-Backed Notes?
OpenClawβs memory system stores agent knowledge as Markdown files in a dedicated notes directory. Unlike in-memory state that vanishes with each container restart, these files persist on the host filesystem through Docker volume mounts.
This design gives you:
- Human-readable memory β notes are plain Markdown you can read and edit
- Git-friendly β version control your agentβs knowledge base
- Portable β move notes between OpenClaw instances
- Inspectable β debug agent behavior by reading what it remembers
The Notes Directory
Memory notes live at:
/home/node/.openclaw/memory/notes/ (inside container)
/home/azureuser/.openclaw/memory/notes/ (on host via volume mount)The directory structure:
~/.openclaw/
βββ memory/
β βββ main.sqlite β Embedding index
β βββ notes/ β Markdown knowledge files
β βββ seed.md
β βββ durable.md
β βββ 2026-02-25.md β Auto-generated by memory flush
βββ openclaw.json
βββ ...Creating Seed Notes
Seed notes provide initial knowledge for a fresh agent deployment. Create them before the agent runs its first conversation:
cat > ~/.openclaw/memory/notes/seed.md <<'EOF'
# Seed note
This is a test note to initialize file-backed memory/search.
EOFAfter creating seed notes, restart the gateway so the memory search system indexes them:
docker compose restart openclaw-gatewayPractical Seed Notes
For a production deployment, seed notes can encode domain knowledge:
cat > ~/.openclaw/memory/notes/project-context.md <<'EOF'
# Project Context
## Infrastructure
- Running OpenClaw v2026.2.25 on Azure B2s VM (vm-openclaw-01)
- Docker Compose deployment with gateway on port 18789
- Control UI on port 18790
- Discord channel integration active
## Preferences
- Responses should be concise and technical
- Code examples use bash and Docker Compose
- Timezone: UTC for all timestamps
## Key Contacts
- Admin: azureuser (SSH access)
- Discord: configured via channels.discord
EOFcat > ~/.openclaw/memory/notes/troubleshooting-log.md <<'EOF'
# Troubleshooting Log
## Known Issues
- Discord Error 4014: Requires Message Content Intent in Developer Portal
- Config migration: Use channels.discord path (not root discord key)
- SQLite permissions: chown 1000:1000 on memory directory
- Startup takes 8-12 seconds on B2s VM
## Resolution History
(Agent will append entries here during memory flush)
EOFHow Memory Flush Writes Notes
When configured (see the memory flush article), the agent automatically writes notes before context compaction. The typical flow:
- Conversation approaches token limit
- Memory flush fires with your configured prompt
- Agent writes to
memory/YYYY-MM-DD.md(or whatever path you specify) - Context is compacted
- On the next query, memory search can retrieve the saved notes
Auto-Generated Note Example
After a flush, you might find:
# Session Notes β 2026-02-25
## Key Decisions
- Configured hybrid memory search with 70/30 vector/text split
- Set soft threshold to 4000 tokens for compaction flush
- Using all-MiniLM-L6-v2 for local embeddings
## Open Tasks
- Monitor embedding cache size after extended use
- Test memory recall accuracy across long conversationsVerifying Notes Inside the Container
Check that the gateway can see your notes:
docker exec -it openclaw-openclaw-gateway-1 sh -lc \
'ls -la /home/node/.openclaw/memory/notes'Expected output:
total 12
drwx------ 2 node node 4096 Feb 25 23:37 .
drwx------ 3 node node 4096 Feb 25 23:37 ..
-rw-r--r-- 1 node node 68 Feb 25 23:37 seed.mdOrganizing Notes
By Date (Recommended for Auto-Generated)
notes/
βββ 2026-02-24.md
βββ 2026-02-25.md
βββ 2026-02-26.mdBy Topic (Recommended for Seed Notes)
notes/
βββ project-context.md
βββ troubleshooting-log.md
βββ user-preferences.md
βββ architecture-decisions.mdHybrid Approach
notes/
βββ _seed/ β Manual seed notes (prefixed)
β βββ project-context.md
β βββ known-issues.md
βββ 2026-02-24.md β Auto-generated daily notes
βββ 2026-02-25.md
βββ 2026-02-26.mdIntegration with Memory Search
When you configure memorySearch with the local provider, notes are automatically indexed:
- Indexing: The gateway reads all
.mdfiles from thenotesdirectory - Embedding: Each note is split into chunks and embedded using all-MiniLM-L6-v2
- Storage: Embeddings are stored in
main.sqlite - Query: When the agent searches memory, both vector and text search scan the index
Reindexing After Manual Changes
If you manually add or edit notes, trigger a reindex:
docker compose run --rm openclaw-cli memory reindexNote Format Best Practices
Use Clear Headers
Headers help both humans and the search system understand note structure:
# Topic: Database Configuration
## Decision
Chose PostgreSQL over MySQL for the primary database.
## Rationale
- Better JSON support
- ACID compliance
- Team familiarityKeep Notes Focused
One topic per note performs better in search than a single monolithic file. The embedding model (MiniLM-L6-v2) has a 256-token sequence limit β shorter, focused notes produce better embeddings.
Include Keywords
While vector search understands semantics, explicit keywords help the text search component:
# Keywords: docker, permissions, UID, chown, node user
# Topic: Container Permission Fix
The memory directory requires UID 1000 ownership...Use Bullet Points for Facts
Facts stored as bullet points are easier for the agent to extract during retrieval:
## Server Details
- VM: vm-openclaw-01
- Region: East US
- Size: Standard_B2s
- OS: Ubuntu 24.04 LTS
- Docker: 28.4.0Backup and Versioning
Git-based Versioning
Since notes are plain Markdown, track them with git:
cd ~/.openclaw/memory/notes
git init
git add .
git commit -m "Initial seed notes"
# After agent generates new notes
git add .
git commit -m "Session notes $(date +%Y-%m-%d)"Automated Backup Cron
# Add to crontab
0 2 * * * tar czf /backup/openclaw-notes-$(date +\%Y\%m\%d).tar.gz \
/home/azureuser/.openclaw/memory/notes/Troubleshooting
Notes not found by search:
- Run
memory reindexafter adding new files - Check file permissions (must be readable by UID 1000)
- Verify files have
.mdextension
Agent writes to wrong path:
- Check the
memoryFlush.promptβ ensure the path template matches your directory structure - The
memory/YYYY-MM-DD.mdpath in the prompt is relative to the OpenClaw state directory
Notes disappear after restart:
- Verify the Docker volume mount includes the memory directory
- Check that Docker Compose doesnβt use an anonymous volume that gets recreated

