引用
openprogram references add docs ~/work/product-docs --description "product behaviour and terms"
openprogram references add sdk https://github.com/example/sdk --branch main
openprogram references list
之后在任何对话里:Compare @docs/api/auth.md with how we log in.
| 写法 | 含义 |
|---|---|
@docs | 整个文件夹,智能体按需搜索和阅读 |
@docs/api/auth.md | 这个文件。在网页输入框里它和其他 @ 文件一样变成附件卡片 |
@./docs/api/auth.md | 工作目录自己的同名 docs 文件夹 |
在网页输入框里打 @,匹配的名字作为文件夹排在最前;接着写 @docs/ 就在 docs 里搜索。每个对话的系统上下文都列出每个引用和它的路径,所以 TUI、频道和 --print 也一样能用。
智能体在那里能做什么
| 引用 | 读取和搜索 | 写入、编辑、打补丁 |
|---|---|---|
| 文件夹(默认) | 可以 | 任何权限模式下都拒绝,Bypass 也一样 |
加了 --writable 的文件夹 | 可以 | 和工作目录一样:Accept edits 生效,沙箱里的命令也能写 |
| 仓库 | 可以 | 拒绝,仓库始终只读 |
由最近的一层文件夹决定:放在只读引用里的项目仍能写自己的文件。沙箱禁止读取的文件仍然读不到。没开沙箱时,拒绝只管文件工具,不检查 shell 命令。
管理
| 命令 | 作用 |
|---|---|
openprogram references add NAME FOLDER--writable、--description TEXT | 登记文件夹(绝对路径、~,或相对于运行命令的位置)。同名再加一次就替换 |
openprogram references add NAME URL--branch BRANCH | 把 https://、ssh:// 或 git@host:path 仓库克隆到 ~/.openprogram/references/ |
openprogram references refresh NAME | 把克隆的仓库更新到远端分支。不会自动更新 |
openprogram references remove NAME | 删掉这个名字。克隆会被删除,文件夹原样保留 |
openprogram references list--json | 每个名字、路径和读写权限 |
在网页输入框和 TUI 里,/references 用同样的动词,例如 /references add docs ~/work/product-docs;那里的相对路径从对话的工作目录算起。名字只能用字母、数字、.、_ 和 -。引用属于当前 profile,存在它的 config.json 的 references 下。
Last updated · 2026-11-30