Local Agent Memory v1
Build or refine a reliable file-based memory system for an agent.
Core workflow
- 1. Create or inspect these layers:
-
memory/YYYY-MM-DD.md
-
memory/semantic/
-
memory/procedural/
-
MEMORY.md
- 2. Keep
MEMORY.md lightweight and routing-oriented. - Put stable facts in semantic files.
- Put repeatable methods in procedural files.
- Treat memory as a hint/index layer, not unquestionable truth.
- Re-verify current facts before taking real actions based on remembered information.
- Write destination files first, then update
MEMORY.md only if the change deserves long-term indexing.
Decision rules
Use daily memory for
- - new events
- one-off attempts
- temporary troubleshooting detail
- anything not yet proven reusable
Use semantic memory for
- - stable user preferences
- durable environment facts
- platform constraints
- lasting architecture or governance decisions
Use procedural memory for
- - repeatable workflows
- checklists
- maintenance routines
- methods likely to be reused across sessions
Maintenance pattern
Run a lightweight dream/consolidation pass when memory starts to sprawl:
- - read INLINECODE6
- read recent daily logs
- identify repeated facts or workflows
- extract stable facts into semantic memory
- extract repeatable methods into procedural memory
- prune low-value or duplicated summary lines from INLINECODE7
Run a deeper pass for large daily logs or when the topic tree needs restructuring.
Guardrails
- - Do not let
MEMORY.md become a diary. - Do not promote everything that looks interesting.
- Do not rely on stale remembered facts for real actions.
- Do not mix memory maintenance with unrelated code changes unless the user asked for both.
- Prefer a few clear topic files over many overlapping files.
References
Read these only as needed:
- -
references/architecture.md for the memory model and core disciplines - INLINECODE10 for minimum structure and topic layout
- INLINECODE11 for governance and consolidation rules
本地代理记忆 v1
为代理构建或优化一个基于文件的可靠记忆系统。
核心工作流程
- 1. 创建或检查以下层级:
- memory/YYYY-MM-DD.md
- memory/semantic/
- memory/procedural/
- MEMORY.md
- 2. 保持 MEMORY.md 轻量且以路由为导向。
- 将稳定的事实放入语义文件中。
- 将可重复的方法放入程序文件中。
- 将记忆视为提示/索引层,而非绝对真理。
- 在基于记忆信息采取实际行动前,重新验证当前事实。
- 先写入目标文件,仅当变更值得长期索引时才更新 MEMORY.md。
决策规则
使用日常记忆存储
- - 新事件
- 一次性尝试
- 临时故障排查细节
- 任何尚未证明可重复使用的内容
使用语义记忆存储
- - 稳定的用户偏好
- 持久的运行环境事实
- 平台约束
- 长期的架构或治理决策
使用程序记忆存储
- - 可重复的工作流程
- 检查清单
- 维护例程
- 可能跨会话重复使用的方法
维护模式
当记忆开始膨胀时,执行一次轻量的梳理/整合:
- - 读取 MEMORY.md
- 读取最近的日常日志
- 识别重复的事实或工作流程
- 将稳定的事实提取到语义记忆中
- 将可重复的方法提取到程序记忆中
- 从 MEMORY.md 中修剪低价值或重复的摘要行
对于大型日常日志或需要重构主题树时,执行更深入的梳理。
防护措施
- - 不要让 MEMORY.md 变成日记。
- 不要推广所有看起来有趣的内容。
- 不要依赖过时的记忆事实来执行实际操作。
- 除非用户同时要求,否则不要将记忆维护与不相关的代码变更混在一起。
- 优先使用少量清晰的主题文件,而非大量重叠的文件。
参考资料
仅在需要时阅读:
- - references/architecture.md:记忆模型和核心规范
- references/setup.md:最小结构和主题布局
- references/maintenance.md:治理和整合规则