Permissions and Approval: a Three-State Rule Set, Matching by Tool and Path, and the Boundaries of Auto Mode
Give the agent an approval gate: judge every tool call against a set of allow/ask/deny three-state rules, match rules by tool name and path pattern, remember approval decisions, and work out exactly when fully automatic mode is responsible to enable.
Today's Goals
- Design a three-state permission rule set matched by tool and path, and explain the match priority
- Turn approval into a state machine that doesn't block the loop, letting the model try another path on denial instead of hanging
- Name the three preconditions for auto mode, and which one missing means it shouldn't be turned on
Yesterday gave it write access; today gives it a gate. When you finish, scroll back up and tick the three goals off.
Plain-Language Walkthrough
Deciding who signs off: what the new hire does alone and what needs asking
Once the new hire has commit rights, you two will have a conversation roughly like: "running tests, reading logs, editing your own module — no need to ask me; database migrations, CI config, releases — ask first."
That conversation's product is not a permission list but a criterion. That matters, because you cannot enumerate every operation. What you actually convey is: if this goes wrong, is the cost reversible? does it affect only you or other people?
An Agent's approval gate writes that criterion into code. But it has a difficulty a new hire does not: you cannot converse with it, only give it rules. And wrong rules fail in two directions:
- Too strict: nearly every step asks. After thirty approvals the user stops reading and just presses yes — at which point the gate no longer exists, only its ceremony.
- Too loose: it finishes the job on its own, including the part you did not want. And you find out afterwards.
So the gate's design goal is not to block a lot but to ask about the few things worth asking about and leave the rest alone. Today's three tasks all serve that goal: make the verdict three-state rather than two, match rules by specificity rather than order, and make approval a pause inside the loop rather than an exception.
Interview questions
Designing an agent's permission model: which states do you need, what do rules match on, and which rule wins when several match?设计一个 Agent 的权限模型,你需要哪几种状态?规则按什么匹配、命中多条时听谁的?
Common in ChinaCommon overseasIntermediate#permissions#agent-design🔒 Unlock this chapter to see the answer keys.
The user rejects a tool call. How does the loop continue, and why not just throw?用户拒绝了一次工具调用,循环该怎么继续?为什么不能直接抛错?
Common in ChinaCommon overseasDeep dive#approval#agent-loop🔒 Unlock this chapter to see the answer keys.
When is it acceptable to run an agent fully autonomously, and what preconditions do you require?什么情况下可以给 Agent 开全自动模式?你会要求哪些前置条件?
Common in ChinaCommon overseasIntermediate#autonomy#safety🔒 Unlock this chapter to see the answer keys.
