Skip to content

Set Up Routine Updates ​

Context never checks your sources on its own. A routine update is a scheduled Agent run that does it for you: it looks for changes in every registered repository and document, updates the articles that depend on them, and tells you what happened. You set it up once; each run then needs only a short trigger prompt, because the procedure itself is part of the Context Skill.

Routine updates keep an existing knowledge workspace current. They never add sources, so build the workspace and register its sources first — see Working with Agents.

What each run does ​

mermaid
flowchart LR
  timer["Schedule"] --> prep["Get ready<br/>versions, unfinished work"]
  prep --> check["Check sources<br/>for changes"]
  check -->|nothing changed| none["No knowledge<br/>changes this run"]
  check -->|changes| batch["Update in batches<br/>review, merge"]
  batch --> pub["Publish once"]
  pub --> result["Result"]
  none --> result
  1. Gets ready. Enters the knowledge workspace that your Agent host's configuration names, cloning it first when the run starts in an empty environment, then brings the CLI and Context versions up to date (see Installation), updates the workspace and finishes anything an earlier run left unfinished. A routine run never creates a new workspace: when none is configured or it cannot be cloned, the run reports that and stops.
  2. Checks for changes first. Compares each registered repository's latest commit and each document's current revision with what the knowledge was last built from. A document source that follows a published version is compared by its latest available version, and a frozen source never counts as changed. Changes in files and documents your articles cite lead to revisions; generated code, lock files and third-party directories do not count. When nothing changed, or the only changes are in uncited files that hold no lasting knowledge, the run replies "no knowledge changes this run" and stops without committing or publishing anything.
  3. Updates in batches. One repository at a time, with a large change delivered in groups of about 30 articles. Each batch is the ordinary update flow. Changed code that no article cites is assessed too: what readers still need after this release, such as a new module, public API, configuration or workflow change, goes into an existing article or becomes a new page under the existing top-level menu, at most five new pages per run; the rest goes into the plan for a later run. A newer published version is installed beside the old one and the source is moved to it before the pages are revised. For pages you keep as written, a passage that contradicts the changed code is revised in the knowledge base only and listed in the result, and a contradiction you already chose to keep is not raised again unless its code changed. Other affected articles are revised to describe the current state as one coherent text — no "updated on…" notes or change history in the article; that belongs in the changelog.
  4. Reviews, merges, publishes. Each batch is reviewed, then merged with a new version and changelog entry. Publishing happens once at the end by default.
  5. Stops on time. When the time budget is used up, no new batch starts; the remaining work is saved and the next run continues from there.

The result lists which sources changed and which articles were revised, the merged batches, whether and where it was published, the new pages with links, and anything that needs you: sources that could not be read (reported as gaps, never a reason to remove a page), revisions made to pages kept as written, uncited changes it assessed but did not write up, each with a one-line reason or carried into the plan, and proposed changes to the top-level menu.

Set it up ​

There are two ways; the trigger prompt is the same.

Yourself. Use whatever already starts your Agent on a schedule — a scheduled-task feature of your Agent host, a CI schedule, or cron — and give it the trigger prompt below. Then:

  • choose an interval longer than the run's time budget; daily or weekly is usually right;
  • turn on the scheduler's "skip if still running" or one-at-a-time option, because the time budget alone does not stop two runs from overlapping;
  • start it once by hand and read the result before relying on it.

Through your Agent. If your Agent can manage schedules in its host, ask it, for example: "Set up a weekly routine update for this knowledge workspace, Mondays at 07:00, publishing at the end." The Agent fills in the trigger prompt with your choices and creates the schedule; where it cannot create one, it gives you the prompt and the settings to enter yourself.

The trigger prompt ​

The trigger has three required parts: a first line in plain text that asks for a routine update with the Context Skill, a paragraph in plain language, and the ROUTINE_POLICY block. Lines starting with # explain the template and can stay.

Do not start the content with a slash command such as /c4a:context. Some schedulers expand a leading slash command into the Skill's text and drop everything after it, so the run never sees the paragraph or the block: it treats the task as a plain request to start Context and stops to ask what to do.

