Solana Program Audit — Agent Orchestration
This skill audits Solana on-chain programs (Rust / Anchor / native solana-program / Pinocchio) with a small team of subagents (see agents/) and, when they are installed separately, orchestrates the Trail of Bits execution skills.
Bundled paths. Every bundled path — scripts, tools, templates, corpus files — is relative to <skill-root>: the directory containing this skill's SKILL.md, never the audited repo, which is usually the working directory. Command and agent text writes that root as <skill-root> for what it runs and what it reads; substitute the absolute path before running or reading anything, and in a file read later, use the absolute root you were given (OUTPUT-RULES.md Rule 11e).
Flow (full audit)
- Pre-scan (optional, deterministic). If
<skill-root>/tools/auditor-tools/is built,audit-scanemits the instruction/constraint/PDA/arithmetic map at ~$0 andaudit-mem warm --program-id <id>loads prior invariants + open false-positive rulings (Rule 11d: from an in-tree.audit-memory/only if the auditor created it andGIT_NO_LAZY_FETCH=1 git --no-pager -c core.fsmonitor=false --icase-pathspecs ls-files -- .audit-memoryprints nothing and exits 0, checked beforemkdir -p .audit-memory && printf '*\n' > .audit-memory/.gitignoreand before everyaudit-memuse; any output, in any letter case, or any error means a fresh store outside the tree, passed as--db <path outside the tree>) — seedingcontext-builderwith a map instead of a blank repo, and lettingvuln-hunterauto-suppress findings that carry a priorFALSE_POSITIVEruling (audit-mem check). Falls back to the grep walk if the toolchain is absent. See references/orchestration/pre-scan.md. context-builder— Phase 0 setup + Phase 0.5 context reconstruction. No verdicts; understanding only. 1b.threat-modeler— from the context worksheets +audit_<n>/intake.md, emitsaudit_<n>/threat-model.md(asset inventory · actor×capability · trust boundaries) that hands the reviewers attacker goals and seeds report §4.4/§4.6/§4.7. When a bootstrap trigger fires (prior audit or incident, fork provenance, prior audits/incidents next to the target), the bundled collector (<skill-root>/scripts/threat-model/collect.sh, never ascripts/path relative to the audited repo) first gathers history and prior reports offline intoaudit_<n>/bootstrap/; the agent stays read-only and cites that evidence per goal. No verdicts.vuln-hunter— item-by-item walk against in-scope checklists + phase-triggered vectors. Every finding with N ≥ 6 must pass the Rule 5b gate. Delegates SAST / harnesses to the Trail of Bits skills when installed (seereferences/orchestration/boundary-map.md).economic-analyst— checklist 06 + economic vectors; drives theeconomic-simplaybook (commands/economic-sim.md, Surfpool mainnet-fork) to quantify profitability for High/Critical economic findings.peer-reviewer— independent reconciliation on top-severity findings (N≥8, contested N≥7): re-derives from the code (reusing the context worksheets), delegates to Trail of Bitsfp-check(local) andsecond-opinionwhen installed —second-opinionsends the selected code to an external LLM CLI (OpenAI Codex or Google Antigravity / Gemini), disclosed in the report perOUTPUT-RULES.mdRule 11b; emits CONFIRM / DISPUTE / DOWNGRADE. (Neodyme independent dual-review.)audit-reporter— deterministic assembly: Scope Coverage, findings, Phase 4.5 maturity scorecard, remediation roadmap →audit_<n>/REPORT.md.
Between review and reconciliation, the triage playbook (commands/triage.md) batch-dedups the candidate set (root-cause + audit-mem suppression/regression), re-applies Rule 5b, and splits real findings from Notes & Nitpicks. On demand for High/Critical findings, poc-engineer + patch-engineer (via the poc / patch playbooks, commands/poc.md / commands/patch.md, or the audit-cycle playbook with --with-poc) emit executable PoCs + verified fix patches (see references/orchestration/poc-harness.md).
Cheap lanes: the quick-scan and diff-audit playbooks (commands/quick-scan.md, commands/diff-audit.md) skip the full item-by-item walk.
Every agent that builds or runs target code — poc-engineer, patch-engineer, Trail of Bits harnesses when installed — uses the execution mode recorded at intake (OUTPUT-RULES.md Rule 11a); any outside service it contacts is listed in the report (Rule 11b).
Full-lifecycle flows: the audit-cycle playbook (commands/audit-cycle.md, fully automated → client report) and the audit-assist playbook (commands/audit-assist.md, human-in-the-loop, iterative); the re-audit playbook (commands/re-audit.md) for fix-review. See references/audit-lifecycle/methodology.md.
Trail of Bits (optional, installed separately)
Trail of Bits provides tool execution this skill cannot do in prose (CodeQL/Semgrep taint, fuzzing, coverage, mutation, IR-level zeroize/constant-time analysis). It is not bundled. If the Trail of Bits skills (https://github.com/trailofbits/skills, CC-BY-SA-4.0) are installed separately, subagents delegate per references/orchestration/boundary-map.md; otherwise they use the native grep checks in discovery/grep-commands.md and note the tooling gap in the report. It is a reference, not a copy — CC-BY-SA stays with Trail of Bits; this skill's own corpus is MIT. Methodology patterns re-implemented natively are credited in ATTRIBUTION.md.