pii-guard: Instructions file for Claude Code

AGENTS.md

pii-guard AGENTS.md is an instructions file for Claude Code, Codex, OpenCode from danyuchn/pii-guard. It costs 1,726 tokens per session, scanned A, original, MIT.

Repository instructions for a Traditional Chinese privacy tool that replaces personal information with placeholders before sending text to an AI system, then restores the original values locally.

In plain words
What is it for?
Use them when installing, running, testing, type-checking, or linting the pii-guard project.
Why use it?
They explain the privacy pipeline and the supported Taiwan-specific personal-data detectors, so real data can remain on the user's machine.

Instructions file for Claude CodeCodexOpenCode

Written for Claude Code and Codex and OpenCode: PreToolUse hook event, but also the file is AGENTS.md. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions AGENTS.md.

This is danyuchn/pii-guard's own configuration. It tells Claude Code, Codex and OpenCode how to work on pii-guard 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 pii-guard configures →

Reuse

Borrowing it

Nothing to install: this file belongs to danyuchn/pii-guard. 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/danyuchn/pii-guard/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/danyuchn/pii-guard

Made for: Claude Code, Codex, OpenCode.

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-guard AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/danyuchn/pii-guard/agents-md/github.svg)](https://agentmods.dev/instructions/danyuchn/pii-guard/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/danyuchn/pii-guard/agents-md"><img src="https://agentmods.dev/badge/instructions/danyuchn/pii-guard/agents-md/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 pii-guard AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/danyuchn/pii-guard/agents-md"><img src="https://agentmods.dev/badge/instructions/danyuchn/pii-guard/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,726 This file is loaded in full into every session.
When invoked 1,726 The same file — it is already loaded in full.
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.01726 $0.01726
Opus 5.5 $0.00690 $0.00690
Sonnet 5.5 $0.00345 $0.00345
Haiku 4.5 $0.00173 $0.00173

Measured yesterday against content hash 9bc14ece610e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pii-guard AGENTS.md 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 yesterday.

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.

AGENTS.md · 90 lines

How it starts

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

AGENTS.md

This file provides guidance to coding agents (Claude Code, Codex, and others) working in this repository. CLAUDE.md is a symlink to this file.

Project Overview

pii-guard-tw — 繁體中文(台灣)個人資料去識別化工具。將文件中的 PII 替換為佔位符後送 AI 處理,完成後自動還原,確保真實資料全程不離開本機。

Tech Stack

  • Language: Python 3.11+
  • Package manager: uv(必用 uv run / uvx,禁用 pip)
  • PII framework: Microsoft Presidio(偵測 + 匿名化 + 還原)
  • Chinese NER: ckiplab/bert-base-chinese-ner(中研院,繁體中文)
  • Taiwan PII Regex: 自建 PatternRecognizer(身分證、手機、市話、統一編號)
  • Pipeline: LangChain PresidioReversibleAnonymizer(mapping table 序列化/還原)

Architecture

原始文件
  ↓ [偵測層] CKIP NER + 台灣 Regex PatternRecognizer
  ↓ [替換層] 建立 mapping table → 去識別化文本
  ↓ [LLM 處理] AI 只看到佔位符版本
  ↓ [還原層] reverse replace → 還原後 AI 回答

關鍵原則:LLM 只做輔助偵測,替換與還原全由程式碼完成,decode 可靠性 100%。

Commands

# 安裝依賴
uv sync

# 執行主程式(CLI)
uv run python -m pii_guard <input_file>

# 執行測試
uv run pytest

# 執行單一測試
uv run pytest tests/test_recognizers.py::test_tw_id_number -v

# 型別檢查
uv run mypy src/

# Lint
uv run ruff check src/

# 常駐 hook 去識別化服務(install 會併好 settings 並自動啟動)
uv run pii-guard-hookd install [--engine full|regex] [--scope user|project] [--no-launchd] [--harden] [--mod]
uv run pii-guard-hookd doctor [--harden] [--mod] | uninstall
uv run pii-guard-hookd serve [--engine full|regex] [--foreground] [--session-ttl-days N]
uv run pii-guard-hookd status | stop | purge [session_id|--all]

# 參考名單:把客戶名單(xlsx/csv)的欄位對應存成描述檔,值留在原檔
uv run pii-guard-hookd terms inspect <表格> [--sheet 名稱] [--json]
uv run pii-guard-hookd terms import <表格> [--map 姓名=PERSON,金額=SKIP] [--yes] [--materialize]
uv run pii-guard-hookd terms status | remove <表格>|--all | ui

PII Types Supported

類型 方式
人名、組織、地名 CKIP NER
身分證字號 Regex
外籍居留證 Regex
手機號碼(本地) Regex
手機號碼(+886) Regex
市話 Regex
統一編號 Regex + context
Email、信用卡 Presidio 內建(zh 覆寫)
車牌 Regex + context
出生日期 Regex + context
銀行帳號 Regex + context

Read the full file on GitHub · 90 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. yesterday Changed · -15 tokens per session 9bc14ece610e
  2. 5d ago Changed · -8 lines · -413 tokens per session dbce138735c9
  3. 1mo ago Changed · +6 lines · +409 tokens per session 3dfdb608e102
  4. 1mo ago Changed · +8 lines · +332 tokens per session 2b8b9e88e4c2
  5. 1mo ago Changed · +91 tokens per session 83c724cdb9fc
  6. 1mo ago First seen · 84 lines · 1,322 tokens per session scan A ad5ce5c898a2

Subscribe to this mod's changes

pii-guard AGENTS.md is an instructions file published in the GitHub repository danyuchn/pii-guard (252 stars, last pushed 2d ago), licensed MIT. It adds 1,726 tokens to every session, about $0.0069 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.

Related

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,715 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,786 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,731 tokens

deno copilot-instructions.md

Copilot instructions for denoland/deno, covering deno development guide for github copilot, network access, high level overview, key directories and key files to understand first.

denoland/deno · 3,077 tokens