Open-source AI agent workflow for auditing Solidity smart contracts Chain-shield released AI Agent Audit, an open-source Rust tool that uses large language models to audit Solidity smart contracts for security vulnerabilities. The tool generates proof-of-concept exploits and professional reports, and has been tested in Code4rena competitions. AI Agent Audit is a Rust command-line tool for AI-assisted security review of Solidity repositories. - discovers security vulnerabilities in Solidity and EVM-based codebases - deduplicates and validates findings - generated runnable PoC for each validated High/Medium finding - create professional audit report for each validated finding in markdown I used this tool to compete in Code4rena competitions and the results were encouraging: https://code4rena.com/@saraswati https://code4rena.com/@saraswati The repository is in public beta. It is meant to accelerate expert review, not replace manual auditing. - Public beta. - Solidity and EVM-focused. - Repository source, docs, and derived context are sent to third-party LLM providers you configure. - The current default audit pipeline uses ChatGPT/Codex OAuth for OpenAI access and runs the active review flow on gpt-5.5 . Deduplication helpers use gpt-5.4 with low reasoning. - Codex is the recommended default path for the current validation workflow and operating model. - Startup performs a one-time ChatGPT sign-in if needed and reuses the cached session on later runs until the token expires. OPENAI API KEY is supported as a secondary fallback for Rust OpenAI calls by setting AI AGENT AUDIT OPENAI BACKEND=api . ANTHROPIC API KEY , GEMINI API KEY / GOOGLE AI API KEY , and DEEPSEEK API KEY are still supported by the agent layer, but they are not required by the default review path.- Discovery-style runs can be switched to Gemini by changing the defaults in src/config.rs /chain-shield/ai-agent-audit/blob/develop/src/config.rs if you want to use Google AI for patterns, actors, and invariants while keeping verification/reporting on OpenAI/Codex. - PoC generation and PoC verification are supported through validation-three-shot , which is the primary validation workflow. - Clones and builds Foundry or Hardhat repositories under ~/Desktop/Audit by default. - Generates audit scope and protocol docs from README/configured entry files into audit-docs/ . - Uses Slither-derived call graph and semantic data when static analysis succeeds. - Builds inheritance and interface-implementation indexes from Solidity source. - Generates contextual codeblocks for each in-scope contract. - Uses pattern libraries, invariant prompts, and actor-oriented context to discover candidate findings. - Verifies and deduplicates findings before producing report output. - Stores local SQLite state in .ai-agent-audit/ . - Smart contract auditors and security researchers. - Protocol teams doing internal review of Solidity codebases. - Engineers experimenting with AI-assisted audit workflows on repos they are allowed to share with external model providers. This project is not a hosted service, not a generic SAST scanner for every language, and not a substitute for human validation. - Rust stable toolchain. Install from rust-lang.org/tools/install https://www.rust-lang.org/tools/install . - Git. Install from git-scm.com/downloads https://git-scm.com/downloads . - Slither. Install from github.com/crytic/slither https://github.com/crytic/slither . - Foundry forge for Foundry repositories. Install from book.getfoundry.sh/getting-started/installation https://book.getfoundry.sh/getting-started/installation . - Node.js 18+ plus npm / npx , Yarn, pnpm, or Bun for JavaScript/Hardhat repositories. Install Node.js from nodejs.org https://nodejs.org/ . Install Bun from bun.sh https://bun.sh/ if the target repo uses bun.lock / bun.lockb . - Optional GITHUB TOKEN for private GitHub repositories. - Clone this repository and enter it. git clone https://github.com/chain-shield/ai-agent-audit.git cd ai-agent-audit - Create a local env file from the template. cp .env.example .env - Edit .env and set the values you actually need: RUST LOG=info AI AGENT AUDIT OPENAI BACKEND=codex Codex is the recommended default for cost. Optional Rust API fallback: AI AGENT AUDIT OPENAI BACKEND=api OPENAI API KEY=your openai api key Optional non-OpenAI provider keys: ANTHROPIC API KEY=... GEMINI API KEY=... DEEPSEEK API KEY=... - The first Codex-backed run will prompt you to sign in with ChatGPT if there is no cached Codex session yet. After that, the session is reused automatically until expiry. If you set AI AGENT AUDIT OPENAI BACKEND=api , Rust OpenAI calls use OPENAI API KEY instead and do not require Codex sign-in. - Copy the example config and point it at a Solidity repository. cp examples/audit-config.example.yaml audit-config.yaml Minimal example: repo: "https://github.com/example/protocol.git" audit type: "Client" code folders: - "src" - Build and run the tool. cargo build --release cargo run --release -- --config audit-config.yaml If you prefer not to use YAML for a simple run: cargo run --release -- https://github.com/example/protocol.git --audit-type Client For repos that keep contracts under contracts/ instead of src/ , set code folders accordingly. The main Rust run produces the initial audit artifacts and, by default, emits a ready-to-run validation-three-shot job. That validation workflow is where deeper filtering, PoC generation, PoC verification, and report hardening happen. If the target repository is private, set GITHUB TOKEN before running the tool. The clone path uses that token for GitHub HTTPS URLs. export GITHUB TOKEN=... --config