Safeguard
Coding Agents•

Stop Clicking Approve: Set Up a Coding Agent That Asks Only When It Matters

Cut coding agent approval prompts safely: allow reads and in-project edits, ask for installs and network, deny secrets and force pushes. Setup steps.

Safeguard Security Team
14 min read

To make a coding agent ask only when it matters, sort its actions by risk. Let it read and edit inside the project freely, ask before installs, network calls and pushes, and deny reads of secrets and destructive git outright. Then write those defaults into the agent's policy so you stop approving the same safe command fifty times a day.

This is a security fix as much as a speed fix. People stop reading prompts they see all day, so an agent that asks less, about the right things, is safer than one that asks about everything.

Key takeaways

  • Approval fatigue is a measured problem: Anthropic reports that users accept 93% of manual permission prompts (March 2026).
  • Allow the safe and reversible, ask about the risky, deny the catastrophic. Deny rules win and never reach a prompt.
  • In CI, nothing should ask: anything not pre-approved is denied.
  • The Safeguard CLI (v11.19.21, built 21 November 2026) ships six permission modes, allow and deny rules, workspace trust and file checkpoints.

Why is approval fatigue a security problem?

A prompt only protects you if a person reads it. Anthropic's engineering team wrote in March 2026 that in practice users accept 93% of Claude Code's manual permission prompts, and called the result "approval fatigue" (Anthropic, 25 March 2026). An earlier post on sandboxing said constant approval clicks mean users "might not pay close attention to what they're approving", and that sandboxing cut prompts by 84% in Anthropic's internal use (Anthropic, 20 October 2025).

Prompt injection makes this worse. An agent that reads a poisoned README can propose a harmful command that looks routine, and after forty clicks the forty-first is a reflex. See agent hijacking through prompt injection.

What should a coding agent be allowed to do without asking?

Rank each class of action by two questions. Can it be undone? Can it reach outside this repository? The table below is the policy we recommend for any agent, with the matching Safeguard CLI control. Safeguard behaviour is from the CLI docs and the --help output of v11.19.21, checked 22 November 2026.

Action classDefaultWhySafeguard CLI control
Read files inside the projectAllowNo side effectsReads run unasked in every mode
Edit files inside the projectAllow (in a git repo)Reversible with git and checkpointsedits mode; safeguard checkpoints restore
Tests, linters, buildsAllow by ruleRoutine and local--allowedTools 'Bash(go test:*)'
Other shell commandsAskEffects are hard to predictguarded mode asks for anything the policy does not allow
Network callsAsk, or allow named hostsData can leave the machine--restricted removes network tools entirely
Package installsAskInstall scripts run third-party codeLeave out of allow rules so they ask
Secrets and credential filesDenyOnce read, they sit in the transcript--disallowedTools 'Read(~/.ssh/**)'
Push, force push, history rewritesAsk for push, deny force pushHard or impossible to undoDeny rules win and are never sent for approval
Anything in CIDeny unless pre-approvedNo human is watchingsafeguard exec defaults to strict
Risk model for coding agent actionsAllow reads, project edits and tests. Ask before other commands, network, installs and push. Deny secrets, force push and unapproved CI actions; deny is checked first.AllowRead project filesEdit project files (git)Tests, linters, buildsAskOther shell commandsNetwork callsPackage installsgit pushDeny, checked firstSecrets and private keysForce push, rewritesUnapproved CI actions

For a deeper look at scoping each tool, see least privilege tool scoping for AI coding agents.

Which permission modes does the Safeguard CLI have?

The Safeguard CLI has six modes. The docs stress that they are separate choices, not a scale (interactive terminal docs). You pick one with /permissions, Shift+Tab, or --permission-mode (-a).

  • supervised (the default): reads run unasked; everything else asks.
  • edits: also allows edits in the workspace and allow-listed commands.
  • plan: reads only; tools that change things are refused.
  • guarded: what your policy file allows runs; the rest asks.
  • strict: only what the policy file pre-approves runs; everything else is denied. Built for CI.
  • autonomous: everything runs. It is refused outside a sandbox unless you pass --dangerously-skip-permissions (alias --yolo).

The older names ask, auto and yolo still work and map to supervised, guarded and autonomous. Note that auto means guarded, not autonomous.

Use supervised for an unfamiliar repository, edits for daily work in one you trust, guarded once you have allow rules, and strict for pipelines.

