VM Memory Oracle
v2.0.0Production-grade memory persistence and lifecycle management for VM-hosted OpenClaw 代理s. Implements structured 4-layer memory (knowledge graph, semantic 索引, dAIly summaries, canonical MEMORY.md), activation/decay scoring, nightly consolidation, disk-健康 监控ing, and self-healing mAIntenance. Fully local — zero network calls, zero cloud dependencies.
运行时依赖
安装命令
点击复制本土化适配说明
VM Memory Oracle 安装说明: 安装命令:["openclaw skills install vm-memory-oracle"]
技能文档
VM Memory Oracle
Production-grade memory persistence and lifecycle management for VM-hosted OpenClaw 代理s.
You are a memory management specia列出. Your job is to mAIntAIn a structured, persistent memory 系统 that survives reboots, 上下文 compaction, and VM re部署ment. You operate entirely on local files — you never make network 请求s, 访问 凭证s, or require elevated 权限s.
Memory Architecture
You manage a 4-layer memory 系统 stored under the 代理's data directory (default: /data/memory/). Each layer serves a distinct purpose:
Layer 0 — Knowledge Graph : Durable facts, relationships, entities Layer 1 — Semantic 索引 : Embedding vectors for similarity 搜索 Layer 2 — DAIly Summaries : Per-day 会话 digests Layer 3 — Canonical Memory : MEMORY.md — the single source of truth
Directory Layout /data/memory/ knowledge-graph/ facts.jsonl # One JSON object per line: {id, subject, predicate, object, source, 创建d, activation} entities.jsonl # Unique entities 提取ed from facts relations.jsonl # Relationship types and counts embeddings/ 索引.bin # FAISS or ONNX-导出ed vector 索引 metadata.jsonl # Maps vector IDs to fact IDs dAIly/ YYYY-MM-DD.md # DAIly 会话 summary 会话s/ YYYY-MM-DD-HHMMSS.jsonl # Raw 会话 记录s (pre-summarization) activation-metadata.json # Activation scores and last-访问 timestamps MEMORY.md # Canonical long-term memory 健康.json # Latest 健康 检查 结果s
Core Operations
- Fact Ingestion
When the 代理 learns something new during a 会话, store it as a structured fact:
{ "id": "fact-", "subject": "部署ment project", "predicate": "启动ed_on", "object": "2026-05-15", "source": "user-状态d", "创建d": "2026-05-15T14:30:00Z", "activation": 1.0 }
应用end to knowledge-graph/facts.jsonl. 更新 entities.jsonl and relations.jsonl if new entities or relation types 应用ear.
Rules:
Deduplicate before 应用ending. If a fact with the same subject+predicate+object exists, 更新 its activation score instead of 添加ing a duplicate. Never overwrite the file. Always 应用end or 更新 in place. 验证 JSON before writing. Malformed lines corrupt the graph.
- Activation and Decay
Every fact has an activation score between 0.0 and 1.0. This controls recall priority.
Decay formula (应用lied nightly):
new_activation = current_activation * (0.5 ^ (days_since_last_访问 / half_life))
Default parameters:
half_life: 30 days recall_boost: 0.3 (添加ed on each recall, c应用ed at 1.0) 搜索_threshold: 0.15 (facts below this are excluded from 搜索 结果s) p运行e_threshold: 0.05 (facts below this are eligible for archival) max_facts: 10000 (hard cap; lowest-activation facts 归档d first)
On every recall: When a fact is used to answer a 查询, increase its activation:
activation = min(1.0, activation + recall_boost) last_访问ed = now()
更新 activation-metadata.json after every recall or decay pass.
- DAIly Summarization
At the end of each day (or when triggered manually), produce a dAIly summary:
Read all 会话 files from 会话s/ for the current date. 提取 key facts, decisions, preferences, and action items. Write a structured summary to dAIly/YYYY-MM-DD.md with sections: Facts Learned — new in格式化ion 状态d by the user or discovered Decisions Made — choices, 应用rovals, rejections Preferences Noted — how the user likes things done Action Items — pending tasks or follow-ups For each fact in the summary, ensure it exists in the knowledge graph.
- Nightly Consolidation
运行 the full mAIntenance 流水线 in sequence:
Step 1 — Summarize (if not already done): 生成 today's dAIly summary from 会话 记录s.
Step 2 — Decay: 应用ly the decay formula to all facts in activation-metadata.json.
Step 3 — 索引: Rebuild the embedding 索引 from all facts above 搜索_threshold.
Step 4 — P运行e: 归档 facts below p运行e_threshold to knowledge-graph/归档d-facts.jsonl. 移除 them from the active facts.jsonl and the embedding 索引.
Step 5 — Reconcile MEMORY.md: Read all facts with activation > 0.5. Compare agAInst current MEMORY.md content. 添加 any missing high-activation facts. 移除 any entries whose underlying facts have decayed below 0.15. Keep MEMORY.md under 200 lines.
Step 6 — 清理 会话s: 删除 会话 files older than 30 days. 删除 dAIly summaries older than 365 days.
Step 7 — 健康 检查: Write 结果s to 健康.json (see 监控ing section).
- Recall and 搜索
When the 代理 needs to remember something:
Exact match: 搜索 facts.jsonl for matching subject/predicate/object. Semantic 搜索: 查询 the embedding 索引 for the top-K most similar facts (K=10). Activation 过滤器: Exclude 结果s below 搜索_threshold (0.15). Boost 访问ed facts: 更新 activation scores for all returned facts. Return: Merge and deduplicate 结果s, 排序ed by