Here is the basic idea: let a strong model understand the project once, then let a smaller and cheaper model review it in small pieces, with exact instructions on what to check each time.
Both models can be deployed locally. The method does not depend on a hosted model or on sending source code to an external service.
The strong model creates the plan. The cheaper model follows it. The MCP server keeps the review moving and makes sure “done” really means done.
That is the whole workflow.
-
This is a method for static security review of source code with LLMs.
-
It uses two model roles. A strong model plans the review. A cheaper model executes it. Both models can be deployed locally. The executor receives a bounded subsystem and one exactly defined review area at a time.
-
The project is reviewed in parts, so it can be much larger than the model's context window.
-
Those parts are real subsystems, not arbitrary file chunks. Split by responsibility, data, state, process, and trust boundary. Staying within 15,000 production LOC is strongly recommended. Going above that needs a good written reason. 20,000 LOC is the hard limit.
-
Not every subsystem needs every security check. The planner picks the areas that fit the code: Authentication, Access Control, Server-Side Logic and Network Reachability, Injections, Secrets, Web Sessions, Cryptography, Business Logic, Untrusted Data Flows, and Release Changes. Recent code gets extra attention because it has had less real-world review.
-
The companion
llm-code-security-review-mcprepository gives the review model one bounded task at a time, remembers progress and confirmed source reads, and checks completion. A subsystem's source is read once, then reused by its consecutive area-specific tasks in the same executor session. A new session must read the current subsystem again. -
Executor findings are not a final verdict. Post-review triage is separate work performed by a person or a separate strong model; some retained results will also need an explicitly authorized test environment.
- Start a strong model and say:
Read the security code review methodology in
<methodology-directory>and create a plan for the project in<project-directory>.
- Start a second, cheaper model and say:
Connect the MCP server in
<mcp-server-directory>, load the plan<plan>, and execute it.
The execution server is published separately as
llm-code-security-review-mcp.
The plan is the handoff between the two models. It must tell the review model:
- which source directories, files, or ranges belong to the subsystem;
- what that code does and why it matters;
- what to check;
- which callers, consumers, or data flows to follow;
- where and how to save findings;
- what result to return.
The MCP server tells the executor which assigned source is still unread. Once the subsystem is fully read, later area tasks reuse it instead of reading it again. It also verifies the finding ID, finding card and findings registry before accepting a finding or corroboration.
If the review model has to open METHODOLOGY.md, repeat system discovery, pick
its own security areas, or guess what the planner meant, the plan is not ready.
- METHODOLOGY.md explains the review method. It is written for people and for the strong planning model.
- CREATE_PLAN.md is the file you give to that planning model. It explains how to turn a repository into a complete review plan.
- CHANGELOG.md records released changes to the methodology and plan contract.
Copyright 2026 Andrew Rukin (drewrukin). Licensed under
Creative Commons Attribution 4.0 International.
Preferred attribution: “Methodology for Source Code Security Review with an LLM
by Andrew Rukin (drewrukin)”.