papi-audit

A branch-review command that checks recent code changes for bugs, project rule violations, and outdated documentation. It uses the conventions written in CLAUDE.md, a project instruction file.

In plain words
What is it for?
Reviewing changed files, checking naming, types, errors, and imports, and reporting each finding with its file, line, severity, problem, and suggested fix.
Why use it?
It helps catch problems before the changes are merged, including overlooked edge cases and documentation that no longer matches the code.

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/rygel/aiusagetracker/papi-audit
Clone the repo
git clone --depth 1 https://github.com/rygel/AIUsageTracker

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 303 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.00000 $0.00303
Opus 5 $0.00000 $0.00151
Sonnet 5 $0.00000 $0.00061
Haiku 4.5 $0.00000 $0.00030

Measured 3d ago against content hash 1ca7dfef2767, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

papi-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 3d 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/papi-audit.md · 35 lines

What it actually says

Audit the latest changes in this branch for bugs and compliance with the project's conventions defined in CLAUDE.md.

Steps

  1. Identify changed files: Run git diff main --name-only to find all files modified on this branch.

  2. Read each changed file and review it for:

Bug check

  • Logic errors, off-by-one mistakes, incorrect conditions
  • Unhandled edge cases (null, undefined, empty inputs)
  • Race conditions or state management issues
  • Functions that could throw but aren't wrapped in try/catch where needed
  • Incorrect type narrowing or unsafe casts

Code style (from CLAUDE.md)

  • Check all conventions defined in CLAUDE.md and flag any violations
  • Pay special attention to naming, typing, error handling, and import patterns

Documentation check

  • For each changed source file, check if any documentation in docs/ describes behaviour that the change modified
  • If a doc needs updating, report it as a finding with severity "Doc drift"
  1. Report findings in this format:

For each issue found:

  • File: path and line number
  • Severity: Bug / Convention violation / Nitpick
  • Issue: What's wrong
  • Fix: How to fix it

If no issues are found, state that the changes are clean.

  1. Note pre-existing issues separately — flag them but don't fix them unless they interact with the new changes.
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. 3d ago First seen · 35 lines · 0 tokens per session scan A 1ca7dfef2767

Subscribe to this mod's changes

papi-audit is a command published in the GitHub repository rygel/AIUsageTracker (44 stars, last pushed 7d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 303 tokens. 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.