pn-audit-errors

pn-audit-errors is a command for coding agents from perniemann/pnCore. It costs 41 tokens per session (881 once invoked), scanned A, original, MIT.

A code-audit command for making application errors consistent and easier to trace. It checks error responses, logs, request identifiers, and failure flows.

In plain words
What is it for?
Use it to review error handling across a backend or selected modules, including response formats, error codes, structured logs, correlation IDs, and graceful failures.
Why use it?
It removes inconsistency between errors returned by different parts of an application and makes failures harder to follow across services. It also helps keep internal details out of responses sent to users.

Command

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/perniemann/pncore/pn-audit-errors
Clone the repo
git clone --depth 1 https://github.com/perniemann/pnCore

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 pn-audit-errors

README.md
[![agentmods](https://agentmods.dev/badge/commands/perniemann/pncore/pn-audit-errors.svg)](https://agentmods.dev/commands/perniemann/pncore/pn-audit-errors)
Your own site
<a href="https://agentmods.dev/commands/perniemann/pncore/pn-audit-errors"><img src="https://agentmods.dev/badge/commands/perniemann/pncore/pn-audit-errors.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 881 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.00041 $0.00881
Opus 5 $0.00020 $0.00441
Sonnet 5 $0.00008 $0.00176
Haiku 4.5 $0.00004 $0.00088

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

Security

Grade A, and why

pn-audit-errors 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.

packages/pn-core-mcp/content/commands/pn-audit-errors.md · 88 lines

How it starts

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

pn-audit-errors

Start every response with: [pn-command] 🔺

Advanced (palette-hidden). Not in the / slash palette. Invoked by the /pn-backend-audit umbrella, or directly via get_command("pn-audit-errors").

Focused error handling pass: audit and standardize error responses, logging, correlation IDs, and graceful error flows. No API design changes (use pn-audit-api), no security hardening (use pn-audit-security) — error handling and observability only.

Flow

1. Context

Check .pncore-stack.md for framework, logging library, and observability tools. If not found, ask:

  • "What framework? (Express/Fastify/FastAPI/Rails/other)"
  • "What logging library? (pino / winston / structlog / default / none)"
  • "Any APM or tracing in use? (Sentry / Datadog / OpenTelemetry / none)"

2. Scope

If not specified: "Full codebase error handling audit, or specific modules?"

3. Audit

Consult pn-core://skills/backend/reference/error-handling.md and load get_skill("pn-observability").

Error response consistency:

  • Mixed error shapes across routes? ({ message } in some, { error } in others)?
  • Error codes present and stable (not HTTP status numbers as codes)?
  • requestId included in all error responses?
  • Stack traces or internal DB errors leaking to clients?
  • Same error class used for both operational and programmer errors?

Centralized error handling:

  • Is there a single centralized error middleware/handler?
  • Or are errors handled ad-hoc in each route handler?
  • Async errors: are all async route handlers wrapped (asyncHandler / proper try-catch)?
  • Unhandled promise rejections: is process.on('unhandledRejection') captured?

Logging:

  • Using console.log instead of structured logging?
  • console.error without context (no requestId, userId)?
  • Correct log levels? (errors at error, handled operational errors at warn, lifecycle at info)
  • Sensitive data (passwords, tokens, PII) potentially in logs?
  • Structured JSON format configured for production?

Read the full file on GitHub · 88 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. 3d ago First seen · 88 lines · 41 tokens per session scan A 740997f593eb

Subscribe to this mod's changes

pn-audit-errors is a command published in the GitHub repository perniemann/pnCore (0 stars, last pushed today), licensed MIT. It adds 41 tokens to every session and 881 once invoked, about $0.0002 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.