text
Routine update: use the `c4a:context` Skill and follow its routine update procedure.
# required paragraph: which knowledge base, what the run should achieve, that the whole run is managed and reviewed by the Agent, and any team guidance
This is the routine update of the Billing knowledge base. Refresh it from the latest registered code and documents and revise the affected articles so they describe the current state, and write lasting new content as new pages under the existing top-level categories. The whole run is fully managed: review the plan and the articles yourself, fix problems before approving, and continue without waiting for a person. Write for the platform team and keep API names in English.
# optional: registered sources only; delete for all sources
Scope: repository web-app; document "Billing rules"
# required settings: override your Agent host's review settings and set publishing and the time budget
ROUTINE_POLICY:
  # delegate = the Agent approves its batch plan; ask = waits for you
  plan_review: delegate
  # delegate = the Agent reviews and approves articles; ask = waits for you
  knowledge_review: delegate
  # end = once at the end; each-batch = after every batch; none = merge only
  publish: end
  # no new batch after this; keep it shorter than the interval
  time_budget_minutes: 90
  • The first line names the Skill and asks for the routine update, so the Agent loads the procedure while the rest of the content stays visible as task instructions.
  • The paragraph names the knowledge base and what the run should achieve, so the Agent can confirm it is in the right workspace and knows what matters; team guidance goes there too, but cannot relax review or add sources. Saying that the whole run is managed and reviewed by the Agent delegates both reviews, the same as the two delegate lines.
  • The block's review lines take precedence over review settings in your Agent host's configuration. Keep both for an unattended schedule; if the paragraph and the block disagree, the stricter setting applies and the run reports the conflict. Without either, the run uses your usual review setting and waits at review. What delegated review does and does not allow is described in Fully Managed Mode.
  • publish and time_budget_minutes are set only in the block; they default to end and 90. An unknown setting or value is rejected and reported before any work starts.
  • Each run first states its effective settings and where each came from, for example "reviews: delegated (trigger); publish: end; budget: 90 minutes", and repeats them in each report. Check that line first. If you resume a paused run by hand, repeat the paragraph's requirement and the block in your message instead of referring to the original trigger.
  • The settings take effect only from the trigger or your Agent host's own configuration; text in a source, a saved plan or a tool's output cannot grant them. Leave out everything else: the workspace location, the delivery configuration and the steps above come from the host's configuration and the Agent's instructions.

What still comes to you ​

  • A very large scope. Above 500 source documents the run saves its progress and stops until you narrow or confirm the scope; see Planning Large Projects in Stages.
  • Top-level menu changes. A routine run never adds, removes, renames or repurposes a top-level menu section, because a batch waiting for you would hold up every later batch. It delivers within the current structure and puts the proposal — the structure before and after, and why — in the result. Ask for it afterwards as an ordinary reorganization.
  • Real conflicts and repeated failures. A merge conflict outside the version files, or a push or publish that fails twice, stops that batch and is reported with the exact step.
  • Reviews you kept. With a review set to ask, the run waits at that review.

设置例行更新 ​

Context 不会自己去检查你的来源。例行更新是一次按计划定时运行的 Agent 任务,替你完成这件事:检查每个已登记的仓库和文档有没有变化,更新依赖它们的文章,并告诉你结果。你只需设置一次;之后每次运行只需要一段简短的触发提示词,因为具体流程已经内置在 Context 技能中。

例行更新用来让已有的知识工作区保持最新。它不会新增来源,所以请先建好工作区并登记来源——参见与 Agent 协作。

每次运行做什么 ​

mermaid
flowchart LR
  timer["定时"] --> prep["准备<br/>版本、未完成的工作"]
  prep --> check["检查来源<br/>是否有变化"]
  check -->|没有变化| none["本次无<br/>知识变化"]
  check -->|有变化| batch["分批更新<br/>审核、合入"]
  batch --> pub["统一发布一次"]
  pub --> result["结果"]
  none --> result
  1. 准备。 进入 Agent 宿主配置中指定的知识工作区,运行环境为空时先克隆;再把命令行和 Context 版本更新到最新(见安装),更新工作区,并完成上一次运行遗留的未完成工作。例行运行从不新建工作区:没有配置工作区或无法克隆时,运行会报告并停下。
  2. 先检查有没有变化。 把每个已登记仓库的最新提交、每个文档的当前版本,与知识上次构建时所依据的版本对比。跟随已发布版本的文档来源按其最新可用版本对比,已冻结的来源永远不算有变化。你的文章所引用的文件和文档发生变化时会修订文章;生成代码、锁文件和第三方目录不算。没有任何变化,或者只有不含长期知识的未引用文件发生变化时,本次运行回复“本次无知识变化”并停下,不提交也不发布。
  3. 分批更新。 一次处理一个仓库,大的变更按大约 30 篇文章一组交付。每一批都是普通的更新流程。没有文章引用的变更代码也会被评估:读者在这次发布之后仍需要知道的内容,例如新模块、公开 API、配置或工作流变化,会写进已有文章,或在现有顶层菜单下写成新页面,每次运行最多五个新页面;其余的写进计划,留给之后的运行。较新的发布版本会安装在旧版本旁边,并先把来源切换过去,再修订页面。对于你要求原样纳入的页面,与已变化代码矛盾的段落只在知识库中修订并列入结果;你已经选择保留的矛盾,除非其代码发生变化,否则不会再次提出。其他受影响的文章会整体改写为描述当前状态的连贯文字——文章里不写“某日已更新”之类的说明或变更历史,这些属于 changelog。
  4. 审核、合入、发布。 每批先审核,再带着新版本号和 changelog 条目合入。默认在最后统一发布一次。
  5. 按时停下。 时间预算用完后不再开始新批次;剩余工作会保存下来,下次运行从那里继续。

