子代理可回忆长期记忆:放通 memory_search/memory_get 并建立最小检索流程
解决子代理无法读取 MEMORY 上下文导致重复调研的问题。前置:可修改子代理工具白名单并回归安全策略。步骤:放通 `memory_search`/`memory_get`→在子代理提示中强制先检索后回答→仅拉取必要行避免上下文膨胀→对关键结论附来源路径。关键命令:修改配置后执行构建与子代理回归。验证:子代理可给出 `Source: path#line` 级引用且不越权读取。风险:过度放权会增加隐私暴露面,需限制在最小可用工具集。
GITHUBDiscovered 2026-02-15Author BinHPdev
Prerequisites
- You can edit sub-agent tool allowlists and restart OpenClaw gateway safely.
- MEMORY.md and memory/*.md files exist with access boundaries documented.
Steps
- Allow `memory_search` and `memory_get` in sub-agent tool policy (do not open unrelated high-risk tools).
- Update sub-agent instructions to require: search first, then fetch only needed lines, then answer with citations.
- Run a recall regression using known facts (people/date/decision) and verify citation format consistency.
- Add a fallback rule: if confidence is low, explicitly say memory evidence is insufficient.
Commands
openclaw gateway statusnpm run buildopenclaw gateway restartVerify
A spawned sub-agent can answer memory-related prompts with accurate `Source: <path#line>` references and without unauthorized data access.
Caveats
- Do not expose MEMORY.md in shared/public sessions unless explicitly intended.
- Citation quality depends on memory hygiene; stale notes require periodic cleanup(需验证).
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