Skip to content

Cryptographic inventory with an AI agent: a post-quantum test

We tested AI agents on finding quantum-vulnerable cryptography in three codebases. With Cloudflare's open prompt, five models found 92% to 98% of the labelled items.

Published 12 min read

An AI coding agent can do most of the first step of a post-quantum migration: finding the places a codebase uses public-key cryptography. On 3 and 4 December 2026 we measured how well. We built an answer key of 32 uses of public-key cryptography in three open-source projects, written by an AI agent that read the code before any tested model ran. Then we ran Claude Code on five models with three different instructions, 69 runs in all. With Cloudflare's open discovery prompt, the five models found between 92% and 98% of the items across their runs, in a median of 5 minutes and about ten cents per project.

The short version:

  • Use a written discovery prompt. Cloudflare's published prompt found 95% of the labelled items across 30 runs. A one-paragraph request found 72.5%.
  • A low-cost model is enough. DeepSeek V4.1 Flash Fast found 98% in about 4 minutes per project. GLM 5.3 Flash found 92% in 2 minutes.
  • Check library defaults yourself. An agent cannot see what a dependency does by default unless it can read the dependency. On the one project where this mattered, 11 of 23 runs stated a classical default that was wrong.
  • Treat it as a strong first pass. Cloudflare says not to use its prompts as your only inventory tool. Check the findings, and run the agent in a sandbox: it reads code you did not write.

Why start with an inventory

On 2 December 2026 the White House's cyber office, the NSA and CISA said that American companies working on what the statement calls super intelligence had disclosed discoveries that "impact the security of some cryptography currently in use". Their assessment was that these advances do not present an immediate and widespread threat, and that industry and government should upgrade digital infrastructure expeditiously. The same day the NSA told the owners of national security systems to accelerate the move to post-quantum cryptography immediately, and listed "Inventory your cryptographic dependencies" as step 1.

Whatever those discoveries turn out to be, the long-standing quantum risk is to public-key cryptography: RSA, elliptic-curve signatures and key exchange, and Diffie-Hellman, which a large enough quantum computer would break. These hide in TLS settings, SSH libraries, signed tokens, certificate tooling and library defaults, often far from any line that names an algorithm. Finding them is mostly reading code, which is the kind of search a coding agent is good at, if it is told exactly what to look for.

What we tested

Three projects, each checked out at a fixed commit:

Project Language Its public-key cryptography Items
chisel Go SSH tunnel inside WebSocket, with optional TLS, mutual TLS and Let's Encrypt 11
dehydrated Bash ACME client: account keys, signed requests, certificate keys, CSRs, OCSP 7
sydent Python Matrix identity server: Ed25519 signing, replication over mutual TLS, federation 14

We asked in three ways:

  1. A plain request: one paragraph asking for every use of public-key cryptography that a quantum computer could break, with a short output format.
  2. Cloudflare's discovery prompt: stage 1 of the experimental prompts Cloudflare published from its own research on AI-assisted cryptography discovery, under the Apache-2.0 license. We filled in the repository details and added two sentences saying where the code was and that there was no network.
  3. Factory's migrate-post-quantum skill, under the MIT license, installed as a Claude Code skill and run out of the box on its default path, audit only.

Each run used Claude Code 2.1.332 on one of five models: GLM 5.3 Flash, DeepSeek V4.1 Flash, DeepSeek V4.1 Flash Fast, GLM 5.3 and Kimi K3.1 Pro. It ran inside a Docker container with the code mounted read-only and no internet access. We ran the prompt twice per model and project, the plain request and the skill once, and the skill a second time on the three lower-cost models.

How we scored

