Sandbox
@peg/rampart

Policy engine for AI agent actions

Rampart checks AI agent actions before they execute and applies local policy to each one. It can be wired into Claude Code, Codex, Cursor, Copilot, Gemini CLI, MCP servers, or a generic process boundary, then records decisions in a hash-chained audit trail.

83 stars13 forksGoUpdated 7d ago
Who it's for

Builders who want their agent actions checked, approved, or blocked before they touch files, commands, APIs, or MCP tools.

What it delivers

You can keep agents moving while staying in control of what they are allowed to do.

What it does

Policy before execution

Matches shell, file, network, MCP, messaging, and other exposed actions before the host runs them.

Allow, ask, or deny decisions

Returns one of three outcomes for each action, with sensitive actions able to use native approval flows where supported.

Hash-chained audit trail

Records live decisions in a local audit trail and supports `rampart audit tail --follow` and `rampart audit verify`.

Multiple integration paths

Works through native hooks, plugins, proxies, CLI wrappers, and preload-based boundaries.

Local YAML policies

Uses readable YAML policy files, including project-local `.rampart/policy.yaml` created by `rampart init --project`.

MCP proxy mode

Can proxy command-launched MCP servers with `rampart mcp -- ...`.

Verification and status checks

Provides `rampart status`, `rampart doctor`, `rampart verify --all`, and `rampart rules` for inspection and testing.

How to get it

  1. 1Run
    brew install peg/tap/rampart
    
    rampart protect
    rampart verify --all
    rampart watch
  2. 2macOS and Linux installer
    curl -fsSL https://rampart.sh/install | bash
  3. 3Windows PowerShell
    irm https://rampart.sh/install.ps1 | iex
  4. 4Go
    go install github.com/peg/rampart/cmd/rampart@latest

README

Rampart

Open-source policy and approval control for AI agents.

Rampart — Let agents move fast. Keep the final say.

Go License CI Release Docs

Install · How it works · Integrations · Policies · Documentation


AI agents can edit files, run commands, call APIs, and ship code at machine speed. Their permission systems usually ask a different question: can this tool run?

Rampart asks: should this action run?

It sits at supported hooks, plugins, proxies, and process boundaries; evaluates the action against local policy; and returns allow, ask, or deny before the host executes it. Decisions are visible, approvals stay human-owned, and the result becomes part of a hash-chained audit trail.

Agent proposes an action
          │
          ▼
   ┌─────────────┐
   │   Rampart   │  policy · approval · audit
   └──────┬──────┘
          │
      allow / ask / deny
          │
          ▼
Host executes — or does not

Rampart is a security boundary, not a sandbox. It sees actions exposed by the configured integration; it does not see arbitrary syscalls or network traffic inside a process you already allowed. Start with the threat model when deciding where to rely on it.

Install

brew install peg/tap/rampart

rampart protect
rampart verify --all
rampart watch

That is the normal path:

  1. protect detects supported installed agents and configures their managed boundaries.
  2. verify --all runs fixed, non-executing canaries without invoking a model.
  3. watch shows decisions as they happen.
Other installation methods

macOS and Linux installer

curl -fsSL https://rampart.sh/install | bash

Windows PowerShell

irm https://rampart.sh/install.ps1 | iex

Go

go install github.com/peg/rampart/cmd/rampart@latest

Source builds require Go 1.26.8 or newer. Windows upgrades use the PowerShell installer; binary self-upgrade is intentionally disabled there.

Why Rampart

What you get
Policy before executionMatch shell, file, network, MCP, messaging, and other host-exposed actions before they run.
Selective approvalRoutine work stays quiet. Sensitive actions can use the host's native approval UI where the integration supports it.
Fail-closed ownershipWhen Rampart owns a decision and cannot safely classify or persist it, the action does not silently proceed.
Auditable evidenceInspect live decisions, verify installed boundaries, and validate a hash-chained local audit trail.
Local and model-free by defaultThe policy engine is a Go binary. Core enforcement and verification do not require an LLM or provider traffic.

How it works

Rampart architecture

Every integration has a concrete observation boundary. Rampart normalizes the action visible there. When a supported adapter receives multiple represented targets, it evaluates each one and lets the most restrictive decision win.

ALLOW  exec  npm test                         [allow-dev]
DENY   read  ~/.ssh/id_ed25519                [block-credentials]
ASK    exec  kubectl apply -f production.yaml [approve-production]
DENY   resp  tool output contained a secret   [scan-response]

rampart status separates configuration from evidence:

  • HOST VERIFIED means an active safe verifier reached the installed host boundary.
  • ADAPTER VERIFIED means Rampart proved its installed configuration and adapter behavior, not authenticated host ingestion.
  • Experimental and static-only integrations stay labeled as such.

Verification receipts contain outcomes and fingerprints—not prompts, commands, credentials, host output, or agent memory.

Integrations

