Command Reference
Complete reference for everyrafter command, current as of v0.11.4. Node and Python ship the same command tree with one exception, noted below; where a flag or default differs between the two, both are called out inline.
Requires Node.js 22+ (
@rafter-security/cli) or Python 3.11+ (rafter-cli) from Rafter 0.11.1; 0.11.0 supports Node.js 18+ and Python 3.10+.Global Flags
Available on every command.-a must come before the subcommand (rafter -a secrets .):
rafter run
Trigger a remote security scan (SAST, secret detection, and dependency checks) against a remote git repository — the scan runs against what’s pushed, not your local working tree. Aliases: rafter scan, rafter scan remote.
Options
rafter run checks that an auto-detected branch has been pushed before scanning it, and fails immediately with a clear message if it hasn’t. If your local commit is ahead of the pushed one, the output notes that the scan covers the pushed commit, not your local changes.If
scan.plus_requires_approval is set (in .rafter.yml or the global config), a --mode plus scan refuses without --yes or RAFTER_CONFIRM=1 when there’s no interactive terminal attached, exiting 5. Fast scans are never gated.Examples
rafter get
Retrieve results from a previously triggered scan.
Options
A scan whose status is
failed exits 1. A scan the API marks partial (some scanners didn’t finish) still exits 0, but a warning on stderr names the missing scanners — don’t treat a partial result as clean. Transient read failures (5xx, a 404 immediately after the scan is known to exist, a 429 that carries Retry-After in seconds) are retried automatically before the command gives up. A 429 on submit is never retried: it exits 3.Examples
rafter usage
Check API quota and usage.
rafter sites
Manage Rafter Sites — live-application security monitoring of a deployed URL (exposed backends, DNS misconfiguration, SEO, accessibility), as opposed to the git-repository scans above.
The Sites API has no markdown representation.
--format md is rejected with exit code 1 on every sites subcommand; the default is json. A 404 from any sites endpoint means “not found, or not owned by this API key’s account” — the two are deliberately not distinguished.rafter sites create <url>
Register a URL for live monitoring and kick off its first scan.
rafter sites scan <projectIdOrUrl>
Trigger a re-scan of an existing site. The positional argument is read as a URL when it parses as one; otherwise it’s a project id.
rafter sites list
List registered sites, paginated.
rafter sites get <id>
Get a site’s status, latest run, and findings summary.
rafter secrets
The canonical local secret scan. Scans files or directories for hardcoded secrets — regex patterns plus the Betterleaks binary when available. Secrets only, not a full code-security scan; for SAST/SCA use rafter run.
rafter scan local and rafter agent scan are deprecated aliases that still work; rafter agent scan prints a deprecation warning. Use rafter secrets.Arguments
Options
In
auto mode (the default), rafter runs both engines whenever Betterleaks is available and unions the findings — each engine covers secrets the other misses. Each JSON finding then carries an engines attribution array. --engine betterleaks / --engine patterns stay single-engine and omit that field.Exit Codes
Examples
ignore rules, .rafterignore), and baseline details.
Detected Patterns
View All 28 Secret Patterns
View All 28 Secret Patterns
Cloud Providers:
- AWS Access Key ID (
AKIA…,ASIA…, etc.) / AWS Secret Access Key - Google API Key (
AIza…) / Google OAuth Client ID - DigitalOcean Personal Access Token (
dop_v1_…)
- GitHub Personal Access Token (
ghp_…) - GitHub OAuth Token (
gho_…) - GitHub App Token (
ghu_…,ghs_…) - GitHub Refresh Token (
ghr_…)
- Stripe API Key (
sk_live_…) / Stripe Restricted API Key (rk_live_…) - Slack Token (
xox[baprs]-…) / Slack Webhook URL - Twilio API Key (
SK…) - OpenAI API Key (
sk-proj-…,sk-svcacct-…,sk-admin-…, legacysk-…T3BlbkFJ…) - Supabase Secret Key (
sb_secret_…) - HashiCorp Vault Token (
hvs.…) - Mailchimp API Key
- SendGrid API Key (
SG.….…)
- npm Access Token (
npm_…) - PyPI API Token (
pypi-…)
- Database connection strings (Postgres, MySQL, MongoDB)
- Private keys (RSA, DSA, EC, OpenSSH)
- JSON Web Tokens
- Bearer tokens
- Generic API keys
- Generic secrets/passwords
The AWS Access Key ID pattern does not flag the canonical AWS-docs example key (any
AKIA…/ASIA…/etc. key ending in EXAMPLE) — Betterleaks skips it too, so the two engines agree on that one well-known public non-secret.rafter agent
Agent security features: local setup, command interception, configuration, and status.
rafter agent init
Initialize the local security system.
Options
Integrations are opt-in. There are no
--skip-* flags — omit the corresponding --with-* flag instead.rafter agent init --all installs detected agent integrations and downloads Betterleaks. It does not install the git pre-commit hook — use rafter agent install-hook for that.Examples
rafter agent init-project
Node only. Not implemented in the Python CLI.
Options
What It Does
Creates instruction files in the current project, each with a Rafter security context block delimited by<!-- rafter:start --> / <!-- rafter:end --> markers for idempotent updates:
Examples
rafter agent exec
Execute a shell command with risk assessment and approval, outside any platform hook.
Arguments
Options
--force still parses (so old invocations don’t fail) but is a no-op — it no longer skips approval. A command that requires approval is approved only by a person at an interactive terminal: the prompt appears only when stdin is a TTY, and a piped yes is not an approval. There’s no flag that stands in for a person.Pre-Execution Scanning
Forgit commit and git push, agent exec additionally scans staged files for secrets before running the command, and blocks if any are found. Skip with --skip-scan.
Examples
rafter agent config
Manage the global configuration at ~/.rafter/config.json.
Subcommands
Key casing differs by runtime. The Node CLI’s
get/set take camelCase dot-paths (agent.riskLevel); the Python CLI’s take snake_case (agent.risk_level) — this is not an alias, pick the form your installed CLI uses. Only get rejects the other runtime’s casing, with Key not found: <path> (exit 1). set does not validate the key at all: pass the wrong casing and it prints a success message and silently writes a new, unused key instead of changing anything. The config file on disk accepts either casing when loaded.Configuration Keys
Dot-paths below are given in Node’s camelCase; substitute snake_case for Python (e.g.agent.commandPolicy.mode → agent.command_policy.mode).
Values under a credential-named key (matching
api_?key/token/secret/password/credential) are masked (abcd****) wherever the config is rendered — config show, config get, the config set confirmation, and the MCP get_config tool. The value is still stored in full on disk; the protection is file permissions (0600) plus display redaction.Examples
rafter agent audit
View security audit log entries. For the full JSONL schema, see Audit Log.
Options
Event Types
Examples
rafter agent verify
Check local security integration status across all 10 supported agent platforms.
Options
Checks (12 total, in order)
- Config (hard) —
~/.rafter/config.jsonexists and parses - Betterleaks (hard) — binary on
PATHor at~/.rafter/bin/betterleaks - Claude Code (optional)
- OpenClaw (optional)
- Codex CLI (optional)
- Gemini CLI (optional)
- Cursor (optional)
- Windsurf (optional)
- Continue.dev (optional)
- Aider (optional)
- Hermes (optional)
- OpenCode (optional)
1). Every platform check is optional (failure → warning only, exit stays 0 on its account).
With --probe, a 13th check, Claude Code (probe), appears last.
Exit Codes
Examples
rafter agent status
Show a live dashboard of your Rafter local security setup.
What It Shows
Config path and risk level, hook install state (PreToolUse/PostToolUse), Betterleaks version and path, every platform’s detection/install state, hook off-switch state and its source (default, global-config, or env), and an audit log summary.
Example Output
rafter agent install-hook
Install a git hook that scans for secrets before each commit or push.
Options
What It Does
Pre-commit (default): writes a hook to.git/hooks/pre-commit (or ~/.rafter/git-hooks/pre-commit with --global, which also sets git config --global core.hooksPath). On git commit, the hook runs rafter secrets --staged --quiet and blocks the commit if secrets are found. An existing hook is backed up before being overwritten.
Pre-push (--push): writes a hook that runs rafter secrets --diff <remote-sha> --quiet for each ref being pushed — on a new branch, it scans every commit not already on a remote branch. Blocks the push if secrets are found in commits being pushed.
Either hook can be bypassed with git commit --no-verify / git push --no-verify (not recommended).
Examples
rafter agent update-betterleaks
Update or reinstall the managed Betterleaks binary.
rafter agent update-skill-scanner
Install or update the optional skill-scanner deep engine used by rafter skill review --deep / rafter agent audit-skill --deep. This is a heavy third-party PyPI package (cisco-ai-skill-scanner) — not bundled with Rafter, and only invoked when you pass --deep.
The installer runs
uv tool install (preferred) or falls back to pip install --user, always with a pinned version and a list-form subprocess (never a shell). Exit 0 if installed and reachable on PATH, 1 otherwise.
rafter agent remove-skill-scanner
Uninstall the optional skill-scanner deep engine — the inverse of update-skill-scanner. Idempotent: a no-op success if it isn’t installed. Your skills and Rafter’s own dependencies are untouched.
rafter agent audit-skill
Deprecated — use
rafter skill review <path> instead. Still functional; emits a deprecation warning.Options
What It Does
Quick scan: secret detection, external URL extraction, and 11 high-risk shell patterns (rm -rf /, sudo rm, curl | sh, wget | sh, eval(), exec(), chmod 777, fork bombs, dd /dev/xyz, mkfs, base64 -d | sh). If OpenClaw is available, also routes to a deeper 12-dimension review via the /rafter-audit-skill slash command.
Exit Codes
rafter agent list
List every installable component across all supported platforms with its current state.
A component is a
<platform>.<kind> pair (kind ∈ hooks, mcp, instructions, skills), with state installed, not-installed (platform detected, Rafter not wired in), or not-detected (platform directory doesn’t exist).
rafter agent enable / rafter agent disable
Install or uninstall one or more specific components without touching the rest of a platform’s setup.
--force on enable installs even when the platform isn’t detected (creates the platform directory). disable removes only Rafter’s entry — an MCP config’s other servers, or an instruction file’s content outside the <!-- rafter:start/end --> block, are left intact. An instruction file (such as Aider’s RAFTER.md or Cursor’s rafter-security.mdc) is deleted only when nothing but Rafter’s block was in it.
rafter agent baseline
Manage the findings baseline — an allowlist for known/accepted findings, consumed by rafter secrets --baseline.
rafter skill
Manage rafter-authored skills (list / install / uninstall / review) across Claude Code, Codex, OpenClaw, and Cursor.
rafter skill list
List rafter-authored skills and their install state per platform.
rafter skill install <name>
Install a rafter-authored skill (e.g. rafter, rafter-secure-design, rafter-code-review, rafter-skill-review) to detected platforms, or to an explicit path.
rafter skill uninstall <name>
Remove a rafter-authored skill from one or more platforms.
rafter skill review
Security review of a skill, plugin, or agent extension before installing it — or an audit of every skill already on the machine.
Arguments
path-or-url is one of: a local path (file or directory); a git URL (https/ssh/.git); or shorthand — github:owner/repo[/subpath], gitlab:owner/repo[/subpath], npm:pkg[@version]. Omit it when using --installed.
Options
Exit Codes
--installed mode tolerates medium and below so a routine CI sweep across many skills doesn’t fail on noisy signals; use rafter skill review <path> for a strict single-skill gate.Examples
rafter ci init
Generate CI/CD workflow files for your project.
Options
--with-backend is a deprecated alias for --with-remote — it still works on both runtimes. Python hides it from --help; Node still lists it.Examples
rafter brief
Print Rafter knowledge reformatted for CLI output — designed for any agent on any platform: pipe it to memory, save it to instructions, or read it in-session.
Arguments
Topics
There is no
security topic — passing one exits 1 with “Unknown topic” on both runtimes.Examples
rafter mcp serve
Start an MCP server exposing Rafter’s security tools over stdio transport. Works with any MCP-compatible client.
Tools Provided
scan_secrets applies .rafter.yml ignore rules and .rafterignore: suppressed findings are dropped from the primary results and, when any were hidden, reported in a second content block ({"suppressed_count": N, "_suppressed": [...]}) with no secret text.
Resources Provided
MCP Client Config
rafter hook
Hook handlers for agent platform integration — called by the platform itself, not typically run by hand.
rafter hook pretool
PreToolUse hook handler. Reads tool-call JSON from stdin, evaluates risk, and writes a decision to stdout. The hook only denies: when it has no objection it returns the platform’s no-decision answer, so the platform’s own permission settings decide the call as they would without Rafter.
Shell tools go through command policy, and file-write tools through the write checks (the guard on Rafter’s own config, then a secret scan using the same
.rafter.yml policy as rafter secrets). Staged git commit/git push diffs are scanned for secrets too. Any other tool gets the no-objection answer.
The write guard compares real paths, so a write through a symlink that points into ~/.rafter/ is denied like a direct one. For a rafter agent exec command, the hook classifies the command string it would run on its own merits, whether rafter is called by path, through a package runner (npx @rafter-security/cli, pnpm dlx rafter-cli) or under a wrapper (sudo -E, env, unbuffer); only a --dry-run before -- exempts it, since that runs nothing. A pseudo-terminal wrapper around rafter agent exec (script -c, expect, unbuffer, Python’s pty.spawn) is high risk on its own, since it would fake the interactive terminal that approval requires.
A command that requires approval is denied, not asked. The hook has no way to prompt; its deny reason tells the person to run
rafter agent exec '<command>' at an interactive terminal to approve it. See Troubleshooting.Errors fail closed. Input that isn’t a JSON object gets the no-objection answer (nothing to evaluate — this isn’t an error). Any unexpected exception while evaluating a call denies, with reason
rafter hook error: <type>: <message>; denying to be safe. A malformed .rafter.yml is a handled condition, not an error — it warns and falls back to default settings rather than denying. See Troubleshooting.Can be disabled by the machine owner; see Environment Variables.
rafter hook posttool
PostToolUse hook handler. Reads tool-result JSON from stdin, redacts any secrets found in the tool’s output, content and error fields, and writes JSON to stdout.
Both
hook pretool and hook posttool bound their stdin read (default 5000 ms, override with RAFTER_HOOK_STDIN_TIMEOUT_MS) — a host that opens the hook’s stdin but never closes it can’t wedge the process. Both subcommands also ignore unknown options and extra positional arguments a platform appends to the hook command (e.g. Claude Code’s --hook-json <data>).rafter policy export
Export Rafter’s security policy for an agent platform.
rafter docs
Repo-specific security docs declared under a docs: block in .rafter.yml — internal secure-coding rules, threat models, and similar reference material a scanning agent should read.
rafter docs list
List docs declared in .rafter.yml. Never performs network I/O — URL-backed docs report cache status only.
Exit codes:
0 success, 3 no docs configured.
rafter docs show <id-or-tag>
Print a doc’s content. A match on id prints that doc; a match on tags concatenates every matching doc with separator headers.
On a URL doc, a cache hit within TTL is served from cache; a miss or expiry fetches and refreshes the cache; a network failure with a stale cache falls back to the stale copy with a warning; a network failure with no cache exits
1.
Exit codes: 0 ok, 1 fetch/read error, 2 selector matched nothing, 3 no docs configured.
Examples
rafter issues create
GitHub Issues integration — create issues from scan findings or natural text.
rafter issues create from-scan
Create GitHub issues from scan results.
With
--scan-id, a response with no vulnerabilities array (still processing, failed, not JSON, or an error object) exits 1 with a message naming the scan id — it never reports this as “no findings.” An empty list is a legitimate clean result.rafter issues create from-text
Create a GitHub issue from natural-language text (stdin, a file, or inline).
rafter notify
Post scan results to Slack or Discord via webhooks.
rafter report
Generate a standalone HTML security report from scan results.
Remote scan results (
rafter run/rafter get --format json) are rejected with exit 2 — render those with rafter get <scan_id> --format md instead.rafter completion
Generate shell completion scripts.
Setup
rafter version
Print the version and exit — equivalent to rafter --version / rafter -V.
Environment Variables
A project’s
.env file can never set a RAFTER_* variable, including RAFTER_API_KEY — only your shell environment or the stored global config can. This prevents a repository you merely scan from supplying credentials the CLI then uses.Configuration Files
Rafter reads two configuration layers, in increasing precedence:- Global config —
~/.rafter/config.json, managed withrafter agent config. Owned by the machine operator. See the Configuration Keys table underrafter agent configabove. - Project policy —
.rafter.yml(or.rafter.yaml) in the project root; the CLI walks from the current directory up to the git root looking for it.
.rafter.yml top-level keys:
Project policy is a floor, not a replacement.
command_policy.blocked_patterns/require_approval union with the global config rather than overriding it, and a project cannot loosen the global command policy unless the machine owner explicitly set agent.commandPolicy.allowProjectOverride: true in the global config. The always-on critical-command block is never affected by either layer.File Locations
Exit Codes
Local Security (rafter agent *, rafter secrets)
Remote Code Analysis (rafter run, rafter get)
rafter usage doesn’t use this table — it only ever exits 0 (success) or 1 (any error: network failure, 4xx, or 5xx alike). It never breaks a failure out into 2/3/4.Sites (rafter sites create, scan, list, get)
Docs (rafter docs list, rafter docs show)
Support
Need Help?
- Documentation: docs.rafter.so
- GitHub: rafter-cli/issues
- Support: rafter.so/help

