compile-knowledge
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecompile-knowledge
知识编译
Durable knowledge is worth keeping as many small, interlinked markdown files,
compiled over time and surfaced through an index — not as one giant doc, a chat
log, or a one-off file that rots. This skill makes compiling consistent so your
agent gets smarter over time instead of relearning the same things.
持久化知识值得以众多小型、互联的Markdown文件形式保存,随时间逐步编译并通过索引呈现——而非单一的巨型文档、聊天记录或会过时的一次性文件。此技能让知识编译保持一致性,使你的Agent随时间推移变得更智能,无需重复学习相同内容。
Where it goes — pick the right store
存储位置选择——挑选合适的存储库
- Agent memory (default, always available): your folder with
.claude/.../memory/as the index. This is the per-agent store and it survives restarts — it's the karpathy "external memory" that keeps you sharp across sessions. Governed by the memory rules already in your system prompt — follow them. For most agents this is the only store you need.MEMORY.md - Shared wiki (only if you work as a team): a folder in your project with a
wiki/. For knowledge the whole team benefits from — domain facts, research findings, reference material multiple agents would re-derive. Skip this entirely if you're a solo agent; don't manufacture team ceremony.wiki/index.md
Rule of thumb: "only I act on this" → memory. "Anyone on my team might need
this" → shared wiki. Cross-link between them with when they relate.
[[slug]]- Agent memory(默认选项,始终可用):你的文件夹,以
.claude/.../memory/作为索引。这是每个Agent专属的存储库,可在重启后保留——它是Karpathy提出的“外部记忆”,能让你在不同会话中保持敏锐。需遵循系统提示中已有的记忆规则。对于大多数Agent而言,这是唯一需要的存储库。MEMORY.md - Shared wiki(仅适用于团队协作场景):项目中的文件夹,包含
wiki/。用于存储整个团队都能受益的知识——领域事实、研究成果、多个Agent可能会重复推导的参考资料。如果你是独立Agent,请完全跳过此选项;不要刻意营造团队流程。wiki/index.md
经验法则:“只有我会用到这些内容” → 存入Agent memory。“团队中的任何人都可能需要这些内容” → 存入Shared wiki。当内容相关时,使用在两者之间建立交叉链接。
[[slug]]Before you write — the hygiene gate
撰写前的检查准则
Compile ONLY a durable, non-obvious fact. Skip and move on if it is:
- routine / derivable from the repo, git history, or existing docs,
- true only for this one conversation,
- already covered by an existing file (→ UPDATE that file instead, don't duplicate).
Most tasks (a deploy, a restart, a one-line fix) produce nothing durable. That is
fine — do not manufacture a memory to "have written something." Filler is worse
than nothing; it pollutes recall.
仅编译持久化、非显而易见的事实。如果属于以下情况,请跳过并继续:
- 常规内容/可从代码库、git历史或现有文档中推导得出,
- 仅适用于本次对话的内容,
- 已有文件涵盖的内容(→ 改为更新该文件,不要重复创建)。
大多数任务(部署、重启、单行修复)不会产生可持久化的内容。这很正常——不要为了“有所产出”而刻意创建记忆。冗余内容比空白更糟,会干扰信息检索。
The procedure
操作步骤
- Search first. Look for an existing file on this topic (grep the store + skim the index). If one exists, edit it — never create a near-duplicate.
- Atomic. One fact / one topic per file. If you're tempted to add a second unrelated fact, that's a second file.
- Name it. kebab-case slug, with a type prefix for memory
(,
feedback_…,project_…,reference_…) or a clear topic slug for the wiki. The slug is the link target.user_… - Frontmatter. (= the slug),
name(ONE line — this is what gets matched during recall, make it specific), and adescription/category.type - Body. State the fact plainly. Link related entries with — liberally; a link to a file that doesn't exist yet is a fine TODO marker. For
[[slug]]/feedback, follow with Why: and How to apply: lines.project - Index. Add or update a ONE-LINE pointer in the index (for memory;
MEMORY.mdfor the wiki):wiki/index.md. Keep it under ~200 chars; detail lives in the file, never the index. If the wiki- [Title](slug.md) — hookdoesn't exist yet, create it so the store stays discoverable.index.md - Hygiene. Delete files that turned out wrong. Convert relative dates to absolute. If the index is getting long, tighten lines — don't let it bloat.
- 先搜索。查找关于该主题的现有文件(检索存储库并浏览索引)。如果存在,编辑该文件——切勿创建近似重复的文件。
- 原子化。每个文件对应一个事实/一个主题。如果你想添加第二个不相关的事实,应创建第二个文件。
- 命名。使用kebab-case格式的slug,对于Agent memory需添加类型前缀(、
feedback_…、project_…、reference_…),对于Shared wiki则使用清晰的主题slug。slug是链接的目标。user_… - 前置元数据(Frontmatter)。包含(等于slug)、
name(一行内容——这是检索时匹配的关键,需具体明确)和description/类别。type - 正文。清晰陈述事实。大量使用链接相关条目——即使链接的文件尚未存在,也可作为待办标记。对于
[[slug]]/feedback类型,需添加**原因:和应用方式:**部分。project - 索引。在索引中添加或更新一行指向文件的条目(Agent memory对应;Shared wiki对应
MEMORY.md):wiki/index.md。长度控制在约200字符以内;详细内容放在文件中,不要放在索引里。如果Shared wiki的- [标题](slug.md) — 简介尚未存在,请创建它,确保存储库可被检索。index.md - 维护。删除被证明错误的文件。将相对日期转换为绝对日期。如果索引过长,精简条目——不要让它膨胀。
Lifecycle — supersede, don't silently overwrite
生命周期——替代而非静默覆盖
Facts rot. When one is time-sensitive, uncertain, or replaces an older one,
stamp the envelope so recall can age it out instead of surfacing stale truth:
- — date the fact expires / needs a recheck. Past it, recall keeps the fact but demotes + flags it
valid_to: YYYY-MM-DD.⚠ expired - — when a new fact replaces an old one, point at the old slug. The old fact is then demoted (
supersedes: <slug>) in recall instead of lingering as a second, contradictory answer. Prefer this over edit-in-place when the OLD value is still worth seeing (audit trail); edit in place when it isn't.⤴ superseded - — low/medium facts are demoted so a hunch never outranks a verified fact.
confidence: high|medium|low - — where the fact came from, distinct from
provenance: "<source>"(who wrote the note).compiled_by
5dive memory add--valid-to=--supersedes=--confidence=--provenance=事实会过时。当事实具有时效性、不确定性或替代旧事实时,需标记清楚,以便检索时能识别过时内容,而非呈现陈旧信息:
- ——事实过期/需要重新检查的日期。超过该日期后,检索时仍会保留事实,但会降级并标记为
valid_to: YYYY-MM-DD。⚠ expired - ——当新事实替代旧事实时,指向旧事实的slug。旧事实会在检索时被降级(标记为
supersedes: <slug>),而非作为第二个矛盾答案留存。当旧值仍有查看价值(审计追踪)时,优先使用此方式;否则直接原地编辑。⤴ superseded - ——低/中等置信度的事实会被降级,避免猜测内容优先于已验证的事实。
confidence: high|medium|low - ——事实的来源,与
provenance: "<source>"(撰写笔记的人)区分开。compiled_by
5dive memory add--valid-to=--supersedes=--confidence=--provenance=Anti-patterns
反模式
- A wall-of-text doc instead of atomic files.
- Research left as a standalone that never gets folded in — that's working notes, not knowledge. Compile the durable parts into the store.
notes.md - Duplicating a fact across memory AND wiki — pick one home, cross-link.
- Index entries that restate the whole file.
- Writing filler to satisfy a habit/checklist.
- 用大段文本文档替代原子化文件。
- 研究内容以独立的形式留存,从未整合到存储库中——这是工作笔记,而非知识。需将可持久化的部分编译到存储库中。
notes.md - 在Agent memory和Shared wiki中重复存储同一事实——选择一个存储位置,建立交叉链接。
- 索引条目重复文件的全部内容。
- 为满足习惯/检查清单而撰写冗余内容。
Quick checklist
快速检查清单
[ ] durable & non-obvious? [ ] right store? [ ] updated existing vs new?[ ] atomic + named + frontmatter? [ ] [[links]]? [ ] index line added?[ ] 是否为持久化且非显而易见的内容?[ ] 是否选择了正确的存储库?[ ] 是否更新现有文件而非创建新文件?[ ] 是否原子化、命名规范且包含前置元数据?[ ] 是否添加了[[链接]]?[ ] 是否添加了索引条目?