presidio AGENTS.md

General instructions for working in the Presidio repository, a Python SDK for detecting and anonymizing personal information in text and images.

In plain words
What is it for?
Use it when developing Presidio, adding a personal-information recognizer, changing YAML configuration, running tests, or updating package dependencies.
Why use it?
It explains the project’s compatibility and correctness priorities, development commands, supported Python versions, and dependency workflow.

Instructions file for CodexOpenCode

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 instructions/data-privacy-stack/presidio/agents-md
Clone the repo
git clone --depth 1 https://github.com/data-privacy-stack/presidio

Made for: Codex, OpenCode.

Per session 1,478 This file is loaded in full into every session.
When invoked 1,478 The same file — it is already loaded in full.
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.01478 $0.01478
Opus 5 $0.00739 $0.00739
Sonnet 5 $0.00296 $0.00296
Haiku 4.5 $0.00148 $0.00148

Measured yesterday against content hash 8023c1fec5f7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

presidio 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 · 117 lines

How it starts

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

Presidio — Agent Guidelines

Presidio is a Python SDK for detecting (presidio-analyzer) and anonymizing (presidio-anonymizer) PII in text and images, plus CLI, structured-data, and image-redaction components. It is a widely used library: users depend on current detection behavior, and configuration files written years ago must keep working. Correctness and backward compatibility outrank cleverness.

The review-side versions of these rules — which the Copilot PR review agent also enforces — live in .github/copilot-instructions.md and .github/instructions/*.instructions.md. Follow them at authoring time so the review finds nothing.

Working in this repo

cd presidio-analyzer            # or presidio-anonymizer, presidio-cli, ...
uv sync --locked --all-extras --group dev
uv run python -m spacy download en_core_web_lg   # analyzer/CLI only
uv run pytest -xvv
uv run ruff check . && uv run ruff format .
  • Python >=3.10,<3.15; code must run on every version in range.
  • Dependencies are managed with uv, not pip/Poetry. If you touch a package's pyproject.toml dependencies, run uv lock in that package and commit the updated uv.lock in the same change — CI fails on drift.
  • Do not edit CHANGELOG.md; release entries are generated from merged PRs.
  • Never log PII values (entity.text) — only entity types and positions.
  • Modules that process records are stateless; do not add state.
  • Terminology: "threshold", not "cutoff"; ISO 639-1 language codes everywhere.

Adding a PII recognizer

The full rulebook — score bands, context-word rules, validation-hook semantics, the configuration-path test template, and the test-quality bar — is .github/instructions/recognizers.instructions.md. Read it before starting; those rules apply at authoring time, not just in review. The workflow, in order:

  1. Place and name it under predefined_recognizers/: full lowercase country name for new country directories (south_africa, not za; don't imitate the pre-existing short forms us/uk/thai), or generic/, nlp_engine_recognizers/, ner/, third_party/ as appropriate.
  2. Use ISO 639-1 language codes (ko for Korean, never kr) — a mismatch loads nothing, silently.
  3. Make the constructor loader-compatible: accept the YAML loader's kwargs (name, supported_entity, context, ...) and forward them to the base class, or the recognizer crashes the whole registry the moment a user enables it.
  4. Design the pattern for accuracy first — this is the top review priority: as specific as the format allows, score calibrated to the pattern alone, unambiguous context words, the correct checksum if one exists (and none invented if it doesn't), and the pattern's source documented in the docstring, preferably an official specification.
  5. Register it everywhere: exports in predefined_recognizers/__init__.py and the country/category __init__.py; an entry in conf/default_recognizers.yaml (country-specific ships enabled: false); a row in docs/supported_entities.md.
  6. Write the configuration-path test — the most-missed step and the one that matters most: enable the recognizer in a YAML config, load it through RecognizerRegistryProvider, and assert detection (template in the instructions file). Non-English recognizers must set the top-level supported_languages in the test config — it defaults to ["en"] and silently filters everything else.

Read the full file on GitHub · 117 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 First seen · 117 lines · 1,478 tokens per session scan A 8023c1fec5f7

Subscribe to this mod's changes

presidio AGENTS.md is an instructions file published in the GitHub repository data-privacy-stack/presidio (10,706 stars, last pushed yesterday), licensed MIT. It adds 1,478 tokens to every session, about $0.0074 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 instructions, from other repositories