AI · SECURITYJUN 2026·12 MIN READ

Building Heimdall: an AI orchestrator for Web3 bug hunting

A single LLM can read a smart contract. It can't audit a protocol. Here's how I'm building an orchestration layer that coordinates eleven specialist agents to find bugs the way a real security team does — in parallel, with receipts.

DL
Daniel Lima
Blockchain · AI · Security

Most "AI auditing" demos work like this: paste a contract into a chat window, ask "are there any vulnerabilities?", and read back a confident list. It's a good party trick. It is not security work. A real audit isn't a single pass over a single file — it's a team of specialists reasoning about state, money, and adversaries across an entire codebase, cross-checking each other, and refusing to stop at the first plausible finding.

Heimdall is my attempt to make an AI system behave that way. It's an orchestration layer for Web3 bug-bounty research, built with security researcher Antonio Avvigiano, the creator of Chimera. Its design draws on the AgentFlow paper and Monad's open-source bug finder: instead of one model doing everything, it coordinates a roster of narrow, specialized agents through parallel analysis, dependency graphs, iterative review cycles, and a synthesis step that turns noise into a ranked list of real leads.

Why one agent isn't enough

LLMs degrade as context grows and as a task asks for many kinds of reasoning at once. Ask a single agent to simultaneously hold reentrancy, access control, oracle assumptions, accounting invariants, and upgradeability risks in its head — across twenty contracts — and it does all of them shallowly. It also anchors: the first vulnerability it imagines colors everything after it.

Human teams don't work like that. They split by threat category, give each reviewer a focused lens, then reconcile. Heimdall copies that structure directly.

Narrow the lens and the model gets sharper. Eleven focused passes beat one omniscient prompt every time.

The specialist roster

Each agent owns one threat model and nothing else. It gets a system prompt tuned to that category, a curated set of example exploits, and the slice of the dependency graph that matters for its job. The current roster:

Access control
Reentrancy
Accounting / settlement
Invariant violations
Oracle assumptions
Token distribution
Bridge assumptions
Upgradeability risk
Role / permission mgmt
Market settlement
Integration / fuzzing

The pipeline

A run moves through four stages. The expensive reasoning happens in parallel; the cheap deterministic work happens around it.

01
Map
Parse the repo into a dependency graph — contracts, inheritance, external calls, privileged roles, and money flows. This is the shared context every agent reads from.
02
Fan out
Dispatch every specialist agent in parallel against the relevant subgraph. Each returns structured candidate findings — location, hypothesis, severity, and a concrete attack path.
03
Verify
Promising candidates get handed to fuzzing and property-based testing — Chimera, Foundry, Echidna, Medusa, Halmos — to confirm exploitability before a human ever sees them.
04
Synthesize
Deduplicate, cluster related findings, rank by impact × confidence, and write reproducible reports a human researcher can act on immediately.

Verification is the whole game

The hardest problem in AI security tooling isn't finding candidate bugs — it's not drowning a researcher in false positives. An LLM will happily report a "reentrancy risk" on a function that's already guarded. So AgentFlow treats every candidate as a hypothesis, not a finding, until a deterministic tool agrees.

That's where the fuzzing stack earns its keep. When an agent claims an invariant can be broken, Heimdall tries to break it for real with property-based tests. Confirmed findings come with a failing test case attached; unconfirmed ones are demoted, not shipped.

finding.json
{
  "agent": "accounting",
  "target": "Vault.withdraw()",
  "hypothesis": "rounding lets last withdrawer drain dust",
  "severity": "medium",
  "status": "CONFIRMED",
  "repro": "test_invariant_totalAssets.t.sol"
}

What's next

The architecture generalizes well beyond smart contracts — the same fan-out-and-synthesize pattern works for backend systems and protocol logic anywhere money and trust boundaries meet. I'm tightening the feedback loop between agents (letting one specialist's finding seed another's search) and expanding the fuzzing harness library so verification covers more of the candidate space automatically.

If you run a protocol, a bug-bounty program, or a security team and this sounds useful — I'd love to compare notes.

Want to talk security AI or blockchain?
djlblockchain@gmail.com · @karacurt_eth
Get in touch →