Principle:0sec labs 0 LLM Driven Deep Review
| Knowledge Sources | |
|---|---|
| Domains | Source_Code_Review, Agent_Loop, Security |
| Last Updated | 2026-10-30 00:00 GMT |
Overview
Technique for driving an LLM agent loop that investigates static scanner leads, reasons about vulnerability hypotheses, confirms or rejects them, and produces a scan report with findings and cost accounting.
Description
LLM-driven deep review is the core of the 0security source code review pipeline. The unified run command (runUnified) drives the core agent loop (agenticScan) which investigates the seed findings, reads source code, reasons about vulnerability hypotheses, and produces confirmed findings. The agent loop supports two review strategies: pipeline (staged analysis) and lenses (multi-perspective). It respects a hard USD cost ceiling (costCeilingUsd), an AI agent timeout, and an optional operator research hypothesis seed. Results are persisted to SQLite (@0/db) and formatted per the selected output format.
Usage
Use this principle when designing a source code security review system that uses LLM reasoning to investigate and confirm vulnerability findings beyond what static scanners alone can achieve.
Theoretical Basis
The agent loop:
# Abstract algorithm (NOT real implementation)
def agentic_scan(opts, seed_findings):
plan = build_scan_plan(opts.profile, opts.depth, seed_findings)
agent = AgentLoop(
model=resolve_runtime(opts.runtime),
tools=getToolsForRole("reviewer"),
budget=CostTracker(ceiling=opts.costCeilingUsd),
timeout=opts.timeout,
)
findings = agent.run(plan)
persist(findings, db)
return format(findings, opts.format)
The two strategies:
- Pipeline: staged analysis (ingest → prioritize → investigate → confirm → report)
- Lenses: multiple specialized perspectives (memory safety, injection, auth, crypto) applied in parallel
The cost ceiling aborts cleanly with partial findings if exceeded — honest degradation, not silent truncation.