Before any of the five models ran, an AI agent (Anthropic's Claude Opus 5.5, which also built the test harness) read each project and wrote down every operation that would be migrated on its own: the 32 items. The list was frozen with a hash before the first scored run. The same agent then scored every finding against it under run codes, without knowing which model had written which run. An item counted only if a finding described that operation and got that item's algorithm, default and role right.

A second Claude agent, given only the list, the findings and the code, scored a random sample of nine runs on its own. The two agreed on 95 of 96 decisions. No person has reviewed the list or the scores yet.

Results

Share of the labelled items found:

Model Plain request Cloudflare's prompt Factory's skill
GLM 5.3 Flash 47% 92% 59%
DeepSeek V4.1 Flash 88% 95% 92%
DeepSeek V4.1 Flash Fast 81% 98% 78%
GLM 5.3 53% 95% 75%
Kimi K3.1 Pro 94% 95% 94%
All runs 72.5% 95.3% 78.5%

Time and cost per project with Cloudflare's prompt:

Model Median time Cost per project
GLM 5.3 Flash 2 min $0.02
DeepSeek V4.1 Flash 11 min $0.06
DeepSeek V4.1 Flash Fast 4 min $0.05
GLM 5.3 3 min $0.16
Kimi K3.1 Pro 8 min $0.18

The costs are what we were billed on 3 and 4 December 2026, on average per run, with about 85% of input tokens billed at the cached rate. The pricing page has current rates. The whole test, the 69 scored runs and a few trial runs on a fourth project, cost $25.66.

What the numbers say:

  • The prompt does most of the work. With it, the weakest model found 92% and the worst single run 73%. Without it, two models found about half. Factory saw a similar gap on its own test: 90.0% with its work list against 74.6% for a plain agent.
  • Wrong findings were rare. With the prompt, 4 of 327 findings were not public-key cryptography or stated a wrong algorithm, default or role, and 5 more had a smaller inaccuracy. We checked 40 of its citations at random against the code: 38 pointed at exactly the lines described, and 2 were a few lines off.
  • Most misses were key exchanges left to library defaults. A run either skipped one side of a TLS connection or stated a wrong default. The rest were mostly keys and certificates the operator supplies, and code that checks signatures someone else made. Key generation and signing were found almost every time.

How to run it

Step 1: point Claude Code at CommentLLM

Our Claude Code setup guide covers the details. For this job these were the main environment variables we gave Claude Code, so that every helper and background task ran on the same model:

export ANTHROPIC_BASE_URL="https://api.commentllm.com"
export ANTHROPIC_AUTH_TOKEN="cllm_..."
export ANTHROPIC_MODEL="deepseek-v4.1-flash-abliterated-fast"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="$ANTHROPIC_MODEL"
export ANTHROPIC_DEFAULT_SONNET_MODEL="$ANTHROPIC_MODEL"
export ANTHROPIC_DEFAULT_OPUS_MODEL="$ANTHROPIC_MODEL"
export CLAUDE_CODE_SUBAGENT_MODEL="$ANTHROPIC_MODEL"
export CLAUDE_CODE_MAX_CONTEXT_TOKENS="1048576"
export CLAUDE_CODE_MAX_OUTPUT_TOKENS="32000"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"

We also set API_TIMEOUT_MS=900000 for long answers, and DISABLE_TELEMETRY=1 and CLAUDE_CODE_ATTRIBUTION_HEADER=0. In our runs the container held no key at all. A small proxy outside it held the key and forwarded requests to the API, and the container could reach nothing else.

Step 2: check out the code at one commit

git clone https://github.com/jpillora/chisel.git
cd chisel
git checkout 5ee6c74d60d96a75afb18bc866eb19327170aeed

The prompt asks for a fixed revision, so every finding points at lines that will not move. Mount the checkout read-only into the container.

Step 3: fill in the prompt

Download prompts/01-discovery.md from Cloudflare's repository and replace its placeholders. For chisel we put:

  • <REPOSITORY_NAME>: jpillora/chisel
  • <FULL_COMMIT_HASH_OR_IMMUTABLE_REVISION>: the full commit hash from step 2
  • <SHORT_UPPERCASE_SLUG> and <SLUG>: CHISEL
  • <URL_TO_BROWSE_FILES_AT_THIS_REVISION>: https://github.com/jpillora/chisel/blob/ followed by the commit hash

We also added two sentences, as their own paragraph, before the line "Work read-only.": "The repository is checked out read-only at /repo. There is no network access." Nothing else in the prompt changed.

Step 4: run it

Inside the container, from the folder that holds prompt.md:

claude -p "$(cat prompt.md)" --output-format stream-json --verbose \
  --max-turns 150 --dangerously-skip-permissions > run.jsonl

--dangerously-skip-permissions lets Claude Code run commands without asking. Use it only in a container you can throw away. On your own machine, start claude in the checkout, paste the prompt and approve each command instead.

The report is the final message. stream-json also keeps every earlier message, which saved one of our runs (see below).

Step 5: read the report

The report is Markdown: what was searched, one block per finding with the code it cites, then what was left out and why. Here is one finding from a DeepSeek V4.1 Flash Fast run on chisel, shortened: we left out four of its seven fields and replaced the links with file names and line numbers.

CHISEL-002: Server SSH host-key signing during handshake

  • What it does: The parsed private key is installed with AddHostKey on the ssh.ServerConfig; when a client completes ssh.NewServerConn, x/crypto/ssh signs the handshake with it. This signature is the proof of server identity the client can pin via fingerprint.
  • Algorithm: Depends on the imported key; default/generated key is ECDSA P-256 (ssh.ParsePrivateKey).
  • Evidence: server/server.go lines 108-120, parse PEM, build ServerConfig, AddHostKey; server/server_handler.go lines 55-63, WebSocket upgrade then ssh.NewServerConn

Then check three things by hand:

  • Library defaults. For every finding that says the algorithm is chosen outside the repository, look up the default in the exact library version the project pins.
  • The usual misses. Look at both sides of each TLS connection, at keys and certificates the operator supplies, and at code that only verifies signatures.
  • The citations. Open the cited lines before a finding goes into a plan.

Cloudflare's own README says the same: the prompts can miss uses and report false ones, so do not use them as your only cryptographic inventory tool or as a substitute for security review.

Where the agents went wrong

Library defaults. chisel pins version 0.55.0 of Go's SSH library, whose default key-exchange list starts with the hybrid post-quantum mlkem768x25519-sha256. Its TLS comes from Go, which has offered the hybrid X25519MLKEM768 by default since Go 1.24. So when both ends are built from this commit, chisel's key exchange is already hybrid post-quantum, while its server host key is still classical ECDSA P-256.

None of the agents could see this, because the library sources were not in the container. 11 of the 23 runs on chisel stated a classical key exchange as fact: 3 of 10 with the prompt, 4 of 5 plain runs and 4 of 8 with the skill. A few said it might already be hybrid and marked that as unconfirmed, which is the right answer without the sources. Giving the agent those sources should close this gap: for chisel, the vendored dependencies (go mod vendor) and the Go toolchain's own source for crypto/tls. We have not tested that.

Two runs failed in a way you would notice, out of 69:

  • GLM 5.3 with the prompt wrote a complete report, then produced invisible characters until it hit its output limit. The final message was a stub, and the report was in an earlier message.
  • GLM 5.3 Flash with Factory's skill ran the same search 64 times and stopped at the turn limit without writing findings. Its second run on the same project found 13 of 14 items.

Check that the report is there before you rely on it, and run again if it is not. Separately, our own spending cap stopped two runs of the skill early. We reran one. The other, Kimi K3.1 Pro on dehydrated, had already written its findings, which we scored, but not its report or plan.

Factory's skill or Cloudflare's prompt?

They do different amounts of work. Cloudflare's discovery prompt finds and describes. Factory's skill runs a whole audit: it classifies each finding, writes a CycloneDX CBOM, a report and a remediation plan, and can then open pull requests. It also reported things outside our list, such as release artifacts that nothing signs.

For finding the cryptography, the prompt did better in our test: 95% against 79%, a median of 5 minutes against 19, and about $0.10 a project against $0.86. One run of the skill produced nothing.

Three things favour the prompt in this comparison:

  • How we split the items. Our list has one item per operation that would be migrated on its own, which is how the prompt asks for findings. The skill merges related uses into one record, which can cost it items under our rule.
  • What the sandbox allowed. The skill expects to read dependency sources and look at live systems, and our container offered neither.
  • How it ran. The skill is designed as a lead agent with six helpers. Only 6 of our 24 runs launched helpers; the rest worked alone.

Factory reports 90.0% with its work list against 74.6% for a plain agent, on a codebase it held back for testing (README). If you want the CBOM and the plan, the skill did best here on DeepSeek V4.1 Flash (92%) and Kimi K3.1 Pro (94%). If you want the list quickly and cheaply, use the prompt.

Limits of this test

  • Three small projects and 32 items. We do not know how the numbers hold on a large monorepo.
  • An AI agent wrote the answer key, and no person has reviewed it yet. The second judge, also an AI agent, checked the scoring, not the key.
  • The projects are public, so the models may have seen them in training.
  • No network: the agents could not read dependency sources or check live systems.
  • Anthropic does not support running Claude Code on non-Claude models. We used version 2.1.332, and a later version may behave differently.
  • The times are rough. Up to 12 runs shared one rate limit.

Where CommentLLM fits

CommentLLM serves these five models through an Anthropic-compatible API with a 1,048,576-token context window, so Claude Code and other agents can use them as shown above. Treat an inventory as confidential: it lists where your cryptography is weakest, so keep it out of public issues and pull requests. If your code cannot go to an outside API, a private deployment runs abliterated GLM and DeepSeek models in a cloud account you own, operated by CommentLLM.

The post-quantum readiness page covers the rest of an assessment: ranking by risk, questions for vendors, the migration plan and the deadlines already set.

Questions

Can an AI agent build a cryptographic inventory?

It can do most of it. In our test on three small open-source projects, Claude Code with Cloudflare's discovery prompt found 92% to 98% of the items in an answer key written by an AI agent, on each of five models. Cloudflare says not to use its prompts as your only inventory tool, and the agent cannot see library defaults unless it can read the dependency sources, so check the findings yourself.

Which prompt finds quantum-vulnerable cryptography best?

In our test, stage 1 of Cloudflare's crypto-discovery-prompts, which is open source under the Apache-2.0 license. It found 95% of our labelled items across 30 runs, against 72.5% for a one-paragraph request.

Does an AI agent produce a CBOM?

Cloudflare's discovery prompt produces a Markdown list of findings, not a CBOM. Factory's migrate-post-quantum skill writes a CycloneDX CBOM along with a report and a remediation plan. In our test it found fewer of the labelled items than the prompt, took longer and cost more.

How long does an AI cryptography audit take?

With Cloudflare's prompt, a median of 5 minutes per project in our test, from 2 to 11 minutes depending on the model. Our projects were small, so a large codebase will take longer. The cost depends on the model and the size of the code, and the pricing page has current rates.

What do AI agents miss when they look for cryptography?

In our runs most misses were key exchanges left to library defaults, often on one side of a TLS connection. Next came keys and certificates the operator supplies, and code that checks signatures made by someone else. Key generation and signing were found almost every time.

Start building today.

Create an account, tell us what you work on, and send your first request.