solidity-argus 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/AGENTS.md +3 -3
  2. package/README.md +93 -37
  3. package/package.json +33 -7
  4. package/skills/INVENTORY.md +88 -57
  5. package/skills/README.md +26 -23
  6. package/skills/case-studies/beanstalk-governance/SKILL.md +52 -0
  7. package/skills/case-studies/bzx-flash-loan/SKILL.md +53 -0
  8. package/skills/case-studies/cream-finance/SKILL.md +52 -0
  9. package/skills/case-studies/curve-reentrancy/SKILL.md +52 -0
  10. package/skills/case-studies/dao-hack/SKILL.md +51 -0
  11. package/skills/case-studies/euler-finance/SKILL.md +52 -0
  12. package/skills/case-studies/harvest-finance/SKILL.md +52 -0
  13. package/skills/case-studies/level-finance/SKILL.md +51 -0
  14. package/skills/case-studies/mango-markets/SKILL.md +53 -0
  15. package/skills/case-studies/nomad-bridge/SKILL.md +51 -0
  16. package/skills/case-studies/parity-multisig/SKILL.md +55 -0
  17. package/skills/case-studies/poly-network/SKILL.md +51 -0
  18. package/skills/case-studies/rari-fuse/SKILL.md +51 -0
  19. package/skills/case-studies/ronin-bridge/SKILL.md +52 -0
  20. package/skills/case-studies/wormhole-bridge/SKILL.md +51 -0
  21. package/skills/manifests/smartbugs.json +1 -3
  22. package/skills/manifests/sunweb3sec.json +1 -3
  23. package/skills/vulnerability-patterns/access-control/SKILL.md +14 -0
  24. package/skills/vulnerability-patterns/arbitrary-storage-location/SKILL.md +13 -1
  25. package/skills/vulnerability-patterns/assert-violation/SKILL.md +8 -1
  26. package/skills/vulnerability-patterns/asserting-contract-from-code-size/SKILL.md +12 -1
  27. package/skills/vulnerability-patterns/authorization-txorigin/SKILL.md +2 -1
  28. package/skills/vulnerability-patterns/cross-chain-bridge-vulnerabilities/SKILL.md +217 -0
  29. package/skills/vulnerability-patterns/default-visibility/SKILL.md +13 -1
  30. package/skills/vulnerability-patterns/delegatecall-untrusted-callee/SKILL.md +2 -1
  31. package/skills/vulnerability-patterns/dos-gas-limit/SKILL.md +8 -1
  32. package/skills/vulnerability-patterns/dos-revert/SKILL.md +1 -0
  33. package/skills/vulnerability-patterns/erc4626-exchange-rate-manipulation/SKILL.md +64 -0
  34. package/skills/vulnerability-patterns/fee-on-transfer-tokens/SKILL.md +93 -0
  35. package/skills/vulnerability-patterns/flash-loan-attacks/SKILL.md +1 -0
  36. package/skills/vulnerability-patterns/floating-pragma/SKILL.md +8 -1
  37. package/skills/vulnerability-patterns/front-running-attacks/SKILL.md +209 -0
  38. package/skills/vulnerability-patterns/gas-optimization-patterns/SKILL.md +203 -0
  39. package/skills/vulnerability-patterns/governance-attacks/SKILL.md +208 -0
  40. package/skills/vulnerability-patterns/hash-collision/SKILL.md +8 -1
  41. package/skills/vulnerability-patterns/inadherence-to-standards/SKILL.md +12 -1
  42. package/skills/vulnerability-patterns/incorrect-constructor/SKILL.md +8 -1
  43. package/skills/vulnerability-patterns/incorrect-inheritance-order/SKILL.md +8 -1
  44. package/skills/vulnerability-patterns/insufficient-gas-griefing/SKILL.md +12 -1
  45. package/skills/vulnerability-patterns/lack-of-precision/SKILL.md +7 -1
  46. package/skills/vulnerability-patterns/logic-errors/SKILL.md +10 -0
  47. package/skills/vulnerability-patterns/missing-parameter-bounds/SKILL.md +44 -0
  48. package/skills/vulnerability-patterns/missing-protection-signature-replay/SKILL.md +17 -1
  49. package/skills/vulnerability-patterns/msgvalue-loop/SKILL.md +12 -1
  50. package/skills/vulnerability-patterns/off-by-one/SKILL.md +7 -1
  51. package/skills/vulnerability-patterns/oracle-manipulation/SKILL.md +9 -0
  52. package/skills/vulnerability-patterns/outdated-compiler-version/SKILL.md +8 -1
  53. package/skills/vulnerability-patterns/overflow-underflow/SKILL.md +1 -0
  54. package/skills/vulnerability-patterns/proxy-vulnerabilities/SKILL.md +209 -0
  55. package/skills/vulnerability-patterns/reentrancy/SKILL.md +9 -0
  56. package/skills/vulnerability-patterns/shadowing-state-variables/SKILL.md +8 -1
  57. package/skills/vulnerability-patterns/share-accounting-desynchronization/SKILL.md +44 -0
  58. package/skills/vulnerability-patterns/signature-malleability/SKILL.md +2 -1
  59. package/skills/vulnerability-patterns/stateful-parameter-update-drift/SKILL.md +44 -0
  60. package/skills/vulnerability-patterns/unbounded-return-data/SKILL.md +12 -1
  61. package/skills/vulnerability-patterns/unchecked-return-values/SKILL.md +2 -1
  62. package/skills/vulnerability-patterns/unencrypted-private-data-on-chain/SKILL.md +8 -1
  63. package/skills/vulnerability-patterns/unexpected-ecrecover-null-address/SKILL.md +8 -1
  64. package/skills/vulnerability-patterns/uninitialized-storage-pointer/SKILL.md +8 -1
  65. package/skills/vulnerability-patterns/unsafe-erc20-transfers/SKILL.md +132 -0
  66. package/skills/vulnerability-patterns/unsafe-low-level-call/SKILL.md +12 -1
  67. package/skills/vulnerability-patterns/unsecure-signatures/SKILL.md +12 -1
  68. package/skills/vulnerability-patterns/unsupported-opcodes/SKILL.md +11 -1
  69. package/skills/vulnerability-patterns/unused-variables/SKILL.md +8 -1
  70. package/skills/vulnerability-patterns/use-of-deprecated-functions/SKILL.md +8 -1
  71. package/skills/vulnerability-patterns/weak-sources-randomness/SKILL.md +8 -1
  72. package/skills/vulnerability-patterns/weird-tokens/SKILL.md +10 -0
  73. package/skills/vulnerability-patterns/zero-address-misconfiguration/SKILL.md +48 -0
  74. package/src/agents/argus-prompt.ts +24 -7
  75. package/src/agents/pythia-prompt.ts +3 -4
  76. package/src/agents/scribe-prompt.ts +7 -2
  77. package/src/agents/sentinel-prompt.ts +32 -3
  78. package/src/cli/cli-program.ts +29 -26
  79. package/src/cli/commands/check-skills.ts +135 -0
  80. package/src/cli/commands/doctor.ts +48 -26
  81. package/src/cli/commands/init.ts +5 -3
  82. package/src/cli/commands/install.ts +7 -5
  83. package/src/cli/commands/lint-skills.ts +16 -12
  84. package/src/cli/index.ts +5 -5
  85. package/src/cli/types.ts +3 -3
  86. package/src/config/index.ts +1 -1
  87. package/src/config/loader.ts +4 -6
  88. package/src/config/schema.ts +4 -5
  89. package/src/config/types.ts +2 -2
  90. package/src/constants/defaults.ts +2 -0
  91. package/src/create-hooks.ts +145 -34
  92. package/src/create-managers.ts +10 -8
  93. package/src/create-tools.ts +13 -9
  94. package/src/features/background-agent/background-manager.ts +93 -87
  95. package/src/features/background-agent/index.ts +1 -1
  96. package/src/features/context-monitor/context-monitor.ts +3 -3
  97. package/src/features/context-monitor/index.ts +2 -2
  98. package/src/features/error-recovery/session-recovery.ts +2 -4
  99. package/src/features/error-recovery/tool-error-recovery.ts +12 -7
  100. package/src/features/index.ts +5 -5
  101. package/src/features/persistent-state/audit-state-manager.ts +143 -60
  102. package/src/features/persistent-state/global-run-index.ts +38 -0
  103. package/src/features/persistent-state/index.ts +1 -1
  104. package/src/features/persistent-state/run-journal.ts +86 -0
  105. package/src/hooks/config-handler.ts +28 -11
  106. package/src/hooks/context-budget.ts +2 -5
  107. package/src/hooks/event-hook.ts +47 -23
  108. package/src/hooks/hook-system.ts +4 -4
  109. package/src/hooks/index.ts +5 -5
  110. package/src/hooks/knowledge-sync-hook.ts +18 -21
  111. package/src/hooks/recon-context-builder.ts +2 -2
  112. package/src/hooks/safe-create-hook.ts +6 -7
  113. package/src/hooks/tool-tracking-hook.ts +104 -50
  114. package/src/hooks/types.ts +2 -1
  115. package/src/index.ts +23 -36
  116. package/src/knowledge/retry.ts +22 -22
  117. package/src/knowledge/scvd-client.ts +88 -95
  118. package/src/knowledge/scvd-errors.ts +35 -35
  119. package/src/knowledge/scvd-index.ts +78 -80
  120. package/src/knowledge/scvd-sync.ts +106 -101
  121. package/src/managers/index.ts +1 -1
  122. package/src/managers/types.ts +19 -14
  123. package/src/plugin-interface.ts +7 -9
  124. package/src/shared/binary-utils.ts +44 -35
  125. package/src/shared/deep-merge.ts +55 -36
  126. package/src/shared/file-utils.ts +21 -19
  127. package/src/shared/index.ts +11 -5
  128. package/src/shared/jsonc-parser.ts +123 -28
  129. package/src/shared/logger.ts +16 -3
  130. package/src/shared/project-utils.ts +30 -0
  131. package/src/skills/analysis/cluster.ts +414 -0
  132. package/src/skills/analysis/gates.ts +227 -0
  133. package/src/skills/analysis/index.ts +33 -0
  134. package/src/skills/analysis/normalize.ts +217 -0
  135. package/src/skills/analysis/similarity.ts +224 -0
  136. package/src/skills/argus-skill-resolver.ts +17 -6
  137. package/src/skills/skill-schema.ts +11 -10
  138. package/src/solodit-lifecycle.ts +202 -0
  139. package/src/state/audit-state.ts +8 -8
  140. package/src/state/finding-store.ts +68 -55
  141. package/src/state/types.ts +88 -67
  142. package/src/tools/argus-skill-load-tool.ts +12 -7
  143. package/src/tools/contract-analyzer-tool.ts +60 -77
  144. package/src/tools/forge-coverage-tool.ts +226 -0
  145. package/src/tools/forge-fuzz-tool.ts +127 -127
  146. package/src/tools/forge-test-tool.ts +153 -157
  147. package/src/tools/gas-analysis-tool.ts +264 -0
  148. package/src/tools/pattern-checker-tool.ts +185 -190
  149. package/src/tools/pattern-loader.ts +5 -111
  150. package/src/tools/proxy-detection-tool.ts +224 -0
  151. package/src/tools/report-generator-tool.ts +268 -200
  152. package/src/tools/slither-tool.ts +266 -218
  153. package/src/tools/solodit-search-tool.ts +216 -119
  154. package/src/tools/sync-knowledge-tool.ts +7 -11
  155. package/src/utils/audit-artifact-detector.ts +28 -29
  156. package/src/utils/dependency-scanner.ts +37 -37
  157. package/src/utils/project-detector.ts +111 -124
  158. package/src/utils/solidity-parser.ts +103 -74
  159. package/skills/patterns/access-control.yaml +0 -31
  160. package/skills/patterns/erc4626.yaml +0 -29
  161. package/skills/patterns/flash-loan.yaml +0 -20
  162. package/skills/patterns/oracle.yaml +0 -30
  163. package/skills/patterns/proxy.yaml +0 -30
  164. package/skills/patterns/reentrancy.yaml +0 -30
  165. package/skills/patterns/signature.yaml +0 -31
  166. package/src/hooks/event-hook-v2.ts +0 -99
  167. package/src/state/plugin-state.ts +0 -14
