Refuse the Write and Edit tools and limit the web, for an agent that inspects
Refuses the Write and Edit tools, allows web fetches only to a short list of sites (vulnerability databases and GitHub), limits how often shell commands and web fetches run, and asks before publishing a package or running a download-and-run launcher.
Works with: All four agents. On Codex and Hermes Agent an ask is a refusal. Supported hosts has the detail for each agent.
Steps
1. Apply it
isonapse hook policy apply security-auditIt asks for the password you log in to this computer with and replaces your whole policy. The old one is backed up first, and the command prints where.
2. Ask what each mode would do
isonapse hook policy test --write notes.txtNothing runs, and no record is written. It prints one line per mode, with the reason; here Normal and Enforce refuse it.
3. Undo it
isonapse hook policy revisionsisonapse hook policy rollback <revision>The first lists earlier policies; the second restores one, with one approval and the password you log in to this computer with. Use a plain terminal window that runs no agent, such as macOS Terminal or Ghostty.
What it does not do
- It refuses the Write and Edit tools only. Claude Code's MultiEdit and NotebookEdit, and the shell, which is only rate-limited, can still change files. Confining the agent's host is the durable boundary.
- To allow another site, add it to the list of allowed sites. Do not add a block-everything list next to it: blocked beats allowed, so no site would be left.
- These example site rules name Claude Code's
WebFetch. To cover Hermes Agent'sweb_extract, add separate site rules fortool:web_extract;WebFetchrules do not carry over. Hermesweb_extracttakes one valid HTTP(S) URL per call. A batch, even for one site, or an empty or uninspectable URL list is refused in Normal and Enforce; Profile reports what it would refuse. Send one URL per call. Atool:WebFetchblocked-site rule can also refuse a blocked host visibly named by shellcurl; its allowed-site list does not limit shell commands. These checks do not confine network traffic. - The
llmandcoherencelines do not limit what a coding agent spends on its own model.
The policy
The whole starter policy, exactly as isonapse hook policy apply security-audit writes it.
-- security-audit — restrictive read-only mode.
--
-- Denies ALL writes/edits via blocked_capabilities, blocks web egress
-- except a small allowlist of vuln databases, throttles shell + fetch
-- hard, and keeps the tightest LLM budget. Use when an agent should
-- inspect but never change a system. A starting point: copy to your
-- policy_path and edit.
--
-- The non-empty `allowed_domains` list denies every host it does not name,
-- FOR THE KEYS IT GOVERNS. Do not add `blocked_domains = { "*" }` alongside
-- it: blocked beats allowed, so a catch-all blocklist denies the allowlist
-- too and leaves the capability unusable. Refine by editing that list, NOT
-- by adding a deeper key: allowlists resolve most-specific-wins, so an
-- `allowed_domains["tool:WebFetch:x"]` entry would SUBSTITUTE for it rather
-- than narrow it. Blocklists are the surface that stacks.
return {
rate_limits = {
["tool:Bash"] = { per_minute = 10, per_hour = 100 },
["tool:WebFetch"] = { per_minute = 5, per_hour = 20 },
},
allowed_domains = {
["tool:WebFetch"] = {"cve.mitre.org", "nvd.nist.gov", "github.com", "*.githubusercontent.com"},
},
blocked_capabilities = {
["*"] = {"tool:Write", "tool:Edit"},
},
blocked_file_patterns = {
["tool:Edit"] = {"**/isonapse*", "**/managed-settings*"},
["tool:Write"] = {"**/isonapse*", "**/managed-settings*"},
},
actions = {
["tool:Bash:bunx"] = {
decision = "DEFER",
reason = "Download-and-run launcher requires operator approval.",
defer_unless_local_bin = true,
},
["tool:Bash:cargo:publish"] = {
decision = "DEFER",
reason = "publishing a crate is irreversible; confirm it first",
},
["tool:Bash:npm:exec"] = {
decision = "DEFER",
reason = "Download-and-run launcher requires operator approval.",
defer_unless_local_bin = true,
},
["tool:Bash:npm:publish"] = {
decision = "DEFER",
reason = "publishing a package is irreversible; confirm it first",
},
["tool:Bash:npx"] = {
decision = "DEFER",
reason = "Download-and-run launcher requires operator approval.",
defer_unless_local_bin = true,
},
["tool:Bash:pipx:run"] = {
decision = "DEFER",
reason = "Download-and-run launcher requires operator approval.",
},
["tool:Bash:pnpm:dlx"] = {
decision = "DEFER",
reason = "Download-and-run launcher requires operator approval.",
},
["tool:Bash:uv:tool-run"] = {
decision = "DEFER",
reason = "Download-and-run launcher requires operator approval.",
},
["tool:Bash:uvx"] = {
decision = "DEFER",
reason = "Download-and-run launcher requires operator approval.",
},
["tool:Bash:yarn:dlx"] = {
decision = "DEFER",
reason = "Download-and-run launcher requires operator approval.",
},
},
llm = {
allowed_models = {"claude-*"},
budget_per_task_usd = 2.0,
},
coherence = {
{
type = "scalar_baseline",
metric = "spend_usd_per_min",
baseline = 0.03,
tolerance = 2.0,
weight = 1.0,
direction = "above",
hard_cap = false,
},
},
}
Stuck? Help finds the message you see.