为 OpenClaw 打造的五层自适应记忆系统,自进化。替代全量 MEMORY.md 注入 — 节省 92% token。
Five-tier adaptive memory system with self-evolution for OpenClaw. Drop-in replacement for full MEMORY.md injection — 92% token savings.
cmd_index now parses SESSION-STATE.md as high-priority tracespython3 scripts/memcore/cli.py vfm — VFM score analysis# Startup: generate brief (≤500 tokens, replaces full MEMORY.md)
python3 scripts/memcore/cli.py brief
# Search: 5-tier adaptive fallback
python3 scripts/memcore/cli.py search "<query>" -n 5
# Daily maintenance (index new logs → induce patterns → decay → refresh brief)
python3 scripts/memcore/cli.py run-all
# VFM score analysis
python3 scripts/memcore/cli.py vfm
# Stats overview
python3 scripts/memcore/cli.py stats
# Feedback: log whether retrieved memory was useful
python3 scripts/memcore/cli.py feedback-log <trace_id> used|skipped|good|bad
On each session start, replace full MEMORY.md loading with:
1. Read SOUL.md → USER.md → MEMORY_BRIEF.md (auto-generated) → .anatomy.md → yesterday+today memory
2. MEMORY.md loaded on-demand only via: python3 scripts/memcore/cli.py search "<keywords>"
The brief generator picks top 5 active patterns, top 3 recent lessons, and current taskboard items — all under 500 tokens.
Add step 3 to 散会 flow:
python3 scripts/memcore/cli.py index && \
python3 scripts/memcore/cli.py induce && \
python3 scripts/memcore/cli.py feedback
This auto-indexes today's log, induces new patterns, and decays stale traces.
When running daily health checks (09:00), append MemCore diagnostic:
# Get system stats
python3 scripts/memcore/cli.py stats
# If anomalies found, search historical similar faults
python3 scripts/memcore/cli.py search "<anomaly keywords>" -n 3
Safety rule: Report only. Never auto-fix. Let human decide.
After every memory_search call, log feedback:
# If the retrieved memory was helpful:
python3 scripts/memcore/cli.py feedback-log <trace_id> used
# If irrelevant:
python3 scripts/memcore/cli.py feedback-log <trace_id> skipped
This trains the retrieval system — high-value traces rise, stale ones decay.
Two 12-hour maintenance jobs (systemEvent, main session, wakeMode: next-heartbeat):
| Time (CST) | Cron expression | Action |
|---|---|---|
| ----------- | ---------------- | -------- |
| 04:00 | 0 4 * | index + induce + feedback + brief |
| 16:00 | 0 16 * | same |
These are SQLite-only, no model calls, near-zero resource cost.
cp memcore_backup_<date>/AGENTS.md ~/.openclaw/workspace/
cp memcore_backup_<date>/MEMORY.md ~/.openclaw/workspace/
Original MEMORY.md is never modified. All MemCore data lives in separate SQLite files under ~/.openclaw/.
共 1 个版本