flowchart TB
BENCH["Run Benchmark\nJuliet, OWASP, CSE, CGC, CyberGym"] --> SCORE["Score Results\nF1, Precision, Recall per CWE"]
SCORE --> FN["Identify False Negatives"]
FN --> FA["failure-analyst Agent\nReads code, queries graph\nDiagnoses WHY we missed it"]
FA --> PROP["Generate Proposals\n1. AGENT_PROMPT\n2. TAINT_RULE\n3. CWE_MAPPING\n4. NEW_PATTERN"]
PROP --> REV["overfitting-reviewer Agent\nRejects benchmark-specific heuristics\nRejects duplicates\nCatches narrow detection"]
REV -->|Accepted ~34%| APPLY["Apply to agents,\ntaint engine, scoring"]
REV -->|Rejected ~66%| LEARN["Store lesson in\ndurable memory"]
APPLY --> MEM["Durable agent memory\nfor future cycles"]
MEM --> BENCH
style FA fill:#2d1f3f,stroke:#d29922,color:#c9d1d9
style REV fill:#1f3a1f,stroke:#3fb950,color:#c9d1d9
style APPLY fill:#1f3a5f,stroke:#58a6ff,color:#c9d1d9
Skwaq Gym: Benchmark Harness & Agentic Self-Improvement Loop
What Is This
Skwaq Gym is the benchmark and self-improvement system for skwaq's vulnerability detection. It measures detection accuracy against industry-standard benchmarks and runs an agentic self-improvement loop where AI agents analyze their own failures and propose improvements to their investigation methodology.
Architecture
flowchart TB SRC["Source Code / Binary"] --> L1 L1["Layer 1: Pattern Detection\n~260 patterns, 6 languages"] --> L2 L2["Layer 2: Dataflow Analysis\nTaint source→sink tracing\nRecursive CTE call-graph"] --> L3 L3["Layer 3: Context Validation\nMulti-cycle convergence\nFP reduction"] --> L4 L4["Layer 4: LLM Agent Pipeline\nattack-surface → vuln-hunter → critic\n18 specialized agents"] --> L5 L5["Layer 5: Synthesis\nDomain-expert weighted evidence\nConsensus early-exit"] --> OUT["Findings\nCWE + severity + evidence"] style L1 fill:#1f3a5f,stroke:#58a6ff,color:#c9d1d9 style L2 fill:#1f3a5f,stroke:#58a6ff,color:#c9d1d9 style L3 fill:#1f3a5f,stroke:#58a6ff,color:#c9d1d9 style L4 fill:#2d1f3f,stroke:#d29922,color:#c9d1d9 style L5 fill:#1f3f2d,stroke:#3fb950,color:#c9d1d9Multi-Agent Pipeline
sequenceDiagram participant G as Code Property Graph participant AS as attack-surface participant VH as vuln-hunter participant CR as critic AS->>G: get_data_sources() AS->>G: get_imports() AS->>G: get_taint_paths() AS->>G: get_cross_file_calls() AS-->>VH: Attack surface mapped VH->>G: read_function() VH->>G: get_callers() / get_callees() VH->>G: get_taint_paths() VH->>G: create_finding() VH-->>CR: Findings with evidence CR->>G: Validate reachability CR->>G: Check sanitization CR-->>CR: Accept / Reject / Adjust severityDeep Pipeline (Offense/Defense Debate)
flowchart LR VH["vuln-hunter\nfindings"] --> EA["exploit-analyst\nCan attacker trigger this?"] VH --> DA["defense-analyst\nAre mitigations effective?"] EA --> VS["verdict-synthesizer"] DA --> VS VS --> OUT["CONFIRMED / MITIGATED / SAFE"] style EA fill:#3a1f1f,stroke:#f85149,color:#c9d1d9 style DA fill:#1f3a1f,stroke:#3fb950,color:#c9d1d9 style VS fill:#1f2a3f,stroke:#58a6ff,color:#c9d1d9Self-Improvement Loop
flowchart TB BENCH["Run Benchmark\nJuliet, OWASP, CSE, CGC, CyberGym"] --> SCORE["Score Results\nF1, Precision, Recall per CWE"] SCORE --> FN["Identify False Negatives"] FN --> FA["failure-analyst Agent\nReads code, queries graph\nDiagnoses WHY we missed it"] FA --> PROP["Generate Proposals\n1. AGENT_PROMPT\n2. TAINT_RULE\n3. CWE_MAPPING\n4. NEW_PATTERN"] PROP --> REV["overfitting-reviewer Agent\nRejects benchmark-specific heuristics\nRejects duplicates\nCatches narrow detection"] REV -->|Accepted ~34%| APPLY["Apply to agents,\ntaint engine, scoring"] REV -->|Rejected ~66%| LEARN["Store lesson in\ndurable memory"] APPLY --> MEM["Durable agent memory\nfor future cycles"] MEM --> BENCH style FA fill:#2d1f3f,stroke:#d29922,color:#c9d1d9 style REV fill:#1f3a1f,stroke:#3fb950,color:#c9d1d9 style APPLY fill:#1f3a5f,stroke:#58a6ff,color:#c9d1d9Benchmark Suites
Current Baselines (PRs #303-#314, 2026-03-25)
Agentic Mode (full pipeline: attack-surface → vuln-hunter → critic)
Pattern+Dataflow Mode (--quick, no LLM)
Improvement History
Agentic Self-Improvement Stats (22+ cycles)
Per-CWE Improvements (from PR #302 baseline)
Industry Comparison
Binary Analysis Tools
Research Context
Pattern-Only vs Agentic
Next Steps
Site: rysweet.github.io/skwaq