A Codex skill for formal Solidity security reviews across mixed-protocol codebases.
This repo is not a standalone scanner. It is a reusable skill package that orchestrates contract discovery, protocol classification, module clustering, specialized child-agent audits, and final finding synthesis.
It is built for audits that are too broad, too compositional, or too cross-domain for a single generic review pass.
If your agent supports skill installation from GitHub, use the shortest path:
Install skill https://github.com/zpano/solidity-audit/
To update later:
update the solidity-audit skill to latest version from https://github.com/zpano/solidity-audit/
Clone and symlink into your local skills directory:
git clone git@github.com:zpano/solidity-audit.git
export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
mkdir -p "$CODEX_HOME/skills"
ln -s /absolute/path/to/solidity-audit \
"$CODEX_HOME/skills/solidity-audit"Or clone and copy:
git clone git@github.com:zpano/solidity-audit.git
export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
mkdir -p "$CODEX_HOME/skills"
cp -R /absolute/path/to/solidity-audit \
"$CODEX_HOME/skills/solidity-audit"Restart Codex after installation so the skill registry reloads.
Use this skill when the target is a non-trivial Solidity codebase and you want a formal or near-formal security review rather than a quick bug triage.
Example prompt:
Use the solidity-audit skill to review ./contracts and ./src.
Discover in-scope contracts, classify them by protocol, cluster modules,
audit high-risk paths, and write the final report under assets/findings/.
If you name specific files or folders, the skill treats those as the primary review scope.
Good fit:
- multi-contract Solidity systems
- codebases mixing DEX, Lending, Staking, Bridge, Governance, Oracle, and Vault behavior
- audits that need both a global findings list and per-module conclusions
- reviews where cross-module interactions matter as much as single-contract logic
Bad fit:
- single-function bug triage
- linting or style review
- gas-only review
- simple one-contract questions
The orchestrator in SKILL.md drives a staged audit flow:
- Discover in-scope Solidity contracts.
- Build a conservative contract dependency and interaction graph.
- Classify each contract into one or more protocol labels.
- Identify complexity-heavy and liveness-critical paths.
- Check active-lifecycle mutability and live dependency reads.
- Cluster the system into coherent modules.
- Build per-contract audit bundles.
- Dispatch specialized child agents.
- Merge results by
root_cause_key. - Render final findings and module conclusions.
The core design choice is narrow, specialized child agents plus a strict orchestrator, instead of a single broad prompt trying to do everything at once.
The classifier currently routes contracts into:
DEXLendingStakingBridgeGovernanceOracleVaultGeneric
Multi-label classification is allowed and expected.
The repository is split into layers so the audit process stays modular, reusable, and explainable.
SKILL.md defines:
- scope rules
- the staged audit workflow
- bundle composition
- agent routing
- the final output contract
references/workflow/ contains process rules:
classification-rubric.mdmodule-clustering.mdcomplexity-feasibility.mdactive-draw-mutability.mdjudging.mdreport-format.mdresearch-triangulation.md
This is the layer that tells the skill how to reason consistently, not just what to read.
references/common/ contains reusable cross-protocol review lenses:
- access control
- custody and callbacks
- external integrations
- math and accounting
- upgradeability
- generic Solidity checks
- vulnerability taxonomy
references/protocols/ contains protocol-specific review guides for:
- DEX
- Lending
- Staking
- Bridge
- Governance
- Oracle
- Vault
- Generic
These references also include high-frequency category cross-checks derived from protocol-specific audit findings.
references/agents/ defines narrow child-agent contracts:
classifier-agentprotocol-auditor-agentgeneric-auditor-agentcross-module-agentcomplexity-auditor-agentmutable-dependency-agentmodule-summarizer-agentaggregator-agent
Each one has a small, specific responsibility. That is deliberate. It keeps classification, finding generation, summarization, and aggregation from bleeding into each other.
scripts/ contains helper utilities used by the orchestrator:
discover-contracts.shbuild-contract-graph.pybuild-audit-bundles.pymerge-findings.py
solidity-audit/
|-- SKILL.md
|-- README.md
|-- references/
| |-- agents/
| |-- common/
| |-- protocols/
| `-- workflow/
|-- scripts/
| |-- discover-contracts.sh
| |-- build-contract-graph.py
| |-- build-audit-bundles.py
| `-- merge-findings.py
`-- assets/
`-- findings/
This skill now absorbs four external sources into local documents instead of relying on those sources at runtime.
Source: github.com/pashov/skills
Absorbed as:
- cleaner public-skill install and update ergonomics in this README
- a more direct “install -> run -> update” user path for public skill repos
Source: github.com/kadenzipfel/smart-contract-vulnerabilities
Absorbed as:
- generic vulnerability classes in vulnerability-taxonomy.md
- stronger cross-protocol grounding for access control, reentrancy, accounting, DoS, data handling, and unsafe logic classes
Source: github.com/kadenzipfel/protocol-vulnerabilities-index
Absorbed as:
- protocol-specific “high-frequency category cross-check” sections inside the local protocol guides
- stronger priority ordering for what must get an explicit pass in Bridge, DEX, Lending, Oracle, Staking, Vault, Governance, and Generic reviews
Source: evmresearch.io/index
Absorbed as:
- exploit-mechanic and edge-case routing in research-triangulation.md
- more explicit handling for hidden callbacks, stale approvals, router calldata abuse, proxy initialization races, compiler footguns, and process-layer failures
The audit loop now triangulates three knowledge layers:
- protocol identity and high-risk entry points
- generic vulnerability taxonomy
- exploit-mechanic and edge-case research
That matters because protocol-specific heuristics alone miss generic bug classes, while generic taxonomies alone miss which classes are most common for a given protocol type.
These scripts are optional building blocks. The main audit logic still
lives in SKILL.md.
./scripts/discover-contracts.sh contracts srcBy default this excludes common noise paths such as lib/, test/,
tests/, mocks/, interfaces/, script/, and broadcast/.
./scripts/discover-contracts.sh contracts src | \
python3 scripts/build-contract-graph.pyThis produces JSON with declared contracts, imports, inheritance, and basic neighbor relationships.
python3 scripts/build-audit-bundles.py \
--tasks-json tasks.json \
--references-root references \
--output-dir bundlesThis renders downstream review bundles for child agents.
python3 scripts/merge-findings.py findings/*.json > merged.jsonThis keeps the highest-confidence version of each root cause and collects module conclusions.
Intermediate child agents return JSON only.
The final merged output contains:
final_findingsmodule_conclusions
Each finding is expected to include:
titleroot_cause_keymodule_idlabelslocationconfidenceseveritybroken_invariantdescriptionfixevidence
If file output is requested, the final rendered report can be written under
assets/findings/.
By default, the skill includes .sol source files and excludes common
noise such as:
lib/test/tests/mocks/interfaces/script/broadcast/*.t.sol*Test*.sol*Mock*.sol
External dependencies are treated as context by default, not as findings scope, unless the user explicitly includes them.
- Codex with local skill loading enabled
bash,find, and standard Unix shell toolspython3for the helper scripts- a runtime that supports multi-agent orchestration for full use
- This repo is an orchestration skill, not a standalone security product.
- It is not designed for linting, style review, or gas-only review.
- It works best when child-agent execution and report synthesis are both available in the runtime.
- Final audit quality still depends on model quality, scope definition, and evidence discipline.