Skip to content

Clean a file or some text ​

Use this when you want to hide personal data by hand, for example before pasting into a website chat that pii-airlock cannot sit in front of.

The three-step routine ​

1. Hide ​

bash
pii-airlock scrub notes.txt -o notes.clean.txt
  • notes.clean.txt is safe to share. It contains placeholders.
  • The key to undo it (the mapping) is kept, encrypted, in your project's .pii-airlock/maps/ (outside a project: ~/.local/state/pii-airlock/maps/). Git ignores it.

You can also pipe text in:

bash
echo "Contact Jean Dupont at jean@acme.fr" | pii-airlock scrub
text
Contact <PERSON_558644> at <EMAIL_ADDRESS_094087>

2. Use the clean text with your AI ​

Paste notes.clean.txt into the AI. It answers using the placeholders.

3. Restore ​

Save the answer to a file, say answer.txt, then:

bash
pii-airlock restore answer.txt -o answer.final.txt

The placeholders are replaced by the real names and emails.

The mapping contains the real data

Never email, upload or commit a map file, and delete mappings when you have finished restoring. Details on where maps live and how they are protected: Data handling.

Which files work? ​

TypeWorksNotes
Plain text, CSV, JSONAlways
Word .docxNeeds the docx extraChanged paragraphs lose inline formatting such as a bold word in the middle.
PDFNeeds the pdf extraText only. You get cleaned text, not a new PDF.
bash
pii-airlock scrub report.csv -o report.clean.csv
pii-airlock scrub contract.docx -o contract.clean.docx
pii-airlock scrub scan.pdf > scan.clean.txt

Install the extras from Install.

See what it would hide first ​

bash
pii-airlock detect notes.txt
text
PERSON           0.85  [9:21]    'Jean Dupont'
EMAIL_ADDRESS    0.99  [24:38]   'jean@acme.fr'

Nothing is changed. The number is the confidence from 0 to 1.

Useful options ​

OptionWhat it does
--no-mapOne-way cleanup. You cannot restore afterwards.
--encrypt-mapEncrypts the map so it only opens on this computer.
--lang fr,enChoose the languages to look for.
--threshold 0.7Be pickier. Fewer false alarms, more risk of a miss.

Released under the MIT License.