knowledge-layers
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseKnowledge Layers
知识分层
Load when writing or editing AGENTS.md or .context/ files: it
owns the craft (four principles, contents guidelines, what doesn't belong).
Load if not already loaded for disclosure tiers.
Load if not already loaded.
/qi-layer/information-hierarchy/llm-writing编写或编辑AGENTS.md或.context/文件时,请加载:它定义了相关规范(四项原则、内容指南、不属于该范畴的内容)。如果尚未加载用于披露层级的,请加载它。如果尚未加载,请加载它。
/qi-layer/information-hierarchy/llm-writingThe Five Layers
五层结构
| Layer | What it holds | When to use it |
|---|---|---|
| Intent and mental model for a directory | First thing agents read on entry; what to understand before working here |
| Contracts, architecture, rationale ( | Reference depth and tracked deferrals, co-located with the code they describe |
| KB | Cross-cutting decisions, domain concepts, patterns | Spans directories; outlives sessions; no single directory owns it |
| User-facing documentation | Different audience, different update cadence |
| Work directory | Temporary design decisions and scratch | Not colocated with durable content; scoped to an active work item |
| 层级 | 存储内容 | 使用场景 |
|---|---|---|
| 目录的意图与心智模型 | Agent进入目录后首先读取的内容;开始工作前需要理解的信息 |
| 契约、架构、基本原理( | 供Agent查阅详细内容与跟踪待办事项,与所描述的代码共存 |
| KB | 跨领域决策、领域概念、模式 | 跨多个目录;生命周期长于会话;不属于单个目录 |
| 面向用户的文档 | 受众不同,更新节奏不同 |
| 工作目录 | 临时设计决策与草稿 | 不与持久化内容共存;范围限定在当前活跃的工作项 |
Placement Rules
放置规则
If it's intent/mental-model for a directory → .
If it's directory-scoped depth an agent looks up → .
If it's deferred work scoped to this directory → (must-do)
or (nice-to-have). Flat markdown lists — each entry names
the affected path and concrete follow-up. Cross-cutting items or items needing
external visibility get filed in the project's issue tracker instead.
If it's big picture — cross-cutting decisions, domain concepts,
higher-level system architecture → KB.
If it's for end users → .
If it's a temporary work artifact → work directory.
AGENTS.md.context/.context/TODO.context/FUTUREdocs/When in doubt, colocate. Knowledge that depends on one subsystem belongs
in that subsystem's AGENTS.md or .context/ even when it reads like a
concept; the KB stays code-agnostic, holding what survives implementation
change. Knowledge that lives far from what it describes rots faster:
changes to the code don't trigger awareness that a distant doc needs
updating.
如果是目录的意图/心智模型 → 。
如果是目录范围内供Agent查阅的详细内容 → 。
如果是目录范围内的待办工作 → (必须完成)或(期望完成)。采用扁平化Markdown列表——每个条目需注明受影响的路径和具体后续操作。跨领域事项或需要外部可见的事项需提交至项目的问题追踪器。
如果是全局视角内容——跨领域决策、领域概念、更高层级的系统架构 → KB。
如果是面向终端用户的内容 → 。
如果是临时工作产物 → 工作目录。
AGENTS.md.context/.context/TODO.context/FUTUREdocs/若存疑,优先就近放置。依赖单个子系统的知识,即使看起来是概念性内容,也应放在该子系统的AGENTS.md或.context/中;KB保持与代码无关,存储能在实现变更后留存的内容。与所描述内容相距过远的知识更容易失效:代码变更不会触发对远程文档需要更新的认知。
Current Truth Over History
以当前事实为准,而非历史
Every durable layer — AGENTS.md, , KB, — holds the best
current understanding; work directories may keep intermediate reasoning
while their work item is active. When durable content is
superseded, delete it or (for KB pages) move it to
('d, excluded from the knowledge graph). Live content never
references archived content. Pages read as current truth, never narrate
their own evolution.
.context/docs/archive/.kgignoreDeletion needs no replacement. A page whose subject is gone, or that
describes behavior the system no longer has, gets deleted on sight — even
with nothing new to write in its place. Stale knowledge is worse than a
gap: agents load it and reason from it. Deletion is the content-truth
owner's call; structural roles flag instead.
Git history is the archive. Commit untracked files before deleting them
so the removal lands in history, and say what was removed and why in the
commit message. Deletion is cheap because nothing tracked is ever truly
lost.
Truth is anchored per layer. AGENTS.md and describe the
checkout that contains them: update them in the same branch as the code
change and let the merge carry both — with parallel PRs in flight, each
branch documents itself. The KB is code-agnostic: it records the current
settled intent — what the system should be — and a settled decision is KB
truth the moment it's made, merged or not. Unsettled intent isn't KB
material; it stays in the work directory. describes shipped
behavior.
.context/docs/Decision records are the exception: preserve superseded decisions in place
when they explain why the system changed. Mark the old decision as
superseded and link to the replacement.
每个持久化层级——AGENTS.md、、KB、——都存储当前最佳认知;工作目录可在工作项活跃期间保留中间推理过程。当持久化内容被取代时,删除它,或(针对KB页面)将其移至(被忽略,不纳入知识图谱)。有效内容永远不引用归档内容。页面应呈现当前事实,而非叙述自身演变过程。
.context/docs/archive/.kgignore删除无需替代。 主题已消失或描述系统不再具备的行为的页面,一经发现立即删除——即使没有新内容替代。过时知识比空白更糟:Agent会加载并基于它进行推理。删除由内容事实所有者决定;结构角色仅做标记。
Git历史即为归档。 删除前提交未跟踪文件,使删除操作记录在历史中,并在提交信息中说明删除内容及原因。删除成本很低,因为所有被跟踪的内容永远不会真正丢失。
事实按层级锚定。 AGENTS.md和描述包含它们的代码检出版本:在与代码变更相同的分支中更新它们,让合并操作同时携带两者——当存在并行PR时,每个分支自行记录文档。KB与代码无关:它记录当前已确定的意图——系统应该是什么样——已确定的决策在制定时即为KB事实,无论是否合并。未确定的意图不属于KB内容;应留在工作目录中。描述已发布的行为。
.context/docs/决策记录是例外:当被取代的决策能解释系统变更原因时,保留其原位。标记旧决策为已取代,并链接至替代内容。
KB Conventions
KB约定
Structure
结构
The KB is a directory tree like any other: it carries its own AGENTS.md
and pair, written per — intent in AGENTS.md,
governance depth (writing conventions, structure, validation) in
. Read the KB's own before writing. Treat this
skill as the cross-project default; the local KB guide wins for that KB.
See for a suggested starting layout.
.context//qi-layer.context/AGENTS.mdresources/bootstrap.mdKB是一个目录树,与其他目录树相同:它包含自己的AGENTS.md和对,遵循编写——AGENTS.md存储意图,存储治理细节(写作约定、结构、验证规则)。编写前请阅读KB自身的。将本技能视为跨项目默认规范;本地KB指南对该KB具有优先性。参考获取建议的初始布局。
.context//qi-layer.context/AGENTS.mdresources/bootstrap.mdWiki Page Conventions
维基页面约定
Follow . One concept per document; name files by
what they describe (), not when ().
Cross-reference instead of re-explaining. Load for vocabulary
methodology. Use mermaid for anything spatial; capture what code can't
easily tell you.
/information-hierarchytoken-validation.mdauth-redesign-notes.md/shared-dao遵循。每个文档对应一个概念;文件按描述内容命名(如),而非按时间命名(如)。使用交叉引用而非重复解释。加载获取词汇方法论。使用mermaid绘制任何空间相关内容;捕捉代码无法轻易表达的信息。
/information-hierarchytoken-validation.mdauth-redesign-notes.md/shared-daoOperations
操作流程
Ingest: new information enters the KB. Read the source, extract key
knowledge, write or update wiki pages, and update indexes/cross-links touched
by the change.
Maintain: keep the wiki current per Current Truth Over History above.
Lint: health-check the wiki. Look for contradictions, stale claims,
orphan pages, missing cross-references. Use for link
checking and diagram validation.
/md-validationFlag content needing human attention with .
> [!FLAG] **Needs human review**摄入:新信息进入KB。阅读来源,提取关键知识,编写或更新维基页面,并更新受变更影响的索引/交叉链接。
维护:根据上述“以当前事实为准,而非历史”原则保持维基内容最新。
检查:对维基进行健康检查。查找矛盾、过时声明、孤立页面、缺失的交叉引用。使用进行链接检查和图表验证。
/md-validation使用标记需要人工关注的内容。
> [!FLAG] **需要人工审核**