This document explains how openclaw-basic-memory manages short-term memory, long-term memory, and active tasks during normal agent usage.
The plugin composes memory from three places:
MEMORY.md(working memory): lightweight, grep-style retrieval.- Basic Memory knowledge graph: semantic + FTS search over indexed markdown notes.
memory/tasks/*.md(active tasks): execution state with explicit status.
memory_search merges these into one response so agents can reason over current context and durable notes together.
Note on MEMORY.md role: OpenClaw's default convention treats
MEMORY.mdas long-term curated memory — decisions, preferences, and durable facts. This plugin flips that role: because Basic Memory provides a full knowledge graph for durable storage (memory/**/*.md),MEMORY.mdserves as short-horizon working memory instead. Long-lived knowledge belongs in the knowledge graph where it gets indexed, linked, and searchable.MEMORY.mdstays concise and focused on current session context.
- Agent/user writes notes with
write_note(or manually edits markdown files). - The MCP session monitors file changes and indexes them automatically.
- Updated notes become searchable in the knowledge graph.
- Agent calls
memory_search:- searches
MEMORY.mdfor matching lines with context - queries BM graph for top knowledge results
- resolves active tasks (graph query first, filesystem fallback)
- searches
- Agent calls
memory_getorread_notefor full note content. - Agent updates notes/tasks via
edit_note. - Completed tasks are excluded from active task results when
status: done.
flowchart TD
A["Agent/User updates notes (write_note, edit_note, markdown files)"] --> B["MCP session monitors file changes"]
B --> C["Basic Memory index refresh"]
C --> D["Agent calls memory_search(query)"]
D --> E["Search MEMORY.md (line-context grep)"]
D --> F["Search Knowledge Graph (BM FTS + semantic)"]
D --> G["Resolve Active Tasks"]
G --> G1["BM task query first"]
G1 --> G2["Fallback scan: memory/tasks/*.md"]
G2 --> G3["Filter out status: done"]
E --> H["Composited memory_search response"]
F --> H
G3 --> H
H --> I["Agent drills into result (memory_get or read_note)"]
I --> J["Agent updates task state (current_step, checkboxes, status)"]
J --> D
Use memory/tasks/ and include:
statusin frontmatter (active,blocked,done, etc.)current_stepin frontmatter## Contextsection with concise situational state
Example:
---
title: migrate-auth-routes
type: Task
status: active
current_step: 3
---
## Context
Auth middleware is deployed behind a flag. Monitoring error rates before full rollout.
## Plan
- [x] Add middleware
- [x] Add tests
- [x] Deploy to staging
- [ ] Validate metrics
- [ ] Roll out to productionCompletion update:
status: doneWhen memory_search runs, task results are computed in this order:
- Query BM graph using a task-focused query.
- If no results (or BM task query fails), scan
memory/tasks/*.mddirectly. - Exclude tasks where
statusis exactlydone. - Build preview snippets from task metadata and
## Context.
This fallback behavior keeps tasks discoverable even if the graph index is stale or temporarily unavailable.
write_note(
title="migrate-auth-routes",
folder="tasks",
content="""---
title: migrate-auth-routes
type: Task
status: active
current_step: 1
---
## Context
Starting auth route migration.
## Plan
- [ ] Implement middleware
- [ ] Add tests"""
)
- Update plan checkboxes with
edit_note+replace_section - Bump step with
edit_note+find_replace(forcurrent_step)
Use edit_note (find_replace) to change status: active to status: done.
- Keep
MEMORY.mdconcise and current; move durable details to notes undermemory/. - Prefer one task note per workstream; update it incrementally instead of rewriting.
- Ensure
memoryDirpoints to the directory that contains yourtasks/folder. - If task search looks wrong, verify the MCP session is connected and notes exist in expected paths.
This plugin ships with workflow-oriented skills that are automatically loaded when the plugin is enabled:
memory-tasks— standardized task creation/resume/update flowmemory-reflect— periodic memory consolidation from recent notesmemory-defrag— periodic cleanup/reorganization of memory filesmemory-schema— schema lifecycle management (infer, create, validate, diff, evolve)memory-metadata-search— structured metadata search by custom frontmatter fields (status, priority, etc.)memory-notes— guidance for writing well-structured notes with observations and relations
No manual installation needed. To update skills or install new ones as they become available:
npx skills add basicmachines-co/basic-memory-skills --agent openclawSee the upstream source at basic-memory-skills.