Safeguard
Developer Tools•

Use the Safeguard CLI as an AI assistant on your own machine

Run safeguard, sign in with /login and ask in plain language. The CLI finds files, edits code and runs commands with your approval, and scans for vulns.

Safeguard Security Team
18 min read

Yes. The Safeguard CLI works as a general AI assistant in your terminal: run safeguard, sign in with /login, and ask in plain language. With your approval it finds files, edits code and runs commands, and it also knows your vulnerabilities and SBOMs. You can switch to it and keep your existing Claude, ChatGPT or Codex plan.

Switching does not mean giving up what you already pay for. Bring the Claude, ChatGPT or Codex plan you already pay for and use it inside the Safeguard CLI. Safeguard adds no extra charge for that usage; your plan's own usage limits and terms still apply. If you would rather stay in the chat you already use, connect Claude or ChatGPT to the Safeguard MCP server and use Safeguard from there.

Most people meet the Safeguard CLI as a scanner. That is half of it. The other half is an assistant that reads the folder you started in and can act on what it finds, and the same platform follows you from the terminal to the desktop and your phone. This guide covers the whole loop with commands you can paste.

Do the work properly with the Safeguard CLI

The Safeguard CLI scans code, container images and SBOMs on your own machine, sends only the results to the platform, and includes an assistant that can fix what it finds. It is a single static binary, so there is no Node, Python or JVM to install first.

Install

On macOS and Linux:

curl -fsSL https://cli.safeguard.sh/install | bash

On Windows, in PowerShell:

irm https://cli.safeguard.sh/install.ps1 | iex

It runs on macOS, Linux and Windows, on x86_64 or arm64. Windows is x86_64 only. The binary is about 40 MB, and scanners are downloaded on first use. If anything looks wrong after install, safeguard doctor checks your environment and connectivity.

This walkthrough shows the install and first start: set up the runner on your own machine, pick the platform, start it, approve it with its device code, then scan from the same terminal.

Click through it at your own pace, or open it full screen.

Sign in and open your first session

Move into the folder you want to work in, then start the CLI with no arguments:

cd ~/projects/payments-api
safeguard

That opens the interactive terminal instead of a help screen. Type /login and your browser opens so you can approve the session. /whoami shows who you are signed in as, and /logout ends the session and takes the runner offline. Once you are signed in, the runner also polls for scan jobs scheduled from the platform.

The folder you start in matters. The @ file picker lists files from that folder, and /resume restores the last session for that same folder.

Ask in plain language

Anything that does not start with / goes to the assistant. The docs give three examples that show its range:

  • "what's the latest file in ~/Downloads"
  • "fix the lodash CVE in this repo"
  • "how many critical vulns do we have"

The first is a plain machine question. The second is a code change. The third is a question about your Safeguard data. The assistant has tools for your local files and tools for your Safeguard data, and it picks whichever the question needs. You do not have to tell it which one.

Writing and fixing code

The Safeguard CLI writes code, not only scans it. Tools that change things (writing a file, editing code, running a command) ask before they act, according to your approval mode. So the normal flow is: ask, read the proposed action, approve it, then check the result. Because the same assistant can see your findings, you can go from "what is critical here" to "fix it" without leaving the session.

Keep your Claude, ChatGPT or Codex plan

This is the part that makes switching easy. Bring the Claude, ChatGPT or Codex plan you already pay for and use it inside the Safeguard CLI. Safeguard adds no extra charge for that usage; your plan's own usage limits and terms still apply. You keep the subscription you chose and gain an assistant that also knows your findings. The status bar shows which model you are on, and /model switches it. For connecting a model, follow the CLI docs and the /model picker.

There is a second route if you live in a chat app. Connect Claude or ChatGPT to the Safeguard MCP server, and you can ask about your vulnerabilities from the chat you already use.

Approvals

/permissions sets one of three modes. Ask prompts before every action. Auto approves known actions and asks about anything new, and it is the default. Yolo approves everything. The current mode is shown in the bar under the input, so you always know which one is active.

CI with safeguard exec

safeguard exec runs one non-interactive assistant turn and exits:

safeguard exec "summarise the critical findings in this repository"

