openai-privacy-filter — Claude Code skill: mask PII in text
A skill that wires a token-classification model into your project to find and blank out personal data. Useful before shipping logs or documents to an LLM.
npx skills add reason-machines/trending-skills --skill openai-privacy-filter -a claude-codeWhat openai-privacy-filter does
The model labels text token by token and returns span boundaries in a single forward pass. Eight categories are covered: names, addresses, email, phone numbers, personal URLs, dates, account numbers and secrets such as tokens and API keys. Context window is 128k tokens, license Apache 2.0.
The repo ships an opf CLI with three modes: one-shot redaction of a string or file, evaluation on labeled JSONL, and finetuning on your own dataset. The Python API gives you PrivacyFilter() with redact for one string and redact_batch for a list, plus the detected spans with labels and offsets. Precision and recall are tuned through operating_point — high_recall masks wider, high_precision is stricter.
One thing to plan for: the checkpoint downloads to ~/.opf/privacy_filter on first use, so on a tight disk or a closed network set OPF_CHECKPOINT beforehand. GPU inference needs --device cuda, otherwise it runs on CPU. Finetuning expects labeled JSONL with spans, so opf train has nothing to work with until you build that file.
What it helps with
- strip names and emails from logs before sending them to a model
- mask card and account numbers in an export
- find tokens and API keys inside config text
- score the detector against your own labeled set
- finetune the model for your project's PII format
Example prompts for the agent
- Run
opf -f logs/app.txtand show me what got masked - Write a script using
PrivacyFilter(operating_point="high_recall")and process a batch of texts - Build a JSONL with spans and run
opf train train.jsonl --output-dir ./my_finetuned_model
How to install openai-privacy-filter
1Skills CLI (Vercel)
npx skills add reason-machines/trending-skills --skill openai-privacy-filter -a claude-code2Manually: put the files in place
~/.claude/skills/openai-privacy-filter/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/openai-privacy-filter/
1Skills CLI (Vercel)
npx skills add reason-machines/trending-skills --skill openai-privacy-filter -a codex2Manually: put the files in place
.agents/skills/openai-privacy-filter/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add reason-machines/trending-skills --skill openai-privacy-filter -a cursor2Manually: put the files in place
.cursor/skills/openai-privacy-filter/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install reason-machines/trending-skills openai-privacy-filter2Manually: put the files in place
.github/skills/openai-privacy-filter/SKILL.md1Skills CLI (Vercel)
npx skills add reason-machines/trending-skills --skill openai-privacy-filter -a gemini-cli2Platform CLI
gemini skills install https://github.com/reason-machines/trending-skills --path skills/openai-privacy-filterManually: put the files in place
.devin/skills/openai-privacy-filter/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add reason-machines/trending-skills --skill openai-privacy-filter -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about openai-privacy-filter
How do I install Anthropic-privacy-filter in Claude?
Run npx skills add reason-machines/trending-skills --skill openai-privacy-filter -a claude-code. The skill lands at ~/.claude/skills/openai-privacy-filter/SKILL.md.
What does openai-privacy-filter do?
It detects personal data in text and replaces it with block characters. You drive it through the opf CLI or the Python API, and it returns the spans it found with labels.
What does the skill need to run?
Install the package with pip install -e .; the first run downloads a checkpoint to ~/.opf/privacy_filter. Point OPF_CHECKPOINT elsewhere if you keep models in a different place.