Local-first knowledge graph plugin for OpenClaw — persistent memory with graph search and composited memory search.
The openclaw-basic-memory plugin integrates Basic Memory with OpenClaw to provide:
- Composited
memory_search— queries MEMORY.md, the BM knowledge graph, and active tasks in parallel - File watching via
bm watch— automatically syncs workspace markdown files into the knowledge graph - Auto-capture — records agent conversations as structured daily notes
- Graph tools — search, read, write, edit, delete, move, and navigate notes via
memory://URLs
-
Basic Memory CLI (
bm) withwatchcommand support:pip install basic-memory # or with uv: uv pip install basic-memory -
OpenClaw with plugin support
Clone and install:
git clone https://github.com/basicmachines-co/openclaw-basic-memory.git
cd openclaw-basic-memory
bun installAdd to your OpenClaw config:
{
plugins: {
load: {
paths: ["~/dev/openclaw-basic-memory"]
},
entries: {
"basic-memory": {
enabled: true
}
}
}
}{
"basic-memory": {
enabled: true
}
}This uses sensible defaults: auto-generated project name, watches ~/.openclaw/workspace/memory/, captures conversations.
{
"basic-memory": {
enabled: true,
config: {
project: "my-agent", // BM project name (default: "openclaw-{hostname}")
bmPath: "bm", // Path to BM CLI binary
projectPath: "~/.openclaw/workspace/memory/", // Directory BM watches and indexes
memoryDir: "memory/", // Relative memory dir for task scanning
memoryFile: "MEMORY.md", // Working memory file for grep search
autoCapture: true, // Index conversations automatically
debug: false, // Verbose logging
cloud: { // Optional cloud sync
url: "https://cloud.basicmemory.com",
api_key: "your-key"
}
}
}
}| Option | Type | Default | Description |
|---|---|---|---|
project |
string | "openclaw-{hostname}" |
Basic Memory project name |
bmPath |
string | "bm" |
Path to Basic Memory CLI binary |
projectPath |
string | "~/.openclaw/workspace/memory/" |
Directory for BM project data |
memoryDir |
string | "memory/" |
Relative path for task scanning |
memoryFile |
string | "MEMORY.md" |
Working memory file (grep-searched) |
autoCapture |
boolean | true |
Auto-index agent conversations |
debug |
boolean | false |
Enable verbose debug logs |
cloud |
object | — | Optional cloud sync config (url + api_key) |
Snake_case aliases (memory_dir, memory_file) are also supported.
On startup, the plugin spawns bm watch --project <name> as a long-running child process. This:
- Performs an initial sync of all files in the project directory
- Watches for file changes and re-indexes automatically
- Runs until the plugin stops (SIGTERM on shutdown)
No custom file watcher needed — Basic Memory handles everything.
When the agent calls memory_search, three sources are queried in parallel:
- MEMORY.md — grep/text search with ±1 line context
- BM Knowledge Graph — hybrid FTS + vector search (top 5 results with scores)
- Active Tasks — scans
memory/tasks/for non-done tasks
Results are formatted into clear sections:
## MEMORY.md
- matching lines with context...
## Knowledge Graph (memory/)
- note-title (0.85)
> preview of content...
## Active Tasks
- **Task Name** (status: active, step: 3)
context snippet...
After each agent turn (when autoCapture: true), the plugin:
- Extracts the last user + assistant messages
- Appends them as timestamped entries to a daily conversation note (
conversations-YYYY-MM-DD) - Skips very short exchanges (< 10 chars each)
Search the knowledge graph.
bm_search({ query: "API design", limit: 5 })Read a note by title, permalink, or memory:// URL.
bm_read({ identifier: "memory://projects/api-redesign" })Create a new note.
bm_write({ title: "Auth Strategy", content: "## Overview\n...", folder: "decisions" })Edit an existing note (append, prepend, find_replace, replace_section).
bm_edit({ identifier: "weekly-review", operation: "append", content: "\n## Update\nDone." })Delete a note.
bm_delete({ identifier: "notes/old-draft" })Move a note to a different folder.
bm_move({ identifier: "notes/my-note", newFolder: "archive" })Navigate the knowledge graph — get a note with its observations and relations.
bm_context({ url: "memory://projects/api-redesign", depth: 2 })/remember <text>— Save a quick note/recall <query>— Search the knowledge graph
openclaw basic-memory search "auth patterns" --limit 5
openclaw basic-memory read "projects/api-redesign"
openclaw basic-memory context "memory://projects/api-redesign" --depth 2
openclaw basic-memory recent --timeframe 24h
openclaw basic-memory statuswhich bm # Check if installed
bm --version # Check version
bm watch --help # Verify watch command existsIf bm watch doesn't exist, update Basic Memory to the latest version.
rm -rf /tmp/jiti/ "$TMPDIR/jiti/"
openclaw gateway stop && openclaw gateway start- Check that
bm watchis running (look for[bm watch]in logs) - Verify files exist in the project directory
- Try
bm tool search-notes "your query" --project <name>directly - Check project status:
bm project list
bun run check-types # Type checking
bun run lint # Linting
bun test # Run tests (156 tests)openclaw-basic-memory/
├── index.ts # Plugin entry — spawns bm watch, registers tools
├── config.ts # Configuration parsing
├── bm-client.ts # Basic Memory CLI wrapper
├── tools/ # Agent tools
│ ├── search.ts # bm_search
│ ├── read.ts # bm_read
│ ├── write.ts # bm_write
│ ├── edit.ts # bm_edit
│ ├── delete.ts # bm_delete
│ ├── move.ts # bm_move
│ ├── context.ts # bm_context
│ └── memory-provider.ts # Composited memory_search + memory_get
├── commands/
│ ├── slash.ts # /remember, /recall
│ └── cli.ts # openclaw basic-memory CLI
└── hooks/
└── capture.ts # Auto-capture conversations
MIT — see LICENSE file.