Its default permission mode is strict: nothing is asked, and anything your policy file has not pre-approved is denied. It refuses to run outside a git repository unless you pass --skip-git-repo-check, and --output-format json gives a machine-readable result for the next step in your pipeline.

Twelve worked examples

Each example is something you can type today. Outputs depend on your machine and your account.

To see the loop end to end first, this walkthrough attaches a computer running the Safeguard CLI and a folder, asks for a fix, reviews the diff and approves the command before it runs. The demo itself notes that computer work from Search is available and expanding.

Click through it at your own pace, or open it full screen.

1. Find the latest download

what's the latest file in ~/Downloads

Straight from the docs, and a good first prompt: a normal question about your machine.

2. Count critical vulnerabilities

how many critical vulns do we have

The assistant answers from your Safeguard data, so sign in first. If the number surprises you, ask a follow-up in the same session; the context carries over.

3. Fix a named CVE

fix the lodash CVE in this repo

If several advisories hit one package, name the exact CVE ID from your scan results. Editing code asks before it acts, per your approval mode: read the change, approve it, then ask it to run your tests.

4. Scan the folder you are in

/scan .

/scan takes a folder, image or repo, and asks for a target if you give none. /status and /jobs then show the runner and recent scans.

5. Attach a file with @

Type @ and a picker opens over the starting folder. Choose package.json (or go.mod, pom.xml, whatever your project uses), then type:

which of these dependencies show up in our critical findings?

The picker shows five entries at a time. Use the arrow keys to move, enter to select and esc to close.

6. Run a command with approval

run the test suite and tell me which tests fail

Running a command is one of the actions that asks first. In Ask mode you see every command before it runs; in Auto, anything new still stops for you.

7. Write multi-line instructions

Press ctrl+j to insert a newline anywhere. A trailing backslash followed by Enter also continues the line, and alt+enter works where your terminal passes it through.

Upgrade the vulnerable dependency in the payments service.
Keep the change to the lockfile and the manifest.
Then run the tests and summarise the result.

8. Switch models mid session

/model

With no argument, /model opens a picker. With an argument it switches directly, and it accepts an ID or a label, case insensitive. The docs show /model griffin-2p and /model Premium as equivalent.

9. Copy an answer into a ticket

/copy

This copies the last response to your clipboard (new in 1.2.0). Terminal selection also works, because the CLI does not capture the mouse.

10. Pick up tomorrow where you left off

cd ~/projects/payments-api
safeguard
/resume

/resume brings back your last session in that folder. If a long conversation starts to feel slow, /compact summarises it to free up context, and /clear starts fresh.

11. Scan an image, a repo or an SBOM from the shell

safeguard scan --dir .
safeguard scan --image nginx:latest
safeguard scan --repo https://github.com/org/repo
safeguard scan --sbom sbom.json

Each command builds or reads an SBOM and matches it against vulnerability databases. Results are JSON files under ./output, including vuln.json and license.json. Exit code 0 means the scan ran, 1 means the command failed, and 2 means results were written but the vulnerability scan did not run.

12. Validate SBOMs before you ship them

safeguard validate sbom.json
safeguard validate ./sboms --recursive
safeguard validate sbom.json --strict -o report.json

safeguard validate checks CycloneDX, SPDX and VEX documents. Pair it with example 11 when a customer asks for your SBOM.

Slash commands at a glance

Type / in the terminal to open a filterable palette. These are the commands listed in the docs:

CommandWhat it does
/loginSigns you in through the browser and starts the runner polling for jobs
/logoutSigns you out and takes the runner offline
/whoamiShows the account you are signed in as
/modelShows or changes the AI model; opens a picker with no argument
/compactSummarises the conversation to free up context
/resumeResumes your last session in the current folder
/scanScans a folder, image or repo; asks for a target if none is given
/statusShows user, tenant, runner, uptime, job counts and approval mode
/jobsShows recent scan history
/permissionsSets the approval mode to ask, auto or yolo
/doctorDiagnoses health and connectivity
/copyCopies the last response to the clipboard
/clearClears the conversation and the context the assistant was carrying
/versionShows version info
/helpLists all commands
/quitExits Safeguard

