Slash commands are the controls inside the Safeguard CLI's interactive terminal. Run safeguard, type /, and a palette opens that filters as you type. /login signs you in, /scan . scans the folder, /permissions sets how often the assistant asks first, /model switches the model, /resume and /rewind take you back, and /help lists the rest.
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. This guide stays in the terminal, where the slash commands live.
What you will have at the end
Work through this guide once and you will have:
- The CLI installed, signed in and checked with
/doctor. - Every documented slash command, grouped by job: account, scanning, the assistant and housekeeping.
- An approval mode chosen on purpose with
/permissions. - A real fix session in a sample project, with every command and file edit approved by you.
- A way back:
/rewindfor the assistant's edits,/resumefor yesterday's session. - The same session on your desktop and phone, so you can approve a waiting command away from the keyboard.
You need a terminal on macOS, Linux or Windows, a Safeguard account and a project folder. The examples use a small Node.js service called payments-api, so npm appears in a few steps, but every slash command works the same in a Python, Java or Go repository.
Before you start: open the terminal and the palette
If the CLI is not installed yet, the macOS install guide covers it in detail. The short version:
- Install the CLI. On macOS and Linux run
curl -fsSL https://cli.safeguard.sh/install | bash. On Windows PowerShell runirm https://cli.safeguard.sh/install.ps1 | iex. The installer verifies the download against the published checksums and places one static binary on your PATH. There is no Node, Python or JVM to install. - Confirm it with
safeguard --version. If the version looks wrong,which -a safeguard(orGet-Command safeguard -Allon Windows) shows whether an older copy sits earlier on your PATH. - Move into your project with
cd payments-api. The folder you start in matters:@attaches files from it and/resumelooks for the last session in it. - Run
safeguardwith no arguments. The interactive terminal opens. On the first run it downloads its scanner toolchain, so let that finish. - Type
/. The command palette opens and narrows as you type more letters. Use the up and down arrows to move,enterto run the highlighted command andescto close the palette. - Type
/helpand pressenterto see every command your build knows about.
Three keys are worth learning on day one, because they change how the terminal feels:
| Key | What it does |
|---|---|
esc | Interrupts what is running without exiting, and closes the palette or file picker |
ctrl+j | Inserts a newline without sending, in every terminal |
PgUp and PgDn | Scroll the transcript (the mouse wheel does not) |
On a single line input, the up and down arrows recall earlier messages.
The full slash command reference
The docs group the commands into account, AI, runner, tools and general groups.
| Command | Group | What it does | Reach for it when |
|---|---|---|---|
/login | Account | Opens your browser to approve the session; the runner then starts polling for scan jobs | First run, or after a sign out |
/whoami | Account | Shows the account you are signed in as | You work across several tenants or accounts |
/logout | Account | Signs you out and takes the runner offline | Handing the machine over, or switching accounts |
/model | AI | Shows or switches the AI model | A task needs a different model |
/compact | AI | Summarises the conversation to free up context | A long session starts to drift |
/resume | AI | Resumes your last session in the current folder | You come back to work after a break |
/scan | Runner | Scans a folder, image or repository; asks what to scan if you give no argument | You want findings now |
/status | Runner | Shows user, tenant, runner, uptime, job counts and approval mode | Something seems stuck |
/jobs | Runner | Shows recent scan history | You want to know whether a scan ran |
/permissions | Runner | Sets how often the assistant asks before acting | Before any session that will edit code |
/doctor | Tools | Diagnoses health and connectivity | Anything fails |
/copy | General | Copies the last response to the clipboard | You want a summary in a ticket or PR |
/clear | General | Clears the conversation and the context the assistant was carrying | Starting an unrelated task |
/version | General | Shows version information | Filing a bug, or checking an upgrade |
/help | General | Shows all commands | You forget a name |
/quit | General | Exits Safeguard | You are done |
Three more come from other parts of the CLI: /rewind rolls the session back to a file checkpoint, and /bug, /feedback and /support are the interactive versions of safeguard support.
@ is not a command, but it sits next to them. Typing @ opens a picker for the folder you started in, five entries at a time; the file you choose is attached to your message so the assistant can read it.
Account commands: /login, /whoami and /logout
Signing in is the first thing every session needs, and the account commands are short enough to learn in one go.
- Type
/login. Your default browser opens on the Safeguard sign in page. - Approve the session in the browser. The terminal picks it up on its own and the runner begins polling for scan jobs.
- Type
/whoamito confirm which account and tenant you are in. - When you are finished on a shared machine, type
/logout. This ends the session and takes the runner offline.
If the browser cannot open, for example over SSH or on a headless box, sign in from the shell instead with safeguard login --no-browser. It prints a verification URL and a short code. Open the URL on any device, enter the code and approve. Setting SAFEGUARD_NO_BROWSER stops the interactive terminal from trying to open a browser for /login at all; it is implied when the CI variable is set.
To switch accounts, run safeguard logout and then safeguard login --force.
Scanning commands: /scan, /status and /jobs
/scan is the shortest path from a folder to findings.
- Type
/scan .to scan the current folder. Give it an image name or a repository URL instead to scan those. - Type
/scanwith no argument and the terminal asks what you want to scan. - While the scan runs, type
/status. It shows the signed in user, tenant, runner, uptime, job counts and the current approval mode. - Type
/jobsafterwards to see the recent scan history.
When you run /scan . while signed in, the runner uploads the SBOM and the findings to the platform. Your source code does not leave the machine.
The same scan is available as a plain command for scripts: safeguard scan --dir . builds an SBOM, matches it against vulnerability databases and writes JSON files such as vuln.json, license.json and collection.json into a folder under ./output. Swap --dir . for --image nginx:latest, --repo with a repository URL, or --sbom sbom.json. Each run takes exactly one target.
Assistant commands: /permissions, /model, /compact, /clear, /resume and /rewind
/permissions: decide how often it asks
The assistant can read files, edit code and run commands on your machine, and the tools that change things ask before they act. /permissions sets how often. In the current CLI it offers five modes:
| Mode | What runs on its own | What asks first |
|---|---|---|
| Ask | Reads | Every edit and every command |
| Accept edits | Edits inside this folder and read only commands | Other commands |
| Plan | Nothing changes: the assistant reads and plans only | Not applicable |
| Auto (default) | Read only commands and whatever the policy allows | Anything else |
| Strict | Pre-approved actions only | Everything else is denied; meant for CI |
The current mode is shown in the bar under the input, and /status reports it too. There is also a --yolo command line flag that approves everything. Keep it for throwaway sandboxes, never for a repository you care about.
A sensible pattern: Plan to propose an approach, Ask or Accept edits to carry it out, Strict for pipelines.
The recorded session below shows the approvals in practice. It was captured on a Mac on 21 October 2026 against the sample payments-api project with test data. The CLI is installed with the curl command (checksum verified), checked with safeguard --version, and opened with safeguard. Asked to "fix the lodash CVE in this repo", the assistant reads the finding, the files and the advisory, then asks before each command, and you press y or n. It edits package.json to lodash 4.17.21, runs npm install and npm test with approval, prints a summary with a suggested commit message and pushes nothing. The session ends with /permissions, /model and /scan ..
Click through it at your own pace, or open it full screen.
/model: show or switch the model
Type /model with no argument to open a picker. Type /model followed by a model ID or label to switch straight away; matching ignores case. An unknown name is rejected and the response lists the models you can use, which is a quick way to see what your tenant allows. To connect a model from a plan you already have, see the CLI docs and the options /model shows you.
/compact and /clear: manage context
/compact summarises the conversation to free up context and keeps going in the same thread; use it when a long session starts to drift. /clear clears the conversation and discards the context the assistant was carrying; use it when you switch to an unrelated task, so old details do not leak into new answers.
/resume: pick up where you left off
/resume resumes your last session in the current folder. Sessions are tied to the folder, so cd into the same project first. From the shell, safeguard -c continues the most recent session in the workspace, and safeguard --resume does the same, or takes a specific session ID after an equals sign.
/rewind: undo the assistant's file edits
Before the assistant writes or edits a file, the CLI snapshots it. /rewind returns the session to one of those checkpoints: changed files go back to how they were, files the assistant created are removed, and the transcript rolls back to the same point. The state a rewind overwrites is kept as a new checkpoint, so a rewind can itself be undone.
One limit matters: anything a shell command writes is not snapshotted. If the assistant ran npm install, the files that command changed are outside the checkpoint. Commit, or at least run git status, before you approve commands that write.
For scripts, the same checkpoints are on the command line:
safeguard sessions list
safeguard checkpoints list --session SESSION_ID
safeguard checkpoints restore CHECKPOINT_ID --session SESSION_ID --dry-run
safeguard checkpoints restore CHECKPOINT_ID --session SESSION_ID --files-only
--dry-run prints what would change as a diff per file and changes nothing. --files-only restores the files but keeps the transcript as it is.
Everyday commands: /doctor, /copy, /version, /help and /quit
/doctorchecks environment, sign in, tools and policy, and changes nothing. From the shell,safeguard doctor > doctor.txtsaves the report for a support request./copyputs the last response on your clipboard. The CLI does not capture the mouse, so your terminal's own selection works too./versionpairs well withsafeguard self-update --check, which reports whether a newer release exists and installs nothing./bug,/feedbackand/supportreach Safeguard from inside the session.
A worked session: one CVE, start to finish
Here is a complete session in payments-api using only plain language and slash commands. Adjust the package names to your project.
cd payments-apiand confirm the tree is clean withgit status. Create a branch withgit switch -c fix/lodash.- Run
safeguard. - Type
/whoami. If it says you are not signed in, type/loginand approve in the browser. - Type
/permissionsand choose Ask. You want to see every edit and command on this first run. - Type
/scan .and wait for it to finish. Check/jobsif you want to confirm it ran. - Ask in plain language:
how many critical vulns do we have. The assistant answers from your Safeguard data. - Ask:
fix the lodash CVE in this repo. The assistant reads the finding, the relevant files and the advisory, and proposes a change. - Approve the edit to
package.jsonwhen asked. If you want the file in context first, type@and pickpackage.jsonbefore asking. - Approve
npm installandnpm testone at a time. Pressnfor anything you did not expect. - Read the summary. It includes a suggested commit message and pushes nothing.
- Type
/copyto grab the summary for your PR description. - Type
/scan .again to confirm the finding is gone from the new results. - Leave the session with
/quit, then review the diff withgit diffand commit it yourself.
If step 9 goes wrong, /rewind puts the edited files back. Then run git restore package-lock.json and reinstall to undo what npm install wrote, since shell output is not in the checkpoint.
Before you merge, a second look helps. safeguard review reviews the working tree changes for correctness and security, and safeguard review --base main diffs against a branch instead. The post on reviewing AI generated code before merge walks through that step in more depth.
Approve from another device
A CLI session is live. It shows in the web app, the desktop app and the phone app, and other devices can send work to it. From the desktop or phone app you can send work to a computer running the CLI: pick the computer and the folder, then approve each command and file edit.
This recorded session was captured on an Android phone on 21 October 2026, with the same sample project. The same conversations appear on the phone. "Work on my computer" picks a computer running the CLI and a folder. The command waits on the phone for Allow once, Allow for turn or Deny, and the answer shows the tests passed.
Click through it at your own pace, or open it full screen.
The Android guide covers installing the app from Google Play, or from the direct APK on phones without Google Play.
For scripts there is one more route. safeguard runner slash runs terminal slash commands without a terminal, one argument per input line against one session, so safeguard runner slash /status prints the status a person would see. --json gives one JSON object per command, and --list prints every command registered in your build.
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 writes code too, not only scans. The assistant has tools for your local files and for your Safeguard data and picks whichever a question needs, so the same session can answer "what's the latest file in ~/Downloads", "how many critical vulns do we have" and "fix the lodash CVE in this repo".
Three habits follow:
- Write and fix code with an assistant that knows your vulnerabilities. It reads the finding and the advisory before it proposes a change, then edits code and runs commands with your approval.
- Scan what any agent changed before you merge. Run
/scan .orsafeguard reviewafter a change, whether it came from you, from Safeguard or from another coding tool. - Keep source on your machine. When the local runner runs platform scan jobs, only SBOMs and findings are uploaded.
It is one platform on every surface: the CLI for macOS, Linux and Windows, desktop apps for the same three, mobile apps for iOS and Android, IDE and browser extensions, and cloud options with nothing to install. Start in the terminal, continue on the desktop, and approve a waiting command from your phone.
For pipelines, safeguard exec "summarise the critical findings in this repository" runs one non-interactive assistant turn. Its default permission mode is strict, and it refuses to run outside a git repository unless you pass --skip-git-repo-check. The CI guide covers it step by step. Policies and gates are evaluated in the platform, not by the CLI.
Troubleshooting
The palette does not open. You are probably in your shell, not the interactive terminal. Run safeguard first.
/login opens nothing. You may be on a remote or headless machine. Quit, run safeguard login --no-browser, open the printed URL on another device and enter the code.
Not authenticated, or HTTP 401. Run safeguard whoami to see the token expiry. Then safeguard logout and safeguard login --force.
/scan . finds no dependencies. Check you are in the project root with pwd, check a manifest exists with ls -la package.json requirements.txt pom.xml go.mod, and install dependencies so lock files exist.
"syft binary not found" on a new machine. Run safeguard once and let first run setup finish. safeguard update refreshes vulnerability databases for scanners you already have; it does not install missing ones.
/model rejects a name. Use one of the IDs or labels it prints back.
/resume finds nothing. Sessions are per folder. cd into the project you were working in, then try again, or run safeguard sessions list.
Support will ask for /doctor output and the log at ~/.sg/logs/safeguard.log.
Common mistakes
Leaving the approval mode on whatever it was. Set /permissions at the start of any session that will edit code. Ask for unfamiliar repositories, Accept edits once you trust the plan, Strict for CI.
Using --yolo on a real repository. It approves everything. Keep it for throwaway sandboxes.
Expecting /rewind to undo shell commands. It restores files the assistant edited or created. Output from npm install or a build script is not in the checkpoint. Commit before you approve commands that write.
Starting in the wrong folder. @, /resume and /scan . all depend on where you ran safeguard. Start in the project root.
Using /clear when you meant /compact. /clear throws away the context; /compact only shortens it.
Pushing without reading the diff. The assistant pushes nothing on its own. Read git diff, run safeguard review, then commit and push yourself.
FAQ
How do I see every slash command my version supports?
Type /help inside the interactive terminal, or type / and browse the palette. From the shell, safeguard runner slash --list prints every registered command. If the docs and your build ever disagree, trust the build's own help.
Can I use my Claude or ChatGPT subscription with the Safeguard CLI?
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. See the CLI docs or /model for connecting a model. You can also connect Claude or ChatGPT to the Safeguard MCP server, as shown in the guide to connecting Claude to Safeguard.
Which permission mode should I use?
Auto is the default: read only commands and what the policy allows run, anything else asks. Use Ask for repositories you do not know yet, Plan when you only want a proposal, Accept edits once you trust the plan, and Strict in CI.
How do I undo what the assistant changed?
Type /rewind and choose a checkpoint. From the shell, safeguard checkpoints restore with --dry-run shows the diff first. Shell command output is not snapshotted, so use git for that part.
Does /scan upload my source code?
No. The runner uploads the SBOM and findings; source stays on your machine.
Can I approve a command from my phone?
Yes. A CLI session shows in the web, desktop and phone apps. A command waiting for approval can be allowed once, allowed for the turn, or denied from the phone.
Try it yourself
This demo walks through setting up the runner on your own machine: pick the platform, start it, approve it with its device code, then use the same CLI to scan from the terminal.
Click through it at your own pace, or open it full screen.
When you are ready to run it for real, download the CLI from safeguard.sh/download and keep the CLI docs open in another tab while you learn the commands.
Quick check
Which slash command picks up yesterday's session, and what do you need to do first?
/resume. Sessions are tied to a folder, so cd into the same project before you run safeguard.
Why might /rewind not fully undo a change?
It restores the files the assistant wrote or edited and removes files it created, but anything a shell command wrote, such as the output of npm install, is not snapshotted. Use git for that part.
Which approval mode is meant for CI?
Strict. Only pre-approved actions run and everything else is denied. safeguard exec uses strict by default.
Sources
- Safeguard CLI docs
- Safeguard CLI: interactive terminal
- Safeguard CLI: slash commands
- Safeguard CLI: usage
- Safeguard CLI: installation
- Safeguard CLI: troubleshooting
- Safeguard CLI: configuration
- Safeguard download page
- npm docs: npm test
Last reviewed: 21 October 2026.