Skip to content

Evidence Chains and Index First ​

The chain ​

mermaid
flowchart LR
  q["Question"] --> map["Knowledge map and indexes"]
  map --> page["Article section"]
  page -->|source_ref + file and lines| region["Source region at a pinned version"]
  region -->|content digest| check["Verified at write and verify time"]

An answer starts from the knowledge map, lands on an article section, and from there follows a reference to an exact region of a registered source. Each step is checkable: the reference names the source and the lines; the source is pinned; the region's content is fingerprinted.

Sections carry their own evidence ​

Approved articles are divided into sections. Each written fragment cites regions of registered sources: at most five distinct source files, several regions of one file allowed, up to eight regions in total. Each reference is a source_ref plus a locator. An Agent may locate a region by line range, by a Markdown heading (optionally with its ## marker, which also selects the heading level) or by an exact quote; the CLI resolves the heading or quote against the captured text and stores the line range. When an article is submitted, the CLI checks that each cited source is authorized for that task, reads the current captured text and computes the region's content digest. Unknown or unauthorized paths and source-version drift are errors, not warnings. There is no separate fact table or claim ledger to maintain — the references are the evidence.

source_ref values are opaque, verified identities. Agents copy them exactly; they are not file-system paths.

Checked again before delivery ​

context verify re-checks approved pages before close and build: source references for freshness and verbatim match, frontmatter identity, section blocks, assets and the derived structure. Verification errors block close and build. context build itself no longer compares cited source regions, so a publishing build does not need the registered source checkouts; verify still reports changed, moved or missing regions, so run it before publishing. Approved Markdown keeps a stable identity in frontmatter and section metadata, so a page can be revised without losing its history. Reader pages also expose each fragment ID as an anchor, so a link such as page.md#upgrade resolves unless a heading on that page already owns the slug.

Index first, then the original ​

Agents answering from a knowledge package start from directory indexes and the edge records in the build inventory, read the candidate pages, and cite their headings and passages. When the package does not cover a requested fact, they report the gap instead of guessing. The shared context-knowledge-query Skill can search every Context package available to the project, and when a page's text does not settle a question it follows that page's Sources entries: repositories at their recorded commit, documents at their current URL. Consumer packages omit section metadata to stay small; a maintainer can map any page back to the Context knowledge workspace through the inventory to see its full evidence.

With Source Graph, the chain reaches the code without a clone: the optional evidence plugin joins section markers, knowledge/structure.yaml and source registrations, so an Agent reading code at a pinned revision also receives the knowledge sections that cite it. The plugin is read-only; it does not verify source contents or modify knowledge.

Visible to readers ​

On a documentation site, each article ends with a source map built from its recorded references: the article's sections are linked to the documents they cite, grouped by where each document comes from, and a list view shows the same documents with their cited lines. Repository entries link to the recorded revision and document entries to their registered URL; site.sourceMap: false shows a plain source list instead. Inline code in the article that spells a cited repository file or directory exactly also links to it at the recorded revision. Links are never inferred from prose.

证据链与索引优先 ​

证据链 ​

mermaid
flowchart LR
  q["问题"] --> map["知识地图与索引"]
  map --> page["文章章节"]
  page -->|source_ref + 文件与行号| region["固定版本的来源区域"]
  region -->|内容摘要| check["写入和验证时校验"]

回答从知识地图出发,落到某篇文章的章节,再沿引用到达已登记来源中的确切区域。每一步都可校验:引用写明了来源和行号;来源固定在某个版本;区域内容带有指纹。

章节自带证据 ​

已批准的文章按章节划分。每个写作片段引用已登记来源的区域:最多五个不同的来源文件,同一文件可引用多个区域,总计最多八个区域。每条引用由一个 source_ref 加上一个 locator 组成。Agent 可以用行号范围、Markdown 标题(可带 ## 标记,同时限定标题层级)或一段精确引文定位区域;CLI 会在采集文本中解析标题或引文,并保存为行号范围。提交文章时,CLI 会检查每个被引用的来源是否已授权给该任务,读取当前采集到的文本,并计算该区域的内容摘要。未知或未授权的路径以及来源版本漂移都是错误,而不是警告。无需另外维护事实表或论断台账——引用本身就是证据。

source_ref 的值是不透明的、经过校验的标识。Agent 需原样复制它们;它们不是文件系统路径。

交付前再次检查 ​

context verify 会在 close 和构建之前重新检查已批准的页面:来源引用是否最新、是否逐字匹配,frontmatter 标识、章节块、资源文件以及派生结构。验证错误会阻止 close 和构建。context build 本身不再比对被引用的来源区域,因此发布构建不需要已登记来源的检出副本;verify 仍会报告变化、移动或缺失的区域,所以发布前请先运行它。已批准的 Markdown 在 frontmatter 和章节元数据中保持稳定的标识,因此页面可以修订而不丢失历史。阅读页还会把每个片段 ID 暴露为锚点,因此 page.md#upgrade 这样的链接可以直接定位,除非该页已有标题占用了同一个 slug。

先查索引,再看原文 ​

基于知识包回答问题的 Agent,从目录索引和构建清单中的边记录出发,阅读候选页面,并引用其中的标题和段落。当知识包未覆盖所需事实时,Agent 会报告缺口,而不是猜测。共享的 context-knowledge-query Skill 可以检索项目能访问到的所有 Context 知识包;当页面正文不足以回答问题时,它会沿该页面的 Sources 条目继续查找:仓库按记录的提交读取,文档打开其当前 URL。面向使用者的知识包会省略章节元数据以保持精简;维护者可以通过清单把任意页面映射回 Context 知识工作区,查看其完整证据。

借助 Source Graph,这条链无需克隆即可到达代码:可选的证据插件把章节标记、knowledge/structure.yaml 和来源登记关联起来,因此 Agent 在固定版本上阅读代码时,也能拿到引用这段代码的知识章节。该插件是只读的;它不校验来源内容,也不修改知识。

对读者可见 ​

在文档站点上,每篇文章末尾都有一张根据其记录的引用生成的来源图:文章的章节与它们引用的文档相连,并按每份文档的出处分组;列表视图列出同样的文档及其引用的行。仓库条目链接到记录的版本,文档条目链接到其登记的 URL;设置 site.sourceMap: false 则显示普通的来源列表。文章中准确写出某个被引用的仓库文件或目录的行内代码,也会链接到该路径在记录版本下的位置。链接从不从正文推断。