Capafy
Get started
AI Code Guard Agents

AI Code Guard Agents

1 Single Node.js Command • Zero Python • Zero GPU • Zero Cloud • Runs in ~19ms AI Code Guard Agents (sovereign-moe-swarm v1.2) deploys a local Mixture-of-Experts (MoE) swarm of 5 independent micro-agent brains directly inside your repository. Every brain starts from scratch as a deterministic, Git-syncable JSON file and continuously learns from your codebase through Bidirectional Q-Learning — without ever sending a single line of code to external cloud APIs. #Productivity #Engineering #Education

Rating
More ratings needed
Sold
0
How to use
Download

🧠 AI Code Guard Agents — 5 Self-Learning Local AI Security Brains

1 Single Node.js Command • Zero Python • Zero GPU • Zero Cloud • Runs in ~19ms

AI Code Guard Agents (sovereign-moe-swarm v1.2) deploys a local Mixture-of-Experts (MoE) swarm of 5 independent micro-agent brains directly inside your repository. Every brain starts from scratch as a deterministic, Git-syncable JSON file and continuously learns from your codebase through Bidirectional Q-Learning — without ever sending a single line of code to external cloud APIs.


⚡ Why Engineering Teams Use It

  • 5 Independent Specialist Brains (brains/*.json):

    1. 💰 FinanceExpert — Blocks client-side price tampering, checkout arithmetic underflow/overflow, Stripe/PayPal webhook forgery, and Conservation Law (Σ = 0) violations.
    2. 🗄️ SqlDataExpert — Catches SQL/GraphQL injection, permissive Supabase RLS (USING (true)), and mutable financial ledger operations (UPDATE/DELETE).
    3. 🔐 AuthApiExpert — Detects IDOR privilege escalation, unverified jwt.decode(), hardcoded secrets, and unprotected FastAPI/Express body fields.
    4. 🧬 AstQualityExpert — Spots AST Trojans, hidden assignments in conditionals, infinite loops, high-entropy obfuscated payloads, and dependency typosquatting.
    5. ⛓️ EpisodicMemoryExpert — Seals every audit episode in an immutable SHA-256 hash chain to automatically flag REGRESSIONS whenever a previously fixed bug returns.
  • ⚖️ Real Bidirectional Q-Learning (+1.0 Reward & -1.0 False-Positive Penalty):

    • Confirmed vulnerabilities and regressions strengthen synaptic weights up to 0.9990.
    • Run --false-positive <RULE_ID> to apply a real -1.0 Bellman penalty (0.5000 -> 0.1887) that auto-mutes noisy rules for your project (Q < 0.25).
  • 🪝 Automatic Immune System (--install-hook):

    • Installs a .git/hooks/pre-commit guard that audits staged changes in ~19ms before vulnerable code or regressions can enter Git.
  • 🔄 Team Brain Sync via Deterministic JSON:

    • All 5 brains/*.json files are saved with deterministically sorted keys for clean Git diffs — when Developer A trains the swarm on a bug today, Developer B runs git pull tomorrow and inherits the immunity.
  • 📊 Offline 1-File Executive Dashboard (--report):

    • Generates swarm-report.html (zero external dependencies) with synaptic evolution bars per brain, detected regressions, and the latest SHA-256 episode seal.

🚀 Quick Start (1 Command)

# 1. Run the 5-agent swarm and generate the offline visual HTML dashboard
node .agents/skills/sovereign-moe-swarm/scripts/treinar-enxame-moe.cjs ./src --report

# 2. Install the automatic 19ms Git pre-commit hook
node .agents/skills/sovereign-moe-swarm/scripts/treinar-enxame-moe.cjs --install-hook

# 3. Teach the swarm a project-specific false positive (applies -1.0 Q-Learning penalty)
node .agents/skills/sovereign-moe-swarm/scripts/treinar-enxame-moe.cjs --false-positive AST-03-DEPENDENCY-TYPOSQUATTING

# 4. Structured JSON or GitHub SARIF output for IDE agents & CI/CD
node .agents/skills/sovereign-moe-swarm/scripts/treinar-enxame-moe.cjs ./src --format=sarif

📋 Example Output

================================================================================
⚖️ BIDIRECTIONAL Q-LEARNING — FALSE POSITIVE PENALTY (-1.0) APPLIED
================================================================================
🧠 Brain:   🧬 AstQualityExpert (brain-ast-quality.json)
🎯 Rule:    AST-03-DEPENDENCY-TYPOSQUATTING
📉 Q(s,a):  0.5000 -> 0.1887 [Reward R = -1.0]
🔇 Status:  AUTO-MUTED IN PROJECT (Q < 0.25)
================================================================================

🔒 Privacy & Compatibility

  • 100% Local Execution: Zero telemetry, zero external network calls, zero API keys required.
  • Requirements: Node.js 18+ only. Works with TypeScript, JavaScript, Next.js, Node.js, Python (FastAPI/Django), and PostgreSQL/Supabase SQL.