Two keys are worth learning early. esc interrupts a running task without leaving the terminal. PgUp and PgDn scroll the transcript, since the mouse wheel does not.

From terminal to desktop to phone

The CLI is one door into a single platform, and the download page lists the rest. The idea is simple: start in the terminal, continue on the desktop, check findings on your phone.

Terminal. The Safeguard CLI is one static binary for macOS, Linux and Windows, for your own terminal and for CI/CD. This guide is about that part.

Desktop. The desktop app (version 3.2.2 on the download page) runs on Windows, macOS and Linux and puts the whole platform in its own window, where you can ask your supply chain anything in plain English. On Linux it ships as an AppImage that needs the Safeguard CLI on your PATH.

Phone. There are apps for iOS (iPhone and iPad, from the App Store) and Android (phones and tablets, from Google Play), so you can check findings away from your desk.

Editor and browser. IDE extensions cover VS Code, JetBrains IDEs and Open VSX editors such as Cursor and Windsurf, with inline security scanning, guardrail enforcement and one-click remediation. The browser extension, for Chrome and Edge, Firefox and Safari, puts Safeguard search in a side panel.

Cloud, with nothing to install. The Cloud CLI runs the CLI on Safeguard's infrastructure, so a scan needs no local runner. A cloud browser streams a Safeguard session to your tab. A cloud sandbox gives you a hosted tenant against a seeded demo repo, free for seven days with no card.

In practice: fix a dependency from the CLI in the morning, look across products in the desktop app at lunch, and check new findings on your phone on the way home.

Approvals, safety and common mistakes

Approvals matter because the assistant acts. /permissions gives you three modes.

Ask prompts before every action. Use it in a repository you do not know well, on a production config, or any time you want to read each step.

Auto approves known actions and asks about anything new. It is the default, and it suits daily work in your own repositories: routine steps flow, and new kinds of action still stop for you.

Yolo approves everything without asking. Keep it for throwaway environments, such as a scratch folder or a disposable VM, where a wrong command costs you nothing. Switch back with /permissions as soon as you are done.

A few habits make any mode safer:

  • Commit before you ask for a large change. A clean git state makes the assistant's edits easy to review and easy to undo.
  • Read the command before approving it. If it does more than you asked, say no and rephrase.
  • After any fix, scan again. /scan . after an upgrade tells you whether the finding actually went away.

One more boundary to know: policies and gates are evaluated in the Safeguard platform, not by the CLI. The CLI produces SBOMs and findings; the platform decides whether a build passes.

Common mistakes

Starting in the wrong folder. The @ picker and /resume both work from the folder you launched in, so another project's session will not appear. If the file you want is missing from the picker, quit and restart in the right directory.

Treating Yolo as a speed setting. It removes the prompt before every action, including commands. Use Auto for daily work.

Asking about vulns before signing in. Questions about your Safeguard data need /login first. /whoami confirms the session.

Running safeguard exec outside a repo. It refuses unless you pass --skip-git-repo-check. In CI, check out the repository first.

Parsing text output in a pipeline. Use --output-format json with safeguard exec, and read the JSON files under ./output after safeguard scan.

Ignoring exit code 2. It means files were written but the vulnerability scan did not run. Run safeguard doctor and check that the scanners are available.

Pressing Enter for a new line. Enter sends the message. Use ctrl+j.

How it compares with Claude Code and Codex CLI

All three are terminal assistants that read code, edit files and run commands with approvals. The facts below come from each product's own docs.

Safeguard CLIClaude CodeCodex CLI
InterfaceInteractive terminal, plus safeguard exec for one turnTerminal, VS Code and JetBrains, desktop app, webTerminal
LicenceNot described as open source"All rights reserved", Anthropic Commercial TermsApache-2.0
Sign in/login through the browserPrompted on first use; Claude subscription or Anthropic Console account"Sign in with ChatGPT" or an API key
Models/model picker; bring your Claude, ChatGPT or Codex plan/model picker; third-party providers on terminal, VS Code and JetBrains/model for model and reasoning effort
Where code runsYour machine; scan jobs upload only SBOMs and findingsYour machine for local surfaces; web sessions need no local setupYour local repository
ApprovalsAsk, Auto (default), Yolo; exec defaults to strictManual, acceptEdits, plan, auto, dontAsk, bypassPermissions; Shift+Tab to switchSandbox modes read-only, workspace-write, danger-full-access; approval policies on-request and never
Resume/resume in the same folder/resume by ID or name, or a pickercodex resume for recent chats in the repository

