detrix: Command for Claude Code

.claude/commands/audit.md

audit is a command for Claude Code from flashus/detrix. It costs 12 tokens per session (1,890 once invoked), scanned A, original, MIT.

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

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md; mentions subagents; names the AskUserQuestion tool.

This is flashus/detrix's own configuration. It tells Claude Code how to work on detrix itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything detrix configures →

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/ilyadyachenko/Documents/Yandex.Disk/_src/detrix/detrix-release.

Reuse

Borrowing it

Nothing to install: this file belongs to flashus/detrix. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/flashus/detrix/main/.claude/commands/audit.md
Clone the repo
git clone --depth 1 https://github.com/flashus/detrix

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for audit

README.md
[![agentmods](https://agentmods.dev/badge/commands/flashus/detrix/audit/github.svg)](https://agentmods.dev/commands/flashus/detrix/audit)
Your own site
<a href="https://agentmods.dev/commands/flashus/detrix/audit"><img src="https://agentmods.dev/badge/commands/flashus/detrix/audit/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for audit

Your own site · 80×15
<a href="https://agentmods.dev/commands/flashus/detrix/audit"><img src="https://agentmods.dev/badge/commands/flashus/detrix/audit.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00012 $0.01890
Opus 5.5 $0.00005 $0.00756
Sonnet 5.5 $0.00002 $0.00378
Haiku 4.5 $0.00001 $0.00189

Measured 2mo ago against content hash 4efd279fe0b8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo ago.

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. 2mo ago 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 (28 stars, last pushed 2mo ago), licensed MIT. It adds 12 tokens to every session and 1,890 once invoked, about $0.0000 per session on Opus 5.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.