Skip to content

Keeping Knowledge Current ​

The update loop ​

mermaid
flowchart LR
  change["Source changes"] --> cmp["Compare versions"]
  cmp --> decide["Keep, revise, add"]
  decide --> write["Write"]
  write --> review["Review"]
  review --> deliver["Close and build"]
  deliver --> base["New baseline"]

Building completes the currently approved state; it does not freeze the Context knowledge workspace. When a source moves on, context update opens a new round for the selected change. The workflow hands the Agent the fixed old and new source versions and the confirmed requirement scope, plus a list of pages that cite the changed material.

Deciding what to change ​

The listed pages are candidates to inspect, not an instruction to rewrite all of them. For each page the Agent reads its current approved Markdown and the change, then submits one decision: no change, or a concrete correction. Unrelated content and readers' earlier improvements are preserved.

After a repository is re-pinned, context update --pending narrows that list to pages whose cited text needs a look: the cited block is no longer found at the new version, it now matches in more than one place, or the snapshot cannot show it. Citations whose text is unchanged or only moved are not asked about; they follow the text when the update settles. A source that cannot be read is reported as a gap, never as a change. When a repository was cloned partially, --pending first downloads the contents of cited files the clone does not have yet, once per source and before reading; if they cannot be downloaded, the update stops and names the source, the number of files and the reason. Every other page that cites the source appears in scope_pages: it needs no decision, but the Agent includes it with an instruction when an addition or a shared change affects it, such as an overview that should mention a new export. When a document change only reformats text, Context can propose where each citation moved, and the Agent may accept it as a formatting-only change instead of revising the pages. The new commit is recorded only after this one scope decision.

Existing references cannot discover every new topic. For repositories the request therefore also lists uncited_changes: the changed files that no approved page cites, grouped by directory with added, modified and deleted counts, with new directories marked and lock files and generated output left out. The Agent starts from new directories and reads the diff only for groups that look like lasting knowledge, then inspects additions and shared dependencies and lists necessary new pages, each with a path, title, registered sources and instruction. New pages go through the same writing and review as revisions. A renamed subject is revised in place rather than given a new identity; a retirement explains what disappeared and which readers are affected instead of silently deleting pages.

Moving the baseline ​

The CLI keeps the previous processed version until every requested page has been approved, closed and built. If temporary progress is lost, the next inspection starts again from that version and keeps pages already approved. A saved report or acquisition receipt does not prove the update was completed.

When the update settles, pages that were kept as they are are brought up to date with the new version:

  • Citations whose text only moved are relocated. This also works on a fresh clone or another machine without the local region cache: for repository sources the cited region is read from the previously settled commit and used only when it still matches the recorded digest.
  • Citations whose text changed or cannot be confirmed keep their previous locations, and the completion result lists them in reference_warnings.
  • Same-repository (repo-content:) citations are re-signed to the current repository text, so verify will not report them later; when their text changed they are listed in reference_warnings as well, which makes the receipt the place to check those pages.
  • The structure's input hash is recomputed with the rewritten references, so verify is not left reporting a stale structure after settlement.

A warning is a receipt for the accepted decision, not a request to resubmit it: after the update finishes, revise each listed page that needs a correction. See Version-Aware Knowledge.

Keep the update local ​

For one or two documents or a clearly bounded module, the update stays local: which articles to add or revise, and where readers expect them. It does not turn into a taxonomy for the whole knowledge workspace or a navigation redesign. Only the sources needed for the current change are restored; missing material stays a gap rather than being treated as investigated.

Ways an update starts ​

TriggerHow
A source changedTell /c4a:context the new version; it runs context update for the selected scope
A page is wrong or incompletecontext revise "<page>" --instruction "<correction>" continues through Review and delivery, with no recapture for wording-only changes
On a scheduleA routine update checks every registered source, updates what changed in batches and reports the result; see Set Up Routine Updates

Gaps found while answering questions are handled the same way: they become revision tasks for the affected pages.

知识的持续更新 ​

更新循环 ​

mermaid
flowchart LR
  change["来源变更"] --> cmp["比较版本"]
  cmp --> decide["保留、修订、新增"]
  decide --> write["撰写"]
  write --> review["审核"]
  review --> deliver["close 与构建"]
  deliver --> base["新基线"]

