memory-discipline
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMemory only pays off when reads happen before the work and writes happen at decision points. This loop is the skill; every tool call in it is mechanical.
只有在工作前读取记忆、在决策节点写入记忆时,记忆才能发挥价值。这个循环就是一项技能;其中的每个工具调用都是机械性操作。
Quick start
快速开始
json
memory_smart_search { "query": "auth refresh flow", "project": "myrepo", "limit": 5 }at task start, then at each settled decision:
json
memory_save { "content": "Chose cursor pagination over offset; offset scans broke past 100k rows in db/list.ts.", "concepts": "cursor-pagination, offset-scan-limit", "files": "src/db/list.ts" }json
memory_smart_search { "query": "auth refresh flow", "project": "myrepo", "limit": 5 }在任务开始时执行上述操作,然后在每个决策确定后执行:
json
memory_save { "content": "Chose cursor pagination over offset; offset scans broke past 100k rows in db/list.ts.", "concepts": "cursor-pagination, offset-scan-limit", "files": "src/db/list.ts" }Why
核心原因
Hooks capture what happened automatically. What they cannot capture is judgment: which fact mattered, which decision was settled, which correction should change future behavior. That judgment applied at the right moments is this discipline.
钩子会自动记录已发生的事件,但它们无法捕捉判断:哪些事实至关重要,哪些决策已确定,哪些修正应改变未来行为。在恰当的时刻运用这种判断,就是这套方法的关键。
Workflow
工作流程
- Task start, before reading code for any nontrivial task: with the task topic and the project name. Spend the first tool call here; a hit saves rediscovery, a miss costs one call.
memory_smart_search - Mid-task, the moment a decision settles or a gotcha resolves: with the decision AND the reason, 2-5 specific concepts, real file paths. Save at the moment of resolution; end-of-session batch saves lose the reasons.
memory_save - On user correction of your approach: save a lesson instead of a memory (the skill). Lessons carry confidence and resurface before similar work; memories carry facts.
lesson - Before repeating a task type you have been corrected on: with the task type as query.
memory_lesson_recall - Session end: stop. Hooks summarize and consolidate; a manual recap save duplicates them.
- 任务启动时,在处理任何重要任务的代码前:使用任务主题和项目名称调用。将第一个工具调用用于此处;如果检索到相关内容,可避免重复探索;如果没有,也仅消耗一次调用。
memory_smart_search - 任务进行中,当决策确定或问题解决的那一刻:调用,传入决策内容及原因、2-5个具体概念、真实文件路径。要在问题解决的当下保存;会话结束后批量保存会丢失决策原因。
memory_save - 当用户修正你的方法时:保存为经验教训(使用技能)而非普通记忆。经验教训带有可信度,会在类似工作前重新浮现;普通记忆仅存储事实。
lesson - 在重复执行曾被修正过的任务类型前:以任务类型为查询词调用。
memory_lesson_recall - 会话结束:停止操作。钩子会自动总结和整合记忆;手动保存总结会造成重复。
What qualifies
可保存的内容
Save: settled decisions with reasons, non-obvious constraints discovered by debugging, environment facts not derivable from the repo. Skip: anything readable from the code, transient state, secrets, and step-by-step narration (hooks already captured it).
可保存:带有原因的确定决策、调试发现的非显而易见的约束条件、无法从代码库推导的环境信息。需跳过:任何可从代码中读取的内容、临时状态、机密信息,以及分步操作叙述(钩子已自动记录这些内容)。
Anti-patterns
反模式
WRONG: finish implementing, then search memory to double-check, and batch-save a summary of everything done.
RIGHT: search first, save each decision as it settles, let hooks own the summary.
错误做法:完成实现后,再检索记忆进行双重检查,然后批量保存所有操作的总结。
正确做法:先检索记忆,在每个决策确定时立即保存,让钩子负责总结工作。
Checklist
检查清单
- First tool call on a nontrivial task was a project-scoped search.
- Every save carries the reason, not just the conclusion.
- Corrections became lessons, not memories.
- Nothing saved that the repo or hooks already record.
- 重要任务的第一个工具调用是针对项目范围的检索。
- 每次保存都包含决策原因,而非仅结论。
- 修正内容被保存为经验教训,而非普通记忆。
- 未保存代码库或钩子已记录的内容。
See also
相关技能
- ,
recall: the user-invoked forms of the read and write sides.remember - : the correction loop this discipline hands off to.
lesson
- 、
recall:由用户触发的记忆读取和写入操作。remember - :这套方法所衔接的修正循环技能。
lesson
Troubleshooting
问题排查
See ../_shared/TROUBLESHOOTING.md if or is not available.
memory_smart_searchmemory_save如果或无法使用,请查看../_shared/TROUBLESHOOTING.md。
memory_smart_searchmemory_save