audit

A command that coordinates a broad code audit by assigning separate review tasks and combining their reports.

In plain words
What is it for?
Use it to audit current-branch changes, uncommitted changes, a named Rust crate, or the full project.
Why use it?
It organizes reviews across a branch, changes, crate, or entire project instead of treating the audit as one undifferentiated task.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/flashus/detrix/audit
Clone the repo
git clone --depth 1 https://github.com/flashus/detrix

Made for: Claude Code.

Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,890 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00012 $0.01890
Opus 5 $0.00006 $0.00945
Sonnet 5 $0.00002 $0.00378
Haiku 4.5 $0.00001 $0.00189

Measured yesterday against content hash 4efd279fe0b8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

audit scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/audit.md · 215 lines

How it starts

The opening of the file, as written. The whole thing — 215 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a PROJECT MANAGER coordinating a comprehensive code audit. You do NOT read source code yourself. You dispatch subagents and compile their reports.

Scope

The argument provided is: "$ARGUMENTS"

If the argument is empty or blank, you MUST use AskUserQuestion to ask the user BEFORE doing anything else:

Question: "What scope should the audit cover?"
Options:
- "Current branch" — "Audit changes on current branch vs main"
- "Uncommitted changes" — "Audit only uncommitted/staged changes"
- "Full project" — "Audit all 13 crates + clients (takes a while)"
- "Single crate" — "I'll specify which crate to audit"

If the user picks "Single crate", follow up: "Which crate? (e.g. detrix-core, detrix-api)" Then use their answer as the scope.

If the argument IS provided, map it:

  • branch — audit changes on current branch vs main
  • uncommitted — audit uncommitted changes only
  • project — audit entire project
  • A crate name (e.g. detrix-core) — audit just that crate

CRITICAL: Context Window Management

You MUST NOT read source code files yourself. Your job is to:

  1. Set up the audit directory
  2. Run automated tooling (clippy, etc.)
  3. Dispatch one subagent per crate (they each get a fresh context window)
  4. Read only the subagent OUTPUT FILES to compile the final report

This architecture lets us audit 13 crates without exhausting the context.

Phase 1: Setup & Automated Checks

mkdir -p .agents/audit

Check which crates were already audited (for resumability):

ls .agents/audit/*.md 2>/dev/null

If audit files already exist, ask the user: "Found existing audit files for [crates]. Skip already-audited crates, or start fresh?"

Run automated checks and save output:

cargo clippy --all -- -D warnings 2>&1 | head -200 > .agents/audit/_clippy.txt

Phase 2: Determine Crates to Audit

For scope branch: identify which crates have changes:

git diff main...HEAD --name-only | grep "^crates/" | cut -d/ -f2 | sort -u

Read the full file on GitHub · 215 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 215 lines · 12 tokens per session scan A 4efd279fe0b8

Subscribe to this mod's changes

audit is a command published in the GitHub repository flashus/detrix (23 stars, last pushed 8d ago), licensed MIT. It adds 12 tokens to every session and 1,890 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.