pii-audit

pii-audit is an agent for Claude Code from sonomoshq/Canary. It costs 41 tokens per session (651 once invoked), scanned A, original, MIT.

An agent for checking all stored Claude Code transcripts for personally identifying information, or PII—details that can identify a person. It combines existing detections with pattern matching and manual semantic review.

In plain words
What is it for?
Use it to locate transcript files, review previously detected leaks, scan user messages for identifiers and sensitive details, and prepare a comprehensive privacy audit.
Why use it?
It helps find sensitive information across old sessions rather than checking only the conversation currently open.

Agent for Claude Code

Written for Claude Code: ${CLAUDE_PLUGIN_DATA} variable. Also seen: model in frontmatter; reads .claude/ paths; mentions Claude Code.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the canary plugin — 5 skills, 1 agent, 3 hooks shipped together

Good fit Use it to locate transcript files, review previously detected leaks, scan user messages for identifiers and sensitive details, and prepare a comprehensive privacy audit.

Compare 6 agents from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add sonomoshq/Canary
Claude Code
/plugin install canary

Made for: Claude Code.

Or install canary, the plugin that ships this one along with the rest of its 5 skills, 1 agent, 3 hooks.

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 pii-audit

README.md
[![agentmods](https://agentmods.dev/badge/agents/sonomoshq/canary/pii-audit.svg)](https://agentmods.dev/agents/sonomoshq/canary/pii-audit)
Your own site
<a href="https://agentmods.dev/agents/sonomoshq/canary/pii-audit"><img src="https://agentmods.dev/badge/agents/sonomoshq/canary/pii-audit.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 651 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.00041 $0.00651
Opus 5 $0.00020 $0.00326
Sonnet 5 $0.00008 $0.00130
Haiku 4.5 $0.00004 $0.00065

Measured 7d ago against content hash f8cb0399a03b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

pii-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 7d 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.

canary/agents/pii-audit.md · 56 lines

How it starts

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

PII Audit Agent

You are a privacy auditor. Your job is to perform a comprehensive PII audit across all stored Claude Code transcripts and the existing leak detection data.

Process

  1. Locate data directory: Check for the data directory at ${CLAUDE_PLUGIN_DATA} first, then fall back to ~/.sonomos/.

  2. Read existing detections: Parse leaks.jsonl to understand what has already been detected.

  3. Find all transcripts: ls -t ~/.claude/projects/*/*.jsonl 2>/dev/null. Each filename's stem (before .jsonl) is that transcript's session UUID.

  4. Run regex detectors: For each transcript, extract user message text with:

    jq -r 'select(.type == "user") | .message.content | if type=="string" then . elif type=="array" then ([.[] | select(.type=="text") | .text] | join("\n")) else empty end' "$TRANSCRIPT"
    

    Then run ${CLAUDE_PLUGIN_ROOT}/scripts/detectors.sh on that text to find PII the regex engine catches.

  5. Semantic analysis: Review the same user-message text yourself for PII categories regex cannot catch:

    • Names, entity names, addresses
    • Legal identifiers (case numbers, contracts, patents)
    • Medical data (MRNs, health plan IDs, diagnoses)
    • Organizational secrets (trade secrets, internal comms, employee data)
    • Credential compounds (username+password pairs, connection strings)
  6. Cross-reference: Compare newly found items against existing leaks.jsonl to identify:

    • New detections not previously recorded
    • Categories with the highest exposure
    • Sessions with the most PII
    • Trends over time
  7. Generate report: Present findings as a structured summary:

    • Total PII items (existing + newly found)
    • Breakdown by category and detection method
    • Top 5 highest-risk sessions
    • Recommendations for reducing exposure

Rules

  • NEVER output raw PII values. Always redact: keep first 2 and last 2 characters, replace the middle with dots.
  • Be conservative: medium/high confidence only.
  • Record any new detections with ${CLAUDE_PLUGIN_ROOT}/scripts/record-llm-hit.sh "<category>" "<redacted>" "<high|medium>" "<session_id>" — pass the session UUID from the transcript's filename (step 3) as the 4th argument; omit it only if you're processing data with no identifiable session.
  • Focus on real PII, not example data, code variables, or documentation references.

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

Subscribe to this mod's changes

pii-audit is an agent published in the GitHub repository sonomoshq/Canary (2 stars, last pushed 7d ago), licensed MIT. It adds 41 tokens to every session and 651 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.

Related

Other agents, from other repositories

compliance-reviewer

Flags where a feature, document, or data flow may trigger a named regulatory regime, returning a flag list with each regime named - never legal advice or a legal conclusion. Use when a change touches personal data, health, finance, or regulated communications.

emtcmca/promptsmith · 55 tokens

governance-letter

Drafts HOA and condo board correspondence that is firm, fair, and compliant - violation notices, assessment letters, board communications. Use for community-association owner correspondence.

emtcmca/promptsmith · 38 tokens

feifei-li

Fei-Fei Li — Human-Centered AI & Ethics. Spawnable director agent for responsible AI reviews, ethical impact assessment, UX for AI systems, governance, and human oversight design. Use when fairness, dignity, or societal impact is at stake.

markusbegerow/board-of-directors · 57 tokens

product-ideation-market-researcher

Researches market size, growth trends, key players, regulatory landscape, and technology enablers for a product idea using web sources. Produces evidence-based market assessment with TAM/SAM/SOM estimates. Use when the orchestrator needs market landscape data for a product idea.

QBall-Inc/the-bulwark · 64 tokens

csharp-reviewer

C#-specific code reviewer. Audits for .NET patterns, async/await correctness, LINQ efficiency, IDisposable compliance, and security vulnerabilities.

KevinZai/commander · 35 tokens

implementer

Feature-sized coding work where the decisions live inside the task - multi-file changes, refactors, end-to-end implementation from a spec. Used by senior-fable mode for the code the lead specifies but does not type. Not for mechanical edits with an obvious diff, and not for open-ended investigation.

AndyShaman/senior-fable · 63 tokens