4.2
Asking is not a limit詢問不是限制询问不是限制
This chapter assumes you have read A rule in a prompt is a request: a rule that must hold has to be code, not words.
這一章假設你讀過提示裡的規則只是請求:一定要守住的規則,必須是程式碼,不能只是文字。
读这一章,请先读过提示里的规则只是请求:必须成立的规则要写成代码,不能只靠文字。
The Knowledge經驗分享经验分享
In one sentence
"Ask me first" is not a limit, because people click Allow the hundredth time. A limit is a refusal the agent cannot argue with, graded by what the action can break.
一句話
「先問我」不是限制,因為問到第一百次,人就會直接點允許。限制是 agent 吵不贏的拒絕,並且按動作可能弄壞多少來分級。
一句话
“先问我”不是限制,因为到第一百次,人就会点“允许”。真正的限制是 agent 辩不过的拒绝,并且按动作可能弄坏多少来分级。
For leaders
- The decision: decide that "ask me first" is not a safety limit. Actions that must not happen get a refusal, graded by what a mistake costs. A question to a person is kept for rare judgment calls.
- The risk: people click Allow the hundredth time, and the platform offers ways to remove the box altogether. VS Code says global auto-approval "bypasses all user approvals, potentially leading to destructive actions". I did not measure how often people click without reading.
- The cost of doing it right: a short set of refusal rules, each with a written reason the agent can act on, plus someone to read the logs for rules that fire too often. Isolation in a sandbox cuts the number of boxes: Anthropic reports 84% fewer permission prompts in its own internal use, which is its number for its own tool.
- Ask the team: "Which actions can our agent take with no person in the loop, and are any of them impossible to undo?"
給主管
- 要做的決定:決定「先問我」不算安全限制。一定不能發生的動作,要用拒絕,並按出錯的代價分級。問人,留給少見的、需要判斷的情況。
- 風險:問到第一百次,人就直接點允許;平台還提供把詢問框整個拿掉的辦法。VS Code 說,全域自動批准會「繞過所有使用者批准,可能導致破壞性的動作」。我沒有量過人有多常不看就點。
- 做對的成本:一小組拒絕規則,每條都附一句 agent 能照著做的原因,再加一個人去看日誌,找觸發太頻繁的規則。把 agent 關進沙箱,可以減少詢問框的數量:Anthropic 說它自己內部使用時,權限提示少了 84%,這是它對自己工具的數字。
- 可以問團隊:「我們的 agent 有哪些動作,不用任何人在場就能做?其中有沒有無法撤銷的?」
写给管理者
- 要拍板的事:认定“先问我”不是安全限制。不许发生的动作要拒绝,并按出错的代价分级。向人提问,留给少数需要判断的情况。
- 风险:人到第一百次就会点“允许”,而且平台还提供了把弹窗彻底去掉的办法。VS Code 说全局自动审批“绕过所有用户审批,可能导致破坏性操作”。人们不看就点的频率有多高,我没量过。
- 做对的代价:一小组拒绝规则,每条都附一条 agent 能据以行动的理由,再加一个人去读日志,找出触发得太频繁的规则。在沙箱里隔离,能减少弹窗的数量:Anthropic 报告说,在它自己的内部使用中,权限提示少了 84%,这是它对自己工具的数字。
- 可以问团队:“我们的 agent 有哪些动作,可以在没人把关的情况下执行?其中有没有无法撤销的?”
The problem
The obvious way to keep an agent safe is to make it ask. Before it runs a command, a box pops up: Allow or Deny. You are in charge, and nothing happens without your click.
It works on the first day. The first command, you read. The tenth, you glance. By the hundredth you click Allow before the box has finished drawing, because ninety-nine of the last ones were fine. This is not laziness. It is what people do when almost every question has the same right answer. The box has become a delay, not a check. (This is what I and many others see, and what the platform docs warn about. I did not measure how often; see the end.)
Then the platform gives you ways to remove the delay, and you use them, because the delay is annoying:
- Allow all. One setting, and no box ever appears. The action just runs.
- Allow in this session. One click on a single box, and the same kind of action is not asked again in that chat.
- Autopilot. The agent keeps working with no one at the keyboard. A box may appear, but no one is there to read it.
VS Code says it plainly: global auto-approval "bypasses all user approvals, potentially leading to destructive actions", and its command parsing is "best-effort" (security). Its hooks page adds that ask "requires an interactive approval flow", so do not assume it pauses an unattended session (hooks).
In the three modes I tried (default, Allow all, Autopilot), one thing held: a refusal from a hook. A box can be switched off. A refusal cannot be clicked away in a pop-up. (A person can still change the rule itself, and Guard the files that hold the rules is about doing that safely.)
問題
讓 agent 保持安全,最直覺的辦法是讓它先問。執行指令之前彈出一個框:允許或拒絕。你說了算,沒有你點頭什麼都不會發生。
第一天這招有用。第一個指令,你會讀。第十個,你掃一眼。到第一百個,框還沒畫完你就點了允許,因為前面九十九個都沒事。這不是偷懶。幾乎每個問題的正確答案都一樣時,人就是這樣。框已經變成一段延遲,不再是檢查。(這是我和很多人看到的,也是平台文件提醒過的。我沒有量過有多頻繁,見結尾。)
然後平台給你幾種辦法去掉這段延遲,你也會用,因為延遲很煩:
- 全部允許。一個設定,詢問框再也不出現,動作直接執行。
- 這個會話內允許。在一個框上點一下,同一類動作在這次對話裡就不再問。
- Autopilot。agent 在沒人守著鍵盤時繼續工作。框也許會彈出來,但沒人看。
VS Code 說得很直接:全域自動批准會「繞過所有使用者批准,可能導致破壞性的動作」,它對指令的解析也只是「盡力而為」(security)。它的 hooks 頁面還補了一句:ask「需要互動式的批准流程」,所以別以為它能讓無人值守的會話停下來(hooks)。
我試了三種模式(預設、全部允許、Autopilot),有一樣東西都守住了:hook 發出的拒絕。詢問框可以被關掉。拒絕不能在彈窗裡被點掉。(人仍然可以改規則本身,保護規則本身的檔案講的就是怎麼安全地改。)
问题
让 agent 安全,最显而易见的办法是让它询问。在它运行一条命令之前,弹出一个框:允许或拒绝。由你说了算,你不点,什么都不会发生。
第一天,这行得通。第一条命令,你会读。第十条,你扫一眼。到第一百条,框还没画完你就点了“允许”,因为前面九十九条都没问题。这不是懒。当几乎每个问题的正确答案都一样时,人就是这么做的。这个框已经成了拖延,不是检查。(这是我和很多人看到的情况,也是平台文档警告过的。我没量过它的频率;见末尾。)
然后平台给你一些去掉这种拖延的办法,你用了,因为拖延很烦人:
- 全部允许。 一个设置,从此不再弹框。动作直接运行。
- 本次会话内允许。 在某一个框上点一下,同一类动作在这个对话里就不再问了。
- Autopilot。 agent 在没人守在键盘前的情况下继续工作。也许会弹出框,但没人去读。
VS Code 说得很直白:全局自动审批“绕过所有用户审批,可能导致破坏性操作”,而且它对命令的解析是“尽力而为”(security)。它的 hooks 页面还补充说,ask “需要交互式的审批流程”,所以别以为它能让一个无人值守的会话停下来(hooks)。
在我试过的三种模式(默认、全部允许、Autopilot)里,有一样东西始终有效:hook 做出的拒绝。弹框可以被关掉。拒绝没法在弹窗里一点就没了。(人仍然可以改规则本身,怎么安全地改,保护规则本身的文件会讲。)
How it works
Asking and refusing
Two words to pin down. To ask is to stop and wait for a person to say yes. To refuse is to say no without waiting, and to say it the same way every time. The agent can talk a person into a yes (or the person can talk themselves into one). It cannot talk a program out of a no, as long as the program is running.
So the two are for different jobs.
- Refuse what must not happen. Things you would never approve, or that you cannot undo. No one should be asked to say no to these a hundred times; the program says it once, always.
- Ask what depends on a person's judgment, and is rare. Asking only works when the box is rare enough to be read. Spend it where it is worth a person's attention.
An ask that matters needs one more thing: it must reach the person through a channel the agent cannot press itself. A box in the chat can be switched off by "allow for this session". I come back to this in Two approvals.
The terminal is the hard case
Edit tools are easy to guard. The path is a field in the call, and the rule is "refuse this path".
The terminal is not. It is the strongest tool an agent has, because it can run anything you can run. It is also the hardest to guard, because one effect can be spelled in many ways: a redirect, rm, sed -i, a script that runs another script. A hook reads the text of the command. It catches the common spellings, and it does not catch a path built from variables or a script written first and run later (Hooks). So rules on the terminal never reach "complete". That is not a reason to skip them. It is a reason to be honest about what they are: a guard against mistakes, not against an agent set on getting round them.
Grade by consequence
If you cannot stop everything, stop by how much a mistake costs. Do not grade by how hard the task is. Hard tasks can be harmless, and easy commands can ruin a day. Code can judge consequence from the path and the command, so you do not have to choose a level for each task by hand. Note the limit: the code sees the words of a command, not its effect. The grade is a guess from text (see the traps below).
| Consequence | Example | What I do |
|---|---|---|
| Reads only | Looking things up, reading files | Not stopped |
| Writes that can be undone | Editing in a work folder, writing a plan | Allowed, inside a defined area only |
| Writes to a real repository | Code that people will use | The agent writes in a work area first. A person approves before it is written back (Two gates) |
| Cannot be undone | Pushing, deleting a branch, resetting hard | Refused. The agent never gets a yes. A person does it |
The pattern: the more a mistake costs, the less the agent decides alone. At the top there is no asking at all.
git as an example
git has both ends, so it makes a good case. In my setup, with a repository connected:
- Reads pass.
status,diff,logand the like are never stopped. - Writes are refused with a way forward.
add,commit, switching branches. The refusal message holds the full command and a code. The person reads it, and approves by typing one command in their own terminal, within a time limit. The approval is for that command, not for git in general. - Some are never approvable by the agent.
push, opening a pull request,reset --hard,clean, and force options. The person runs these themselves.
Why not ask for all of them? Because the three groups deserve different treatment. Reads are free. Writes are normal and must be seen. A push or a hard reset is the kind of thing a hundredth click would let through.
Write the reason for the agent
A refusal has two readers: you, and the agent. The agent matters more. It reads the message and decides what to do next.
A message that says only "denied" gets one of two results: the agent tries the same thing again, or it tries something worse. A good message does two jobs:
- Why it was refused, in one sentence.
- What to do instead.
For example, if the agent writes to the code folder before the plan is approved, a good reason says: the plan is not approved yet (plan approval is the first gate in Two gates); write the plan, stop, and ask the person to approve it in their terminal. The agent now knows the next step, so it goes that way rather than finding a side door.
I write every refusal as if it were the only help the agent will get. This is the same split as in the last chapter: the code stops, the words teach.
原理
詢問和拒絕
先說清楚兩個詞。詢問是停下來,等人說好。拒絕是不等人就說不,而且每次都用同樣的方式說。agent 能說服人答應(人也能自己說服自己)。但只要程式還在跑,agent 就說服不了程式收回一個不。
所以兩者各管不同的事。
- 拒絕不能發生的事。你永遠不會批准的,或者無法撤銷的。不該讓人對這些事說一百次不;程式說一次,並且永遠這樣說。
- 詢問要靠人判斷的事,而且這種事很少。詢問框只有少到會被人讀的時候才管用。把它用在值得人花注意力的地方。
一個重要的詢問還需要一樣東西:它必須經過 agent 自己按不到的管道傳到人那裡。對話裡的框,可以被「這個會話內允許」關掉。我會在兩道門:人在哪裡批准再講這一點。
終端機最難管
編輯工具很好管。路徑是呼叫裡的一個欄位,規則就是「拒絕這個路徑」。
終端機不行。它是 agent 最強的工具,因為你能執行的它都能執行。它也最難管,因為同一個效果有很多種寫法:重新導向、rm、sed -i、執行另一個腳本的腳本。hook 讀的是指令的文字。常見的寫法它攔得住,但攔不住用變數拼出來的路徑,也攔不住先寫好再執行的腳本(Hooks:每次呼叫都會經過的執行點)。所以終端機上的規則永遠不會「完整」。這不是不寫的理由,而是要老實說它們是什麼:防的是失誤,不是一個鐵了心繞過去的 agent。
按後果分級
攔不住所有的事,就按出錯的代價來攔。不要按任務難不難來分。難的任務可能無害,簡單的指令也可能毀掉一整天。程式可以從路徑和指令判斷後果,所以你不必替每個任務手動選等級。注意它的限制:程式看到的是指令的文字,不是它的效果。這個等級是從文字猜出來的(見下面的陷阱)。
| 後果 | 例子 | 我怎麼做 |
|---|---|---|
| 只讀 | 查東西、讀檔案 | 不攔 |
| 可以撤銷的寫入 | 在工作資料夾裡編輯、寫計劃 | 允許,只限在劃定的範圍內 |
| 寫進真正的倉庫 | 別人會用到的程式碼 | agent 先寫在工作區。寫回去之前由人批准(兩道門:人在哪裡批准) |
| 無法撤銷 | push、刪分支、reset --hard | 拒絕。agent 永遠得不到答應。由人自己做 |
規律是:出錯的代價越大,agent 能自己決定的就越少。到最上面一級,就完全不問了。
以 git 為例
git 兩端都有,所以是個好例子。在我的設定裡,連上倉庫後:
- 讀的放行。
status、diff、log這類永遠不攔。 - 寫的會被拒絕,但附一條出路。
add、commit、切換分支。拒絕訊息裡有完整的指令和一個代碼。人讀完,在自己的終端機裡打一條指令來批准,有時間限制。批准只針對那一條指令,不是針對整個 git。 - 有些 agent 永遠批不到。
push、開 pull request、reset --hard、clean,還有強制選項。這些由人自己執行。
為什麼不全都用詢問?因為這三組值得不同的對待。讀是免費的。寫是正常的,但必須被看到。push 或 hard reset 這種事,第一百次點擊就會放它過去。
把原因寫給 agent 看
一條拒絕有兩個讀者:你,和 agent。agent 更重要。它讀了訊息,決定下一步怎麼做。
訊息只寫「已拒絕」,結果不外乎兩種:agent 再試一次同樣的事,或者試更糟的辦法。好的訊息做兩件事:
- 為什麼被拒絕,一句話。
- 改做什麼。
舉例,agent 在計劃還沒批准時就寫程式碼資料夾,好的原因會說:計劃還沒批准(計劃批准是兩道門:人在哪裡批准的第一道門);先寫計劃,然後停下來,請人在自己的終端機批准。agent 現在知道下一步了,就會走這條路,不去找旁門。
我把每一條拒絕都當成 agent 唯一能得到的幫助來寫。這和上一章是同一個分工:程式負責擋,文字負責教。
原理
询问和拒绝
先把两个词说清楚。询问是停下来,等人说“是”。拒绝是不等,直接说“不”,而且每次都用同样的方式说。agent 可以说服人答应(或者人自己说服自己)。但只要程序在运行,agent 没法把程序说服得不再说“不”。
所以这两者各管不同的事。
- 拒绝不许发生的事。你绝不会批准的事,或者无法撤销的事。不该让谁对这些事一百次地说“不”;程序说一次,永远这么说。
- 询问取决于人的判断的、而且很少出现的事。只有弹框少到有人读的时候,询问才管用。把它花在值得人关注的地方。
要紧的询问还需要一样东西:它必须经过一个 agent 自己按不到的渠道,送到人面前。对话里的弹框,可以被“本次会话内允许”关掉。我在两道门:人在哪里审批里再讲这一点。
终端是最难的情况
编辑工具很容易守。路径是调用里的一个字段,规则就是“拒绝这个路径”。
终端不是。它是 agent 最强的工具,因为你能运行的东西它都能运行。它也是最难守的,因为同一个效果可以有很多种写法:重定向、rm、sed -i、一个运行另一个脚本的脚本。hook 读的是命令的文本。它能抓到常见的写法,抓不到用变量拼出来的路径,或者先写好、之后再运行的脚本(Hook:每次调用都会经过的执行点)。所以终端上的规则永远不会“完整”。这不是跳过它们的理由。这是要老实说明它们是什么的理由:它防的是失误,不是铁了心要绕过的 agent。
按后果分级
如果没法拦住一切,就按出错的代价来拦。不要按任务有多难来分。难的任务可能无害,而简单的命令也可能毁掉一天。代码可以根据路径和命令判断后果,所以你不用手动为每个任务选一个级别。注意这个限度:代码看到的是命令的字面,不是它的效果。分级是根据文本做的猜测(见下面的坑)。
| 后果 | 例子 | 我怎么做 |
|---|---|---|
| 只读 | 查东西、读文件 | 不拦 |
| 可以撤销的写入 | 在工作文件夹里编辑、写一份计划 | 允许,只限在划定的区域内 |
| 写进真正的仓库 | 别人会用到的代码 | agent 先在工作区里写。由人审批后,才写回去(两道门:人在哪里审批) |
| 无法撤销 | push、删除分支、hard reset | 拒绝。agent 永远得不到“是”。由人来做 |
规律是:出错的代价越大,agent 能自己决定的就越少。到最上面,就根本不问了。
以 git 为例
git 两端都有,所以是个好例子。在我的配置里,连着一个仓库时:
- 读的放行。
status、diff、log之类永远不拦。 - 写的拒绝,但指一条路。
add、commit、切换分支。拒绝消息里有完整的命令和一个代码。人读完之后,在自己的终端里输入一条命令来批准,并有时间限制。批准的是那一条命令,不是笼统的 git。 - 有些动作 agent 永远批不到。
push、开 pull request、reset --hard、clean,以及各种强制选项。这些由人自己来运行。
为什么不全部询问?因为这三组值得不同的对待。读是免费的。写是正常的,但必须被看到。push 或 hard reset 这类事,第一百次点击就会放过去。
把理由写给 agent 看
一条拒绝有两个读者:你,和 agent。agent 更重要。它读这条消息,决定下一步怎么办。
只说“拒绝”的消息,会有两种结果之一:agent 再试一遍同样的事,或者试更糟的办法。好的消息做两件事:
- 为什么被拒绝,一句话。
- 改做什么。
比如,agent 在计划获批之前往代码文件夹写东西,好的理由会说:计划还没获批(计划审批是两道门:人在哪里审批里的第一道关卡);先写计划,然后停下来,请人在自己的终端里审批。agent 现在知道下一步了,所以它会走这条路,而不是去找旁门。
我写每一条拒绝,都当它是 agent 能得到的唯一帮助。这和上一章的划分一样:代码负责拦,文字负责教。
Costs and traps
Refusing is not free. A refusal that is too wide stops real work, and the agent cannot argue its way past it. Keep the patterns narrow, keep a way for a person to approve what is wrong to refuse, and read the logs to see which rule fires.
A box still has a use. I keep some "needs a person" steps as a reminder. But I never count them as protection. If something must hold, it is a refusal.
The patterns are always behind. For the terminal, a new spelling will get through. For the things that must never be touched, do not rely on a pattern at all. Do not give the agent the thing (Least privilege).
The grade is a guess from text. Code judges a command by its words, not by what it does. A command that looks harmless can do harm after it is let through.
I do not have numbers on approval fatigue. The claim that people click Allow without reading is something I and many others see, and it is what the platform docs warn about. I have not measured how often.
代價和陷阱
拒絕不是免費的。拒絕得太寬,會擋住真正的工作,而 agent 吵不贏它。規則要窄,要留一條路讓人批准那些不該拒絕的事,還要看日誌,知道哪條規則在觸發。
詢問框還是有用。有些「需要人」的步驟我留著當提醒。但我從不把它們算作保護。一定要守住的,就用拒絕。
規則永遠慢一步。終端機上,新的寫法總會漏過去。對那些絕對不能碰的東西,完全不要靠規則。不要把那樣東西交給 agent(有些東西根本不給)。
等級是從文字猜的。程式按指令的字面判斷,不是按它做了什麼。一個看起來無害的指令,放行之後也可能造成傷害。
我沒有批准疲勞的數字。人不看就點允許,這是我和很多人看到的,也是平台文件提醒過的。我沒有量過有多頻繁。
代价和坑
拒绝不是免费的。 太宽的拒绝会挡住正常的工作,而 agent 没法通过争辩绕过去。模式要写窄,要留一条让人批准那些不该被拒绝的事的路,还要读日志,看是哪条规则触发的。
弹框仍然有用。 我保留了一些“需要人”的步骤作为提醒。但我从不把它们算作保护。如果某件事必须成立,就用拒绝。
模式总是落在后面。 对终端来说,新的写法总能漏过去。对绝不能碰的东西,根本不要依赖模式。不要把那个东西交给 agent(有些东西根本不给)。
分级是根据文本做的猜测。 代码按字面判断一条命令,而不是看它实际做什么。一条看起来无害的命令,放行之后可能造成伤害。
审批疲劳我没有数字。 人们不看就点“允许”这个说法,是我和很多人看到的,也是平台文档警告过的。我没量过它的频率。
What the industry says Industry practice
VS Code's security page recommends sandboxing over relying on approval rules alone, and suggests scoping auto-approval to the session rather than the workspace or the user. It calls model-assisted permissions "not a security boundary" (security). This fits the chapter: asking is a convenience, refusing is a rule, and isolation is stronger than both.
Isolation also attacks approval fatigue at the root. Inside a sandbox, the agent may be allowed far more without asking, so there are fewer boxes to click. Anthropic reports that, in its internal use of Claude Code, sandboxing "safely reduces permission prompts by 84%", and that it needs both file system and network isolation to work (Claude Code sandboxing). That is Anthropic's own number for its own tool; I have not tested the sandbox VS Code offers.
業界怎麼說 業界做法
VS Code 的 security 頁面建議用沙箱,不要只靠批准規則,並建議把自動批准限定在會話範圍,不要開到工作區或使用者層級。它說模型輔助的權限「不是安全邊界」(security)。這和本章一致:詢問是方便,拒絕是規則,隔離比兩者都強。
隔離也從根上解決批准疲勞。在沙箱裡,agent 可以不問就被允許做更多事,詢問框就少了。Anthropic 說,它內部使用 Claude Code 時,沙箱「安全地減少了 84% 的權限提示」,而且要同時有檔案系統和網路的隔離才行(Claude Code sandboxing)。這是 Anthropic 對自己工具的數字;VS Code 提供的沙箱我沒有測過。
业界怎么说 业界做法
VS Code 的安全页面建议用沙箱,而不是单靠审批规则,并建议把自动审批限制在会话范围,而不是工作区或用户范围。它称模型辅助的权限“不是安全边界”(security)。这和本章吻合:询问是图方便,拒绝才是规则,而隔离比两者都强。
隔离也从根上解决审批疲劳。在沙箱里,可以允许 agent 不经询问做得多得多,所以要点的弹框就少了。Anthropic 报告说,在它内部使用 Claude Code 时,沙箱“安全地把权限提示减少了 84%”,并且需要文件系统和网络两方面的隔离才能起作用(Claude Code sandboxing)。那是 Anthropic 对它自己工具的数字;VS Code 提供的沙箱,我没有测过。
When to delete it Industry practice
My refusal patterns for the terminal exist because I do not have a real sandbox. If your agent runs inside a container or a locked-down environment where it can only reach what you chose, most of them can go; the boundary does the work. The grading by consequence stays, since it is a way of thinking, not a feature.
If a platform lets you write refusals in its own permission settings, so they hold in every mode, move your hook rules there and keep the reasons.
什麼時候可以刪掉 業界做法
我在終端機上寫的拒絕規則,是因為我沒有真正的沙箱。如果你的 agent 跑在容器或鎖死的環境裡,只能碰到你選好的東西,大部分規則就可以刪;邊界已經做了這份工作。按後果分級則留著,因為它是一種想法,不是一個功能。
如果平台讓你在它自己的權限設定裡寫拒絕,使它在每種模式下都有效,就把你的 hook 規則搬過去,原因保留。
什么时候可以删掉 业界做法
我为终端写的拒绝模式,之所以存在,是因为我没有真正的沙箱。如果你的 agent 运行在容器或者锁得很死的环境里,只能碰到你选定的东西,那这些模式大多可以去掉;边界已经在起作用了。按后果分级的做法会保留,因为它是一种思路,不是一项功能。
如果平台允许你在它自己的权限设置里写拒绝规则,使它在每种模式下都有效,就把你 hook 里的规则挪到那里去,并保留那些理由。
Try it on your own setup
No harness needed. Open your agent in your own repository and paste:
Inspect how this project's agent handles permissions: the editor and agent settings, allow and deny lists, auto-approve options, and any hooks that refuse. List what runs without asking, what asks a person, and what is refused. Flag anything that can be undone only with difficulty (push, delete, reset, deploy) and say which of the three groups it is in. Also say whether any setting would let the box be switched off for a whole session or for good. Do not change any files.在你自己的環境試試
不用裝 harness。在你自己的倉庫裡打開 agent,貼上:
檢查這個專案的 agent 怎麼處理權限:編輯器和 agent 的設定、允許和拒絕清單、自動批准的選項,以及任何會拒絕的 hook。列出哪些不用問就執行、哪些要問人、哪些被拒絕。把很難撤銷的動作(push、刪除、reset、部署)標出來,並說它屬於三組中的哪一組。另外說明有沒有任何設定,能讓詢問框在整個會話或永久被關掉。不要改任何檔案。在你自己的环境里试试
不用装 harness。在你自己的仓库里打开 agent,粘贴:
检查这个项目的 agent 是怎么处理权限的:编辑器和 agent 的设置、允许列表和拒绝列表、自动批准选项,以及任何会拒绝的 hook。列出什么不经询问就运行,什么会询问人,什么会被拒绝。标出任何很难撤销的动作(push、删除、reset、部署),并说明它在这三组中的哪一组。还要说明有没有哪个设置能让弹框在整个会话中、或永久地被关掉。不要修改任何文件。Go deeper
- VS Code docs: Security, Hooks
- In this book: Hooks, Guard the files that hold the rules, Least privilege
延伸閱讀
- VS Code 文件:Security、Hooks
- 本書:Hooks:每次呼叫都會經過的執行點、保護規則本身的檔案、有些東西根本不給
延伸阅读
- VS Code 文档:Security、Hooks
- 本书:Hook:每次调用都会经过的执行点、保护规则本身的文件、有些东西根本不给
You can stop here: that is the whole idea. The next part shows where it runs, so you can look inside.讀到這裡就夠了,這就是整個想法。下一部分告訴你它在哪裡運行,可以進去看看。读到这里就够了,核心思路就是这些。下一部分告诉你它在哪里跑,可以进去看看。
In my practice (Copilot Harness)實作实战
Copilot Harness is my open-source harness for VS Code Copilot.
Repository: https://github.com/Smars-Bin-Hu/copilot-agentic-harness
Get started: clone it, open it in VS Code, and type /harness-rookie-get-me-ready in Copilot Chat. You need Python 3.9 or later and git.
Copilot Harness 是我開源的 VS Code Copilot harness。
倉庫: https://github.com/Smars-Bin-Hu/copilot-agentic-harness
開始:clone 下來,用 VS Code 打開,在 Copilot Chat 裡輸入 /harness-rookie-get-me-ready。需要 Python 3.9 以上和 git。
Copilot Harness 是我开源的 VS Code Copilot harness。
仓库: https://github.com/Smars-Bin-Hu/copilot-agentic-harness
上手:把仓库 clone 下来,用 VS Code 打开,在 Copilot Chat 里输入 /harness-rookie-get-me-ready。需要 Python 3.9 及以上版本和 git。
Explore it in the harness
Copilot Harness grades by consequence, refuses on the terminal with a reason, and has a git ladder. The harness can walk you through the real rules and what the agent sees when it hits them. After the setup above, type:
/harness-rookie-wondering I have read the chapter "Asking is not a limit". Teach me how this harness handles permissions: why "ask first" is not a limit (topic 8), how it grades by consequence, how git commands are treated, and how the terminal is guarded (topic 5). Open the real rules and refusal messages with me, and show me what the agent sees when it is refused.It teaches one small piece at a time, stops to ask if you are following, and opens the files with you.
在 harness 裡探索
Copilot Harness 按後果分級,在終端機上帶著原因拒絕,還有一條 git 的階梯。harness 可以帶你看真實的規則,以及 agent 被拒絕時看到什麼。照上面的說明準備好之後,輸入:
/harness-rookie-wondering 我讀完了「詢問不是限制」這一章。請教我這個 harness 怎麼處理權限:為什麼「先問」不是限制(主題 8)、它怎麼按後果分級、git 指令怎麼處理,以及終端機怎麼防護(主題 5)。帶我打開真實的規則和拒絕訊息,讓我看 agent 被拒絕時看到什麼。它一次教一小塊,停下來確認你跟得上,然後和你一起打開檔案。
在 harness 里探索
Copilot Harness 按后果分级,在终端上带着理由拒绝,还有一个 git 的阶梯。harness 能带你看真实的规则,以及 agent 撞上它们时看到的内容。按上面的说明准备好之后,输入:
/harness-rookie-wondering 我读完了“询问不是限制”这一章。请教我这个 harness 是怎么处理权限的:为什么“先问”不是限制(主题 8),它怎么按后果分级,git 命令是怎么对待的,以及终端是怎么守的(主题 5)。带我打开真实的规则和拒绝消息,并给我看 agent 被拒绝时看到的是什么。它一次只教一小块,停下来确认你跟上了,再和你一起打开文件。