Claude Code is Anthropic's agentic coding tool. It runs in the terminal, IDE extensions, a desktop app and the browser. Most surfaces require a Claude subscription or an Anthropic Console account, and the desktop app requires a paid subscription. In auto mode, a second model reviews actions instead of you.

Codex CLI is OpenAI's coding agent that runs locally. Its README lists the Plus, Pro, Business, Edu and Enterprise ChatGPT plans for sign in, and also supports an API key. Its sandboxing docs name workspace-write as the default low-friction mode for local work.

The Safeguard CLI covers the same everyday ground with your approval, and adds your vulnerabilities, scans, SBOM validation and the local runner. Switching is not all or nothing. Bring your existing plan into the Safeguard CLI, or keep writing with the assistant you like and use the Safeguard CLI to scan what changed before you merge. We cover that workflow in checking coding agent changes with the Safeguard CLI. For open source options, see OpenCode alternatives.

FAQ

Can the Safeguard CLI do things that are not about security?

Yes, within its tools. It can find and read files, edit code and run commands on your machine, with your approval. Its tools cover files, code edits, commands and your Safeguard data.

Can I switch to Safeguard and keep my Claude, ChatGPT or Codex plan?

Yes. Bring the Claude, ChatGPT or Codex plan you already pay for and use it inside the Safeguard CLI. Safeguard adds no extra charge for that usage; your plan's own usage limits and terms still apply. You can also connect Claude or ChatGPT to the Safeguard MCP server and use Safeguard from the chat you already use. See the CLI docs or /model for connecting a model.

Does it change files without asking?

Only if you allow it. Writing a file, editing code and running a command ask before they act, according to your approval mode. In Auto, the default, known actions are approved and anything new is asked. Only Yolo approves everything, and you choose it yourself with /permissions.

Does my source code leave my machine?

When the local runner runs platform scan jobs, your source code stays on your machine; only SBOMs and findings are uploaded.

Which approval mode should I use?

Ask for unfamiliar or sensitive repositories. Auto for daily work in code you own. Yolo only in disposable environments.

How do I attach a file?

Type @ in the input. A picker opens over the folder you started in, and the file you choose is attached so the assistant can read it.

Can I run it in CI?

Yes. safeguard exec "your prompt" runs one assistant turn and exits. It needs a git repository (or --skip-git-repo-check), and --output-format json gives a result your pipeline can parse. safeguard scan and safeguard validate also run fine in scripts.

What platforms does it support?

The CLI runs on macOS, Linux and Windows, on x86_64 or arm64; Windows is x86_64 only. Beyond the terminal there is a desktop app for Windows, macOS and Linux, iOS and Android apps, IDE and browser extensions, and cloud options with nothing to install. More on the assistant is in the security aware coding assistant post.

Try it yourself

Prefer to start from the chat you already use? This walkthrough connects Claude to the Safeguard MCP server with OAuth and lets you choose which tools Claude can use.

Click through it at your own pace, or open it full screen.

Ready to run it on your own machine? Download the Safeguard CLI, run safeguard, type /login, and ask your first question. The full reference is in the CLI docs.

Watch it recorded live

This is a real Safeguard CLI session recorded on a Mac on 21 October 2026: install, ask for a fix, approve each command, check the result and scan the folder.

Click through it at your own pace, or open it full screen.

A real session in the Safeguard desktop app: the CLI run shows up, you pick the computer and folder, approve each step and get the result.

Click through it at your own pace, or open it full screen.

Quick check

Which approval mode is the default in the interactive terminal?

Auto. It approves known actions and asks about anything new. You can change it with /permissions.

What does /resume restore?

Your last session in the folder you started the CLI in. Start in the same folder to pick up where you left off.

What is the default permission mode for safeguard exec?

strict. Nothing is asked, and anything your policy file has not pre-approved is denied.

Sources

Last reviewed: 21 October 2026.

Never miss an update

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

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.