CI/Headless Agents¶
Decide whether an unattended job should deny sensitive actions immediately or wait for an operator. Use explicit deny rules when nobody will review the job. ask is appropriate only when the integration has a reachable approval owner and the job can tolerate its wait and timeout behavior.
Deny instead of asking¶
Keep a base profile such as standard and add the headless overlay from the repository's policies/examples/ directory next to it:
mkdir -p ~/.rampart/policies
curl -fsSL -o ~/.rampart/policies/headless.yaml \
https://raw.githubusercontent.com/peg/rampart/main/policies/examples/headless.yaml
rampart test ~/.rampart/policies/headless.yaml
Every file in the policy directory loads and the most restrictive decision wins, so the overlay's denies replace the base profile's approval prompts for package installation, privileged execution, persistence changes, cloud uploads, and unclassified or dangerous MCP tools. The base profile keeps its own deny rules and receives updates as before. The overlay has no default_action, so it never allows anything the base profile would not.
# Headless Overlay
# For: CI jobs and other unattended agent runs with nobody to approve requests
# Base: none. Install next to a base profile such as standard.
#
# Every policy file in the policy directory loads, and the most restrictive
# decision wins. These deny rules therefore replace the base profile's
# approval prompts for the listed actions, and the base profile keeps its own
# deny rules and updates. There is intentionally no default_action.
#
# Usage: copy to ~/.rampart/policies/headless.yaml
# Validate: rampart test policies/examples/headless.yaml
version: "1"
policies:
- name: headless-no-package-install
description: "Deny package installation in unattended runs"
match:
tool: ["exec"]
rules:
- action: deny
when:
command_matches:
- "pip install **"
- "pip3 install **"
- "python -m pip install **"
- "python3 -m pip install **"
- "npm install **"
- "npm i **"
- "yarn add **"
- "pnpm add **"
- "go get **"
- "go install **"
- "cargo install **"
- "apt install **"
- "apt-get install **"
- "brew install **"
- "winget install **"
- "choco install **"
message: "Package installation is denied in unattended runs"
- name: headless-no-privilege
description: "Deny privileged execution in unattended runs"
match:
tool: ["exec"]
rules:
- action: deny
when:
command_matches:
- "sudo **"
- "doas **"
- "runas **"
- "runas.exe **"
message: "Privileged execution is denied in unattended runs"
- name: headless-no-persistence
description: "Deny persistence changes in unattended runs"
match:
tool: ["exec", "write", "edit"]
rules:
- action: deny
when:
command_matches:
- "crontab **"
- "** | crontab -"
- "systemctl enable **"
- "systemctl --user enable **"
- "launchctl load **"
- "launchctl bootstrap **"
message: "Persistence changes are denied in unattended runs"
- action: deny
when:
path_matches:
- "**/.config/systemd/user/**"
- "**/Library/LaunchAgents/**"
- "**/Library/LaunchDaemons/**"
- "/etc/cron.d/**"
- "/etc/crontab"
message: "Persistence file writes are denied in unattended runs"
- name: headless-no-cloud-upload
description: "Deny cloud storage uploads in unattended runs"
match:
tool: ["exec"]
rules:
- action: deny
when:
command_matches:
- "aws s3 cp ** s3://**"
- "aws s3 sync ** s3://**"
- "gcloud storage cp ** gs://**"
- "gsutil cp ** gs://**"
- "az storage blob upload **"
message: "Cloud uploads are denied in unattended runs"
- name: headless-no-unreviewed-mcp
description: "Deny unclassified and dangerous MCP tools in unattended runs"
match:
tool: ["mcp", "mcp-dangerous"]
rules:
- action: deny
message: "Unclassified or dangerous MCP operations are denied in unattended runs"
tests:
- name: "denies package installation"
tool: exec
params: { command: "npm install left-pad" }
expect: deny
- name: "denies privileged execution"
tool: exec
params: { command: "sudo systemctl restart nginx" }
expect: deny
- name: "denies crontab changes"
tool: exec
params: { command: "crontab -e" }
expect: deny
- name: "denies launch agent writes"
tool: write
params: { path: "/Users/ci/Library/LaunchAgents/job.plist" }
expect: deny
- name: "denies cloud uploads"
tool: exec
params: { command: "aws s3 cp build.tar s3://bucket/build.tar" }
expect: deny
- name: "denies unclassified MCP tools"
tool: mcp
params: {}
expect: deny
The overlay does not convert every ask rule in the base profile or in your custom policies. Review the active policy set and test the commands your job needs, for example rampart test "npm ci".
Configure your actual host with its integration guide and verify that it invokes the installed boundary. The presence of a policy file alone does not protect a process. rampart wrap only covers a cooperative $SHELL path; wrapping a Python process does not intercept arbitrary Python file, network, or subprocess APIs.
External review for a headless job¶
For the Claude hook, ask.headless_only: true selects Rampart's blocking external approval queue instead of the native prompt:
version: "1"
policies:
- name: reviewed-deployment
match:
tool: [exec]
rules:
- action: ask
ask:
headless_only: true
when:
command_matches: ["kubectl apply *"]
message: "Deployment requires operator review"
Run rampart serve and have the operator review the complete request in the dashboard or with rampart pending --details, then use rampart approve <id> or rampart deny <id>. Agent credentials should not have approval authority.
This option does not inspect the TTY or detect CI. The hook requires a reachable service and waits up to five minutes for a result; it does not fall back to a native prompt. An earlier host timeout follows that host's documented failure behavior. Codex, Cursor, and Gemini hooks and standalone rampart mcp already use external approval for ask; with the service running, an MCP ask holds that call and every later message from the client for up to five minutes instead of failing fast. Integrations without a resolver refuse the action. See the approval support table.
Customize without weakening the baseline accidentally¶
Copy a profile to a custom policy and edit only the restrictions you intend to change. Then point the integration at the intended policy set. Adding an ordinary higher-priority allow policy does not override an applicable deny. A project policy can tighten the global policy but cannot loosen a global deny.
rampart policy lint /path/to/ci-custom.yaml
rampart test --config /path/to/ci-custom.yaml "npm ci"
rampart test --config /path/to/ci-custom.yaml "kubectl apply -f k8s/staging/"
Treat these as policy checks. Before using the job unattended, verify an allowed marker reaches the real dispatcher, a denied marker does not, and the installed host behaves as documented when the approval/service path is unavailable. Use the marker walkthrough as a starting point and run failure cases in disposable state.
Audit and retention¶
Native hooks write local audit records; rampart serve is required for the external queue and integrations that delegate evaluation to it. Check the correlated decisions and run rampart audit verify after the job.
Audit logs contain operational metadata even after credential redaction. Export only to access-controlled storage with deliberate retention. Do not upload personal agent state or credentials as CI artifacts.