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.

Author here. Let me know if you have questions!
- Deepsec’s real trick is division of labor: regex does retrieval, agents do investigation, and revalidation keeps the system honest.
- The repo treats security review as persistent state, so interrupted scans can resume without starting from zero.
- Matcher gates and noise tiers are economic controls, not convenience features, because they keep expensive agent work focused on promising targets.
- Deepsec sits between SAST and AI code review tools: it is a security harness that orchestrates analysis, not a single analyzer.
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.
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.
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.
| Dimension | Traditional SAST | AI code review tools | Deepsec |
|---|---|---|---|
| Search strategy | Broad rule scanning across the codebase | Model-driven review of selected diffs or files | Regex retrieval first, then targeted agent investigation |
| Reasoning style | Deterministic pattern checks | LLM commentary or classification | Agentic investigation with follow-up revalidation |
| False-positive control | Rules, suppression lists, tuning | Prompting and reviewer judgment | Noise tiers, gating, triage, and revalidation |
| Statefulness | Often stateless or report-centric | Usually session-centric | Persistent FileRecord plus analysisHistory |
| Extensibility | Plugins and custom rules | Limited workflow customization | Matcher plugins, providers, model orchestration |
| Execution model | Local or CI job | Mostly cloud or SaaS | Local-first with optional sandbox fan-out |
| Cost profile | Predictable compute cost | LLM cost can spike with context | Cheap 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 class | Primary strength | Main weakness | Where Deepsec differs |
|---|---|---|---|
| Traditional SAST | Fast, broad coverage | Rigid patterns can miss context | Deepsec uses reasoning after retrieval, not before |
| DAST | Finds runtime exposure | Needs reachable environments and can be noisy | Deepsec inspects code paths directly, then revalidates |
| AI code review/security tools | Natural-language explanations and summaries | Often shallow or session-bound | Deepsec is a persistent pipeline with gates, state, and sandboxed execution |
| Security harness | Customizable workflow | Requires more setup and discipline | Deepsec 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.