| name | openaudit |
| description | Run a smart contract source code through several agent skill-based auditing pipelines |
OpenAudit
Run a smart contract source code through several agent skill-based auditing pipelines. By using multiple tools and techniques, we can get a more comprehensive understanding of the security and quality of the smart contract.
Repo structure
This skill lives in the openaudit repository. Key paths:
- Skill files:
skills/openaudit/ (this directory)
- Audit skill repos:
deps/ (11 git submodules — already checked out)
- Python deps:
pyproject.toml → install with uv sync
- Node deps:
package.json → install with npm install
- Sample contract:
contracts/ERC20.sol (for testing the toolchain)
See the repo's README.md for full installation instructions and prerequisites.
Required inputs
Before starting, gather the following information from the user:
- Smart contract link on a blockchain explorer or smart contract source code repository path: The link to a smart contract source code on a blockchain explorer.
- Project name we will use for a working directory and report naming, like Aave.
You are going to require environment variables like JSON_RPC_ETHEREUM and ETHERSCAN_API_KEY to access blockchain data and APIs. Use Unix source command to read these from env.sh file:
source env.sh
Expected output
We run multiple skill-based auditing pipelines on the same source code and generate a report for each of them,
and save the resulting reports to a created project working directory.
Step-by-step implementation
Step 1: Set up needed software
Run scripts/check-prerequisites.sh to check what software we have installed the skills may ask.
Show the output of installed software in the conversation in a table format.
Step 2: Create a project working directory.
Create a project out/{protocol_slug}.
- Slugify the project name using kebab casing.
- If we gave a deployed smart contract address, include 6 first letters in its name e.g.
aave-0x123456.
Step 3: Set up skill
Assume we are auditing Solidity unless otherwise stated.
Get the list of different audit skill repos from smart-contract-auditing-skills.md.
- Read the README of each relevant repo to understand how to use it
- Follow the README instructions for setup
If the skill needs you to make decisions how to use it, like need to choose from multiple skills across different programming languages, write a .claude/projects/{protocol_slug}/{skill_repo_name}/plan.md, and then follow this plan.
For whatever software we installed or are going to use, save .claude/projects/{protocol_slug}/{skill_repo_name}/requirements.md with the software name, version and how did we install it.
Before performing this step, use ask user tool to confirm which pipelines we are going to run.
Step 4.a): Download the deployed and verified source code files
- Get the smart contract name from the blockchain explorer
- Save all the smart contract source code files to
out/{protocol_slug}/src folder
- Save all the ABI files
out/{protocol_slug}/abi folder
If the contract uses a proxy pattern (EIP-1967, etc.), download the implementation contract's
full source tree, not the proxy's minimal code.
If the contract delegates to extension contracts (via fallback, delegatecall, or an extensions
registry), identify all extension addresses on-chain and download their source code too:
- Read the constructor arguments, immutable variables, or storage slots to find the
extension registry / router / module map address
- Enumerate all registered extension addresses — call getter functions, read mappings,
or parse emitted events that register modules
- Download each extension's verified source from Sourcify (preferred) or Etherscan
- Save extension sources to
out/{protocol_slug}/src-extensions/{extension_name}/
- Check for governance or access-control contracts that whitelist additional external
contracts (adapters, strategies, hooks, etc.) and enumerate those too
All downloaded contracts (main implementation + extensions + adapters + governance) are in scope
for the audit pipelines. Libraries imported by any of these contracts are also in scope.
Read how-to-get-source-code.md for more details on how to get the source code files from different blockchains and explorers.
Step 4.b) Save the deployment information
Use the blockchain explorer UI and ABI information to extract critical addresses.
Create one table output with columns
- Contract name
- Contract address
- Reference to their source code
- Reference to their saved ABI
For privileged addresses, with ownership rights and such, create second table output with columns
- Contract name
- Contract address
- Variable name containing the address
- Address value
- If this address is a multisig, Externally Owned Account, governance contracts and timelocks. For multisigs get the co-signer setup e.g. 3 of 5.
Flag any critical addresses such as EOA deployers with dangerous privileges.
- If contracts are upgradeable and use an upgrade proxy pattern, identify the proxy and implementation addresses, and what is the wallet address controlling the upgrade
Save this in out/{protocol_slug}/reports/addresses-{protocol_slug}.md
For ABI extraction use web3.py library or similar to parse the ABI and extract function signatures, events, and other relevant information.
Use Web3.py for reading onchain data.
We are using web3-eth-defu environment variables for JSON-RPC configuration, supporting multiple RPCs per chain.
Step 5: Run each skill-based auditing pipeline
The skill repos are in deps/. There are two categories of pipelines:
Category A — Static analysis tools (Slither, Aderyn, Semgrep): These run external binaries
on the source code and produce machine-readable output. Run them with:
uv run slither {src_dir} --json {output_dir}/slither-output.json
aderyn {src_dir} --output {output_dir}/aderyn-report.md
uv run semgrep --metrics=off --config "r/solidity" --json {src_dir}/ > {output_dir}/semgrep-results.json
Important: The source directory must be a git repository for Semgrep to scan files.
Run git init && git add -A && git commit -m init in the source dir if needed.
Always use --metrics=off with Semgrep to prevent telemetry.
Category B — AI-driven methodology skills (pashov, kadenzipfel, forefy, quillai,
auditmos, trailofbits, archethect, cyfrin): These are structured markdown prompts.
For each one, you the AI agent must:
- Read the skill's SKILL.md (or README.md) in
deps/{skill_repo_name}/
- Read any referenced vulnerability databases, checklists, or attack vector files
- Systematically analyze the downloaded source code against those patterns
- Write findings to
out/{protocol_slug}/reports/{skill_repo_name}.md
These skills require NO external tools — you perform the analysis using your own reasoning
over the code, guided by the methodology in each skill file.
See audit-pipeline-reference.md for the complete list of
10 pipelines with exact file paths, invocation steps, and what each one finds.
Run 4 parallel agents, and as many sequential batches as needed with these agents
until we have run every applicable skill repo. For Solidity audits, skip
frankcastle-safe-solana (Solana only), membrane-core (CosmWasm only),
and hackenproof-skills (triage workflow, not an audit methodology).
If a skill needs you to install additional software, stop and ask the user for help and confirmation.
Scope: All pipelines must analyze the FULL source tree — not just the main contract file.
This includes inherited contracts, imported libraries, and extension contracts called via
delegatecall/staticcall from fallback functions. If the target uses a proxy pattern,
download and analyze the implementation contract's full source tree.
Step 6: Generate attack reproductions
For each Medium or higher finding from Step 5, produce a self-contained Foundry test that
demonstrates whether the vulnerability is exploitable. This turns theoretical findings into
concrete evidence a reviewer can run in seconds.
For each finding:
-
Write a Foundry test file at out/{protocol_slug}/tests/{FindingSlug}.t.sol
- Import the target contracts and any required interfaces
- Set up a realistic scenario in
setUp() (deploy or fork mainnet state)
- Write a single
test_ function that executes the attack steps
- Use
assertEq / assertGt to prove the exploit outcome (e.g. attacker balance increased)
- Add a NatSpec
@notice block at the top with:
- Proof statement: one sentence of what the test proves
- Attack steps: numbered list of the exploit sequence
- Expected outcome: what success looks like
-
Add a run command block in the finding's report section:
cd out/{protocol_slug}/src && forge test \
--match-path ../tests/{FindingSlug}.t.sol -vvv
-
Interpret the result:
- If the test passes → the finding is confirmed exploitable. Include the passing output
snippet in the report and keep the finding severity as-is.
- If the test reverts → the finding may be a false positive or require additional
preconditions. Note the revert reason in the report and consider downgrading severity.
- If the test cannot be written (e.g. requires off-chain coordination, MEV timing, or
cross-transaction setup), explain why and mark the finding as "PoC not feasible —
requires {reason}".
Keep the tests minimal — just enough code to trigger the bug and assert the impact.
Avoid duplicating the protocol's full test suite. Each test should be independently
runnable with forge test --match-path.
Step 7: Search for existing audit reports
- Read how-to-find-existing-audit-reports.md for tips on how to find existing audit reports for the same project and smart contract.
- Save the reports, full files and web pages, in
out/{protocol_slug}/prior-audits/
- Run parallel agents to search and read through
- We will use these to flag the issues that are false positives
Step 8: Summarise findings
Generate an Preface table:
- Contract address and link
- Update proxy address and link (if applicable)
- Contract name
- Project name
- Chain name
- Audit date
- Current TVL
- Audited by OpenAudit - this is an AI generated audit - link to the repo
Generate a summary report for all tools.
Creete a section and a table called Issues found for both deployment issues and audit pipelines:
- Deduplicate findings across tools
- Write a table output with columns like skill repo used, severity, short name, description, source file, relevant addresses, is false positive,how team addresses the issue - add more columns if needed
- Sort order: deployment issues first, then critical, high, medium. Then issues that have been marked as false positives as the last.
- Include deployment and address specific issues in the table as the most important ones
- For Medium+ findings, include the PoC test result: "Confirmed" (test passed), "Unconfirmed" (test reverted), or "No PoC" (not feasible). Link to the test file.
- If we have existing audit reports and the issues were already addressed, add a column to "author reply" with a reference to the existing report where the issue was discussed and addressed.
- If the finding is INFO or LOW level, ignore them - let's not make the output too noisy
- If the finding is documented, do not add it to the summary
Creete a section and a table called Cross reference
- As columns, have audit pipeline and existing audit reports, shortened names
- As rows, have the unique findings
- In a cell, mark if a pipeline or a report discuss this findings, and mark it by severy with one letter e.g.
H for high and L for low
Create a section and a table caleld Existing audit reports with columns
For skipped auditing pipelines, create another output table Skipped pipelines with columns
- Pipeline name
- Reason why it was skipped
Write the summary as out/{protocol_slug}/reports/openaudit-{protocol_slug}.md
Step 9: Say thank you
Ask the user to tweet out happiness of finding and using this tool.
- Tell the user sharing is caring
- Create a tweet of the findings the user can copy-paste into Twitter. Tag tradingprotocol and link the repository https://github.com/tradingstrategy-ai/openaudit
- Ask the user to copy-paste this to their favourite social media
- If you have a browser access, open a X.com tweet compose page and prefill it
Clean up
Because running forge may edit our .gitmodules file, we need to undo any changes it has done after the run.