Skip to content

About

Zero-dependency local runtime firewall, DLP secret redactor, and command sanitizer for AI coding agents.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🛡️ AgentGuard

Zero-dependency local runtime firewall, DLP secret redactor, and command sanitizer for AI coding agents (Claude Code, Gemini CLI, Cursor, Aider, OpenCode).

CI Workflows License: MIT Node.js Version


💡 What is AgentGuard?

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         │
                 └──────────────────────┘      └──────────────────────┘

⚡ 1-Minute Quickstart

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

🔍 Key Security Features

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.

💻 CLI Reference

agentguard init

Initializes security policy (.agentguard/policy.json) and audit logger.

npx agentguard init

agentguard scan

Scans local workspace files for hardcoded secrets and credentials.

npx agentguard scan

agentguard audit

Displays recent security execution audit logs.

npx agentguard audit [--limit 20]

agentguard exec <command>

Executes a shell command through AgentGuard DLP and firewall inspection.

npx agentguard exec "npm run build"

📜 License

MIT License © 2026 AgentGuard Contributors

About

Zero-dependency local runtime firewall, DLP secret redactor, and command sanitizer for AI coding agents.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages