Skip to content

About

Read-only crypto & post-quantum readiness audit for your own computer. Drop AGENTS.md + one script into Claude Code, Codex, opencode, pi, Qwen Code or any shell-capable AI agent. Get a sourced report, then fix issues one at a time with your OK.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

pqc-doctor

Read-only crypto & post-quantum readiness audit for your own computer. Drop AGENTS.md + one script into Claude Code, Codex, opencode, pi, Qwen Code or any shell-capable AI agent. Get a sourced report, then fix issues one at a time with your OK.

What it checks

  • Quantum-vulnerable crypto: RSA, ECDSA/ECDH, Ed25519/X25519, DSA and classic Diffie-Hellman.
  • "Harvest now, decrypt later" risk: SSH, TLS and VPN key exchange that is not post-quantum (PQ).
  • Things broken today: weak keys, old protocols, risky SSH config, a disabled firewall, untrusted root CAs, and secrets lying around.

It follows the NSA advisory steps: Inventory → Assess risk → Triage & fix.

What it covers, and what it does not

pqc-doctor audits your user account plus the machine's crypto settings. It does not scan the whole disk.

Covered, system-wide:

  • OS version and pending updates.
  • Installed crypto tools and their versions (OpenSSH, OpenSSL, GnuTLS, GPG, Python, Node, Java).
  • SSH server config and host keys.
  • VPN software, VPN interfaces and VPN configs in the standard system folders.
  • Every listening network port, from any process.
  • System certificate trust (root stores and custom trust settings).
  • Disk encryption, firewall, Secure Boot and browser versions.

Covered, in your home folder:

  • ~/.ssh and its subfolders: keys, config, and other files that may hold secrets.

  • Known credential files, such as ~/.aws/credentials and ~/.kube/config (presence and permissions only).

  • With --deep: a search of your home folder for stray private keys, and for cloud access-key exports in Downloads, Desktop and Documents.

  • App data folders, where apps keep their own files, depend on the OS:

    OS App data folder Searched by the deep search?
    Linux ~/.config, ~/.local/share, ~/.var/app, ~/snap Yes, always
    macOS ~/Library Only with --deep --library
    Windows AppData Only with -Deep -AppData

    The macOS and Windows folders are large, so they are off by default. ~/.cache is never searched.

Not covered:

Not covered Example
Other users' home folders A second account on the same computer
Most of the disk outside your home Keys in /opt, /srv, /var or on another volume
Files only root can read Some configs under /etc
External drives and network shares The deep search stays on one filesystem
Inside containers and virtual machines Docker images, VM disks
Secrets in files without a key header A password in a .env file or in shell history
Password manager and keychain contents Only trust settings are checked, never stored secrets

Run it as a normal user, not with sudo. As root, the script may scan root's home folder and miss yours. It also gives a script and an AI agent more access than a read-only inventory needs. If one check needs admin rights, the agent asks you first and runs only that check.

Safety

  • The inventory is read-only. The agent changes nothing until you approve each fix.
  • It never prints secrets. It shows only fingerprints, algorithms, sizes, permissions and paths.
  • Network use is opt-in. It makes one TLS handshake to pq.cloudflareresearch.com and one SSH handshake (no login) to github.com.
  • Before each fix, the agent tells you what changes, how to undo it, and what could break. It backs up config files first.

What the AI model sees

The collector reads your key files on your computer. It prints only metadata. The model sees that output, never the keys.

The model sees The model never sees
File names and paths (~/.ssh/prod.pem) The contents of private keys
Permissions and "encrypted / no passphrase" Passwords, tokens, cloud secret keys
Key types, sizes and fingerprints (public data) The contents of credential files
Crypto-related config lines (~/.ssh/config, VPN configs)
Listening services and software versions

With a cloud model, that metadata leaves your computer. It goes to the model provider (Anthropic, OpenAI, and others). The script hides your username, hostname and emails. File names can still reveal client or project names, and config lines can contain hostnames.

If nothing at all may leave your computer, you have two options:

  • Use a local model, for example opencode or pi with Ollama.
  • Review the output first. Run bash crypto-inventory.sh > inventory.txt, remove what you do not want to share, then ask the agent to read inventory.txt instead of running the script.

Extra guard for Claude Code. .claude/settings.json blocks Claude Code's file-reading tool on key and credential files (~/.ssh, ~/.aws, *.pem, *.key, and others). The audit still works, because the collector runs as a separate program. Other agents rely on the rule in AGENTS.md.

  • The guard does not block shell commands such as cat. It is a second lock, not a wall.
  • If you turn on Claude Code's sandbox, the same rules also block the collector. So .claude/settings.json lets bash crypto-inventory.sh run outside the sandbox. Claude Code asks you to approve it once. This works only for the plain command, without > file or pipes.
  • As a Claude Code plugin, the project settings do not travel with it. A hook in the skill (hooks/block-secret-reads.sh) gives the same guard instead. It turns on when the skill loads and stays on until the conversation ends (/clear). It still lets the agent read ~/.ssh/config, known_hosts and *.pub, which the fixes need. With the sandbox on, the plugin's collector needs your approval to run outside it.
  • If any check is still blocked, the collector says so. Its RESULT section ends with INCOMPLETE and lists the checks that could not run. "Nothing found" never hides "could not look".

For extra caution: turn on Claude Code's sandbox. It is off by default. Type /sandbox in Claude Code before you start the audit.

  • What it adds: shell commands can no longer read key and credential files either. With the guard alone, a command such as cat ~/.ssh/id_rsa is stopped only by the rule in AGENTS.md and by your approval of the command.
  • What it costs: you approve the collector once, so it can run outside the sandbox. Extra checks by the agent and each fix in step 4 also ask for your approval.
  • Where it works: macOS, Linux and WSL2. Not native Windows.

Quick start

Claude Code, as a plugin (works from any folder):

/plugin install pqc-doctor --marketplace include/pqc-doctor

Then ask for "a post-quantum audit of this computer", or type /pqc-doctor:pqc-doctor. The plugin does not work in claude.ai or through the Claude API: there, skills run in a cloud container, so it would audit that container, not your computer.

From a terminal, outside Claude Code:

claude plugin install pqc-doctor --marketplace include/pqc-doctor   # install
claude plugin update pqc-doctor@pqc-doctor                          # get the latest version
claude plugin uninstall pqc-doctor@pqc-doctor                       # remove

Any other agent, from a clone. There is nothing to install. The agent reads AGENTS.md from the folder you start it in:

git clone https://github.com/include/pqc-doctor.git && cd pqc-doctor
codex        # or opencode, pi, qwen, gemini, copilot, aider... (see the table)
# then type:
start the audit

To update, run git pull in the folder. Outside Claude Code, the Read guard does not apply. The rule in AGENTS.md still tells the agent never to open key or credential files.

You can also run the collector on its own:

bash crypto-inventory.sh                    # local facts only
bash crypto-inventory.sh --network --deep   # + PQ handshake test + home-folder key search
bash crypto-inventory.sh --deep --library   # macOS: the key search also covers ~/Library (much slower)
bash crypto-inventory.sh > inventory.txt    # save output (git-ignored)

On Windows (PowerShell 5.1 or 7+):

powershell -ExecutionPolicy Bypass -File .\crypto-inventory.ps1                  # local facts only
powershell -ExecutionPolicy Bypass -File .\crypto-inventory.ps1 -Network -Deep   # + PQ handshake test + key search
powershell -ExecutionPolicy Bypass -File .\crypto-inventory.ps1 -Deep -AppData    # the key search also covers AppData (much slower)

Run it from an elevated (Administrator) prompt to also see the BitLocker method, Secure Boot, TPM and SMBv1. It stays read-only either way.

Supported agents

Agent (harness) Works out of the box? Start with
Claude Code Yes (CLAUDE.md imports AGENTS.md), or install the plugin claude
OpenAI Codex CLI Yes codex
opencode Yes opencode
pi Yes pi
Qwen Code Yes qwen
Gemini CLI Yes (.gemini/settings.json adds AGENTS.md) gemini
GitHub Copilot CLI Yes copilot
DeepSeek Harness (dsh) Yes (developer preview) dsh
Grok Build (includes Cursor CLI) Yes —
Kimi Code CLI, goose, Crush, Amp, Codewhale Yes —
Aider Yes (.aider.conf.yml adds AGENTS.md) aider
Any other tool Paste the part of AGENTS.md below the line as the system prompt —

Use a capable model with web access if you can. The agent cites official sources for each finding and fix.

The report

The agent writes a fixed layout:

  1. Summary: overall state, count by severity (🔴 🟠 🟡 🟢), and the single most important action.
  2. Findings table: # | Sev | Area | Finding | Why it matters | Fix | Who | Source.
  3. Key points: two or three lessons specific to your machine.
  4. Next step: which fixes to start with.
  5. Limits: what it did not check.
  6. References: every cited source, with links.

See docs/example-report.md for an example with invented findings. The layout is fixed. The wording varies by agent and model.

Files

File Purpose
AGENTS.md The agent prompt: safety rules, procedure, severity rubric, report format, references
CLAUDE.md One line (@AGENTS.md) so Claude Code loads the prompt
.claude/settings.json Blocks Claude Code's file-reading tool on key and credential files
.gemini/settings.json Tells Gemini CLI to read AGENTS.md
.aider.conf.yml Tells Aider to read AGENTS.md
crypto-inventory.sh Read-only collector for macOS and Linux
crypto-inventory.ps1 Read-only collector for Windows
CHANGELOG.md What changed in each version
.claude-plugin/ Claude Code plugin and marketplace manifests (the repo itself is the plugin)
skills/pqc-doctor/SKILL.md The Claude Code skill: points to AGENTS.md and the collectors
hooks/block-secret-reads.sh The skill's guard: blocks the Read tool on key and credential files
tests/test-block-secret-reads.sh Checks which paths the guard blocks and allows

Status and limits

  • crypto-inventory.sh was tested on:
    • macOS 27
    • MX Linux 23.6 (Debian 12 base), kernel 7.3.5-2-liquorix-amd64
    • Omarchy (Arch-based), kernel 7.2.15-4-omarchy
  • crypto-inventory.ps1: syntax and key-detection logic tested in PowerShell 7. Not yet run on a real Windows machine.
  • --deep lists every file that holds a private key header. Some are test or sample keys. The agent judges each one.
  • On macOS, --deep may trigger a system prompt for access to Downloads, Desktop or Documents.
  • Keep AGENTS.md under 32 KiB. Codex reads at most 32 KiB.

Learn more

See the # References section at the end of AGENTS.md. It lists NIST, NSA, NCSC, OpenSSH, OpenSSL, vendor and cloud sources.

License

MIT. See LICENSE.

About

Read-only crypto & post-quantum readiness audit for your own computer. Drop AGENTS.md + one script into Claude Code, Codex, opencode, pi, Qwen Code or any shell-capable AI agent. Get a sourced report, then fix issues one at a time with your OK.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages