Back/Engineering/Claude
IntermediateEngineering

How to Set Up a Continuous Code Security Scan Using a Hybrid AI Workflow

Implement a 24/7 security scanning system where a local AI model continuously scans your codebase for issues, and a powerful cloud model periodically reviews and validates the findings for a cost-effective solution.

How to Set Up a Continuous Code Security Scan Using a Hybrid AI Workflow

From 20:42 to 22:24, Alex Finn explains how a local model continuously scans code for security issues and hands credible findings to Claude Code for deeper analysis. Clip range: 20:42 to 22:24.

Before you start

What you need

  • Mac Studio or another high-memory machine
  • Local GLM 5.2 model installation
  • Source code repository to scan
  • Claude Code environment for cloud review
  • Scheduled scan intervals and reporting path

What you’ll make

A prioritized security findings report with validated risks and suggested code fixes.

Tools used

Step by step

The workflow

Follow the sequence once, then adapt the prompts, checks, and handoffs to your own setup.

5 steps

Step01

Set Up the Local 'BDR' Model

On a machine with high unified memory, such as a Mac Studio, load a large local model like GLM 5.2. Set this model to run as an agent, scanning your codebase for potential security issues at a regular interval, for example, every 30 minutes.

Step02

Generate Findings Reports

Instruct the local model to compile all potential security issues into a single, structured text file. A Markdown report is a good format because it's readable and easy to parse. This report will be the input for the cloud model.

Example prompt
You are a security analysis agent tasked with scanning a codebase for potential vulnerabilities.

Analyze the code provided below. For each potential issue you identify, create a finding that includes:
1. A description of the potential vulnerability.
2. The relevant code snippet.
3. A severity rating (Low, Medium, or High).

Format the entire output as a single Markdown file.

[paste code to be scanned]
Step03

Configure the Cloud 'Closer' Model

In a powerful cloud-based AI environment like Claude Code, set up a recurring loop to run once a day. The blog post mentions using a command like/loop 24 hours.

Step04

Review and Validate Findings

Set up a powerful cloud model, such as Claude Code, to run once a day. Its task is to ingest and analyze the Markdown report from the local model, reviewing the entire list of potential issues.

Step05

Prioritize and Suggest Fixes

The cloud model acts as the expert 'closer' by reviewing the code snippets for each finding, determining which issues are legitimate security risks, and suggesting how to fix them.

Example prompt
You are an expert security code reviewer. Your task is to prioritize validated security risks and suggest fixes.

For the list of security issues below, prioritize them from most to least critical. For each issue, provide a clear explanation of the risk and a corrected code snippet that implements the fix.

[paste list of validated security risks]

What good looks like

  • Local model produces a structured Markdown findings report
  • Cloud review process runs on the configured daily schedule
  • Each validated issue includes severity and affected code snippets
  • Suggested fixes contain corrected code examples for confirmed risks

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

After the steps

Runbook notes

How to recover when the loop fails and where human judgment helps.

Recover

If it goes sideways

Local model reports a high volume of false positives
Tune scan prompts with repository-specific patterns and known-safe exclusions
Cloud review misses critical vulnerabilities from the local report
Require manual review for all high-severity findings before closure
Security reports expose sensitive source code in shared storage
Restrict report access and redact secrets before upload

Start shipping
better products.

Join 100,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start
No credit card
SOC 2 certified
Enterprise ready