How affaan-m/agentshield works
AgentShield audits AI-agent configuration, chiefly by discovering local configuration, applying security rules, grading findings, and presenting reports. The CLI also exposes remediation, policy and baseline workflows, evidence bundles, monitoring, and optional LLM-assisted analysis; MiniClaw is a separate sandboxed agent service. Edges reflect the supplied excerpts, SOURCE INDEX references, and README. Several documented capabilities have no sampled implementation details, so their internal connections are omitted.
Main entry points: src/index.ts CLI · scanner/index.ts Discovery and Scan · server.ts MiniClaw Server · pipeline.ts Opus Analysis
Components 25
Configuration Scanning
- Discovery and Scan
src/scanner/index.ts - Config Discovery
src/scanner/discovery.ts - Rule Registry
src/rules/index.ts - Security Rules
src/rules - Harness Adapters
src/harness-adapters/index.ts - Skill Health
src/skills/health.ts
Findings and Remediation
- Scoring
src/reporter/score.ts - Report Formats
src/reporter - Auto-fix
src/fixer/index.ts
Audit Governance
- Policy Evaluation
src/policy - Baseline Comparison
src/baseline - Evidence Pack
src/evidence-pack/index.ts
Advanced Analysis
- Supply-chain Analysis
src/supply-chain - Opus Analysis
src/opus/pipeline.ts - LLM Client
src/llm/client.ts - Injection Testing
src/injection
Agent Operations
- Configuration Watch
src/watch - Runtime Monitor
src/runtime - MiniClaw Server
src/miniclaw/server.ts - Prompt Router
src/miniclaw/router.ts - MiniClaw Sandbox
src/miniclaw/sandbox.ts - Safe Tools
src/miniclaw/tools.ts
Other components
- Developer
- CLI
src/index.ts - Anthropic API
Connections 29
- Developer → CLI: runs commands
README.md - CLI → Discovery and Scan: starts scan
src/index.ts - Discovery and Scan → Config Discovery: discovers files
src/scanner/index.ts - Discovery and Scan → Rule Registry: loads rules
src/scanner/index.ts - Rule Registry → Security Rules: registers checks
src/rules/index.ts - Discovery and Scan → Harness Adapters: detects adapters
src/scanner/index.ts - Discovery and Scan → Skill Health: analyzes skills
src/scanner/index.ts - CLI → Scoring: scores findings
src/index.ts - CLI → Report Formats: renders reports
src/index.ts - CLI → Auto-fix: applies fixes
src/index.ts - CLI → Policy Evaluation: evaluates policy
src/index.ts - CLI → Baseline Comparison: compares baseline
src/index.ts - CLI → Evidence Pack: writes bundle
src/index.ts - Evidence Pack → Report Formats: renders artifacts
src/evidence-pack/index.ts - CLI → Supply-chain Analysis: analyzes supply chain
src/index.ts - CLI → Opus Analysis: runs deep analysis
src/index.ts - Opus Analysis → Discovery and Scan: uses scan result
src/opus/pipeline.ts - Opus Analysis → LLM Client: creates client
src/opus/pipeline.ts - LLM Client → Anthropic API: sends requests
src/llm/client.ts - CLI → Injection Testing: runs injection tests
src/index.ts - Injection Testing → LLM Client: uses client
src/injection/index.ts - CLI → Configuration Watch: starts watching
src/index.ts - CLI → Runtime Monitor: installs monitor
src/index.ts - Developer → MiniClaw Server: sends prompts
- MiniClaw Server → MiniClaw Sandbox: creates sandbox
src/miniclaw/server.ts - MiniClaw Server → Prompt Router: routes prompts
src/miniclaw/server.ts - MiniClaw Server → Safe Tools: builds whitelist
src/miniclaw/server.ts - Prompt Router → MiniClaw Sandbox: uses sandbox
src/miniclaw/router.ts - Safe Tools → MiniClaw Sandbox: uses sandbox
src/miniclaw/tools.ts