package/AGENTS.md CHANGED
@@ -13,19 +13,19 @@ CLI: `argus doctor`, `argus init`, `argus install`.
13
13
  **Role**: Primary security audit orchestrator
14
14
  **Description**: Argus Panoptes, the All-Seeing Guardian. Coordinates full Solidity security audits by dispatching Sentinel (analysis), Pythia (research), and Scribe (reporting). Follows a rigorous 7-step methodology: Reconnaissance, Automated Scanning, Manual Review, Attack Surface Mapping, Vulnerability Research, Testing & Verification, and Reporting.
15
15
  **Model**: anthropic/claude-opus-4-6
16
- **Tools**: All 8 argus_* tools (argus_slither_analyze, argus_analyze_contract, argus_check_patterns, argus_solodit_search, argus_forge_test, argus_forge_fuzz, argus_generate_report, argus_sync_knowledge)
16
+ **Tools**: All 12 argus_* tools (argus_slither_analyze, argus_analyze_contract, argus_check_patterns, argus_proxy_detection, argus_solodit_search, argus_forge_test, argus_gas_analysis, argus_forge_fuzz, argus_forge_coverage, argus_skill_load, argus_generate_report, argus_sync_knowledge)
17
17
 
18
18
  ## sentinel
19
19
 
20
20
  **Role**: Static analysis and testing specialist
21
21
  **Description**: Finds vulnerabilities through Slither static analysis, Foundry testing, fuzzing, and pattern matching. The tactical executor — runs tools, writes PoC tests, and verifies findings. Dispatched by Argus during Automated Scanning and Testing & Verification phases.
22
22
  **Model**: anthropic/claude-sonnet-4-6
23
- **Tools**: argus_slither_analyze, argus_forge_test, argus_forge_fuzz, argus_analyze_contract, argus_check_patterns, skill
23
+ **Tools**: argus_slither_analyze, argus_forge_test, argus_gas_analysis, argus_forge_fuzz, argus_forge_coverage, argus_analyze_contract, argus_check_patterns, argus_proxy_detection, skill
24
24
 
25
25
  ## pythia
26
26
 
27
27
  **Role**: Vulnerability researcher
28
- **Description**: Consults Solodit, SCVD, and the knowledge base to find historical precedents and known attack vectors. Searches 7,769+ real-world audit findings and 55 curated vulnerability pattern files. Dispatched by Argus during Vulnerability Research phase.
28
+ **Description**: Consults Solodit, SCVD, and the knowledge base to find historical precedents and known attack vectors. Searches 7,769+ real-world audit findings and 44 curated vulnerability pattern files. Dispatched by Argus during Vulnerability Research phase.
29
29
  **Model**: anthropic/claude-sonnet-4-6
30
30
  **Tools**: argus_solodit_search, argus_check_patterns, skill
31
31
 
package/README.md CHANGED
@@ -15,12 +15,12 @@ Argus Panoptes — the mythological all-seeing giant — orchestrates a team of
15
15
  **What it does:**
16
16
  - Runs Slither static analysis and Foundry tests automatically
17
17
  - Searches 7,769+ real-world audit findings via SCVD and Solodit
18
- - Matches code against 55 curated vulnerability pattern files
18
+ - Matches code against 82 curated SKILL.md knowledge files
19
19
  - Generates professional markdown audit reports with severity classifications
20
20
  - Follows a rigorous 7-step audit methodology (Reconnaissance → Report)
21
21
 
22
22
  **Why it's useful:**
23
- - Catches reentrancy, oracle manipulation, access control flaws, flash loan vectors, and 35+ other vulnerability classes
23
+ - Catches reentrancy, oracle manipulation, access control flaws, flash loan vectors, and 50+ vulnerability classes across 14 pattern categories
24
24
  - Integrates seamlessly into OpenCode's agent system — no separate tooling setup required
25
25
  - Knowledge base sourced from Trail of Bits, Cyfrin, DeFiFoFum, and the broader security community
26
26
 
@@ -88,10 +88,13 @@ Transforms raw findings into professional, structured markdown audit reports wit
88
88
  |------|-------|-------------|
89
89
  | `argus_slither_analyze` | Sentinel | Runs Slither static analysis on Solidity contracts; detects reentrancy, uninitialized variables, unchecked returns, and more |
90
90
  | `argus_analyze_contract` | Sentinel | Generates a deep structural profile of a contract: functions, state variables, modifiers, inheritance tree |
91
- | `argus_check_patterns` | Sentinel, Pythia | Scans code against a library of complex vulnerability patterns (regex/AST-based) covering 35+ vulnerability classes |
91
+ | `argus_check_patterns` | Sentinel, Pythia | Scans code against a library of complex vulnerability patterns (regex/AST-based) covering 50+ vulnerability classes across 14 pattern categories |
92
+ | `argus_proxy_detection` | Sentinel | Detects proxy patterns in Solidity contracts (ERC1967, UUPS, transparent, beacon, diamond) with confidence scoring |
92
93
  | `argus_solodit_search` | Pythia | Searches Solodit's database of real-world audit reports for similar protocols and historical findings |
93
94
  | `argus_forge_test` | Sentinel | Runs existing or newly written Foundry/Forge tests; essential for PoC verification |
95
+ | `argus_gas_analysis` | Sentinel | Runs forge gas report analysis, parses per-function gas metrics, and identifies high-gas hotspots above configurable threshold |
94
96
  | `argus_forge_fuzz` | Sentinel | Fuzzes specific functions with random inputs to find edge cases and invariant violations |
97
+ | `argus_forge_coverage` | Sentinel | Runs forge coverage analysis and returns structured per-file coverage metrics (lines, statements, branches, functions) |
95
98
  | `argus_generate_report` | Scribe | Generates the final structured audit report in professional markdown format |
96
99
  | `argus_sync_knowledge` | Argus | Syncs the local vulnerability database from SCVD (api.scvd.dev) |
97
100
 
@@ -99,49 +102,103 @@ Transforms raw findings into professional, structured markdown audit reports wit
99
102
 
100
103
  ## Knowledge Base
101
104
 
102
- The plugin ships with **55 curated SKILL.md files** organized into 5 categories:
105
+ The plugin ships with **82 curated SKILL.md files** organized into 6 categories:
103
106
 
104
107
  | Category | Files | Description |
105
108
  |----------|-------|-------------|
106
- | Vulnerability Patterns | 38 | Reentrancy, oracle manipulation, flash loans, access control, overflow/underflow, and 33 more |
109
+ | Vulnerability Patterns | 51 | Reentrancy, oracle manipulation, flash loans, access control, ERC4626, governance, front-running, and 44 more |
107
110
  | Methodology | 3 | Audit workflow, report templates, severity classification |
108
111
  | Protocol Patterns | 5 | AMM/DEX, bridges, governance, lending, staking security guides |
109
112
  | Checklists | 6 | Cyfrin audit checklists (DeFi core, integrations, upgrades, gas, best practices) |
110
113
  | References | 2 | DeFi exploit reference index, SmartBugs vulnerable contract examples |
114
+ | Case Studies | 15 | Major DeFi exploit analyses (Euler, Nomad Bridge, Ronin, Cream Finance, etc.) |
111
115
 
112
- **Sources:** Trail of Bits, Cyfrin, DeFiFoFum, kadenzipfel, SunWeb3Sec, smartbugs
116
+ **Sources:** Trail of Bits, Cyfrin, DeFiFoFum, kadenzipfel, SunWeb3Sec, smartbugs, BailSec, Argus
113
117
 
114
- ### Pattern Packs
118
+ ### Detection Rules
115
119
 
116
- Pattern packs are YAML files containing collections of regular expression patterns used for vulnerability detection. These packs allow Argus to scan code for known security flaws without requiring full static analysis tools.
120
+ Vulnerability detection patterns are defined as `detection_rules` in SKILL.md frontmatter. Each skill with a `pattern_category` field is automatically discovered by the pattern checker no separate configuration needed.
117
121
 
118
- - **Location:** `skills/patterns/`
119
- - **Available Packs:**
120
- - `access-control.yaml` — Ownership and permission checks
121
- - `erc4626.yaml` — Vault standard security patterns
122
- - `flash-loan.yaml` — Flash loan attack vectors
123
- - `oracle.yaml` — Price manipulation and staleness checks
124
- - `proxy.yaml` — Upgradeability and initialization flaws
125
- - `reentrancy.yaml` — State change and external call ordering
126
- - `signature.yaml` — Malleability and replay protection
122
+ - **51 vulnerability pattern skills** with detection rules across **14 categories**
123
+ - Categories: `reentrancy`, `oracle-manipulation`, `flash-loan`, `access-control`, `erc4626`, `proxy`, `signature`, `dos`, `front-running`, `governance`, `token-standard`, `gas-optimization`, `logic-error`, `delegatecall`
127
124
 
128
- #### Custom Pattern Packs
125
+ #### Adding Custom Detection Rules
129
126
 
130
- You can create custom pattern packs by adding YAML files to your configured `customSkillsDir`. Each pack must follow this structure:
127
+ Add custom detection rules by creating SKILL.md files in your `customSkillsDir`:
131
128
 
132
129
  ```yaml
133
- pack_name: "My Custom Pack"
134
- pack_version: "1.0"
135
- patterns:
136
- - name: "Insecure Transfer"
137
- category: "access-control"
138
- severity: "High"
139
- regex: "transfer\\(msg\\.sender, .+\\)"
140
- description: "Detects potentially insecure transfers to the caller"
130
+ ---
131
+ name: my-custom-pattern
132
+ description: Detects insecure transfer patterns
133
+ pattern_category: access-control
134
+ detection_rules:
135
+ - regex: 'transfer\(msg\.sender, .+\)'
136
+ severity: High
137
+ description: Potentially insecure transfer to caller
138
+ ---
141
139
  ```
142
140
 
