What shipped
wispr-pseudonymise is about 150 lines of rules and no dependencies. Twelve kinds in priority order: secrets, emails, URLs, IPs, accounts (IBAN, card numbers, wallet addresses), phones, amounts, dates, labelled IDs, street addresses in nine countries' formats, organisations, people. A lone capitalised word mid sentence is masked as an organisation unless it is a known public name, a common noun, a demonym, or appears in lowercase elsewhere in the text; technologies, countries, big cities and big companies stay, because masking "Node.js" or "Germany" leaves the model without the subject of the question and identifies nobody.
restore() puts the values back and tolerates a placeholder the model altered slightly. reconstruct() does the same and reports any placeholder the model invented, so the caller retries instead of trusting a [PERSON_9] that was never issued. hint() is one sentence to send above the masked text that says what the placeholders are. It runs in 27 microseconds on a paragraph, and every decision is in the source.
const { text, map } = pseudonymise('Our CFO Maya Lindqvist approved a
How we measured it
Two parts. The gate is offline and free: 62 prompts written for the benchmark across legal, medical, finance, HR, code, support and property, with 155 identifiers that must not survive and 81 public names that must stay readable. The first run caught eight gaps (names with accents, a title with one name, streets with the number after, the yen sign); those are rules now, and the run exits with an error on any leak, which is the check the gateway's copy of the rules has to pass.
| Check | Result |
|---|---|
| Identifiers masked | 155 of 155 |
| Public names kept | 81 of 81 |
| Text restored exactly | 62 of 62 |
| Time per prompt | 27 µs |
The live arm asks a model the same 100 SQuAD questions with the paragraph as is and pseudonymised, restores the answer and scores both with SQuAD F1: two models, 800 answers, $0.84. With the hint sentence, the open model answered ordinary questions the same (-1.2 F1, 95% CI [-6.1, +3.6]). On the slice built to hurt, 100 questions whose answer is itself a masked name, date or organisation, it stayed within 8 points, against a ceiling of 95 set by placeholder spans being wider than the gold answer. In all 800 answers no model invented a placeholder. The full tables, including the frontier model's figures, are in the repository.
How to check it
npm i wispr-pseudonymise # the library, MIT, no dependencies node bench/run.mjs # the gate: 62 prompts, exit 1 on any leak, no model, no cost node bench/run.mjs --live --hint # a model answers as is and pseudonymised, scored both ways
Add your own prompts to bench/prompts.json; a leak you find there is a leak worth a rule. The code, the gate set and every result file are at github.com/wisprxyz/wispr-pseudonymise.
What it does not do
The rules read English prose and the street formats listed in the README. A name written in lowercase, a nickname, or a company that is one ordinary word can get through; the gate is where that case goes. On text dense with proper nouns, an encyclopaedia paragraph carries seven to ten placeholders, the model has less to work with than on a prompt about one client, and a frontier model given no answer format started narrating the mask instead of answering; that is measured in the repository, not hidden. Pseudonymisation is not anonymisation: a model can still infer who someone is from everything that is not a name, and the map, which stays with you, is the identity. What leaves the process has no name, no amount and no account in it; that is the claim, and the gate is how you check it.