IntegrationBoundaryCurrent assurance
OpenClawNative before_tool_call pluginLive host verifier; managed fail-closed defaults and native approval cards
Claude CodeNative pre/post tool hooksInstalled configuration and adapter verification
CodexUser-level lifecycle hooks for CLI, IDE, and desktopInstalled configuration and adapter verification
ClineEditor and CLI hook filesPackage startup, hook shape, and adapter tested; host limitations documented
AntigravityShared CLI/IDE PreToolUse pluginInstalled plugin and adapter verification
GitHub CopilotCLI adapter and VS Code Preview hooksPackage/adapter and contract testing; authenticated ingestion pending
CursorLocal Agent and Cmd+K preToolUse hookInstalled fail-closed configuration and adapter verification; Cloud/Tab separate
Hermes AgentExperimental pre_tool_call user pluginCompatible hosts can use native approval; no safe live host verifier yet
Gemini CLIExperimental BeforeTool/AfterTool hooksEnterprise/API-key path; authenticated host proof pending
MCP serversJSON-RPC stdio proxyCorrelated request/response policy and identity enforcement
Other agentsCooperative shell wrapper or compatible process preloadExplicitly limited; prefer a native integration when available
rampart protect openclaw
rampart setup claude-code
rampart setup codex
rampart setup cline
rampart setup antigravity
rampart setup copilot
rampart setup cursor

Experimental integrations are explicit opt-ins and stay outside bare rampart protect auto-detection:

rampart setup hermes
rampart setup gemini

See the support matrix for platform coverage, verifier strength, and known host-owned limitations.

A policy you can read

Rampart policies are YAML, local, and hot-reloaded:

version: "1"
default_action: allow

policies:
  - name: block-credential-reads
    match:
      tool: [read]
    rules:
      - action: deny
        when:
          path_matches:
            - "**/.ssh/id_*"
            - "**/.aws/credentials"
            - "**/.env"
        message: "Credential access blocked"

  - name: approve-production
    match:
      tool: [exec]
    rules:
      - action: ask
        when:
          command_matches:
            - "kubectl apply *"
            - "terraform apply *"
        message: "Production change requires approval"

For common cases, you do not need to edit YAML:

rampart allow "npm install *"
rampart block "curl * | bash"
rampart rules
rampart test "rm -rf /"

Project-specific policy can live with the code:

rampart init --project

That creates .rampart/policy.yaml. Set RAMPART_NO_PROJECT_POLICY=1 when working in a repository whose policy you do not trust.

Policy guide → · Policy schema → · Community policies →

Approvals without prompt fatigue

An ask rule escalates only the action that matched. Depending on the integration, approval appears in the agent's native UI or in Rampart's CLI and dashboard.

rampart pending
rampart approve <id>
rampart deny <id>

OpenClaw can offer allow-once, allow-always, and deny on the original tool call. Compatible Hermes installations pause and resume that same call. Other integrations expose only the approval behavior their host can safely support; Rampart does not invent a second approval owner and call it equivalent.

Watch, verify, and audit

Rampart live decision view
rampart status
rampart doctor
rampart verify --all
rampart audit tail --follow
rampart audit verify

Audit records are hash-chained and redact common credential shapes before normal persistence and display boundaries. They still contain operational metadata and command structure, so treat the owner-only audit directory as sensitive authorization state.

MCP and non-native agents

Proxy a command-launched MCP server:

rampart mcp -- npx @modelcontextprotocol/server-filesystem /path
rampart init --profile mcp-server

For an agent without native hooks:

rampart wrap -- your-agent
rampart preload -- your-agent

wrap is a cooperative $SHELL boundary and cannot intercept absolute shell paths or direct process APIs. preload covers compatible dynamically linked exec/spawn calls on Linux and non-SIP-protected macOS processes; static, setuid, direct-syscall, and SIP-protected paths remain outside that boundary.

MCP proxy → · Any CLI agent → · Threat model →

What changed in 1.8

Rampart 1.8 adds a native local Cursor hook, separates approval of reviewed pending calls from explicit grants for future calls, and binds those grants to the requesting credential and run. It also gives approval state one live service owner and keeps native approvals compatible with Hermes v0.20.2.

Read the changelog for the full release notes.

Documentation

Contributing

Focused fixes, integration compatibility work, documentation improvements, and security hardening are welcome. Start with CONTRIBUTING.md.

Please report suspected vulnerabilities privately through SECURITY.md, not a public issue.

Companion project

Snare adds detective controls with canary credentials and paths. Rampart blocks; Snare catches.

License

Apache 2.0

Files in the repo

Repository payload34 top-level entries
  • .github
  • assurance
  • bench
  • cmd
  • configs
  • docs
  • docs-site
  • examples
  • internal
  • pkg
  • policies
  • preload
  • registry
  • scripts
  • sdks
  • .dockerignore
  • .gitattributes
  • .gitignore
  • .goreleaser.yml
  • CHANGELOG.md
  • CONTRIBUTING.md
  • docker-compose.example.yml
  • Dockerfile
  • docs-requirements.txt
  • go.mod
  • go.sum
  • install.ps1
  • install.sh
  • LICENSE
  • Makefile
  • mkdocs.yml
  • NOTICE
  • README.md
  • SECURITY.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k