Skip to content

Knowledge Collections ​

Every approved article in knowledge/ lives under a collection — the first directory of its path, such as knowledge/sop/…. The collection says what kind of reading the article serves. At build time it decides which package root the article goes to, and package select.collections filters by it.

mermaid
flowchart LR
  k["knowledge/collection/..."] --> w["wikis/<br/>entities and relationships"]
  k --> g["guides/<br/>explanations and procedures"]
  k --> r["rules/<br/>standards and checks"]
  k --> f["feats/<br/>feature records"]

The collections ​

CollectionHoldsPackage pathOKF type
codeindexSource-backed code indexes, with optional structured relationshipswikis/codeindex/Wiki
businessStructured business entities and relationshipswikis/business/Wiki
productStructured product entities, behavior and relationshipswikis/product/Wiki
architectureArchitecture explanations and design narrativesguides/architecture/Guide
sopProcedures and runbooksguides/sop/Guide
faqQuestion-oriented explanations and troubleshootingguides/faq/Guide
decisionDecision records and trade-off narrativesguides/decision/Guide
incidentIncident timelines, response and follow-upguides/incident/Guide
standardsNormative standards and constraintsrules/standards/Rule
testValidation rules, scenarios and acceptance checksrules/test/Rule
featsFeature capability recordsfeats/Feature

codegraph is still accepted as the legacy name of the code index collection and maps to wikis/ like codeindex.

What the package roots mean ​

  • wikis/ is the structured entity-and-relationship layer and the required default entry of a knowledge package, starting at wikis/index.md.
  • guides/ and rules/ explain, operationalize or constrain that knowledge. Placing an article there does not create a relationship to anything; only a typed edge recorded by Context does.
  • feats/ holds feature records.

A package can choose roots with select.okfRoots as well as collections; see Package Templates.

Choosing a collection ​

The Indexer proposes a collection from the reader's need, not from the source type: a document can become a runbook in sop, a decision record in decision or a standard in standards. Typical pairings:

Reader needUseful form
Understand a term, boundary or business ruleDomain explanation with scope and examples
Understand architecture or integrationTechnical explanation, contracts and limitations
Complete a repeatable taskGuide with prerequisites, actions and checks
Diagnose or recoverRunbook with symptoms, safe actions and verification
Understand a choiceDecision, alternatives, rationale and consequences
Learn from an incidentImpact, observations, causes and response
Interpret a testMethod, scope and what the result establishes

You can move an approved article to another collection later with context revise <target> --move-to <path>, which keeps its identity.

Reserved names ​

index.md is reserved for package bundle and directory indexes. A source document may be called index.md, but an article must use another name such as index-page.md; context build rejects copied knowledge that would occupy wikis/**/index.md.

知识分类 ​

knowledge/ 中每篇已批准的文章都位于某个知识分类之下——即其路径的第一级目录,例如 knowledge/sop/…。知识分类说明这篇文章服务于哪类阅读需求。构建时,它决定文章进入哪个包根目录,包的 select.collections 也按它来过滤。

mermaid
flowchart LR
  k["knowledge/collection/..."] --> w["wikis/<br/>实体与关系"]
  k --> g["guides/<br/>说明与操作步骤"]
  k --> r["rules/<br/>规范与检查"]
  k --> f["feats/<br/>功能记录"]

分类一览 ​

知识分类内容包内路径OKF 类型
codeindex有源码依据的代码索引,可附带结构化关系wikis/codeindex/Wiki
business结构化的业务实体与关系wikis/business/Wiki
product结构化的产品实体、行为与关系wikis/product/Wiki
architecture架构说明与设计叙述guides/architecture/Guide
sop操作流程与运维手册guides/sop/Guide
faq以问题为导向的解释与故障排查guides/faq/Guide
decision决策记录与权衡分析guides/decision/Guide
incident事故时间线、响应与后续跟进guides/incident/Guide
standards规范性标准与约束rules/standards/Rule
test验证规则、场景与验收检查rules/test/Rule
feats功能能力记录feats/Feature

codegraph 作为代码索引分类的旧名称仍被接受,并与 codeindex 一样映射到 wikis/。

包根目录的含义 ​

  • wikis/ 是结构化的实体与关系层,也是知识包必需的默认入口,从 wikis/index.md 开始。
  • guides/ 和 rules/ 用于解释、落地或约束这些知识。把文章放在这里并不会与任何内容建立关系;只有 Context 记录的类型化边才会。
  • feats/ 存放功能记录。

除了知识分类,知识包还可以用 select.okfRoots 选择根目录;见包模板。

如何选择知识分类 ​

Indexer 根据读者的需求而不是来源类型来建议知识分类:同一份文档可以成为 sop 中的运维手册、decision 中的决策记录,或 standards 中的规范。常见的对应关系:

读者需求合适的形式
理解某个术语、边界或业务规则带范围和示例的领域说明
理解架构或集成方式技术说明、契约与限制
完成一项可重复的任务包含前置条件、操作和检查的指南
诊断或恢复包含症状、安全操作和验证的运维手册
理解某个选择决策、备选方案、理由与后果
从事故中学习影响、观察、原因与响应
解读一项测试方法、范围以及结果能证明什么

之后你可以用 context revise <target> --move-to <path> 把已批准的文章移到其他知识分类,文章标识保持不变。

保留名称 ​

index.md 保留给包入口索引和目录索引使用。来源文档可以叫 index.md,但文章必须换个名字,例如 index-page.md;如果复制进来的知识会占用 wikis/**/index.md,context build 会拒绝构建。