Download and install Betterleaks binary (gitleaks successor)
false
--all
Install all detected integrations and download Betterleaks
false
-i, --interactive
Guided setup — prompts for each detected integration
false
--update
Re-download betterleaks and reinstall integrations without resetting config
false
--dry-run
Print every file path that would be created, modified, or downloaded — make no changes
false
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.
Creates instruction files in the current project for all 7 supported agent platforms:
Platform
File Created
Claude Code
.claude/CLAUDE.md
Codex CLI
AGENTS.md
Gemini CLI
GEMINI.md
Cursor
.cursor/rules/rafter-security.mdc
Windsurf
.windsurfrules
Continue.dev
.continuerules
Aider
.aider/conventions.md
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.
# Generate for all platformsrafter agent init-project# Preview what would be createdrafter agent init-project --list# Generate only for specific platformsrafter agent init-project --only claude-code,cursor# Generate for a single platformrafter agent init-project --only codex
Commit the generated files so every contributor’s agent session sees Rafter security context automatically.
Scan only files changed since a git ref (e.g. HEAD~1, main)
--engine <type>
Scan engine: patterns, betterleaks, or auto (default)
--history
Scan git history for secrets (requires betterleaks engine)
--baseline
Filter findings present in the saved baseline
--watch
Watch for file changes and re-scan on change
--gitignore / --no-gitignore
Honor .gitignore when walking the scan target (default: on). Honors nested .gitignore, negations, .git/info/exclude, and the global excludes file. Outside any git work tree this flag is a no-op.
# View all configrafter agent config show# Get risk levelrafter agent config get agent.riskLevel# Set to aggressiverafter agent config set agent.riskLevel aggressive# Change policy moderafter agent config set agent.commandPolicy.mode deny-list# Enable secret redactionrafter agent config set agent.outputFiltering.redactSecrets true# Set log retentionrafter agent config set agent.audit.retentionDays 60# Configure webhook notificationsrafter agent config set agent.notifications.webhook https://hooks.slack.com/services/T.../B.../xxxrafter agent config set agent.notifications.minRiskLevel critical
Validates your Rafter setup by checking 10 things in order:
Config — ~/.rafter/config.json exists and is valid JSON
Betterleaks — Binary available on PATH or at ~/.rafter/bin/betterleaks (legacy ~/.rafter/bin/gitleaks is detected and surfaced as an “upgrade needed” hint, not an error)
Claude Code — ~/.claude/settings.json has PreToolUse hooks installed (optional)
OpenClaw — ~/.openclaw/workspace/skills/rafter-security/SKILL.md exists with ClawHub frontmatter (optional)
Codex CLI — ~/.agents/skills/rafter/SKILL.md and ~/.agents/skills/rafter-agent-security/SKILL.md exist (optional)
Gemini CLI — MCP server configured for Gemini (optional)
Emit a single JSON object (checks[] + summary) with stable pass | warn | fail status. Intended for CI consumption.
--probe
Runtime probe for Claude Code: synthesize a PreToolUse stdin payload with a known-dangerous sentinel command, invoke rafter hook pretool, and confirm ~/.rafter/audit.jsonl recorded a command_intercepted entry. Catches the “wrote file but the hook never fires” failure mode that file-presence checks miss.
# Run health checkrafter agent verify# CI consumption — single JSON object on stdoutrafter agent verify --json# Runtime probe — confirms Claude Code's PreToolUse hook actually firesrafter agent verify --probe# Example output (all passing):# ✓ Config ~/.rafter/config.json# ✓ Betterleaks 1.1.2 (/home/you/.rafter/bin/betterleaks)# ✓ Claude Code PreToolUse hook installed# ✓ OpenClaw rafter-security SKILL.md present# Example output (legacy gitleaks needs upgrade):# ✓ Config ~/.rafter/config.json# ⚠ Betterleaks legacy gitleaks at ~/.rafter/bin/gitleaks — run: rafter agent update-betterleaks# ✓ Claude Code PreToolUse hook installed
Run rafter agent verify after rafter agent init to confirm everything installed correctly, and after system updates to catch binary incompatibilities. Use --probe in CI/post-install to catch hook regressions that file-presence checks miss.
When 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).
# Install for current reporafter agent install-hook# Install globally for all reposrafter agent install-hook --global# Remove global hookgit config --global --unset core.hooksPath
If OpenClaw is available, the command routes the skill to the /rafter-audit-skill slash command for a deeper 12-dimension security review covering trust, network access, credential handling, obfuscation, supply chain, and more.
# Auto-detect platform and generate configrafter ci init# Generate GitHub Actions workflowrafter ci init --platform github# Include backend scanning jobrafter ci init --platform github --with-backend
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.
# List available topicsrafter brief# Get the local security briefingrafter brief security# Platform-specific setup guiderafter brief setup/claude-code# For agents without native skill support — load context manuallyrafter brief security # save to memory/instructionsrafter brief commands # save command reference# Pipe to a file for manual skill creationrafter brief scanning > ~/.agents/skills/rafter/SKILL.md
rafter brief works on any platform — use it to bootstrap agent knowledge when skill auto-install isn’t available.
PostToolUse hook handler for Claude Code. Reads tool result JSON from stdin, logs security-relevant events to the audit log.
rafter hook posttool
Logs completed 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.