Deepsec: When a Security Scanner Learns to Think in Stages

A Vercel Labs harness that uses fast pattern matching, agentic investigation, and revalidation to turn vulnerability hunting into a disciplined pipeline.

9 min read View on GitHub More from vercel-labs

A wide black-ink editorial scene showing code fragments being filtered by precise mechanical combs on the left, then carried into a glass-walled analysis chamber on the right. It explains Deepsec’s core idea: cheap matching narrows the search so expensive agentic reasoning can focus on high-value candidates.
Deepsec does not ask an AI to inspect everything. It uses regex to find the interesting parts first, then spends agent cycles where they matter.

Author here. Let me know if you have questions!

cramforce, Author · Deepsec | Hacker News
Key Takeaways

Most security tools try to be universal. Deepsec takes the opposite bet. It is built around a simple claim: the best way to use AI for vulnerability hunting is not to let AI inspect everything, but to make AI the second step in a system that already knows how to narrow the field.

That is why the repo feels unusually disciplined. The first pass is cheap and mechanical. The second pass is expensive and interpretive. The third pass checks the work again. Deepsec is less a scanner than a pipeline with opinions about where reasoning should start, and where it should stop.

The clever part is what happens before the AI starts

The architecture turns regex into retrieval. Matchers sweep through a repository looking for candidate sites, and only then does an agent step in to investigate the code path, gather context, and decide whether the pattern is real. That sounds obvious until you compare it with the usual “send the whole repo to the model” approach, which burns tokens, time, and patience.

The pipeline works because the system spends attention only after a file clears cheap gates. The decision tree is the product.

This matters because security review is not just an accuracy problem. It is an economics problem. Every extra file you hand to an agent raises cost and adds noise. Deepsec’s architecture is built to make the expensive part selective.

Today we're open sourcing deepsec: a security harness powered by coding agents. It runs on your own infrastructure and surfaces hard-to-find issues in large codebases.

Why security work needs a memory

Deepsec treats analysis as state, not output. The central record, FileRecord, tracks where a file sits in the lifecycle, what has already been analyzed, and what happened along the way. That matters because real security scans get interrupted, rerun, and revised. A useful system has to remember what it already knows.

The repo’s state machine is the hidden backbone of the whole project. scan creates candidates. process adds findings and analysis history. revalidate checks whether a report still holds at the current git head. That loop makes the tool resilient to drift, and it prevents a stale finding from pretending to be fresh truth.

A WSJ-style hedcut portrait of Malte Ubl from a verified GitHub avatar. It gives a face to the maintainer behind Deepsec and grounds the project’s engineering voice in a real contributor.
A close-up black-ink ledger showing one file moving through states like pending, candidate, analyzed, and revalidated. A small bookmark and stopped clock suggest the process can resume after interruption. It explains Deepsec’s memory model and why persistence is central to the design.
Deepsec stores the path of an investigation, not just its conclusion. That lets it pause, resume, and revisit findings without wasting work.

The matcher layer is not a dumb prefilter. It is the economics engine

Deepsec’s matcher layer is full of practical compromises that read like good engineering judgment. Matchers use sentinel files, so a rule only activates when the repository has evidence that the target stack is actually present. Noise tiers rank matchers by how much trust they deserve. Example-backed contracts keep the regex honest.

DimensionTraditional SASTAI code review toolsDeepsec
Search strategyBroad rule scanning across the codebaseModel-driven review of selected diffs or filesRegex retrieval first, then targeted agent investigation
Reasoning styleDeterministic pattern checksLLM commentary or classificationAgentic investigation with follow-up revalidation
False-positive controlRules, suppression lists, tuningPrompting and reviewer judgmentNoise tiers, gating, triage, and revalidation
StatefulnessOften stateless or report-centricUsually session-centricPersistent FileRecord plus analysisHistory
ExtensibilityPlugins and custom rulesLimited workflow customizationMatcher plugins, providers, model orchestration
Execution modelLocal or CI jobMostly cloud or SaaSLocal-first with optional sandbox fan-out
Cost profilePredictable compute costLLM cost can spike with contextCheap filtering protects expensive reasoning

That table is the real category clue. Deepsec is not trying to beat conventional scanners on their own terms. It is trying to make agentic security work affordable enough, and selective enough, to be used repeatedly.

How Deepsec scales without turning into a bottleneck

The heavy lifting happens in the processor and CLI layers. Work is batched, concurrency is controlled, and reinvestigation markers keep the system from needlessly redoing old work. If the repository is large, Deepsec can fan tasks out into Vercel Sandboxes so a long tail of model latency does not stall the whole run.

The important move is that scaling does not come from one giant model call. It comes from orchestration. Deepsec breaks analysis into stages that can be parallelized, retried, and resumed. That is how the repo deals with both repository size and the slow reality of LLM throughput.

What Deepsec is really competing with

The obvious comparison is with SAST and DAST, but that misses the point. Tools like Snyk and GitHub Advanced Security are built to detect issues through well-defined analysis paths. Deepsec is closer to a harness for agentic investigation. It uses models to reason about candidate sites, then re-checks the result before surfacing it.

Tool classPrimary strengthMain weaknessWhere Deepsec differs
Traditional SASTFast, broad coverageRigid patterns can miss contextDeepsec uses reasoning after retrieval, not before
DASTFinds runtime exposureNeeds reachable environments and can be noisyDeepsec inspects code paths directly, then revalidates
AI code review/security toolsNatural-language explanations and summariesOften shallow or session-boundDeepsec is a persistent pipeline with gates, state, and sandboxed execution
Security harnessCustomizable workflowRequires more setup and disciplineDeepsec is explicitly designed as that harness

This is why the repo feels more like an operating system for security than a scanner. It defines providers, plugins, model orchestration, and execution policy. That lets teams adapt the workflow instead of accepting a fixed product shape.

The trade-off: power, cost, and trust

Deepsec is persuasive because it accepts the hard trade-offs instead of hiding them. Agentic review is expensive. It can be noisy. It depends on prompt discipline and sandboxing. It also demands trust in the revalidation layer, because a finding is only as good as the current state it was checked against.

That tension is the point. Deepsec is not pretending security can be automated into silence. It is arguing that a disciplined pipeline can make human-grade investigation cheaper, faster, and more repeatable. That is a stronger claim than “the AI found a bug.”

deepsec is the first tool that's surfaced the kind of issues we'd actually want a security engineer to flag, and it runs on infrastructure we control.

That quote captures the product’s best case: useful findings, on infrastructure the team controls, with enough structure to trust the output. The interesting part is how much machinery is working behind that simplicity.