memory-consolidate
Scripts live in the directory containing this SKILL.md. No copying needed.
OPENCLAW_WORKSPACE (default: ~/.openclaw/workspace) tells scripts where to read/write.
Install
Create required directories:
CODEBLOCK0
Patch OpenClaw config to inject snapshot into agent sessions:
CODEBLOCK1
Add daily cron (read timezone from USER.md, default UTC):
CODEBLOCK2
Run initial consolidation and verify:
CODEBLOCK3
Semantic Pipeline (LLM-powered)
INLINECODE2 runs the full pipeline including a semantic consolidation step powered by claude-haiku-4-5-20251001 via the tui provider. This is auto-configured from openclaw.json — no manual API key setup needed. The LLM step clusters related memories, deduplicates, and improves signal quality in MEMORY_SNAPSHOT.md.
Identity
Auto-detected from IDENTITY.md (assistant name) and USER.md (owner name, timezone, language). No config needed if these files exist with - **Key:** Value format.
Config
Edit config.yaml in the directory containing this SKILL.md:
- -
ingest.agent_ids — which agents to scan (default: "main", or ["main", "worker"]) - INLINECODE13 — lookback window (default: 24)
- INLINECODE14 — project keyword → tag mapping
- INLINECODE15 — decay speed (default: 0.07)
Health check
CODEBLOCK4
🟢 healthy / 🟡 watch / 🔴 needs tuning
Troubleshooting
| Symptom | Fix |
|---|
| Snapshot shows "Assistant"/"User" | Ensure IDENTITY.md/USER.md have **Name:** format |
| LLM semantic step fails |
Check
tui provider config in
openclaw.json has
baseUrl and
apiKey |
| Semantic pipeline degraded | Run
memory_candidate_extract.py, check import errors |
| SNR too low | Increase
temperature.age_lambda in config.yaml |
| No cold items after 2 weeks | Increase
age_lambda (0.07 default should work) |
| Memory not updating | Verify
OPENCLAW_WORKSPACE env var is set and cron job is active |
memory-consolidate
脚本位于包含此 SKILL.md 的目录中。无需复制。
OPENCLAW_WORKSPACE(默认值:~/.openclaw/workspace)指示脚本的读写位置。
安装
创建所需目录:
bash
mkdir -p $OPENCLAW_WORKSPACE/memory/structured/{archive,candidates,semantic}
修补 OpenClaw 配置以将快照注入代理会话:
gateway config.patch path=hooks.internal raw={enabled:true,entries:{bootstrap-extra-files:{enabled:true,paths:[MEMORY_SNAPSHOT.md]}}}
添加每日定时任务(从 USER.md 读取时区,默认 UTC):
cron add job={
name: Memory Consolidation (daily),
schedule: {kind: cron, expr: 0 3 *, tz: fromUSER.md>},
payload: {
kind: agentTurn,
message: bash $OPENCLAWWORKSPACE/scripts/memoryconsolidate_report.sh,
thinking: off,
timeoutSeconds: 300
},
sessionTarget: isolated,
delivery: {mode: announce}
}
运行初始整合并验证:
bash
bash $OPENCLAWWORKSPACE/scripts/memoryconsolidate_report.sh
语义管道(LLM 驱动)
memoryconsolidatereport.sh 运行完整管道,包括由 claude-haiku-4-5-20251001 通过 tui 提供程序驱动的语义整合步骤。此步骤从 openclaw.json 自动配置——无需手动设置 API 密钥。LLM 步骤对相关记忆进行聚类、去重,并提高 MEMORY_SNAPSHOT.md 中的信号质量。
身份标识
从 IDENTITY.md(助手名称)和 USER.md(所有者名称、时区、语言)自动检测。如果这些文件以 - Key: Value 格式存在,则无需配置。
配置
编辑包含此 SKILL.md 的目录中的 config.yaml:
- - ingest.agentids — 要扫描的代理(默认值:main,或 [main, worker])
- ingest.sessionhours — 回溯窗口(默认值:24)
- tagrules — 项目关键词 → 标签映射
- temperature.agelambda — 衰减速度(默认值:0.07)
健康检查
bash
python3 $OPENCLAWWORKSPACE/scripts/memoryconsolidate_observe.py
🟢 健康 / 🟡 需关注 / 🔴 需要调整
故障排除
| 症状 | 修复方法 |
|---|
| 快照显示Assistant/User | 确保 IDENTITY.md/USER.md 具有 Name: 格式 |
| LLM 语义步骤失败 |
检查 openclaw.json 中的 tui 提供程序配置是否包含 baseUrl 和 apiKey |
| 语义管道性能下降 | 运行 memory
candidateextract.py,检查导入错误 |
| 信噪比过低 | 增加 config.yaml 中的 temperature.age_lambda |
| 两周后无冷项 | 增加 age_lambda(默认值 0.07 应有效) |
| 记忆未更新 | 验证 OPENCLAW_WORKSPACE 环境变量已设置且定时任务处于活动状态 |