Approvals
Before every tool call, the thread’s host asks the kernel what to do. Two things decide:
- The workspace’s
tool/beforehooks, in its init files: they may allow the call, deny it, or ask the user a question. A hook that fails, or a workspace host that cannot answer, denies: a broken guard never lets a call through. - Otherwise the thread’s approval mode. Tools known to change nothing (reads, searches,
omfp_callof a method that only reads) always run; for the others:
| Mode | File edits (edit, write) |
Everything else (shell, jobs, evals, MCP tools, …) |
|---|---|---|
yolo (default) |
run | run |
write |
run | ask |
always-ask |
ask | ask |
always-ask-cached |
ask | ask, and you may allow a tool for the rest of the session |
flowchart LR
call["Tool call"] --> hooks{"tool/before hooks"}
hooks -->|deny| blocked["Blocked: the agent reads why"]
hooks -->|ask| card["Question card in the window"]
hooks -->|no decision| mode{"Approval mode"}
mode -->|runs| run["Runs"]
mode -->|asks| card
card -->|allowed| run
card -->|denied| blocked
A hook that asks before a force push:
ctx.on("tool/before", ({ tool, args }) => tool === "bash" && /git push --force/.test(JSON.stringify(args)) ? { ask: "Force push?" } : undefined,);:approvals shows the selected thread’s mode and :approvals write sets it; only a window can change it, so agents
cannot loosen their own approvals. Questions show as cards in the windows following the thread; a subagent inherits
its parent’s mode.