Knaph

Keeping an Agent in Check24 of 375 min read

Asking Permission

An agent that can rename 300 photos can also delete 300 photos. It can run any command your computer understands, change any file it can reach, and send things over the internet. Most of the time it does exactly what you asked. But "most of the time" isn't good enough for delete.

So who decides what an agent is allowed to do?


Leila My agent keeps stopping to ask "Allow this command?" Forty times a day. I've started clicking yes without reading.

Omid Who do you think is asking you: the model or the harness?

Leila The model wrote the command. But the model can't run anything... so the harness must be the one stopping it, before it runs.

Omid Right. Every tool call passes through the harness on its way to your computer. That's the one place where it can be checked, whatever the model has in mind.

Leila Then why ask me about harmless things, like listing a folder?

Omid It doesn't know which things are harmless to you, unless you tell it. And what happens to your forty "yes" clicks?

Leila They stop meaning anything. If it asked me to delete the archive, I'd probably click yes to that too.

Omid That's the real danger: not the asking, but asking so often that you stop reading. So the trick is to let the routine things through without a question, so that the questions you do get are rare, and worth reading.


A checkpoint on every action

A permission is a decision, made by the harness before a tool call runs: allow it, ask you first, or refuse. The model can ask for anything; only what's permitted happens.

Every tool call the model writes passes through the harness's permission check before it reaches the computer. The check either allows it, asks the user, or refuses it.

When an action is refused, the model is told so, as a tool result, and usually tries another way or asks you what to do. Nothing touched your computer.

Permission modes

A permission mode sets how cautious the agent is overall. In Claude Code (as of 2026) you switch between them with Shift+Tab:

  • Default: reading is allowed; the agent asks before editing files, running commands or using the network.
  • Accept edits: file edits in the project happen without asking; commands still ask.
  • Plan: the agent can look but not change anything. (A later lesson is about this one.)
  • Auto: a separate checker reviews each action and lets the safe ones through.
  • Bypass permissions: everything is allowed, no questions. Only for a throwaway sandbox (see below), never on your own computer with your own files.

Rules: allow, ask, deny

Modes are broad. Rules are precise: a list of actions that are always allowed, always asked about, or always refused. In Claude Code they live in a settings file. Here's part of Leila's project's .claude/settings.json:

{
  "permissions": {
    "allow": ["Bash(npm run test *)", "Bash(git status)"],
    "deny": ["Read(./.env)", "Bash(git push *)"]
  }
}
JSON

Line by line:

  • "allow" is the allow list: actions that go ahead without a question. Bash(...) means a shell command, and * means "anything here", so npm run test * covers every way of running the tests.
  • "deny" lists actions that are always refused. Read(./.env) stops the agent reading the file where passwords and keys are usually kept. git push * stops it sending code to the shared copy of the project; Leila wants to do that herself.
  • Anything not on either list falls back to the mode's behaviour: usually, ask.

Three lists of rules, checked in order: deny first, then ask, then allow. The first list that matches decides, so a deny rule always wins over an allow rule.

The order matters: deny rules are checked first, then ask, then allow. So if one rule allows git * and another denies git push *, a push is refused. You can't accidentally allow something you meant to forbid.

Sandboxes

Rules decide which actions run. A sandbox limits what an action can reach once it runs: which folders a command can see or change, and whether it can use the network at all. Even if a command slips through, it can only touch what's inside the sandbox. Claude Code can run its commands in a sandbox on your computer, and many agents run entirely in a container in the cloud: a fresh, empty computer that's thrown away afterwards. That's where "bypass permissions" is reasonable: nothing of yours is there to lose.

Try it

If you use Claude Code, type /permissions to see the rules you already have, and press Shift+Tab a few times to watch the mode change at the bottom of the screen. With any agent, find where it asks before running a command, and notice what kind of actions it asks about. Which of them would you always say yes to?

Using it well

  1. Allow the routine, safe things. Commands you approve every day without thinking (running tests, listing files, checking status) belong on the allow list, so your attention is saved for the rest.
  2. Deny what must never happen. Secret files, sending code out, deleting outside the project: write a deny rule once, rather than trusting yourself to click "no" every time.
  3. Read every question you do get. Once the routine is allowed, a question means something unusual. Read the command before you answer.
  4. Give a free hand only inside a sandbox. If you want the agent to run without asking, put it somewhere it can't reach anything you care about.

Words to know

  • permission - the harness's decision, before a tool call runs, to allow it, ask you, or refuse it
  • permission mode - an overall setting for how cautious the agent is, from asking about every change to allowing everything
  • allow list - a list of actions that may go ahead without asking; deny and ask lists work the same way for refusing and asking
  • sandbox - a closed-off space that limits which files and network an agent's actions can reach

Big idea

The model can ask for any action, but the harness decides what actually happens. Permission rules let you allow the routine, forbid the dangerous, and save your attention for the questions that matter.

Watch this lesson

3 minPart of episode 6 (8 min)Watch the whole episode

Test your understanding

Sign in to test your understanding of this lesson and track your progress.