Business News · XiaoHu Explains

Canada's Alberta Province Uses Claude Code for Security Review — Scans 466 Million Lines of Code in 20 Hours, a Job That Once Took 6.5 Years

50 agents worked autonomously in parallel, covering 27 provincial departments and 3,400 code repositories — and could automatically fix vulnerabilities and rewrite legacy systems too.
At a Glance
  • Since 2025, Alberta's Ministry of Technology and Innovation has used Claude Code (paired with the Claude Opus and Claude Sonnet models) to review the security of government systems.
  • About 50 agents worked autonomously in parallel, scanning 466 million lines of code in 20 hours — covering 27 provincial departments, roughly 1,280 applications, and 3,400 code repositories.
  • The team estimates a traditional manual review at the same scale would have taken about 6.5 years.
  • Claude Code doesn't just locate vulnerabilities — it can also generate fixes, write tests, and even rewrite outdated systems in modern languages. A 25-year-old Java subsidy system that originally took 5 months to build by hand was rebuilt in just 4 to 5 days.
  • The team also built continuously running red team / blue team security review agents that check roughly 95 security controls per application on every pass; Alberta has published a technical white paper for other governments to reference.
This piece was published on Anthropic's official site to showcase a customer case study. The scale figures and time comparisons in it (like "6.5 years") are mostly self-reported estimates disclosed by the Alberta team; what follows is a factual retelling of the original.
1Who's Behind This

Who's Using AI to Check Government System Security

Alberta's Ministry of Technology and Innovation started using Claude Code (paired with the Claude Opus and Claude Sonnet models) in 2025 to run security reviews on provincial government systems: finding vulnerabilities, fixing them, and along the way building a security review tool that keeps running continuously.

A team inside the ministry had about 50 agents work autonomously in parallel, scanning 466 million lines of government code in 20 hours.
Why it matters: This is the largest publicly known AI code security review at government scale to date. The team estimates the same-scale work would have taken about 6.5 years with traditional manual review.
2How Big Was the Problem

How Old and Messy Was This Code

Alberta's Ministry of Technology and Innovation maintains systems for 27 departments across the province — everything from social services to public safety to wildfire response depends on it. Behind that sits roughly 1,280 applications and 3,400 code repositories.

27provincial departments (social services / public safety / wildfire response...)
~1,280applications
3,400code repositories
466 million lines of code in total

Most of it had never been through a systematic security review. Years of accumulated technical debt — insecure code, unfixed bugs, outdated software — adds up to a rough estimate of billions of dollars. And these are the systems holding the most sensitive information there is: tax records, government procurement data, social services case files.

Accumulated technical debt in the billions of dollars · Most repositories previously had zero systematic security review
3How the Issues Were Found

How Do You Find Problems in 466 Million Lines of Code

About 50 agents worked autonomously in parallel, each scanning a share of the repositories. They looked not just for security vulnerabilities but also weak points in underlying infrastructure and deployment pipelines, and gaps in technical documentation.

Core Method · Two-Stage Pipeline

The whole scan runs in two stages: a rules engine does a fast first pass, flagging code that matches known suspicious patterns; then Claude reviews each flag one by one, pinpointing exactly which file and which line each issue is on so developers can go check it directly. Information gets filtered and refined at each stage.

The rules engine here is a set of pre-written mechanical matching rules: any code that fits a certain shape gets flagged. It only flags — it doesn't judge whether something is a real problem.

An analogy

It's like an airport metal detector. The alarm going off doesn't mean there's definitely a problem — it just flags the person for a closer look, and the finer check downstream decides if it's real. The rules engine's job is "setting off the alarm"; Claude handles the "finer check" afterward, and even tells you exactly which bag to open.

466 million lines of code · 50 agents scan the full set in parallel
Rules engine flags "known suspicious patterns"
Claude reviews · pinpoints exact file and line
Developers verify by line number · confirm real issues

This single pass covered every code repository Alberta owns, and turned up issues that traditional automated scanning tools had missed. It finished in 20 hours; the team estimates traditional manual review at this scale would take roughly 6.5 years.

~50
autonomous scanning agents working in parallel
20 hours
actual time for the full scan
466M lines
total government code covered
~6.5 years
estimated time for traditional manual review
4How Issues Get Fixed

Once Found, AI Fixes It

Finding the issue is only half the job. Where the scan turns up a vulnerability, Claude Code can often write the patch itself: generating the fix, running tests, completing the build.

When a system lacks automated tests and there's no way to confirm a patch is safe, Claude adds the tests first. When code is too old and too complex for patching in place to be worthwhile, it simply rewrites it in a more modern, more maintainable language. The whole process happens alongside the department's own engineers: every patch goes through human engineer review and approval before it ships.

Scan finds a vulnerability
No tests?
Add tests first
Generate a fix
or rewrite it entirely
Engineer
reviews & approves

The clearest illustration of the gap is a subsidy program portal. It was hand-written in Java 25 years ago, and building it originally took a full 5 months. Rewriting it in a modern language this time took as little as 4 to 5 days.

25 Years Ago · Built by Hand
5 months

Time it took to build the Java-written subsidy program portal from scratch, originally.

Now · Rebuilt with Claude Code
4–5 days

The shortest time needed to rewrite the same system in a modern language.

5Ongoing Oversight

Scanning Isn't the End: Red Team and Blue Team Watch Around the Clock

Scanning the systems and shipping the patches isn't the end of the story. Alberta's cybersecurity team also built a dedicated set of Claude review agents that run continuously throughout the development process — turning security review from a one-off special sweep into a standing checkpoint baked into everyday development.

Core Method · Continuous Red Team / Blue Team Review

Red team agents probe the system from outside like an attacker, working out how a vulnerability could actually be exploited; blue team agents then assess the defenses against international security standards and write remediation plans down to the specific file. The two teams work together so every application clears roughly 95 security controls on every pass.

Red Team · Offense

Plays the attacker, actively trying to break into the system from outside to work out how a vulnerability could be exploited.

Blue Team · Defense

Checks defenses against international security standards and writes concrete remediation plans specifying which file to change.

① Red Team ProbesProbes the system from outside like an attacker, finding vulnerabilities that could be exploited
② Blue Team AssessesChecks defenses against international security standards, writes remediation plans down to the file
③ Fix ShipsOnce an engineer reviews and approves, the patch goes into the system
↻ Back to step ① for the next round · ~95 security controls per application, every round

On every run, each application is checked item by item against roughly 95 security controls. These 95 items are specific checks broken out from international security standards — things like whether passwords are stored encrypted, whether user input is validated. Together they form a 95-item security checklist that gets run through from the top every single round.

Besides the red and blue teams, there are also agents dedicated to checking code quality and whether the text the public sees is clear. This entire suite of review agents is built on the Claude Agent SDK.

6Can This Be Replicated

Can Other Governments Copy This Playbook

Alberta has no intention of keeping this playbook to itself. It has already written up the entire process as a set of technical white papers, published openly for other provinces, states, and federal governments to reference — because technical debt and security vulnerabilities are headaches every government system in the world shares.

2025
The ministry formed an internal team and began using Claude to review and harden system security.
Following that
Scanned 466 million lines of code in 20 hours, fixing vulnerabilities and rewriting legacy systems.
Following that
Built continuous red team / blue team review agents, making security oversight a standing practice.
Published
A public technical white paper, giving other governments a blueprint they can follow.
July 2026
Holding an industry day in Edmonton to share what was learned from this approach.
Starting This Fall
Launching a program to roll this approach out across the provincial government.

Next, Alberta plans to have AI agents do more than fix code — working alongside engineers to build entirely new software and tools from scratch. For instance, one department has 185 legacy applications still running in production, expensive to maintain and hard to update; the team plans to use Claude Code to map them out and consolidate them into 16 reusable, modern-language applications.

Now
185

Legacy applications still running in production, expensive to maintain and hard to update.

Plan: Consolidate Into
16

Modern, reusable applications built on modern languages.

At the same time, Alberta is also training government employees and the general public on how to use AI through the "Alberta AI Academy" — teaching everything from writing prompts to shipping enterprise-grade applications.

Thousands
of government employees have learned AI through the platform
10,000+
members of the public have used the platform to learn AI
7The Numbers

The Numbers Speak

Putting the most striking numbers in this piece side by side: the same job, two very different timescales.

Actually completed with Claude Code20hours
Traditional manual review · team estimate≈6.5years
Same 466-million-line-of-code security review — that top bar, so thin it's almost invisible, is the 20 hours.
By using AI to find and fix vulnerabilities in our systems, we accomplished in a matter of hours what would have taken years the traditional way.Nate Glubish, Minister of Technology and Innovation, Alberta
Source: Anthropic's official site, "Government of Alberta uses Claude to find and fix cybersecurity vulnerabilities." The scale figures and time comparisons in this piece (including "6.5 years" and "185 → 16") are mostly self-reported estimates disclosed by Alberta's Ministry of Technology and Innovation. Alberta's published technical white paper can be found at thevelocitywhitepapers.com.