Coding agents write a lot of code quickly. Some of it will pull in an outdated dependency, hardcode a token or skip a check. The sensible response is not to stop using agents. It is to put a security-aware one in the loop and keep a human on the approval button.
Safeguard Code is a local coding agent that writes and refactors securely by default. It runs on your machine through the runner. This post covers how it works as documented, and how to keep control of it. We are not going to claim benchmark numbers, because there are none to cite.
What it is
Safeguard Code runs locally. The agent works on code in your workspace, on your machine, through the same runner that is built into the Safeguard CLI. The CLI is sometimes described as like Claude Code for security, because you can ask it for something in plain language and it uses tools to do the work.
The assistant has tools for your local files and for your Safeguard data, and picks whichever the question needs. Examples from the docs:
how many critical vulns do we have
fix the lodash CVE in this repo
It does not replace code review, and you should still read the diff.
How to use it
Start the agent in a repo
cd your-repo
safeguard
Type /login once. Then ask for the change you want. Attach a file with @ so the agent can read it.
For a one-shot request from a terminal:
safeguard agent "fix the critical CVEs in this repository"
Review the working tree
Before you commit anything an agent wrote, ask Safeguard to review it for correctness and security.
safeguard review --help
Run it on the working-tree changes, and run the usual tests as well. Two reviewers are better than one, and the second is a person.
Choose how much it may do alone
Inside the terminal, /permissions selects the approval mode.
| Mode | Behavior |
|---|---|
| Ask | Prompts before every action |
| Auto | Approves known actions, asks for anything new. The default |
| Yolo | Approves everything and never asks |
The current mode shows in the bar under the input. Tools that change things, such as writing a file, editing code or running a command, ask before they act unless you have chosen otherwise.
For headless use, safeguard exec runs one turn and exits. It defaults to strict mode: nothing is asked, and anything the policy file has not pre-approved is denied. It also refuses to run outside a git repository unless you pass a flag to skip that check. Being inside git means every change is one command from being undone.
Keep the code on your machine
The agent works locally. Source stays on your machine, and only the SBOM and findings are uploaded. If you do not want any model involved in code analysis, the CLI works in Zero AI mode as well.
Pick the model
The /model command shows or switches the model. With no argument it opens a picker. You can also bring your own model.
Good habits with any coding agent
- Work on a branch, so nothing lands on main without review.
- Keep the permission mode on Ask or Auto while you learn what it does.
- Run a scan after the agent finishes, not just before.
- Read every diff that touches dependencies, auth or configuration.
- Never paste a real secret into a prompt.
Try it yourself
Create a small branch with a deliberately old dependency in the manifest. Run safeguard, sign in, and ask the agent to fix the critical CVEs. Read the diff before accepting it. Then run a scan again and compare the results.
To see what a code scan finds, click through the demo.
Click through it at your own pace, or open it full screen.
Quick check
Which permission mode does safeguard exec use by default?
Strict. Nothing is asked, and anything the policy file has not pre-approved is denied.
Where does the agent's work happen?
On your machine, through the local runner. Source stays there.