143
141
  **SCVD Integration:** The plugin connects to [api.scvd.dev](https://api.scvd.dev) for 7,769+ real-world audit findings. Sync with `argus_sync_knowledge` or configure `knowledge.autoSync: true`.
144
142
 
143
+ ### Audit PDF Extraction Pipeline
144
+
145
+ A generic pipeline for extracting security findings from public audit report PDFs and converting them into structured data for pattern creation.
146
+
147
+ **How it works:**
148
+ 1. Downloads PDFs from configured GitHub repositories
149
+ 2. Parses each PDF page-by-page using `pdf-parse`
150
+ 3. Extracts findings using regex-based heading/severity/description detection
151
+ 4. Deduplicates and categorizes findings into 11 categories
152
+ 5. Outputs structured JSON to `scripts/audit-pdf-output/`
153
+
154
+ **Running the pipeline:**
155
+
156
+ ```bash
157
+ bun scripts/audit-pdf-extract.ts
158
+ ```
159
+
160
+ > **Note:** The extraction pipeline scripts are available in the [source repository](https://github.com/Apegurus/solidity-argus) only. They are not included in the npm package. If you installed `solidity-argus` via npm/bun, you'll need to clone the repository to run the extraction pipeline.
161
+
162
+ **Output files:**
163
+ - `scripts/audit-pdf-output/findings.json` — All extracted findings
164
+ - `scripts/audit-pdf-output/metadata.json` — Extraction stats, errors, source info
165
+ - `scripts/audit-pdf-output/by-category/*.json` — Findings grouped by category (reentrancy, access-control, oracle, etc.)
166
+
167
+ **Adding new audit sources:**
168
+
169
+ The pipeline uses a generic `AuditSource[]` interface. To add a new audit firm's reports, edit `scripts/audit-pdf-extract.ts` and add an entry to `DEFAULT_SOURCES`:
170
+
171
+ ```typescript
172
+ {
173
+ name: "AuditFirmName",
174
+ repoRawBase: "https://raw.githubusercontent.com/org/repo/main",
175
+ repoUrl: "https://github.com/org/repo",
176
+ pdfFiles: [
177
+ "Audit Report - Protocol Name.pdf",
178
+ // ... more PDFs
179
+ ],
180
+ }
181
+ ```
182
+
183
+ **How agents leverage extracted findings:**
184
+
185
+ The extracted findings are used to create new SKILL.md vulnerability pattern files (e.g., `erc4626-exchange-rate-manipulation`, `missing-parameter-bounds`). These patterns are loaded on-demand by agents via `argus_skill_load` during audits. The extraction pipeline is a developer tool — agents don't run it directly.
186
+
187
+ ### Case Studies
188
+
189
+ 15 detailed case studies of major DeFi exploits are included in `skills/case-studies/`. Each provides deep narrative context: root cause analysis, attack flow, impact assessment, key transactions, and lessons learned.
190
+
191
+ **Sources:** Public exploit research from [rekt.news](https://rekt.news) and [SunWeb3Sec/DeFiHackLabs](https://github.com/SunWeb3Sec/DeFiHackLabs).
192
+
193
+ **How they complement SCVD:** SCVD provides breadth (7,769+ searchable findings by keyword). Case studies provide depth (detailed narratives of 15 major exploits). The `@pythia` agent uses both — SCVD for "has this pattern been seen before?" and case studies for "how did this type of exploit actually unfold?"
194
+
195
+ **Adding new case studies:**
196
+
197
+ 1. Create a new directory under `skills/case-studies/<exploit-name>/`
198
+ 2. Add a `SKILL.md` file with frontmatter (`name`, `description`, `category: reference`, `source_url`, `source_license`, `detection_rules`)
199
+ 3. Include sections: Overview, Root Cause, Attack Flow, Impact, Key Transactions, Lessons
200
+ 4. Add the entry to `skills/INVENTORY.md`
201
+
145
202
  ---
146
203
 
147
204
  ## Knowledge Ingestion Contract
@@ -173,7 +230,7 @@ Argus classifies knowledge sources into three trust tiers:
173
230
  Knowledge freshness is monitored automatically:
174
231
 
175
232
  - **SCVD local index** — Stale if not synced within 7 days. `argus doctor` will warn if stale and suggest running `argus_sync_knowledge`.
176
- - **Pattern packs** — Versioned via `PATTERN_PACK_VERSION` and updated on package release.
233
+ - **Detection rules** — Versioned via `DETECTION_RULE_VERSION` and updated on package release.
177
234
  - **Baked-in curated skills** — Updated only on package release; no automatic refresh.
178
235
  - **On-demand live sources** — Retrieved per-request; never cached locally.
179
236
 
@@ -203,7 +260,7 @@ Argus supports three distinct knowledge ingestion patterns:
203
260
  **Sources:** SCVD local index, Trail of Bits companion skills
204
261
 
205
262
  - Local index synced periodically via `argus_sync_knowledge`
206
- - Cached locally in `~/.cache/opencode-argus/scvd-index.json`
263
+ - Cached locally in `~/.cache/solidity-argus/scvd-index.json`
207
264
  - Refreshed on-demand when `knowledge.autoSync: true`
208
265
  - Trail of Bits skills git-cloned on install and updated via companion plugin
209
266
  - Example: SCVD findings indexed locally, queried without network latency
@@ -301,7 +358,7 @@ This prevents context pollution and ensures non-audit agents operate independent
301
358
 
302
359
  Agents load specialized knowledge on-demand via the `argus_skill_load` tool:
303
360
 
304
- - **Vulnerability Patterns** — 38 SKILL.md files covering reentrancy, oracle manipulation, flash loans, etc.
361
+ - **Vulnerability Patterns** — 51 SKILL.md files covering reentrancy, oracle manipulation, flash loans, etc.
305
362
  - **Protocol Patterns** — 5 files for AMM/DEX, bridges, governance, lending, staking
306
363
  - **Methodology** — 3 files for audit workflow, report templates, severity classification
307
364
  - **Checklists** — 6 Cyfrin audit checklists
@@ -311,13 +368,13 @@ This channel is **lazy-loaded** — agents request skills only when needed, redu
311
368
 
312
369
  ### Implementation Notes
313
370
 
314
- - **Phase 1 (Current):** `system.transform` is `undefined` (line 84 in `src/create-hooks.ts`). Agent-gated injection will replace this in Phase 2.
371
+ - **Dynamic injection:** `system.transform` uses agent-gated dynamic audit state injection via `createSystemPromptHook` (see `src/create-hooks.ts`).
315
372
  - **Global transforms forbidden:** No global system context injection unless agent-gated and minimal. Prevents context window overflow.
316
373
  - **Audit state persistence:** State is saved to `.opencode/argus-state.json` and restored on session restart (see `Persistent Audit State` section).
317
374
 
318
375
  ---
319
376
 
320
- ## New in v2: Modular Architecture
377
+ ## Modular Architecture
321
378
 
322
379
  This release restructures solidity-argus into a modular factory-based architecture with several new infrastructure features:
323
380
 
@@ -335,7 +392,7 @@ argus init
335
392
  # Validate SKILL.md files against schema
336
393
  argus lint-skills
337
394
 
338
- # Install optional dependencies (Slither, Foundry)
395
+ # Register solidity-argus in opencode.json (tools installed separately; see Requirements)
339
396
  argus install
340
397
  ```
341
398
 
@@ -354,18 +411,17 @@ Selectively disable any hook via config:
354
411
  Config is resolved by merging three layers (last wins):
355
412
 
356
413
  1. **Defaults** — Built-in sensible defaults
357
- 2. **User-level** — `~/.config/solidity-argus/config.jsonc`
414
+ 2. **User-level** — `~/.config/opencode/solidity-argus.jsonc`
358
415
  3. **Project-level** — `.opencode/solidity-argus.jsonc`
359
416
 
360
417
  ### Background Agent Management
361
418
 
362
- Background tasks (knowledge sync, long-running analysis) are tracked with configurable concurrency limits and lifecycle callbacks:
419
+ Background tasks (knowledge sync, long-running analysis) are tracked with configurable concurrency limits:
363
420
 
364
421
  ```jsonc
365
422
  {
366
423
  "background": {
367
- "max_concurrent": 3,
368
- "cleanup_interval_ms": 60000
424
+ "max_concurrent": 3
369
425
  }
370
426
  }
371
427
  ```
package/package.json CHANGED
@@ -1,8 +1,19 @@
1
1
  {
2
2
  "name": "solidity-argus",
3
- "version": "0.2.0",
4
- "description": "Solidity smart contract security auditing plugin for OpenCode — 4 specialized agents, 8 tools, and a curated vulnerability knowledge base",
5
- "keywords": ["solidity", "security", "audit", "opencode", "plugin", "smart-contract", "ethereum", "defi", "slither", "foundry"],
3
+ "version": "0.3.0",
4
+ "description": "Solidity smart contract security auditing plugin for OpenCode — 4 specialized agents, 12 tools (11 core + optional Solodit), and a curated vulnerability knowledge base",
5
+ "keywords": [
6
+ "solidity",
7
+ "security",
8
+ "audit",
9
+ "opencode",
10
+ "plugin",
11
+ "smart-contract",
12
+ "ethereum",
13
+ "defi",
14
+ "slither",
15
+ "foundry"
16
+ ],
6
17
  "author": "Apegurus",
7
18
  "license": "MIT",
8
19
  "type": "module",
@@ -17,24 +28,39 @@
17
28
  "solidity-argus": "./src/cli/index.ts",
18
29
  "argus": "./src/cli/index.ts"
19
30
  },
20
- "files": ["src/", "!src/**/*.test.ts", "skills/", "README.md", "AGENTS.md", "LICENSE"],
31
+ "files": [
32
+ "src/",
33
+ "!src/**/*.test.ts",
34
+ "skills/",
35
+ "README.md",
36
+ "AGENTS.md",
37
+ "LICENSE"
38
+ ],
21
39
  "scripts": {
22
40
  "test": "bun test",
23
41
  "typecheck": "tsc --noEmit",
42
+ "lint": "biome lint .",
43
+ "format": "biome format --write .",
44
+ "format:check": "biome format .",
45
+ "check": "biome check .",
46
+ "check:fix": "biome check --write .",
47
+ "ci": "biome ci .",
24
48
  "cli": "bun src/cli/index.ts",
25
49
  "doctor": "bun src/cli/index.ts doctor",
26
50
  "init": "bun src/cli/index.ts init"
27
51
  },
28
52
  "dependencies": {
53
+ "@opencode-ai/plugin": "^1.2.10",
29
54
  "yaml": "^2.8.2",
30
- "zod": "^4.3.6"
55
+ "zod": "^4.1.8"
31
56
  },
32
57
  "peerDependencies": {
33
- "@opencode-ai/plugin": "^1.2.6"
58
+ "@opencode-ai/sdk": "^1.0.0"
34
59
  },
35
60
  "devDependencies": {
36
- "@opencode-ai/plugin": "^1.2.6",
61
+ "@biomejs/biome": "^2.4.4",
37
62
  "@types/bun": "^1.2.0",
63
+ "pdf-parse": "^2.4.5",
38
64
  "typescript": "^5"
39
65
  },
40
66
  "repository": {
@@ -1,79 +1,110 @@
1
1
  # Argus Knowledge Base Inventory
2
2
 
3
- Generated: 2026-02-18
4
- Total SKILL.md files: 55
3
+ Generated: 2026-02-20
4
+ Total SKILL.md files: 82
5
5
 
6
6
  ## Vulnerability Patterns
7
7
  | File | Source(s) | Topic | Word Count |
8
8
  |------|-----------|-------|------------|
9
- | vulnerability-patterns/access-control/SKILL.md | DeFiFoFum, kadenzipfel | Access Control Exploits | 1018 |
10
- | vulnerability-patterns/arbitrary-storage-location/SKILL.md | kadenzipfel | Write to Arbitrary Storage Location | 309 |
11
- | vulnerability-patterns/assert-violation/SKILL.md | kadenzipfel | Assert Violation | 356 |
12
- | vulnerability-patterns/asserting-contract-from-code-size/SKILL.md | kadenzipfel | Asserting Contract from Code Size | 336 |
13
- | vulnerability-patterns/authorization-txorigin/SKILL.md | kadenzipfel | Authorization Through tx.origin | 266 |
14
- | vulnerability-patterns/default-visibility/SKILL.md | kadenzipfel | Default Visibility | 298 |
15
- | vulnerability-patterns/delegatecall-untrusted-callee/SKILL.md | kadenzipfel | Delegatecall to Untrusted Callee | 309 |
16
- | vulnerability-patterns/dos-gas-limit/SKILL.md | kadenzipfel | DoS with Block Gas Limit | 333 |
17
- | vulnerability-patterns/dos-revert/SKILL.md | kadenzipfel | DoS with (Unexpected) Revert | 408 |
18
- | vulnerability-patterns/flash-loan-attacks/SKILL.md | DeFiFoFum, kadenzipfel | Flash Loan Attack Exploits | 1000 |
19
- | vulnerability-patterns/floating-pragma/SKILL.md | kadenzipfel | Floating Pragma | 279 |
20
- | vulnerability-patterns/hash-collision/SKILL.md | kadenzipfel | Hash Collision with abi.encodePacked() | 318 |
21
- | vulnerability-patterns/inadherence-to-standards/SKILL.md | kadenzipfel | Inadherence to Standards | 361 |
22
- | vulnerability-patterns/incorrect-constructor/SKILL.md | kadenzipfel | Incorrect Constructor Name | 285 |
23
- | vulnerability-patterns/incorrect-inheritance-order/SKILL.md | kadenzipfel | Incorrect Inheritance Order | 289 |
24
- | vulnerability-patterns/insufficient-gas-griefing/SKILL.md | kadenzipfel | Insufficient Gas Griefing | 368 |
25
- | vulnerability-patterns/lack-of-precision/SKILL.md | kadenzipfel | Lack of Precision | 334 |
26
- | vulnerability-patterns/logic-errors/SKILL.md | DeFiFoFum, kadenzipfel | Logic Bug Exploits | 1192 |
27
- | vulnerability-patterns/missing-protection-signature-replay/SKILL.md | kadenzipfel | Missing Protection Against Signature Replay | 350 |
28
- | vulnerability-patterns/msgvalue-loop/SKILL.md | kadenzipfel | msg.value Reuse in Loops | 378 |
29
- | vulnerability-patterns/off-by-one/SKILL.md | kadenzipfel | Off-By-One Errors | 336 |
30
- | vulnerability-patterns/oracle-manipulation/SKILL.md | DeFiFoFum, kadenzipfel | Oracle Manipulation Exploits | 985 |
31
- | vulnerability-patterns/outdated-compiler-version/SKILL.md | kadenzipfel | Outdated Compiler Version | 327 |
32
- | vulnerability-patterns/overflow-underflow/SKILL.md | kadenzipfel | Integer Overflow and Underflow | 332 |
33
- | vulnerability-patterns/reentrancy/SKILL.md | DeFiFoFum, kadenzipfel | Reentrancy Exploits | 1034 |
34
- | vulnerability-patterns/shadowing-state-variables/SKILL.md | kadenzipfel | Shadowing State Variables | 363 |
35
- | vulnerability-patterns/signature-malleability/SKILL.md | kadenzipfel | Signature Malleability | 320 |
36
- | vulnerability-patterns/unbounded-return-data/SKILL.md | kadenzipfel | Unbounded Return Data | 359 |
37
- | vulnerability-patterns/unchecked-return-values/SKILL.md | kadenzipfel | Unchecked Return Values | 281 |
38
- | vulnerability-patterns/unencrypted-private-data-on-chain/SKILL.md | kadenzipfel | Unencrypted Private Data On-Chain | 330 |
39
- | vulnerability-patterns/unexpected-ecrecover-null-address/SKILL.md | kadenzipfel | Unexpected ecrecover Null Address | 324 |
40
- | vulnerability-patterns/uninitialized-storage-pointer/SKILL.md | kadenzipfel | Uninitialized Storage Pointer | 315 |
41
- | vulnerability-patterns/unsafe-low-level-call/SKILL.md | kadenzipfel | Unsafe Low-Level Call | 328 |
42
- | vulnerability-patterns/unsecure-signatures/SKILL.md | kadenzipfel | Unsecure Signatures | 441 |
43
- | vulnerability-patterns/unsupported-opcodes/SKILL.md | kadenzipfel | Unsupported Opcodes on EVM-Compatible Chains | 391 |
44
- | vulnerability-patterns/unused-variables/SKILL.md | kadenzipfel | Presence of Unused Variables | 333 |
45
- | vulnerability-patterns/use-of-deprecated-functions/SKILL.md | kadenzipfel | Use of Deprecated Functions | 323 |
46
- | vulnerability-patterns/weak-sources-randomness/SKILL.md | kadenzipfel | Weak Sources of Randomness from Chain Attributes | 377 |
47
- | vulnerability-patterns/weird-tokens/SKILL.md | DeFiFoFum | Weird ERC20 Tokens Reference | 852 |
9
+ | vulnerability-patterns/access-control/SKILL.md | DeFiFoFum, kadenzipfel | Access Control Exploits | 1164 |
10
+ | vulnerability-patterns/arbitrary-storage-location/SKILL.md | kadenzipfel | Write to Arbitrary Storage Location | 334 |
11
+ | vulnerability-patterns/assert-violation/SKILL.md | kadenzipfel | Assert Violation | 369 |
12
+ | vulnerability-patterns/asserting-contract-from-code-size/SKILL.md | kadenzipfel | Asserting Contract from Code Size | 367 |
13
+ | vulnerability-patterns/authorization-txorigin/SKILL.md | kadenzipfel | Authorization Through tx.origin | 295 |
14
+ | vulnerability-patterns/cross-chain-bridge-vulnerabilities/SKILL.md | Argus | Cross-Chain Bridge Vulnerabilities | 1195 |
15
+ | vulnerability-patterns/default-visibility/SKILL.md | kadenzipfel | Default Visibility | 331 |
16
+ | vulnerability-patterns/delegatecall-untrusted-callee/SKILL.md | kadenzipfel | Delegatecall to Untrusted Callee | 356 |
17
+ | vulnerability-patterns/dos-gas-limit/SKILL.md | kadenzipfel | DoS with Block Gas Limit | 355 |
18
+ | vulnerability-patterns/dos-revert/SKILL.md | kadenzipfel | DoS with (Unexpected) Revert | 481 |
19
+ | vulnerability-patterns/erc4626-exchange-rate-manipulation/SKILL.md | BailSec | ERC4626 Exchange Rate Manipulation | 381 |
20
+ | vulnerability-patterns/fee-on-transfer-tokens/SKILL.md | BailSec | Fee-on-Transfer Token Incompatibility | 540 |
21
+ | vulnerability-patterns/flash-loan-attacks/SKILL.md | DeFiFoFum, kadenzipfel | Flash Loan Attack Exploits | 1116 |
22
+ | vulnerability-patterns/floating-pragma/SKILL.md | kadenzipfel | Floating Pragma | 301 |
23
+ | vulnerability-patterns/front-running-attacks/SKILL.md | Argus | Front-Running and MEV Vulnerabilities | 1147 |
24
+ | vulnerability-patterns/gas-optimization-patterns/SKILL.md | Argus | Gas Optimization Vulnerability Patterns | 1219 |
25
+ | vulnerability-patterns/governance-attacks/SKILL.md | Argus | Governance Attack Vulnerabilities | 1321 |
26
+ | vulnerability-patterns/hash-collision/SKILL.md | kadenzipfel | Hash Collision with abi.encodePacked() | 326 |
27
+ | vulnerability-patterns/inadherence-to-standards/SKILL.md | kadenzipfel | Inadherence to Standards | 369 |
28
+ | vulnerability-patterns/incorrect-constructor/SKILL.md | kadenzipfel | Incorrect Constructor Name | 320 |
29
+ | vulnerability-patterns/incorrect-inheritance-order/SKILL.md | kadenzipfel | Incorrect Inheritance Order | 325 |
30
+ | vulnerability-patterns/insufficient-gas-griefing/SKILL.md | kadenzipfel | Insufficient Gas Griefing | 392 |
31
+ | vulnerability-patterns/lack-of-precision/SKILL.md | kadenzipfel | Lack of Precision | 395 |
32
+ | vulnerability-patterns/logic-errors/SKILL.md | DeFiFoFum, kadenzipfel | Logic Bug Exploits | 1336 |
33
+ | vulnerability-patterns/missing-parameter-bounds/SKILL.md | BailSec | Missing Parameter Bounds | 407 |
34
+ | vulnerability-patterns/missing-protection-signature-replay/SKILL.md | kadenzipfel | Missing Protection Against Signature Replay | 362 |
35
+ | vulnerability-patterns/msgvalue-loop/SKILL.md | kadenzipfel | msg.value Reuse in Loops | 413 |
36
+ | vulnerability-patterns/off-by-one/SKILL.md | kadenzipfel | Off-By-One Errors | 398 |
37
+ | vulnerability-patterns/oracle-manipulation/SKILL.md | DeFiFoFum, kadenzipfel | Oracle Manipulation Exploits | 1126 |
38
+ | vulnerability-patterns/outdated-compiler-version/SKILL.md | kadenzipfel | Outdated Compiler Version | 342 |
39
+ | vulnerability-patterns/overflow-underflow/SKILL.md | kadenzipfel | Integer Overflow and Underflow | 385 |
40
+ | vulnerability-patterns/proxy-vulnerabilities/SKILL.md | Argus | Proxy Pattern Vulnerabilities | 1063 |
41
+ | vulnerability-patterns/reentrancy/SKILL.md | DeFiFoFum, kadenzipfel | Reentrancy Exploits | 1160 |
42
+ | vulnerability-patterns/shadowing-state-variables/SKILL.md | kadenzipfel | Shadowing State Variables | 404 |
43
+ | vulnerability-patterns/share-accounting-desynchronization/SKILL.md | BailSec | Share Accounting Desynchronization | 390 |
44
+ | vulnerability-patterns/signature-malleability/SKILL.md | kadenzipfel | Signature Malleability | 370 |
45
+ | vulnerability-patterns/stateful-parameter-update-drift/SKILL.md | BailSec | Stateful Parameter Update Drift | 388 |
46
+ | vulnerability-patterns/unbounded-return-data/SKILL.md | kadenzipfel | Unbounded Return Data | 389 |
47
+ | vulnerability-patterns/unchecked-return-values/SKILL.md | kadenzipfel | Unchecked Return Values | 331 |
48
+ | vulnerability-patterns/unencrypted-private-data-on-chain/SKILL.md | kadenzipfel | Unencrypted Private Data On-Chain | 360 |
49
+ | vulnerability-patterns/unexpected-ecrecover-null-address/SKILL.md | kadenzipfel | Unexpected ecrecover Null Address | 339 |
50
+ | vulnerability-patterns/uninitialized-storage-pointer/SKILL.md | kadenzipfel | Uninitialized Storage Pointer | 337 |
51
+ | vulnerability-patterns/unsafe-erc20-transfers/SKILL.md | BailSec | Unsafe ERC20 Transfer and Approve Calls | 620 |
52
+ | vulnerability-patterns/unsafe-low-level-call/SKILL.md | kadenzipfel | Unsafe Low-Level Call | 347 |
53
+ | vulnerability-patterns/unsecure-signatures/SKILL.md | kadenzipfel | Unsecure Signatures | 459 |
54
+ | vulnerability-patterns/unsupported-opcodes/SKILL.md | kadenzipfel | Unsupported Opcodes on EVM-Compatible Chains | 432 |
55
+ | vulnerability-patterns/unused-variables/SKILL.md | kadenzipfel | Presence of Unused Variables | 388 |
56
+ | vulnerability-patterns/use-of-deprecated-functions/SKILL.md | kadenzipfel | Use of Deprecated Functions | 385 |
57
+ | vulnerability-patterns/weak-sources-randomness/SKILL.md | kadenzipfel | Weak Sources of Randomness from Chain Attributes | 398 |
58
+ | vulnerability-patterns/weird-tokens/SKILL.md | DeFiFoFum | Weird ERC20 Tokens Reference | 1013 |
59
+ | vulnerability-patterns/zero-address-misconfiguration/SKILL.md | BailSec | Zero Address Misconfiguration | 426 |
48
60
 
49
61
  ## Methodology
50
62
  | File | Source(s) | Topic | Word Count |
51
63
  |------|-----------|-------|------------|
52
- | methodology/audit-workflow/SKILL.md | DeFiFoFum | audit-workflow | 382 |
53
- | methodology/report-template/SKILL.md | DeFiFoFum | Audit Report Template | 481 |
54
- | methodology/severity-classification/SKILL.md | DeFiFoFum | Severity Classification Guide | 465 |
64
+ | methodology/audit-workflow/SKILL.md | DeFiFoFum | Audit Workflow | 523 |
65
+ | methodology/report-template/SKILL.md | DeFiFoFum | Audit Report Template | 585 |
66
+ | methodology/severity-classification/SKILL.md | DeFiFoFum | Severity Classification Guide | 603 |
55
67
 
56
68
  ## Protocol Patterns
57
69
  | File | Source(s) | Topic | Word Count |
58
70
  |------|-----------|-------|------------|
59
- | protocol-patterns/amm-dex/SKILL.md | DeFiFoFum | AMM (Automated Market Maker) Security Guide | 597 |
60
- | protocol-patterns/bridges-cross-chain/SKILL.md | DeFiFoFum | Cross-Chain Bridge Security Guide | 851 |
61
- | protocol-patterns/dao-governance/SKILL.md | DeFiFoFum | Governance Protocol Security Guide | 827 |
62
- | protocol-patterns/lending-borrowing/SKILL.md | DeFiFoFum | Lending Protocol Security Guide | 663 |
63
- | protocol-patterns/staking-vesting/SKILL.md | DeFiFoFum | Staking Protocol Security Guide | 698 |
71
+ | protocol-patterns/amm-dex/SKILL.md | DeFiFoFum | AMM (Automated Market Maker) Security Guide | 852 |
72
+ | protocol-patterns/bridges-cross-chain/SKILL.md | DeFiFoFum | Cross-Chain Bridge Security Guide | 1083 |
73
+ | protocol-patterns/dao-governance/SKILL.md | DeFiFoFum | Governance Protocol Security Guide | 1024 |
74
+ | protocol-patterns/lending-borrowing/SKILL.md | DeFiFoFum | Lending Protocol Security Guide | 871 |
75
+ | protocol-patterns/staking-vesting/SKILL.md | DeFiFoFum | Staking Protocol Security Guide | 895 |
64
76
 
65
77
  ## Checklists
66
78
  | File | Source(s) | Topic | Word Count |
67
79
  |------|-----------|-------|------------|
68
- | checklists/cyfrin-best-practices-runtime/SKILL.md | Cyfrin | Cyfrin Audit Checklist — Best Practices (Runtime & Cross-chain) | 4766 |
69
- | checklists/cyfrin-best-practices-upgrades/SKILL.md | Cyfrin | Cyfrin Audit Checklist — Best Practices (Upgrades & Versioning) | 2269 |
70
- | checklists/cyfrin-defi-core/SKILL.md | Cyfrin | Cyfrin Audit Checklist — DeFi Security (Core) | 4555 |
71
- | checklists/cyfrin-defi-integrations/SKILL.md | Cyfrin | Cyfrin Audit Checklist — DeFi Security (Integrations & Tokens) | 4632 |
72
- | checklists/cyfrin-gas/SKILL.md | Cyfrin | Cyfrin Audit Checklist — Gas Optimization | 443 |
73
- | checklists/general-audit/SKILL.md | DeFiFoFum, Cyfrin | Solidity Audit Checklist | 2341 |
80
+ | checklists/cyfrin-best-practices-runtime/SKILL.md | Cyfrin | Cyfrin Audit Checklist — Best Practices (Runtime & Cross-chain) | 4303 |
81
+ | checklists/cyfrin-best-practices-upgrades/SKILL.md | Cyfrin | Cyfrin Audit Checklist — Best Practices (Upgrades & Versioning) | 2053 |
82
+ | checklists/cyfrin-defi-core/SKILL.md | Cyfrin | Cyfrin Audit Checklist — DeFi Security (Core) | 4222 |
83
+ | checklists/cyfrin-defi-integrations/SKILL.md | Cyfrin | Cyfrin Audit Checklist — DeFi Security (Integrations & Tokens) | 4290 |
84
+ | checklists/cyfrin-gas/SKILL.md | Cyfrin | Cyfrin Audit Checklist — Gas Optimization | 342 |
85
+ | checklists/general-audit/SKILL.md | DeFiFoFum, Cyfrin | Solidity Audit Checklist | 2878 |
74
86
 
75
87
  ## References
76
88
  | File | Source(s) | Topic | Word Count |
77
89
  |------|-----------|-------|------------|
78
- | references/exploit-reference/SKILL.md | SunWeb3Sec | DeFi Exploit Reference Index | 1133 |
79
- | references/smartbugs-examples/SKILL.md | smartbugs | SmartBugs Curated Dataset — Vulnerable Contract Examples | 3386 |
90
+ | references/exploit-reference/SKILL.md | SunWeb3Sec | DeFi Exploit Reference Index | 1125 |
91
+ | references/smartbugs-examples/SKILL.md | smartbugs | SmartBugs Curated Dataset — Vulnerable Contract Examples | 1677 |
92
+
93
+ ## Case Studies
94
+ | File | Source(s) | Topic | Word Count |
95
+ |------|-----------|-------|------------|
96
+ | case-studies/beanstalk-governance/SKILL.md | DeFiFoFum | Beanstalk Governance Attack Case Study | 420 |
97
+ | case-studies/bzx-flash-loan/SKILL.md | DeFiFoFum | bZx Flash Loan Attack Case Study | 370 |
98
+ | case-studies/cream-finance/SKILL.md | DeFiFoFum | Cream Finance Attack Case Study | 420 |
99
+ | case-studies/curve-reentrancy/SKILL.md | DeFiFoFum | Curve Reentrancy Attack Case Study | 395 |
100
+ | case-studies/dao-hack/SKILL.md | DeFiFoFum | The DAO Hack Case Study | 350 |
101
+ | case-studies/euler-finance/SKILL.md | DeFiFoFum | Euler Finance Attack Case Study | 419 |
102
+ | case-studies/harvest-finance/SKILL.md | DeFiFoFum | Harvest Finance Attack Case Study | 405 |
103
+ | case-studies/level-finance/SKILL.md | DeFiFoFum | Level Finance Attack Case Study | 371 |
104
+ | case-studies/mango-markets/SKILL.md | DeFiFoFum | Mango Markets Attack Case Study | 422 |
105
+ | case-studies/nomad-bridge/SKILL.md | DeFiFoFum | Nomad Bridge Attack Case Study | 429 |
106
+ | case-studies/parity-multisig/SKILL.md | DeFiFoFum | Parity Multisig Wallet Attack Case Study | 395 |
107
+ | case-studies/poly-network/SKILL.md | DeFiFoFum | Poly Network Attack Case Study | 395 |
108
+ | case-studies/rari-fuse/SKILL.md | DeFiFoFum | Rari Fuse Attack Case Study | 391 |
109
+ | case-studies/ronin-bridge/SKILL.md | DeFiFoFum | Ronin Bridge Attack Case Study | 384 |
110
+ | case-studies/wormhole-bridge/SKILL.md | DeFiFoFum | Wormhole Bridge Attack Case Study | 337 |
package/skills/README.md CHANGED
@@ -7,12 +7,13 @@ The Argus knowledge base provides a structured collection of Solidity security p
7
7
  ```
8
8
  OpenCode Skills System
9
9
  ├── skills/ (bundled with plugin)
10
- │ ├── vulnerability-patterns/ (37 patterns from kadenzipfel + DeFiFoFum)
10
+ │ ├── vulnerability-patterns/ (51 patterns from kadenzipfel + DeFiFoFum + BailSec + Argus)
11
11
  │ ├── methodology/ (3 files from DeFiFoFum)
12
12
  │ ├── protocol-patterns/ (5 files from DeFiFoFum)
13
13
  │ ├── checklists/ (6 files from DeFiFoFum + Cyfrin)
14
- └── references/ (2 files: SmartBugs + DeFiHackLabs)
15
- ├── SCVD Local Index (~/.cache/opencode-argus/scvd-index.json)
14
+ ├── references/ (2 files: SmartBugs + DeFiHackLabs)
15
+ │ └── case-studies/ (15 case studies from DeFiFoFum)
16
+ ├── SCVD Local Index (~/.cache/solidity-argus/scvd-index.json)
16
17
  │ └── 7,769+ findings, auto-synced from api.scvd.dev
17
18
  └── Companion Plugins (installed separately)
18
19
  ├── Trail of Bits Skills (trailofbits/skills)
@@ -29,11 +30,12 @@ All sources in the table below must include the following metadata in their SKIL
29
30
 
30
31
  | Source | License | URL | What Was Imported |
31
32
  |--------|---------|-----|-------------------|
32
- | DeFiFoFum/fofum-solidity-skills | MIT | https://github.com/DeFiFoFum/fofum-solidity-skills | 15 SKILL.md files: methodology, vulnerability patterns, protocol patterns |
33
+ | DeFiFoFum/fofum-solidity-skills | MIT | https://github.com/DeFiFoFum/fofum-solidity-skills | 15 SKILL.md files: methodology, vulnerability patterns, protocol patterns, case studies |
33
34
  | kadenzipfel/smart-contract-vulnerabilities | MIT | https://github.com/kadenzipfel/smart-contract-vulnerabilities | 37 vulnerability reference files with Detection Heuristics |
34
35
  | Cyfrin/audit-checklist | Unspecified (attributed) | https://github.com/Cyfrin/audit-checklist | 221 structured checklist items organized by category |
35
36
  | smartbugs/smartbugs-curated | Apache-2.0 | https://github.com/smartbugs/smartbugs-curated | 143 annotated vulnerable contract references |
36
37
  | SunWeb3Sec/DeFiHackLabs | Reference only | https://github.com/SunWeb3Sec/DeFiHackLabs | 15 exploit PoC GitHub URL references |
38
+ | BailSec | CC0 | https://github.com/bailsec/BailSec | Vulnerability patterns extracted from professional audit PDFs |
37
39
  | SCVD (api.scvd.dev) | CC0 | https://api.scvd.dev | 7,769+ findings via local index (auto-synced) |
38
40
 
39
41
  ## SKILL.md Format Specification
@@ -46,10 +48,9 @@ name: topic-name # Must match parent directory name
46
48
  description: One sentence description (1-1024 chars)
47
49
  version: 1.0.0 # Optional semver
48
50
  category: vulnerability-pattern # methodology, protocol-pattern, checklist, reference
49
- provenance:
50
- source: "Author Name"
51
- license: "MIT"
52
- lastVerified: "2024-01-01"
51
+ source_url: "https://github.com/org/repo"
52
+ source_license: "MIT"
53
+ imported_at: "2024-01-01T00:00:00Z"
53
54
  detection_rules:
54
55
  - regex: "pattern here"
55
56
  severity: "High"
@@ -65,7 +66,7 @@ detection_rules:
65
66
 
66
67
  ## Custom Skills
67
68
 
68
- To add your own skills, use the `knowledge.customSkillsDir` configuration option in your `opencode-argus.jsonc` file. Point this to a directory containing your custom `SKILL.md` files organized into subdirectories.
69
+ To add your own skills, use the `knowledge.customSkillsDir` configuration option in your `solidity-argus.jsonc` file. Point this to a directory containing your custom `SKILL.md` files organized into subdirectories.
69
70
 
70
71
  ### Skill Overrides
71
72
 
@@ -79,25 +80,27 @@ By default, built-in skills take priority. You can change this behavior using th
79
80
 
80
81
  When set to `custom-first`, skills in your `customSkillsDir` will override built-in skills with the same name. All custom skills must have valid frontmatter with at least `name` and `description` fields.
81
82
 
82
- ## Pattern Pack Authoring
83
+ ## Detection Rules
83
84
 
84
- Pattern packs are YAML files that define collections of regex-based vulnerability detectors.
85
+ Vulnerability patterns are defined as `detection_rules` in SKILL.md frontmatter. Each skill with a `pattern_category` field is automatically discovered and loaded by the pattern checker.
85
86
 
86
- ### Structure
87
+ ### Adding Detection Rules to a Skill
87
88
 
88
89
  ```yaml
89
- pack_name: "My Security Pack"
90
- pack_version: "1.1"
91
- patterns:
92
- - name: "Unprotected Selfdestruct"
93
- category: "access-control"
94
- severity: "Critical"
95
- regex: "selfdestruct\\("
96
- description: "Detects use of selfdestruct which may be unprotected"
97
- swc: "SWC-106"
90
+ ---
91
+ name: my-vulnerability
92
+ description: Description of the vulnerability
93
+ pattern_category: reentrancy
94
+ detection_rules:
95
+ - regex: '\\.call\\{value:'
96
+ severity: High
97
+ confidence: High
98
+ swc: SWC-107
99
+ description: External value transfer via low-level call
100
+ ---
98
101
  ```
99
102
 
100
- ### Available Categories
103
+ ### Available Pattern Categories
101
104
 
102
105
  - `reentrancy`
103
106
  - `oracle-manipulation`
@@ -116,4 +119,4 @@ patterns:
116
119
 
117
120
  ## Inventory
118
121
 
119
- See [INVENTORY.md](./INVENTORY.md) for a complete listing of all 55 SKILL.md files currently bundled with Argus.
122
+ See [INVENTORY.md](./INVENTORY.md) for a complete listing of all 82 SKILL.md files currently bundled with Argus.