name: cairo-auditor description: Systematic Cairo/Starknet security audit workflow with deterministic preflight, parallel vector specialists, adversarial reasoning, and strict false-positive gating. allowed-tools: [Bash, Read, Glob, Grep, Task]
Cairo Auditor
When to Use
- Security review for Cairo/Starknet contracts before merge.
- Release-gate audits for account/session/upgrade critical paths.
- Triage of suspicious findings from CI, reviewers, or external reports.
When NOT to Use
- Feature implementation tasks.
- Deployment-only ops.
- SDK/tutorial requests.
Rationalizations to Reject
- "Tests passed, so it is secure."
- "This is normal in EVM, so Cairo is the same."
- "It needs admin privileges, so it is not a vulnerability."
- "We can ignore replay or nonce edges for now."
Modes
default: full in-scope scan with four specialist vector passes.deep: default + adversarial exploit-path pass.targeted: explicit file set, same validation gate, faster iteration.
Quick Start
Open workflows/default.md for standard audits, or workflows/deep.md for adversarial mode.
Load agents/vector-scan.md, references/judging.md, and references/README.md.
Select attack-vector partitions from
references/attack-vectors/attack-vectors-1.mdthroughreferences/attack-vectors/attack-vectors-4.md.Run deterministic preflight on target repo:
python scripts/quality/audit_local_repo.py \ --repo-root /path/to/repo \ --scan-id local-auditFormat output using references/report-formatting.md, then validate against
references/vulnerability-db/README.md.
Orchestration (4 Turns)
Turn 1: Discover
- Determine mode (
default,deep,targeted). - Discover in-scope
.cairofiles; exclude tests/mocks/examples/vendor/generated paths. - Run deterministic preflight checks to identify likely classes (upgrade/auth/session/external-call).
Turn 2: Prepare
- Load specialist instructions and references:
- Build four specialist bundles. Each bundle includes:
- full in-scope Cairo code,
- one vector partition:
references/attack-vectors/attack-vectors-1.mdreferences/attack-vectors/attack-vectors-2.mdreferences/attack-vectors/attack-vectors-3.mdreferences/attack-vectors/attack-vectors-4.md
- Record line counts per bundle for parallel chunk-reading instructions.
Turn 3: Spawn
- Spawn 4 parallel vector specialists (one per bundle) following
agents/vector-scan.md. - In
deepmode, spawn agents/adversarial.md in parallel. - Each specialist must:
- triage vectors (
Skip/Borderline/Survive), - apply FP gate from references/judging.md,
- output only findings formatted by references/report-formatting.md.
- triage vectors (
Turn 4: Report
- Merge outputs.
- Deduplicate by root cause (keep higher-confidence variant).
- Run composability pass when multiple findings interact.
- If Scarb/Sierra is available, run Sierra confirmation for CEI and upgrade classes.
- Sort by priority and confidence.
- Emit actionable findings + required regression tests.
Reporting Contract
Each finding must include:
class_idseverityconfidenceentry_pointattack_pathguard_analysisaffected_filesrecommended_fixrequired_tests
Evidence Priority
references/vulnerability-db/references/attack-vectors/../datasets/normalized/findings/../datasets/distilled/vuln-cards/../evals/cases/
Output Rule
- Report only findings that pass FP gate.
- Findings with confidence
<75may be listed as low-confidence notes without a fix block.