构建完成的是当前已批准的状态,并不会冻结 Context 知识工作区。当来源继续演进时,context update 会为选定的变更开启新一轮。工作流交给 Agent 固定的新旧来源版本、已确认的需求范围,以及引用了变更内容的页面列表。

决定改什么 ​

列出的页面是待检查的候选,并不是要求全部重写。对每个页面,Agent 阅读其当前已批准的 Markdown 和变更内容,然后提交一个决定:不改,或给出具体的更正。无关内容和读者此前的改进都会保留。

仓库重新固定版本后,context update --pending 会把这份列表缩小到引用文字需要查看的页面:被引用的段落在新版本中找不到了,或者现在能匹配到不止一处,或者快照无法显示它。文字没变或只是移动了位置的引用不会被问到,更新完成时它们会自动跟随到新位置。无法读取的来源会作为缺口报告,绝不当作变更。仓库是部分克隆时,--pending 会先下载克隆中还没有的被引用文件内容,每个来源一次,并在读取之前完成;下载不了时,更新会停下,并说明来源、文件数和原因。其余所有引用该来源的页面列在 scope_pages 中:它们无需逐个决定,但当新增内容或共享变更影响到某个页面时(例如需要提到新导出的概览页),Agent 会附上修订说明把它一并提交。如果文档的变更只是调整了格式,Context 可以给出每条引用移动到的位置,Agent 可以把它作为仅格式变更接受,而不必修订页面。只有在这一次范围决定之后才会记录新的 commit。

已有引用无法发现所有新主题。因此对于仓库,请求中还会列出 uncited_changes:没有任何已批准页面引用的变更文件,按目录分组并给出新增、修改和删除的数量,标出新目录,锁文件和生成产物不计入。Agent 从新目录开始,只对看起来含有长期知识的分组阅读 diff,再检查新增内容和共享依赖,列出必要的新页面,每个新页面都带有路径、标题、已登记的来源和写作说明。新页面与修订一样经过撰写和审核。主题改名时在原处修订,而不是赋予新标识;主题下线时要说明消失了什么、影响哪些读者,而不是悄悄删除页面。

推进基线 ​

在所有请求的页面都已批准、close 并完成构建之前,CLI 会保留之前的已处理版本。如果临时进度丢失,下一次检查会从该版本重新开始,并保留已经批准的页面。保存的报告或获取回执并不能证明更新已经完成。

更新结算时,保持不变的页面会同步到新版本:

  • 只是位置移动的引用会被重新定位。即使在全新克隆或另一台没有本地区域缓存的机器上也能做到:对于仓库来源,会从上一次结算的提交读取被引用的区域,并且只有在它仍与记录的摘要一致时才使用。
  • 文本已改变或无法确认的引用保留原来的位置,并由完成结果在 reference_warnings 中列出。
  • 同仓库内容(repo-content:)的引用会重新签名到当前仓库文本,因此之后 verify 不会再报告它们;如果其文本发生了变化,它们同样会列在 reference_warnings 中,所以要从这份回执中检查这些页面。
  • 结构的输入哈希会基于改写后的引用重新计算,因此结算之后 verify 不会继续报告结构过期。

警告是对已接受决定的回执,而不是要求重新提交:更新完成后,对列出的页面中需要更正的逐一修订。参见 版本感知的知识。

让更新保持局部 ​

对于一两份文档或边界清晰的模块,更新保持在局部:要新增或修订哪些文章,读者期望在哪里找到它们。它不会演变成整个知识工作区的分类调整或导航重设计。只恢复当前变更所需的来源;缺失的资料仍记为缺口,而不会被当作已调查过。

更新的触发方式 ​

触发条件方式
来源发生变更告诉 /c4a:context 新版本;它会针对选定范围运行 context update
页面有错或不完整context revise "<page>" --instruction "<correction>" 会继续经过审核和交付;仅措辞修改时无需重新采集
按计划定时例行更新会检查所有已登记来源,分批更新有变化的内容并汇报结果;见设置例行更新

回答问题时发现的缺口也按同样方式处理:它们会变成针对受影响页面的修订任务。