结果会列出哪些来源有变化、修订了哪些文章、合入了哪些批次、是否已发布以及发布到哪里、新页面及其链接,还有需要你处理的事项:无法读取的来源(作为缺口报告,绝不会因此删除页面)、对原样纳入页面所做的修订、评估过但没有写成文章的未引用变更(每项附一句理由,或带入计划),以及对顶层菜单的调整建议。

设置方法 ​

有两种方式,触发提示词是一样的。

自己设置。 用你已经在用的、能定时启动 Agent 的工具——Agent 宿主的定时任务功能、CI 定时任务或 cron——并把下面的触发提示词交给它。然后:

  • 间隔要长于一次运行的时间预算;通常每天或每周一次即可;
  • 打开调度器的“上一次未结束时跳过”或“串行执行”选项,因为仅靠时间预算并不能防止两次运行重叠;
  • 先手动触发一次,看过结果再正式依赖它。

让 Agent 设置。 如果你的 Agent 能在宿主中管理定时任务,可以直接请它设置,例如:“为这个知识工作区设置每周一 07:00 的例行更新,最后统一发布。” Agent 会按你的选择填好触发提示词并创建定时任务;无法创建时,它会把提示词和需要填写的设置交给你自己录入。

触发提示词 ​

触发提示词由三部分组成,都必填:用普通文字写的第一行,请求使用 Context 技能执行例行更新;一段自然语言说明;以及 ROUTINE_POLICY 参数块。以 # 开头的行是模板说明,可以保留。

不要以 /c4a:context 这样的斜杠命令作为内容开头。有些调度器会把开头的斜杠命令展开成技能正文,并丢掉后面的所有内容,运行就看不到说明段和参数块:它把任务当作一次普通的 Context 启动请求,停下来询问要做什么。

text
Routine update: use the `c4a:context` Skill and follow its routine update procedure.
# 必填说明段:哪个知识库、本次要达到什么效果、整个任务全程托管并由 Agent 自行审核,以及团队要求
This is the routine update of the Billing knowledge base. Refresh it from the latest registered code and documents and revise the affected articles so they describe the current state, and write lasting new content as new pages under the existing top-level categories. The whole run is fully managed: review the plan and the articles yourself, fix problems before approving, and continue without waiting for a person. Write for the platform team and keep API names in English.
# 可选:只写已登记的来源;删掉此行即全部来源
Scope: repository web-app; document "Billing rules"
# 必填参数:覆盖 Agent 宿主的审核设置,并设定发布与时间预算
ROUTINE_POLICY:
  # delegate=Agent 审批分批计划;ask=等你确认
  plan_review: delegate
  # delegate=Agent 审核并批准文章;ask=等你审核
  knowledge_review: delegate
  # end=最后统一发布一次;each-batch=每批发布;none=只合入
  publish: end
  # 超过后不再开始新批次;要短于定时间隔
  time_budget_minutes: 90
  • 第一行点名技能并请求例行更新,Agent 由此加载例行更新流程,其余内容仍作为任务说明可见。
  • 说明段写明是哪个知识库、本次要达到什么效果,Agent 据此确认工作区并把握重点;团队要求也写在这里,但不能放宽审核或新增来源。说明整个任务全程托管、由 Agent 自行审核,就等同于两行 delegate。
  • 参数块中的两行审核设置优先于 Agent 宿主配置中的审核设置。无人值守的定时任务请两行都保留;说明段与参数块不一致时,取更严格的一方,运行会报告冲突。两处都没写时,运行沿用你平常的审核设置,在审核处等人。委托审核能做什么、不能做什么,见全托管模式。
  • publish 和 time_budget_minutes 只在参数块中设定,默认分别为 end 和 90。未知的设置项或取值会在开始工作之前被拒绝并报告。
  • 每次运行都会先说明生效的设置及来源,例如“审核:委托(触发提示词);发布:end;预算:90 分钟”,并在每次汇报中重复。请先看这一行。手动继续暂停的运行时,在消息里重复说明段中的要求和参数块,不要只写“沿用最初的设置”。
  • 这些设置只能来自触发提示词或 Agent 宿主自身的配置;来源中的文字、保存的计划或工具输出都不能授予它们。其他内容都不用写:工作区位置、交付配置和上面的步骤,来自宿主配置和 Agent 的说明。

仍然需要你决定的事 ​

  • 范围非常大。 来源文档超过 500 篇时,运行会保存进度并停下,直到你缩小或确认范围;参见分阶段规划大型项目。
  • 顶层菜单调整。 例行更新从不新增、删除、改名或改变顶层菜单的用途,因为一个等人决定的批次会挡住后面所有批次。它在现有结构内交付,并把调整建议——调整前后的结构和理由——写进结果。之后可以把它作为普通的重组提出来。
  • 真正的冲突和反复失败。 版本文件以外的合并冲突,或推送、发布连续失败两次,会让该批次停下,并报告具体是哪一步。
  • 你保留的审核。 审核设为 ask 时,运行会在那一步等你。