Command Reference
Complete reference for all Rafter local security and MCP commands.rafter agent init
Initialize local security system.
Options
The legacy
--with-gitleaks, --engine gitleaks, and rafter agent update-gitleaks flags were removed in v0.8.0. Use the -betterleaks equivalents. rafter agent verify and rafter agent status still detect a leftover ~/.rafter/bin/gitleaks and tell you to run rafter agent update-betterleaks.What It Does
- Creates
~/.rafter/config.jsonconfiguration - Initializes directory structure (
~/.rafter/) - Detects installed development environments (
~/.claude,~/.codex,~/.gemini, etc.) - Installs opted-in integrations (skills, hooks, sub-agents, per-skill rules, or MCP server configs)
- Downloads Betterleaks binary if
--with-betterleaksor--allis passed
Examples
rafter agent init-project
Generate project-level instruction files so AI agents discover Rafter at session start.
Options
What It Does
Creates instruction files in the current project for all 7 supported agent platforms:
Each file contains a Rafter security context block with scanning commands, integration tips, and CLI reference pointers. Files use marker comments (
<!-- rafter:start/end -->) for idempotent updates — safe to re-run without duplicating content.
Examples
rafter secrets
Note: rafter agent scan still works but is deprecated — it will be removed in a future major version.
Scan files or directories for secrets.
Arguments
Options
Exit Codes
0- No secrets found1- Secrets detected2- Runtime error (path not found, not a git repo, invalid ref)
Examples
Detected Patterns
View All 21+ Secret Types
View All 21+ Secret Types
Cloud Providers:
- AWS Access Keys (
AKIA...) - AWS Secret Keys
- Google API Keys (
AIza...) - Google OAuth credentials
- GitHub Personal Access Tokens (
ghp_...) - GitHub OAuth Tokens (
gho_...) - GitHub App Tokens (
ghu_...,ghs_...) - GitHub Refresh Tokens (
ghr_...)
- Stripe API Keys (
sk_live_...,rk_live_...) - Slack Tokens (
xox[baprs]-...) - Slack Webhooks
- Twilio API Keys (
SK...)
- npm Access Tokens (
npm_...) - PyPI API Tokens (
pypi-...)
- Database connection strings
- Private keys (RSA, DSA, EC, OpenSSH)
- JWT tokens
- Bearer tokens
- Generic API keys
- Generic secrets/passwords
rafter agent exec
Execute command with security validation.
Arguments
Options
Command Risk Levels
🔴 Critical (Always Blocked)
🔴 Critical (Always Blocked)
rm -rf /:(){ :|:& };:(fork bomb)dd if=/dev/zero of=/dev/sda> /dev/sdamkfs.*fdisk,parted
🟠 High (Requires Approval)
🟠 High (Requires Approval)
rm -rf <dir>sudo rmchmod 777curl ... | shgit push --forcenpm publishdocker system prune
🟡 Medium (Moderate+ Requires Approval)
🟡 Medium (Moderate+ Requires Approval)
sudochmodchownkill -9systemctl
🟢 Low (Allowed)
🟢 Low (Allowed)
npm installgit commit- File read operations (
ls,cat,grep) - Basic file operations (
echo,touch)
Examples
Pre-Execution Scanning
For all commands, Rafter first evaluates the command against risk rules. For git commands (git commit, git push), it additionally:
- Gets list of staged files
- Scans each file for secrets
- Blocks if secrets detected
- Allows if clean
--skip-scan if needed.
rafter agent config
Manage agent configuration.
Subcommands
show
Display full configuration:
get <key>
Get specific configuration value:
set <key> <value>
Set configuration value:
Configuration Keys
Examples
rafter agent audit
View security audit logs. For the full JSONL schema specification, see Audit Log.
Options
Event Types
Examples
Output Format
rafter agent verify
Check local security integration status across all 8 supported platforms.
What It Does
Validates your Rafter setup by checking 10 things in order:- Config —
~/.rafter/config.jsonexists and is valid JSON - Betterleaks — Binary available on PATH or at
~/.rafter/bin/betterleaks(legacy~/.rafter/bin/gitleaksis detected and surfaced as an “upgrade needed” hint, not an error) - Claude Code —
~/.claude/settings.jsonhasPreToolUsehooks installed (optional) - OpenClaw —
~/.openclaw/workspace/skills/rafter-security/SKILL.mdexists with ClawHub frontmatter (optional) - Codex CLI —
~/.agents/skills/rafter/SKILL.mdand~/.agents/skills/rafter-agent-security/SKILL.mdexist (optional) - Gemini CLI — MCP server configured for Gemini (optional)
- Cursor — hooks + per-skill rules + sub-agent installed (optional)
- Windsurf — per-skill rules + AGENTS.md + MCP entry installed (optional)
- Continue.dev — MCP entry + per-skill rules installed (optional)
- Aider —
RAFTER.mdpresent and listed in.aider.conf.yml’sread:(optional)
Options
Exit Codes
Examples
rafter agent status
Show a live dashboard of your Rafter local security setup.
What It Shows
Example Output
rafter agent install-hook
Install a git pre-commit hook that scans staged files for secrets before each commit.
Options
What It Does
Without--global (local install):
- Writes hook to
.git/hooks/pre-commitin the current repo - Backs up any existing hook before overwriting
--global (global install):
- Writes hook to
~/.rafter/git-hooks/pre-commit - Sets
git config --global core.hooksPath ~/.rafter/git-hooks - Applies to every git repo on the machine
git commit runs, the hook calls rafter secrets --staged. If secrets are detected the commit is blocked. Pass git commit --no-verify to bypass (not recommended).
Examples
rafter agent audit-skill
Security audit of a Claude Code or OpenClaw skill file.
Arguments
Options
What It Does
Performs deterministic security analysis on the skill file:- Secret detection — Scans for hardcoded API keys, tokens, and credentials
- URL extraction — Lists all external HTTP/HTTPS URLs
- High-risk command patterns — Detects 11 dangerous patterns:
rm -rf /,sudo rm,curl|sh,wget|sh,eval(),exec(),chmod 777, fork bombs,dd /dev/xyz,mkfs,base64 -d|sh
/rafter-audit-skill slash command for a deeper 12-dimension security review covering trust, network access, credential handling, obfuscation, supply chain, and more.
Exit Codes
Examples
JSON Output
rafter ci init
Generate CI/CD workflow files for your project.
Options
What It Does
- Detects your CI platform from project files (
.github/,.gitlab-ci.yml,.circleci/) - Generates a workflow file with secret scanning and security checks
- Optionally adds a backend scan job using the Rafter API
Examples
rafter brief
Print rafter knowledge reformatted for CLI output. Designed for any agent on any platform — pipe to memory, save to instructions, or just read in-session.
Arguments
Topics
Examples
rafter mcp serve
Start an MCP server exposing Rafter security tools over stdio transport. Works with any MCP-compatible client.
Options
Tools Provided
Resources Provided
MCP Client Config
rafter hook pretool
PreToolUse hook handler for Claude Code. Reads tool input JSON from stdin, writes decision to stdout.
Bash tool calls against command policy and scans Write/Edit content for secrets.
See Claude Code Integration for setup.
rafter hook posttool
PostToolUse hook handler for Claude Code. Reads tool result JSON from stdin, logs security-relevant events to the audit log.
Bash, Write, and Edit tool executions with their outcome and risk level. Useful for auditing what an agent actually did (vs. what was blocked at pretool).
See Claude Code Integration for setup.
rafter policy export
Export Rafter security policy for agent platforms.
Options
rafter completion
Generate shell completion scripts for rafter.
Arguments
Setup
Global Flags
Available on all commands:Environment Variables
File Locations
Exit Codes
Local Security (rafter agent *, rafter secrets)
Remote Code Analysis (rafter run, rafter get, rafter usage)
Support
Need Help?
- Documentation: docs.rafter.so
- GitHub: rafter-cli/issues
- Support: rafter.so/help

