Local-first knowledge graph plugin for OpenClaw — persistent memory with graph search and semantic navigation.
The openclaw-basic-memory plugin integrates Basic Memory with OpenClaw to provide sophisticated knowledge management capabilities. It operates in two complementary modes:
Runs alongside OpenClaw's built-in memory system:
- File watching: Automatically indexes markdown files in your workspace (
memory/,MEMORY.md, etc.) - Auto-capture: Records agent conversations as structured notes with observations and relations
- Workspace integration: Monitors file changes and re-indexes content automatically
Replaces OpenClaw's built-in memory tools with Basic Memory's knowledge graph:
- Semantic search: Uses embedding-based search across all notes and observations
- Graph navigation: Follow relations between concepts via
memory://URLs - Rich context: Retrieve notes with their connections and metadata
Combines archive and agent-memory modes for maximum functionality.
-
Basic Memory CLI: Install the
bmcommand-line toolpip install basic-memory # or with uv: uv pip install basic-memory -
OpenClaw: This plugin requires OpenClaw with plugin support
-
Clone the repo:
git clone https://github.com/basicmachines-co/openclaw-basic-memory.git cd openclaw-basic-memory bun install -
Add to your OpenClaw config (see Development Setup below)
For development with live reloading, add to your OpenClaw config:
{
plugins: {
load: {
paths: ["~/dev/openclaw-basic-memory"]
},
entries: {
"basic-memory": {
enabled: true,
config: {
mode: "both",
debug: true
}
}
}
}
}Add to your OpenClaw configuration file:
{
plugins: {
entries: {
"basic-memory": {
enabled: true,
config: {
mode: "archive", // "archive" | "agent-memory" | "both"
project: "my-agent" // Basic Memory project name
}
}
}
}
}{
plugins: {
entries: {
"basic-memory": {
enabled: true,
config: {
mode: "both", // Operating mode
project: "openclaw-my-machine", // Project name (auto-generated)
bmPath: "bm", // Path to BM CLI (default: "bm")
projectPath: "~/.basic-memory/openclaw/", // Project storage location
watchPaths: ["memory/", "MEMORY.md"], // Files to monitor (archive mode)
indexInterval: 300, // Re-index interval in seconds
autoCapture: true, // Capture agent conversations
debug: false // Enable debug logging
}
}
}
}
}| Option | Type | Default | Description |
|---|---|---|---|
mode |
string | "archive" |
Operating mode: "archive", "agent-memory", or "both" |
project |
string | "openclaw-{hostname}" |
Basic Memory project name (created automatically) |
bmPath |
string | "bm" |
Path to Basic Memory CLI binary |
projectPath |
string | "~/.basic-memory/openclaw/" |
Filesystem path for project data |
watchPaths |
array | ["memory/", "MEMORY.md"] |
Paths to monitor for changes (archive mode) |
indexInterval |
number | 300 |
Seconds between periodic re-indexing sweeps |
autoCapture |
boolean | true |
Automatically index conversation content |
debug |
boolean | false |
Enable verbose debug logs |
The plugin provides five agent tools for AI-driven knowledge management:
Search the Basic Memory knowledge graph for relevant notes and concepts.
// Search for notes about "API design"
bm_search({ query: "API design", limit: 5 })Read a specific note by title, permalink, or memory:// URL.
// Read a specific note
bm_read({ identifier: "projects/api-redesign" })
bm_read({ identifier: "memory://agents/decisions/auth-strategy" })Create new notes in the knowledge graph.
// Create a note in the "projects" folder
bm_write({
title: "API Authentication Strategy",
content: "## Overview\nWe decided to use JWT...",
folder: "projects"
})Edit existing notes with various operations:
append: Add content to the endprepend: Add content to the beginningfind_replace: Replace specific textreplace_section: Replace content under a heading
// Add to end of note
bm_edit({
identifier: "projects/api-redesign",
operation: "append",
content: "\n## Update\nImplementation complete."
})
// Replace a section
bm_edit({
identifier: "weekly-review",
operation: "replace_section",
sectionTitle: "This Week",
content: "- Completed API design\n- Started implementation"
})Delete a note from the knowledge graph.
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 using memory:// URLs to discover related concepts.
// Get context around a concept with related notes
bm_context({
url: "memory://projects/api-redesign",
depth: 2
})Quick commands for manual knowledge management:
Save a quick note to the knowledge graph.
/remember Met with the team about API changes. Need to update the auth flow.
Search your knowledge graph.
/recall API authentication decisions
Direct command-line access via openclaw basic-memory:
openclaw basic-memory search "authentication patterns" --limit 5openclaw basic-memory read "projects/api-redesign"
openclaw basic-memory read "memory://agents/decisions"openclaw basic-memory context "memory://projects/api-redesign" --depth 2openclaw basic-memory recent --timeframe 24h
openclaw basic-memory recent --timeframe 7dopenclaw basic-memory statusRuns alongside OpenClaw's default memory system:
- Monitors workspace files for changes (
memory/,MEMORY.md) - Auto-captures agent conversations as structured notes
- Builds knowledge graph from existing markdown files
- OpenClaw's built-in memory tools remain available
Use when: You want persistent knowledge capture without disrupting existing workflows.
Replaces OpenClaw's memory system entirely:
- Agent tools (
memory_search,memory_get) are replaced with Basic Memory equivalents - All agent memory operations use the knowledge graph
- Semantic search across all notes and observations
- Rich context with graph traversal
Use when: You want sophisticated knowledge graph capabilities as your primary memory system.
Combines both modes:
- Archive mode captures and indexes content
- Agent-memory mode provides enhanced search and retrieval
- Maximum functionality with full knowledge graph features
Use when: You want the complete Basic Memory experience.
Basic Memory uses memory:// URLs for semantic navigation:
memory://projects/api-redesign # Direct note reference
memory://agents/decisions # Category navigation
memory://concepts/authentication # Concept exploration
These URLs work in:
bm_contexttool for graph traversalbm_readtool for direct access- Basic Memory CLI for exploration
The plugin organizes knowledge in a semantic graph:
Markdown documents with:
- Title: Human-readable name
- Content: Full markdown content
- Permalink: Unique identifier
- Folder: Organizational category
Structured insights extracted from content:
- Category: Type of observation (decision, insight, task, etc.)
- Content: The observation text
- Relations: Connections to other notes
Semantic connections between notes:
- References: Direct mentions and links
- Topics: Shared concepts and themes
- Dependencies: Logical relationships
Monitors these paths by default:
memory/— General knowledge notesMEMORY.md— Long-term memory file (see AGENTS.md)
Configure additional paths:
{
"watchPaths": ["memory/", "MEMORY.md", "projects/", "docs/"]
}After each agent conversation:
- Extracts key information and decisions
- Creates structured notes with observations
- Links related concepts automatically
- Indexes content for semantic search
Disable with autoCapture: false.
Periodic re-indexing (default: 5 minutes):
- Processes new and modified files
- Updates embedding vectors for search
- Rebuilds relation graph
- Maintains search performance
Error: bm command failed: bm tool search-notes
Solutions:
- Install Basic Memory CLI:
brew install pip install basic-memory - Verify installation:
which bm - Set custom path:
"bmPath": "/usr/local/bin/bm"
If you see TypeScript/import errors:
# Clear jiti cache (macOS)
rm -rf /tmp/jiti/ "$TMPDIR/jiti/"
# Then fully restart the gateway (stop + start, not just SIGUSR1)
openclaw gateway stop && openclaw gateway startError: Project "openclaw-hostname" not found
The plugin creates projects automatically. If issues persist:
# Manually create project
bm project add openclaw-test ~/.basic-memory/openclaw/- Check
watchPathsconfiguration - Verify files exist in workspace
- Check OpenClaw logs for indexing activity
- Increase
indexIntervalif needed
- Wait for initial indexing (check logs)
- Verify content exists in watch paths
- Try broader search terms
- Check Basic Memory project status:
bm project list
bun run check-types
bun run lintbun testWhen developing:
- Use
debug: truein config for verbose logging - Install with
-lflag for live updates - Monitor OpenClaw logs for plugin activity
- Test with
openclaw basic-memory status
openclaw-basic-memory/
├── index.ts # Plugin entry point
├── config.ts # Configuration schema
├── bm-client.ts # Basic Memory CLI client
├── tools/ # Agent tools
│ ├── search.ts
│ ├── read.ts
│ ├── write.ts
│ ├── edit.ts
│ └── context.ts
├── commands/ # User commands
│ ├── slash.ts # /remember, /recall
│ └── cli.ts # openclaw basic-memory
├── hooks/ # Event handlers
│ └── capture.ts # Auto-capture logic
└── mode-b/ # Archive mode
├── archive.ts
└── file-watcher.ts
- Fork the repository
- Create a feature branch
- Make changes with tests
- Submit a pull request
MIT License - see LICENSE file for details.