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.
npx agentmods add commands/sdsrss/claudemd/claudemd-sampling-auditgit clone --depth 1 https://github.com/sdsrss/claudemdWrote 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.
[](https://agentmods.dev/commands/sdsrss/claudemd/claudemd-sampling-audit)<a href="https://agentmods.dev/commands/sdsrss/claudemd/claudemd-sampling-audit"><img src="https://agentmods.dev/badge/commands/sdsrss/claudemd/claudemd-sampling-audit.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00111 | $0.01480 |
| Opus 5 | $0.00056 | $0.00740 |
| Sonnet 5 | $0.00022 | $0.00296 |
| Haiku 4.5 | $0.00011 | $0.00148 |
Grade A, and why
claudemd-sampling-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 today.
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.
How it starts
The opening of the file, as written. The whole thing — 46 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Default window is 30 days, current project only. If the user passes a number (e.g. /claudemd-sampling-audit 60), set CLAUDEMD_SAMPLING_DAYS=$ARGS before invocation.
Run: CLAUDEMD_SAMPLING_DAYS=${ARGS:-30} node ${CLAUDE_PLUGIN_ROOT}/scripts/sampling-audit.js
Flags (append after the number when needed):
| Flag | Effect |
|---|---|
--days=N |
Window in days (positive integer, default 30; overrides env). |
--sample=N |
Random subset of N transcripts within the window (per project dir). |
--global |
Scan all CC project dirs (~/.claude/projects/*) — not just cwd; adds byClass self-repo vs external stratification. |
--json |
Emit machine-readable JSON to stdout instead of a markdown report. |
The JSON / markdown contains:
| Field | Meaning |
|---|---|
windowDays |
Window in days actually used. |
metricContract |
The A2 pre-registered constraint: compliance = 1 − violations/opportunities; a rate without its denominator is not evidence. |
scannedTranscripts |
Transcripts within the window that contained ≥1 assistant text turn. |
totalTurns |
Total assistant text turns scanned (sum across transcripts). |
unreadableTranscripts |
Transcripts the reader could not open, with the reason ([] is the healthy case). Non-empty means every denominator below describes a SMALLER population than the file count implies — say so when reporting rates, do not quote them as if the sample were complete. |
byRule[<§rule>].violations |
Per-rule violation count (for §10-V: turns with ≥1 match; hits keeps the raw per-pattern match count). |
byRule[<§rule>].opportunities |
Denominator: detected trigger contexts for that rule (Done lines examined / substantive Uncertain lines / typed-after-tool-turn messages / compaction events / hard-class ops / …). |
byRule[<§rule>].precision / .status |
A4 calibration state. precision stays null until ~50 flagged + ~50 unflagged samples are hand-labeled; status is collecting until precision ≥ 0.8, then calibrated. Uncalibrated ratios are collection data, NOT compliance evidence. |
byRule[<§rule>].transcriptsAffected |
Distinct transcripts with ≥1 violation for that rule. |
byClass |
--global only: {self, external, unknown} split of violations/opportunities per rule (self = project dir ends in -claudemd). Self-repo dogfood and external signal must never be pooled. |
overCeremony |
C1 measure (v0.29.0): totalSegments (typed-user task segments; bare 继续/next continuations extend the current segment) / l0l1Segments (segments that edited ≥1 file, ≤2 distinct files, <80 estimated LOC) / overCeremonySegments (L0/L1-shaped segments containing ≥1 model-initiated ceremony Skill call: sp brainstorming / test-driven-development / systematic-debugging / writing-plans / executing-plans) / ceremonyInvocations (per-skill counts, all segments). C2 pre-registered threshold: after 30d, rate < 5% → keep superpowers, close P3; ≥ 5% → evaluate uninstall (§EXT §12 fallback) / fork / hook-disable. Q&A segments (0 edits) are not opportunities — ceremony there can be correct §2.1 routing. |
perTranscript |
Array of {file, hits: [{rule, turn?, ...}]} — limited to transcripts with ≥1 violation. |
Default output (no --json): writes tasks/sampling-audit-<YYYY-MM-DD>.md in the current project (LOCAL calendar day since v0.73.0 — it was UTC, so east of Greenwich a morning run wrote yesterday's filename) and prints a one-line-per-rule violations/opportunities summary to stdout. A same-day re-run refuses to overwrite that file and says so (v0.57.0, after one silently replaced a 216-line hand-annotated calibration record with a 16-line fresh scan); pass --force to replace it anyway, or --json to print without writing. The report also carries a Reader integrity: line stating how many transcripts were unreadable and how many lines failed to parse — printed in both states, so a clean run is distinguishable from a line that stopped appearing.
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.
- today Changed · +1 lines e72fac56f5e4
- 5d ago First seen · 45 lines · 111 tokens per session scan A 361c29b8ac78
claudemd-sampling-audit is a command published in the GitHub repository sdsrss/claudemd (2 stars, last pushed yesterday), licensed MIT. It adds 111 tokens to every session and 1,480 once invoked, about $0.0006 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-31.
Other commands, from other repositories
brooks-health
Run a Brooks-Lint codebase health dashboard across all four dimensions.
brooks-debt
Run a Brooks-Lint tech debt assessment.
plan
Turn an approved spec into an implementation plan an engineer with zero context could execute — with a quality controller that blocks placeholders and hollow tasks.
simplify
The over-engineering review: five tags (delete, stdlib, native, yagni, shrink), a mandatory replacement per finding, and a real null result when there is nothing to cut.
audit
Onboard an existing codebase: every domain's checks over the whole tree, then a triaged plan to bring it in line.
git
The pre-finish status: branch, hygiene findings, message checks, workflow lint, template state.