How do I set it up step by step?

  1. Install and sign in. Download the CLI from safeguard.sh/download, run safeguard, then type /login. On a server, safeguard login --no-browser prints a URL and a code instead.

  2. Check what applies. In a fresh repository, safeguard trust status reports this (real output from v11.19.21):

NOT trusted /path/to/repo
Permission mode: supervised — reads run, every mutating action asks

No project policy is being applied from this workspace.
Run `safeguard trust` here to let a .safeguard/policy.yaml configure the agent.
  1. Trust only repositories you know. safeguard trust lets the repository's own .safeguard settings apply. Until you trust it, a repository's policy file can tighten the rules but cannot loosen them. This matters for code you just cloned from someone else.

  2. Allow your routine commands. Start the agent with the rules your team already agrees on:

safeguard agent -a guarded \
  --allowedTools 'Bash(npm test:*)' \
  --allowedTools 'Bash(npm run lint:*)' \
  --disallowedTools 'Read(~/.ssh/**)' \
  "fix the failing tests in src/auth"

Tests and lint now run unasked; installs and network calls still ask.

  1. Keep an undo button. The CLI snapshots files before it changes them. safeguard checkpoints list --session <id> shows the snapshots, and safeguard checkpoints restore <checkpoint> --session <id> --dry-run previews a rollback as a diff (CLI docs).

  2. Approve away from the terminal when you need to. The Safeguard desktop app pauses a task before a destructive action and asks you to approve or deny it.

How do I run a coding agent safely in CI?

Nobody is there to click, so nothing should ask. safeguard exec runs one agent turn and exits, and its default mode is strict: nothing is asked and anything the policy file has not pre-approved is denied (CLI usage docs). It also refuses to run outside a git repository, because there would be no way to undo its changes.

safeguard exec --output-format json --max-turns 20 --timeout 15m \
  "list the critical vulnerabilities in this repository and propose upgrades"
  • Scoped tokens. Give the job its own least-privilege credential, never a person's token (scoping guide).
  • A kill switch. --max-turns, --timeout and --max-budget-usd end a run that goes wrong; safeguard runner stop drains and stops a headless runner.
  • Confinement. On Linux, --sandbox confines every write to the workspace with Landlock.
  • Review and record. A person merges the diff, and the JSON result is kept with the build log.

Does my code leave the machine?

It depends on the job. For scans, the local runner opens outbound HTTPS only, runs the scan with its own local scan server, and uploads the result files (SBOM and vulnerability results). The docs state that source code stays on the machine (local runner docs). Scan credentials can come from your own vault at scan time.

The coding agent is different. Like any hosted-model agent, it sends the code it reads to the model endpoint for inference. If that is a concern, the CLI can send inference to a model you host (safeguard model local), with only loopback and private-network addresses accepted by default.

How do Claude Code and Codex handle permissions?

Claude Code has allow, ask and deny rules evaluated in the order deny, then ask, then allow, and modes including default, acceptEdits, plan, auto, dontAsk and bypassPermissions (Claude Code permissions docs). Our Claude Code security guide walks through hardening it.

Codex combines a sandbox mode (such as read-only or workspace-write) with an approval policy (such as on-request). By default the agent runs with network access off, and locally writes are limited to the active workspace (Codex agent approvals and security).

The Safeguard CLI reads the mode names both tools use, so acceptEdits, bypassPermissions, read-only or on-request passed to it map onto its own modes. A side by side comparison is in Safeguard CLI vs Claude Code and Codex.

How do I evaluate any agent's permission model?

  1. Does deny beat allow, without asking a human?
  2. Is npm test && curl ... judged one command at a time?
  3. Can a cloned repository loosen your rules, or only tighten them?
  4. Are secrets protected from reads, not only writes?
  5. Is there a CI mode where anything unapproved is denied?
  6. Can you undo file changes and cap turns, time and spend?

Where does Safeguard fit?

The Safeguard CLI is one agent that writes code, scans dependencies, images and SBOMs, and helps fix vulnerabilities under the same permission model; /scan . runs a scan from the interactive screen (first scan guide). On other assistants, the MCP server at mcp.safeguard.sh connects over OAuth and you choose which tools are enabled (MCP permissions checklist).

A tighter permission model limits what an agent can break. It does not remove vulnerable dependencies already in your code, which is what the next section covers.

Fix it without waiting for upstream

Whatever the vulnerability, most of the risk sits in two gaps. The first is the time between a fix being published and that fix actually running in your production builds. The second, and worse, is the time before any fix exists at all, while a maintainer works out a patch and a release schedule. Waiting through both gaps is a habit, not a requirement. Safeguard gives teams three ways to close them.

1. Autonomous remediation: pull requests, not tickets

When a fixed version exists, Griffin, Safeguard's security model, opens a policy gated pull request that moves the affected dependency to the safe version, and your own CI runs your tests on it before anyone merges. You can run it on one repository or in bulk across every project that carries the vulnerable version. Remediation categories include dependencies, licenses, security posture and findings, and each one is set separately. Reachability analysis ranks the vulnerable code paths your application actually calls first, so the first pull requests you merge are the ones that matter most. Auto-merge is a separate switch and stays off by default, so your team decides what merges on its own and what still needs a human approval.

2. Gold Open Source: the safe version in seconds, free

gold.safeguard.sh is free and needs no login. Search any CVE or package to see affected and fixed versions, CVSS, EPSS, CISA KEV status and a recommended safe version, or use the "Am I affected?" checker. The same data is available through a free read API, README status badges and RSS threat feeds.

3. Gold Registry: start from components that are already fixed

Safeguard Gold rebuilds patched versions of open-source packages and images from source, signs each build, attaches an SBOM, SLSA provenance and VEX, and serves them from registry.safeguard.sh to your organization. Every Gold artifact is held continuously to zero exploitable critical or high CVEs and a completed license check, with signed build provenance (signed with Safeguard's key and verifiable with cosign, SLSA Build Level 3 as the design target) and a public evidence page you can hand to an auditor. An artifact loses its Gold badge if it regresses. Teams can point their own package directory at the registry so hardened equivalents resolve without changing how developers install anything.

When upstream has no fix yet, or will not ship one, Safeguard first works to get the fix accepted upstream. If the issue is severe or upstream will not move, Safeguard builds a fork, fixes the vulnerability there and publishes a hardened Gold build, so you are not stuck on a maintainer's release schedule. You can also request a hardened build of a specific package. Ask which packages it covers before you plan around it.

Your situationWhat to use
A fixed version existsAutonomous remediation opens the upgrade pull request; Gold Open Source confirms the safe version
You need to know today whether you are affectedGold Open Source lookup and "Am I affected?" checker, free and without login
You want vulnerable versions to stop shippingSafeguard policies and gates in CI
Upstream has no fix yet, or will not ship oneA custom Gold request; fork and patch
You want to start clean on new projectsPull hardened components and images from Gold Registry

One honest limit: when the vulnerable code lives in a vendor appliance, a hosted service or an operating system runtime you do not build yourself, the fix still has to come from that vendor or distribution. The steps above apply to the open source dependencies and container images you build and ship, which is where most teams carry the largest and least tracked share of their exposure.

See how Safeguard would help

This demo sets up the local runner on your machine, approves it with a device code and scans from the terminal, the same flow you would use before handing a headless runner to CI.

Click through it at your own pace, or open it full screen. A second walkthrough, search runs on your computer, shows the CLI working on your own machine.

Get the CLI at safeguard.sh/download and read the CLI docs.

FAQ

What is approval fatigue in AI coding agents?

Approving agent actions without reading them because there are too many prompts. Anthropic reports users accept 93% of manual prompts.

Which agent actions should always ask?

Package installs, network calls, pushes and shell commands outside your allow list.

Which actions should an agent never take?

Reading secrets, force pushing and unapproved actions in CI. Make them deny rules.

What is the default permission mode in the Safeguard CLI?

Supervised: reads run unasked and every change asks.

Does auto mode in the Safeguard CLI mean nothing asks?

No. auto maps to guarded. Only autonomous asks nothing, and it needs a sandbox or --dangerously-skip-permissions.

How do I run the Safeguard CLI in CI?

Use safeguard exec, which defaults to strict and refuses to run outside a git repository.

Can a cloned repository change my agent's permissions?

Only to tighten them, until you run safeguard trust.

Sources

Last reviewed: 22 November 2026. Safeguard CLI behaviour checked against v11.19.21.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

We email you a link to confirm, and only then add you to the list. Unsubscribe in one click. Privacy

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.