Zero-dependency local runtime firewall, DLP secret redactor, and command sanitizer for AI coding agents (Claude Code, Gemini CLI, Cursor, Aider, OpenCode).
AgentGuard is a zero-dependency, local-first runtime firewall and DLP (Data Loss Prevention) shield for AI coding agents. It intercepts command execution requests and stream outputs in real time, redacting API keys (sk-*, ghp_*, AKIA*) and blocking destructive terminal commands (rm -rf /, chmod 777, sudo, curl | bash) before they cause system harm or secret exfiltration.
┌────────────────────────────────────────┐
│ AI Agent Execution Request │
│ (e.g. `agentguard exec "..."`) │
└───────────────────┬────────────────────┘
│
▼
┌────────────────────────────────────────┐
│ Real-Time Policy & DLP Engine │
│ ├─ Dangerous Command Sanitizer │
│ ├─ DLP Secret Masking (.env, Keys) │
│ └─ Path Traversal Shield │
└───────────────────┬────────────────────┘
│
┌──────────────┴──────────────┐
│ │
[Safe Subcommand] [Restricted / Blocked]
│ │
▼ ▼
┌──────────────────────┐ ┌──────────────────────┐
│ Safe Exec & Redact │ │ Block & Record Event │
│ Output Streams │ │ to Audit Log │
└──────────────────────┘ └──────────────────────┘
Try AgentGuard immediately in any repository:
# 1. Initialize AgentGuard policy in your workspace
npx agentguard init
# 2. Scan repository files for embedded hardcoded secrets
npx agentguard scan
# 3. Safely execute terminal commands through AgentGuard inspection
npx agentguard exec "npm test"
# 4. Inspect local append-only security audit logs
npx agentguard audit| Feature | Description |
|---|---|
| Real-Time DLP Masking | Redacts Anthropic keys (sk-ant-*), OpenAI keys (sk-*), GitHub PATs (ghp_*), AWS keys (AKIA*), and JWTs from outputs before log/prompt exposure. |
| Command Firewall | Intercepts and blocks destructive execution commands (rm -rf /, chmod 777, sudo, curl | bash). |
| Path Traversal Shield | Constrains file system read/write resolution strictly within workspace boundaries (process.cwd()). |
| Cryptographic Audit Logger | Records security actions to .agentguard/audit.jsonl for compliance and debugging. |
| 100% Offline & $0 Cost | Operates 100% locally with zero remote network calls, zero telemetry, and zero cost. |
Initializes security policy (.agentguard/policy.json) and audit logger.
npx agentguard initScans local workspace files for hardcoded secrets and credentials.
npx agentguard scanDisplays recent security execution audit logs.
npx agentguard audit [--limit 20]Executes a shell command through AgentGuard DLP and firewall inspection.
npx agentguard exec "npm run build"MIT License © 2026 AgentGuard Contributors