Lark Documents
A Lark source is a remote document that Context captures into a local snapshot, together with the evidence embedded in it: images, attachments, sheets, Base tables, whiteboards and synced blocks. Pages then cite the snapshot. The Agent never reconstructs resources or substitutes a summary for them; capture handles them as they are.
flowchart LR
url["Document or Wiki URL"] --> reg["Register"]
reg --> cap["Capture body<br/>and resources"]
cap --> snap["Snapshot"]
snap --> pages["Approved pages<br/>and packages"]Add a document
Give the Agent the document or Wiki URL; the title is fetched together with the body, so you do not need to look it up:
Ingest this Wiki page as our operations handbook:
https://example.larkoffice.com/wiki/example-tokenSeveral documents named in one request are added together, and independent documents do not have to become independent articles. For a whole Wiki subtree, the Agent can first list the tree and its pages without reading their bodies, so you can choose which pages to add.
If research has already fetched a document, the Agent can reuse that copy instead of reading it again; the reuse keeps the original capture time, so it does not make the content any fresher. See the CLI Commands reference for details.
Very large Wiki trees
Do not expect a large Wiki tree to be produced in one go: above 30 source documents the Agent plans the work in stages, and for very large scopes it confirms or narrows the scope with you first, as described in Planning Large Projects in Stages.
Permission to read
Capture reads the documents, so it needs your permission in the current conversation. Asking the Agent to capture, ingest or read the named documents grants it; merely mentioning a document or asking only to register it does not, so in that case expect a question before capture.
Read identity
Each document, with all its resources, is read under one identity: yours by default, or a Bot's. The choice is the CONTEXT_LARK_IDENTITY setting (user or bot) in the environment where Context runs; a line in a Bot prompt does not change it.
- As you, Context reads only as you.
- As a Bot, Context may fall back once to reading as you when the Bot cannot read the body, including when Lark refuses the Bot with code 3380004. The fallback restarts the whole document, so a page is never assembled from reads under two identities.
The capture report records which identity read each document and why the Bot could not, and context status keeps showing a fallback until the document is captured again. The Agent tells you which documents were read as you, the risk — content only you can see is now in the snapshot, and later Bot captures may not read it — and the remedy: ask the document's owner to share it with the Bot. An unchanged revision is captured again in full when a different identity reads it than last time, instead of reusing the earlier snapshot.
Once the body is read, every resource uses the same identity. A failed image or sheet never triggers a request for someone else's credentials, and network, rate-limit or format errors do not switch identity.
What happens to embedded resources
| Resource | Captured as |
|---|---|
| Image | The original; if download is denied, one preview, marked as a preview |
| Attachment | The original file, linked from the document |
| Sheet | A Markdown table plus a CSV snapshot |
| Base | The selected table or view as a Markdown table plus a data snapshot |
| Whiteboard, diagram | A readable preview plus the raw structured export |
| Synced block | The source block's body |
| Bookmark, sub-document, chat, embed | A stable navigation reference |
| Video | A reference; downloaded only when you ask to bundle videos |
A required resource that cannot be obtained stops capture. Two cases are recorded and capture continues with a warning: a whiteboard or diagram that Lark confirms was deleted, an explicit permission denial for one embedded resource, and a synced block whose source document the reading identity cannot open. Each leaves a visible "unavailable resource" notice and is listed in the capture result; none is reported as downloaded, and a gap cannot be cited, although the captured text around it can. To close a permission gap, request the missing app scope at https://open.larkoffice.com/app or ask the document's owner to share it, then capture again.
Refreshing a document whose revision has not changed saves the new snapshot even when a resource captured before has become such a gap or a preview, and the result lists each downgrade. A failure that blocks capture keeps the old snapshot, and a body that cannot be read never replaces it.
Captured resources are part of the evidence and are kept with the knowledge workspace in Git, so keep the workspace private when the documents or screenshots are access-controlled.
Image choices for larger tasks
Image handling is decided once for the whole task, not per document. You can tell the Agent to include images, to keep image references only, or to switch based on how many documents the task covers. By default the switch is at 10 documents: up to 10, images are included; above that, documents are captured with image references only.
The number of images matters separately. When a task would bring in more than 30 distinct images and you have not made a choice, the work-start report asks you to pick one: intelligent conversion and inclusion (recommended), including all images, or placeholders only.
If the same choice should hold for every task in a knowledge workspace, ask the Agent to set it for the project, for example "keep image and GIF references only for the handbook".
飞书文档
飞书来源是一份远程文档,Context 会把它连同其中嵌入的证据一起采集为本地快照:图片、附件、电子表格、多维表格(Base)、画板和同步块。页面随后引用该快照。Agent 从不重建资源,也不会用摘要代替它们;资源由采集流程按原样处理。
flowchart LR
url["文档或 Wiki URL"] --> reg["登记"]
reg --> cap["采集正文<br/>和资源"]
cap --> snap["快照"]
snap --> pages["已批准页面<br/>和知识包"]添加文档
把文档或 Wiki URL 交给 Agent 即可;标题会连同正文一起获取,无需你另行查询:
把这个 Wiki 页面作为我们的运维手册导入:
https://example.larkoffice.com/wiki/example-token在一次请求中提到的多份文档会一起添加,而且文档相互独立并不意味着文章也要相互独立。对于整个 Wiki 子树,Agent 可以先列出目录树及其页面而不读取正文,以便你选择要添加哪些页面。
如果调研阶段已经抓取过某份文档,Agent 可以复用那份副本而不必再次读取;复用会保留原始采集时间,因此不会让内容变得更新。详情参见 CLI 命令 参考。
超大的 Wiki 树
不要指望一次性生产完一棵大型 Wiki 树:来源文档超过 30 份时,Agent 会分阶段规划工作;范围非常大时,它会先与你确认或缩小范围,详见 分阶段规划大型项目。
读取授权
采集会读取文档,因此需要你在当前对话中授权。让 Agent 采集、导入或读取指定的文档即构成授权;仅仅提到某份文档,或只要求登记它,都不构成授权,这种情况下 Agent 会在采集前先询问你。
读取身份
每份文档连同其所有资源都以同一个身份读取:默认是你本人,也可以是某个 Bot。这一选择由运行 Context 的环境中的 CONTEXT_LARK_IDENTITY 设置(user 或 bot)决定;写在 Bot 提示词里的一行文字不会改变它。
- 以你的身份读取时,Context 只以你的身份读取。
- 以 Bot 身份读取时,如果 Bot 无法读取正文(包括飞书以错误码 3380004 拒绝 Bot 的情况),Context 可以回退一次,改以你的身份读取。回退会让整篇文档重新开始读取,因此绝不会把两个身份读到的内容拼成一个页面。
采集报告会记录每份文档由哪个身份读取以及 Bot 为什么读不了;在文档重新采集之前,context status 会一直显示这次回退。Agent 会告诉你哪些文档是以你的身份读取的、它的风险——只有你能看到的内容进入了快照,之后 Bot 采集时可能读不到——以及处理办法:请文档所有者把它共享给 Bot。当这次读取的身份与上次不同时,即使修订版本没变,也会重新完整采集,而不是沿用之前的快照。
正文一旦读取完成,所有资源都使用同一身份。图片或电子表格读取失败从不会去索要其他人的凭证,网络、限流或格式错误也不会切换身份。
嵌入资源如何处理
| 资源 | 采集结果 |
|---|---|
| 图片 | 原图;若下载被拒绝,则获取一张预览图,并标记为预览 |
| 附件 | 原始文件,从文档中链接 |
| 电子表格 | 一张 Markdown 表格加一份 CSV 快照 |
| 多维表格(Base) | 选定的数据表或视图,输出为 Markdown 表格加一份数据快照 |
| 画板、图表 | 一张可读的预览图加原始结构化导出 |
| 同步块 | 源块的正文 |
| 书签、子文档、群聊、嵌入内容 | 一个稳定的导航引用 |
| 视频 | 一个引用;仅在你要求打包视频时下载 |
无法获取必需的资源时,采集会停止。以下情况会被记录并带警告继续:飞书确认已被删除的画板或图表、某个嵌入资源被明确拒绝访问,以及读取身份打不开源文档的同步块。每种情况都会留下可见的“资源不可用”提示并列在采集结果中,都不会被报告为已下载;缺口不能被引用,但它周围已采集的文字可以。要补上权限缺口,请在 https://open.larkoffice.com/app 为应用申请缺少的权限范围,或请文档所有者共享文档,然后重新采集。
刷新一份修订版本未变的文档时,即使之前采集到的某个资源变成了这样的缺口或预览图,也会保存新的快照,并在结果中列出每一处降级。阻止采集的失败会保留旧快照,无法读取的正文也绝不会替换它。
采集到的资源是证据的一部分,会随知识工作区一起保存在 Git 中,因此当文档或截图有访问控制时,请将知识工作区设为私有。
大型任务的图片选择
一个任务的图片处理方式只决定一次,而不是逐个文档决定。你可以让 Agent 包含图片、只保留图片引用,或根据任务涉及的文档数量自动切换。默认的切换点是 10 份文档:不超过 10 份时包含图片;超过时,文档只采集图片引用。
图片数量则单独考量。当一个任务将引入 30 张以上不同的图片、而你尚未做出选择时,开工报告 会请你在以下选项中选择:智能转换并纳入(推荐)、包含全部图片,或仅保留占位符。
如果希望同一选择适用于某个知识工作区中的每个任务,请让 Agent 为项目设置它,例如“手册只保留图片和 GIF 的引用”。