Working with Agents
If you have already read Quick Start and the other getting-started pages, the Guides are where you can learn more. Each guide walks through one task you will meet while building and using knowledge: adding material, planning and producing pages, reviewing them, building outputs, answering questions and keeping it all up to date.
From start to finish, everyone has a clear part to play:
| Who | Does what |
|---|---|
| You | Decide the goal, the readers, the scope and the approvals |
| The Agent | Reads the material, proposes a plan, writes the pages and reports back |
| Context | Records sources and decisions, checks every page against its evidence, and builds the packages and sites |
You simply talk to the Agent in plain language. Invoke /c4a:context (Cursor: /c4a-context), describe the knowledge you need and answer the questions it brings back; the Agent runs the commands for you. Context never steps into ordinary coding or design conversations on its own, so invoke it when you want it, or carry on in a conversation where it is already active. For the steps of a task at a glance, see The Workflow at a Glance.
Brief the Agent well
A clear first message saves you questions later. Try to cover three things:
- Readers and questions — who will use the knowledge and what they need to answer.
- Sources — repositories, modules, document folders or links, and what to skip.
- Output — a package for Agents, a website, or both, and the language.
/c4a:context Initialize a Context knowledge workspace in ./kb and build knowledge for
../billing-service and ../docs/billing. Readers are on-call engineers who need
to diagnose failed invoices. Skip the legacy-export module. Investigate first,
then give me the work-start report.Anything you have already answered is remembered for the rest of the task, so the Agent will not ask again at every step.
The decisions that are yours
| You decide | The Agent decides |
|---|---|
| Which sources and modules are in scope | Which Indexer Skills to use |
| Which readers and questions matter | Topics, page boundaries and organization within the approved plan |
| Whether two subjects should be documented as one | Wording and structure of each page |
| Whether a custom Indexer or executable extension is acceptable | The individual steps of the workflow |
| Whether the work-start report and the written pages are approved | — |
Even in Fully Managed Mode, the Agent still checks with you whenever a missing purpose or scope would change the outcome. Before indexing a large area, it goes through the actual material with you to set aside what is obsolete or irrelevant, rather than judging by names alone.
Your judgment matters most at two moments: the work-start report and the review report. Confirming the Work-Start Report and Reading Review Reports show what to look for at each.
Steer and preview early
Writing takes the longest, about a minute per article on average. Along the way the Agent reports progress against the total number of tasks, and you can ask for a local preview whenever you like. Its updates stay short: what changed, where things stand and what needs your decision next.
It pays to look at the work-start report and the first pages early. If something feels off, such as the tone, a missing counterexample or a style rule, just say so. The earlier a correction lands, the better the final result.
Add material or change course
Plans can change along the way. Just tell the Agent in the conversation:
Add ../docs/refunds to the sources, re-plan the affected part and give me a
new work-start report.New material that fits the confirmed purpose joins the plan, and finished work is kept. A new purpose or a new kind of source comes back to you for confirmation first. To fix a single page, see Revising a Page.
Stop and resume at any time
Your progress lives in the knowledge workspace, not in the conversation. If you close a session, or it crashes, open a new conversation in the same knowledge workspace and invoke /c4a:context again; the Agent picks up right where the work stands, and nothing already accepted is redone. If you want to redo part of the task, ask the Agent rather than deleting files in the workspace.
When a round ends
Once you approve the review, the approved pages are applied to knowledge/ and the outputs rebuilt. The Agent then commits the knowledge workspace to Git, and the round is complete. Pushing, publishing or deploying happens only when you ask.
The knowledge workspace stays ready for the next round. When sources change or you spot a gap, start again with /c4a:context, and the Agent reopens only the affected pages.
Learn more through these Guides
The Guides follow a knowledge base from its first material to everyday use. Start wherever you need to; each subsection opens with the page linked below.
- Planning and Producing — briefing, the work-start report, large projects and managed mode, starting with this page and Confirming the Work-Start Report.
- Adding Sources — which kind of material to add and how: Choosing How to Add Material.
- Review and Revision — judging and correcting pages: Reading Review Reports.
- Outputs and Sites — packages, documentation sites and LLM Docs: Knowledge Packages.
- Using Knowledge — getting answers from what you built: Asking Questions.
- Keeping Knowledge Current — updates, versions and saving your work: Updating Knowledge.
- Knowledge Service — producing and answering for a team: Building a Knowledge Service.
- Custom Indexers — the Skills that read your material, and making your own: Built-in Indexers.
- Practices and Evaluation — habits that work and how to measure the result: Best Practices.
- Source Graph — reading code evidence from a pinned code search service: What Is Source Graph.
- Agent Graph — the workflow engine behind Context, for Skill authors: What Is Agent Graph.
与 Agent 协作
如果你已经读过 快速开始 等入门文档,可以通过这组指南进一步了解 Context。每篇指南都围绕你在构建和使用知识时会遇到的一项任务展开:添加材料、规划并生产页面、审核页面、构建产物、回答问题,以及让知识始终保持最新。
整个过程中,每一方各司其职:
| 谁 | 做什么 |
|---|---|
| 你 | 确定目标、读者和范围,并负责审批 |
| Agent | 阅读材料、提出计划、撰写页面并向你汇报 |
| Context | 记录来源和决定,逐页对照证据检查,并构建知识包和站点 |
你只需要用平常说话的方式和 Agent 交流:调用 /c4a:context(Cursor 中为 /c4a-context),说明你需要什么知识,再回答它提出的问题,具体命令都由 Agent 来执行。Context 不会自己介入普通的编码或设计对话,需要它时直接调用即可,也可以在它已经启用的对话里接着聊。想先看一项任务的完整步骤,可以读 工作流概览。
把任务交代清楚
第一条消息说得越清楚,后面要回答的问题就越少。建议讲清楚三件事:
- 读者和问题:谁会用这些知识,他们需要解决哪些问题。
- 来源:涉及哪些仓库、模块、文档目录或链接,哪些内容可以跳过。
- 产出:需要给 Agent 用的知识包、网站,还是两者都要,以及使用哪种语言。
/c4a:context 请在 ./kb 初始化 Context 知识工作区,为 ../billing-service 和 ../docs/billing 整理知识。
读者是需要排查开票失败问题的值班工程师,legacy-export 模块不纳入这次范围。
请先调研,再给我一份开工报告。你回答过的问题会在整个任务中沿用,Agent 不会每一步都再问一遍。
哪些事由你拍板
| 由你决定 | 由 Agent 决定 |
|---|---|
| 哪些来源和模块纳入范围 | 使用哪些 Indexer Skill |
| 重点服务哪些读者、解决哪些问题 | 在已批准的计划内划分主题、页面边界和组织方式 |
| 两个主题是否合并成一份文档 | 每个页面的措辞和结构 |
| 是否接受自定义 Indexer 或可执行扩展 | 工作流中的具体步骤 |
| 是否批准开工报告和写好的页面 | — |
即使在 全托管模式 下,只要缺少的目的或范围会影响结果,Agent 仍然会先来问你。在为一大片内容建立索引之前,它会和你一起根据实际材料筛掉过时或无关的部分,而不是只看名称就下判断。
你的判断在两个环节最为关键:开工报告和审核报告。确认开工报告 和 阅读审核报告 分别介绍了这两个环节该关注什么。
尽早纠偏和预览
撰写是最耗时的阶段,平均每篇文章大约需要一分钟。这期间 Agent 会对照任务总数汇报进度,你也可以随时让它启动本地预览。它的进度消息都很简短:改了什么、进行到哪一步,以及接下来需要你决定什么。
建议尽早看看 开工报告 和最先写好的几篇页面。如果觉得哪里不对,比如语气、缺了反例或者某条风格规则,直接告诉它就好。越早纠正,最终效果越好。
补充材料或调整方向
计划在途中也可以调整,直接在对话里告诉 Agent:
请把 ../docs/refunds 加入来源,重新规划受影响的部分,再给我一份新的开工报告。符合已确认目的的新材料会加入计划,已经完成的工作会保留;如果目的变了,或者加入了新类型的来源,Agent 会先回来找你确认。只想修正某一个页面,请看 修订页面。
随时中断与恢复
进度保存在知识工作区里,而不是对话里。关掉会话也好,会话意外中断也好,只要在同一个知识工作区里新开一个对话,再次调用 /c4a:context,Agent 就会从工作实际进行到的地方接着做,已经通过的工作不会重做。如果想让某一部分重新来过,请直接告诉 Agent,不要自己去删工作区里的文件。
一轮工作结束时
你批准审核后,已批准的页面会写入 knowledge/,产物也会随之重新构建。接着 Agent 把知识工作区提交到 Git,这一轮就完成了。至于推送、发布或部署,只有你开口它才会去做。
知识工作区会一直为下一轮做好准备。来源有了变化,或者你发现哪里还缺内容,再次调用 /c4a:context 就能开始,Agent 只会重新打开受影响的页面。
通过以下指南了解更多
这组指南沿着知识库从第一批材料到日常使用的过程展开。你可以从需要的部分读起,每个小节都从下面链接的页面开始。
- 规划与生产:交代任务、开工报告、大型项目和全托管模式,从本页和 确认开工报告 读起。
- 添加来源:该添加哪类材料、怎么添加,见 选择添加材料的方式。
- 审核与修订:评判和修正页面,见 阅读审核报告。
- 输出与站点:知识包、文档站和 LLM Docs,见 知识包。
- 使用知识:从你构建的知识中获得回答,见 提问。
- 保持知识最新:更新、版本以及保存工作,见 更新知识。
- 知识服务:为团队生产知识、回答问题,见 构建知识服务。
- 定制 Indexer:负责读懂各类材料的 Skill,以及如何编写自己的 Skill,见 内置 Indexer。
- 实践与测评:行之有效的做法,以及如何衡量效果,见 最佳实践。
- Source Graph:从固定版本的代码搜索服务读取代码证据,见 Source Graph 是什么。
- Agent Graph:Context 背后的工作流引擎,适合 Skill 作者阅读,见 Agent Graph 是什么。