Scaffold, sanitize, or share an OpenClaw multi-agent memory system with a reusable workspace, memory-lancedb-pro configuration, role prompts, task-board conv...
记忆
Memory Anchor
试用Long-term memory for OpenClaw agents — SQLite hybrid recall (FTS5 + keyword + associative expansion + optional LLM embeddings), raw/curated anchors, session...
它能做什么
Long-term memory for OpenClaw agents — SQLite hybrid recall (FTS5 + keyword + associative expansion + optional LLM embeddings), raw/curated anchors, session briefings, and an explicit INDEX/REINDEX pipeline. Use when the user wants durable memory across sessions, Persistent Sage-style recall, or to remember/ search facts, preferences, and past conversations.
技能文档
Memory Anchor
Portable long-term memory used in Persistent Sage (originally Project Nova), Snowball, and Linux Ultra. Agents store durable facts as anchors, then recall them with hybrid search.
Who runs what (important)
End users do not run remember / recall. They just chat normally
(“I have three cats”, “what pets do I have?”).
You (the OpenClaw agent) call those CLI commands behind the scenes — same
role as Persistent Sage’s memory_search tool and background ingest. The user
should never need to know the commands exist.
| Actor | Job |
|---|---|
| User | Talks naturally |
| Agent | recall before answering from memory; remember / ingest when they state a durable fact; index after writes; briefing at session start |
| setup | One-time (or rare) bootstrap — agent can run this; power users may too |
When to use (agent)
- User states a durable fact / preference → store with
rememberoringest - User asks about past preferences, facts, projects, or earlier chats →
recallfirst - Start of a session →
briefingbefore answering from memory - After storing facts →
indexso semantic recall stays warm
Architecture (full Persistent Sage design)
| Layer | What it does |
|---|---|
| Raw anchors | Auto-captured snippets from user messages (heuristic split) |
| Curated anchors | fact / insight / curated with importance 1–5 |
| FTS5 | Porter + unicode61 full-text, ranked with bm25 |
| Keyword LIKE | Exact / substring match with escaped wildcards |
| Associative expansion | Rule-based synonyms (e.g. vision → colorblind) |
| Embeddings | Optional cosine similarity over stored vectors |
| INDEX / REINDEX | Explicit embedding pipeline (no always-on app) |
Embedding BLOB layout matches Persistent Sage Rust:
little-endian u32 dimension + dim × f32 LE.
Each vector also stores embedding_model so recall never mixes dimensions
from different embed models. If you switch models, run reindex.
Setup (Install → Start Using)
Requires Python 3 with SQLite FTS5 (standard CPython builds include it).
First run — one command (detects Ollama, optionally installs it, pulls
nomic-embed-text, smoke-tests embeddings):
python3 scripts/memory_anchor_cli.py setup --yes
After setup, the user just chats. You (the agent) call remember/recall internally — do not ask the user to type those commands.
What setup --yes automates:
- Find Ollama CLI / API (
OLLAMA_HOST, defaulthttp://127.0.0.1:11434) - If missing: install via
winget(Windows),brew(macOS), or official script (Linux) - Start the daemon when needed
- Pull
nomic-embed-text(tiny open-source embedder; Pi 5 friendly) - Smoke-test
/api/embed
index also auto-pulls the model if Ollama is already running but the model
is missing — so many users never need a manual ollama pull.
Lexical hybrid (FTS5 + keyword) works even before setup finishes.
Optional env:
export MEMORY_ANCHOR_DB="$HOME/.memory-anchor/memory_anchor.sqlite"
export MEMORY_ANCHOR_EMBED_PROVIDER=ollama # alias: local (default)
export MEMORY_ANCHOR_EMBED_MODEL=nomic-embed-text
export OLLAMA_HOST=http://127.0.0.1:11434
# Opt-in cloud (not default): MEMORY_ANCHOR_EMBED_PROVIDER=openai + OPENAI_API_KEY
CLI entrypoint (from this skill folder):
python3 scripts/memory_anchor_cli.py --help
Agent workflow (behind the scenes)
User says things in natural language. You translate that into tool calls:
| User says (example) | You run (silently) |
|---|---|
| “Remember I prefer dark mode” / states a lasting fact | remember "…" --type fact --index |
| Any substantive user turn worth keeping | ingest "…" --conversation … |
| “What pets do I have?” / “am I colorblind?” | recall "…" before answering |
| New session | briefing to load context |
| (periodic / after writes) | index |
0. First session — bootstrap local embedder
python3 scripts/memory_anchor_cli.py setup --yes
If setup is not ready, lexical recall still works; tell the user what
next_steps reported (usually “install/start Ollama”) — still without
asking them to run remember/recall.
1. Store (agent-only)
python3 scripts/memory_anchor_cli.py remember "User is colorblind and prefers high-contrast UI" \
--type fact --importance 4 --json --index
python3 scripts/memory_anchor_cli.py ingest "I have three cats and a dog named Pixel." \
--conversation default --json
2. Retrieve (agent-only)
python3 scripts/memory_anchor_cli.py recall "any pets?"
python3 scripts/memory_anchor_cli.py recall "Do you know anything about my vision?"
Lexical hybrid works even with zero embeddings. With local Ollama
(nomic-embed-text), cosine similarity is added automatically.
3. Index / briefing / status (agent-only)
python3 scripts/memory_anchor_cli.py index --json
python3 scripts/memory_anchor_cli.py briefing --conversation default --label Companion
python3 scripts/memory_anchor_cli.py status
Tool policy for agents
- Never ask the user to run
remember,recall,ingest, orindex. - Prefer
recallbefore guessing about the user's past facts or preferences. - Prefer
remember/ingestwhen the user states a durable fact. - After a batch of writes (or periodically), run
indexso semantic recall stays aligned with the configured embed model. - Never invent memories that
recalldid not return. - Do not echo API keys or preference values that look like secrets.
Environment
| Variable | Purpose |
|---|---|
MEMORY_ANCHOR_DB | SQLite file path (or directory) |
MEMORY_ANCHOR_EMBED_PROVIDER | Default ollama (local alias). Also ollama_cloud, openai |
MEMORY_ANCHOR_EMBED_MODEL | Default nomic-embed-text |
OLLAMA_HOST | Local Ollama base (default http://127.0.0.1:11434) |
OLLAMA_API_KEY | Ollama Cloud bearer token |
OPENAI_API_KEY | Only if you opt into OpenAI embeddings |
OPENAI_BASE_URL | Custom OpenAI-compatible base |
Design notes
See references/DESIGN.md for schema, scoring, and parity with Persistent Sage.
相关技能
Inspect, back up, search, export, and update OpenClaw long-term memory stored with MemoryOS. Use when Codex needs to manage MemoryOS memory files for an Open...
Audit and maintain OpenClaw-style long-term memory. Use for MEMORY.md cleanup, daily-note digestion, duplicate detection, stale-memory review, and promoting...
在本地磁盘以分类纯 Markdown 文件保存需要长期留存的事实,与智能体内置记忆并存。
Unified memory platform for Hermes, OpenClaw and AI agents — persistent long-term memory, cross-skill sharing, automated capture, governance rules, optimizat...
Give your OpenClaw agent persistent, cross-session memory via AgentPrizm — recall durable facts, decisions, preferences, lessons, and contacts before acting,...