aegis-protocol
Verify first, pause second. The AI circuit breaker
Created on 20th August 2026
•
aegis-protocol
Verify first, pause second. The AI circuit breaker
The problem aegis-protocol solves
DeFi protocols lose millions because humans can't react fast enough to exploits. When a smart contract is drained at 3 AM, the standard response is: a Forta bot fires a Slack alert, someone eventually wakes up, the multisig holders argue on Telegram, and 20 minutes later the admin finally hits "pause." By then, $8.2M is gone.
The deeper problem: protocols are terrified to automate the pause. A false positive — pausing a live protocol because a whale made a legitimate withdrawal — crashes the token price and triggers a bank run. Current tools give you raw data (anomaly scores, gas spikes) but zero real-world context. They can't answer: "Is this a real exploit or just Binance moving cold wallet funds?"
Aegis Protocol solves this with AI-verified auto-remediation. A multi-agent swarm processes every suspicious transaction through four stages:
Watcher Agent — Detects on-chain anomalies (sudden outflows, reentrancy patterns, internal TX explosions) via Web3.py WebSocket monitoring
OSINT Agent — Scrapes Twitter, Telegram, security forums, and news via Tavily AI in ~300ms to answer: "Is there an active exploit being discussed right now?"
Consensus Engine — Aggregates on-chain signals + OSINT verdict into a single threat score (0–100). Score ≥75 = pause, ≥40 = alert, <40 = no action
Executor Agent — If verified, broadcasts a triggerEmergencyPause() transaction to the protocol's Pausable contract, stopping the bleed in under 3 seconds
What people can use it for:
DeFi protocol teams — Drop-in circuit breaker that protects TVL 24/7 without false positives
Security operations — AI triage layer that filters 99% of false alarms before they reach humans
Incident response — Autonomous first-responder that contains damage while the team investigates
Live demo: 3 scenarios running on the dashboard — a reentrancy attack (auto-paused, $8.2M saved), a Binance cold wallet move (correctly identified as false alarm, no panic), and a suspicious flash loan (escalated to humans with alert-only).
Challenges I ran into
-
Next.js 16 hydration crash with headless Playwright — The dashboard rendered perfectly in the browser but produced blank white screenshots via Playwright. After hours of debugging, I discovered two compounding issues: (a) output: "standalone" in next.config.ts caused malformed JS chunks in production mode, and (b) the LogTerminal component's setInterval-based streaming animation accessed .timestamp on undefined during React 19's concurrent rendering cycles. Fix: removed standalone mode (not needed for Vercel) and replaced the streaming animation with static rendering plus optional chaining (log?.timestamp?.slice?.(11, 23)).
-
Network namespace isolation — Playwright's headless Chromium runs in a separate network namespace and couldn't reach localhost:3456 even though curl could. The workaround: start the Next.js server as a Python subprocess within the same Playwright script, so both share the same network stack. This was critical for capturing the 6 dashboard screenshots programmatically.
-
Consensus scoring calibration — Early versions of the threat scoring engine were too aggressive (pausing on legitimate withdrawals) or too conservative (letting small exploits through). I solved this by decomposing the score into 5 weighted components — base anomaly score (+20), OSINT verdict (+25 for confirmed exploit, +0 for false alarm), AI confidence bonus (up to +15), amount severity bonus (up to +20), and internal transaction risk (up to +20) — with clear thresholds: ≥75 pause, ≥40 alert, ≥20 monitor, <20 no action.
Technologies used