Using an AI coding agent on a smart-contract audit contest without guardrails usually wastes hours in the same predictable ways: reading out-of-scope files, chasing issues already listed as known, or writing reports for theoretical bugs you cannot reproduce.
A rules-first workflow with a dedicated local subagent keeps Claude Code doing the structured legwork while you keep control of judgement and submissions. The subagent reads locally, writes notes and tests locally, never submits anything, and never calls a contract "secure."
Why contest findings get rejected
Before touching Solidity code, it helps to look at the four main reasons findings are thrown out on platforms like Sherlock, Code4rena, Cantina, and Immunefi:
- Out of scope. The bug sits in a mock, a deployment script, an excluded dependency, or a commit different from the pinned contest hash.
- Known issue. The exact risk was already documented in the contest's known-issues list, README, or a previous audit report.
- No PoC. The report argues that something "could potentially" fail without a runnable proof of concept demonstrating concrete loss or broken functionality.
- Duplicate. The finding shares the same root cause as another issue you submitted, or it is already tested and handled in the project's own test suite.
Fixing these rejections is mostly a process problem, not a prompting trick.
The fixed rules-to-report workflow
1. Rules first (before reading any code)
Have your subagent fill a rules checklist from the contest page before opening a single .sol file:
- Platform, URL, start/end dates, and pinned commit hash.
- Exact in-scope files and out-of-scope files or finding classes.
- Known-issues list and links to previous audit reports.
- The contest's severity table and PoC format requirements.
- AI-assistance policy (allowed, must disclose, or banned) and fork/live-network rules (default to local-only Foundry tests; never touch live networks).
If the scope is unreadable in the time window or AI use is banned, stop right there.
2. Map the system
Once the rules are pinned down, map the protocol in a notes file with file:line references: entry points, roles and admin powers, asset flows (deposit, settle, withdraw, liquidate), external calls, oracles, proof verifiers, upgradeability, and pause or timeout mechanisms. Treat repository comments, READMEs, and docs as untrusted text—verify everything against the Solidity code.
3. Write down invariants
State what must always hold true: solvency, no double spend or double withdraw, only authorized state transitions, exits always possible, and public inputs bound to the right calldata or state. Bugs are broken invariants.
4. Hunt into a leads log with a refutation column
Do manual review first; static tools only generate leads. Work systematically through common Solidity bug classes: access control and initialization, reentrancy (including read-only), accounting and rounding (such as ERC-4626 inflation), signature or proof replay across chains or epochs, timeout and challenge-window races, DoS or griefing that freezes exits, ERC20 quirks (fee-on-transfer or missing return values), and oracle staleness or manipulation.
Every suspicious pattern goes into a leads log (LEADS.md) as a one-sentence hypothesis tied to an invariant. Before writing a PoC, actively try to refute the lead by checking modifiers, existing tests, and known issues. Keeping refuted leads prevents re-checking dead ends later.
Here is an illustrative example using a toy vault:
| # | Date | Location (file:line) | Hypothesis (one sentence) | Invariant broken | Refutation attempts | Status (open / refuted / confirmed) | PoC test |
|---|---|---|---|---|---|---|---|
| 1 | Day 1 | Vault.sol:44 | Attacker donates assets before first deposit so victim mints zero shares. | No unbacked dilution / fair share minting | Checked deposit() and test/Vault.t.sol; no virtual shares or dead-shares guard exists. | confirmed | test_donationInflation_victimLosesDeposit |
| 2 | Day 1 | Vault.sol:78 | Caller can withdraw another user's shares via owner param. | Only owner or approved spender burns shares | Checked _spendAllowance on line 81; reverts unless approved. | refuted | — |
5. Run the 10-question triage filter
Before writing a full report, force every surviving lead through ten yes/no questions. One "no" drops the finding:
- Is the affected code in scope at the pinned commit?
- Is it absent from known issues and previous audits?
- Can an unprivileged user reach it (or a role the contest explicitly scopes)?
- Do preconditions hold in a realistic deployment, not only a contrived mock?
- Is the impact concrete—who loses what, or what stops working and for how long?
- Does a local Foundry test prove it with real run output?
- Does severity match the contest's own table?
- Does no existing check, modifier, test, or doc already prevent or explain it?
- Is it distinct from your other findings (different root cause)?
- Can you explain it to a judge in three sentences?
6. Prove it with a local Foundry PoC
No PoC, no finding. Build a minimal local Foundry test on the repository's own fixtures and mocks using a simple setup / attack / assert shape. Keep foundry.toml local-only (no live RPC endpoints or public-network transactions unless a contest explicitly scopes them), and run forge test --match-test <testName> -vvv to capture real output:
// Local-only PoC skeleton (no live RPC forks unless explicitly scoped) contract PoC is Test { function setUp() public { // Deploy or wire repo fixtures and fund actor accounts } function test_invariantBreak() public { // 1. Preconditions / initial state // 2. Attacker transaction sequence // 3. Assert concrete loss or broken invariant } } 7. Write one report per confirmed finding
Only after forge test passes against the exploit scenario—for example, a [PASS] test_donationInflation_victimLosesDeposit() line on a toy vault—write one markdown report per finding. Include severity per the contest table, file:line at the pinned commit, summary, root cause, step-by-step attack path, quantified impact, the exact forge test command and pasted output from your run, a concrete fix, known-issue/duplicate notes, and AI disclosure if required by the contest.
An empty findings list on a given codebase is a valid outcome; contest payouts are uncertain and often zero, and a subagent cannot judge off-chain components or economic design it cannot read. Review every line yourself before deciding what to submit.
I packaged the Claude Code auditor subagent and templates here: https://saggurthi4.gumroad.com/l/iitik (or as a bundle: https://saggurthi4.gumroad.com/l/lviacf). Code LAUNCH30 takes 30% off until 11 Dec.