Baldanders
Local personal-data firewall for cloud LLMs. Chat with Claude, ChatGPT, Grok and others while your names, emails, ID numbers, bank details and secrets stay on your machine.
You: Hi, I'm Nahuel Nucera, my DNI is 30.123.456 and my email is nahuel@gmail.com
Sent to AI: Hi, I'm [PERSON_1], my DNI is [NATIONAL_ID_1] and my email is [EMAIL_1]
AI replied: Hi [PERSON_1], ...
You see: Hi Nahuel Nucera, ...
How it works
You type normally. Baldanders finds personal details, swaps each one for a token like [PERSON_1], and sends only the cleaned text to the AI. When the reply comes back, the tokens are swapped back to the real values. The AI never sees your data, and the token map never leaves your computer.
Detection is local and runs in layers:
- Your rules: terms and patterns from your config that must always be hidden.
- Deterministic detectors: emails, phones (any country), cards, IBANs, 55+ national ID formats, secrets. Each one is checksum-validated where the format has a checksum.
- A multilingual AI model (optional) for names and street addresses in 20+ languages.
Install
pip install baldanders # core: regex/checksum detectors, all providers except the API ones
pip install "baldanders[ner]" # + name & address model (pulls in PyTorch, ~1 GB)
pip install "baldanders[anthropic]" # + direct Claude API provider
pip install "baldanders[all]" # everything
pipx keeps it isolated: pipx install "baldanders[all]".
For name and address detection, download the model once (about 320 MB, checksum-verified). After that it runs fully offline:
baldanders download
Usage
baldanders # Claude, via your Claude Code login (no API key)
baldanders -p chatgpt # ChatGPT, via your Codex CLI login (no API key)
baldanders -p grok # Grok, via grok-cli (SuperGrok / X Premium+, no API key)
baldanders -p anthropic-api # Claude API (ANTHROPIC_API_KEY or `ant auth login`)
baldanders -p openai-api # OPENAI_API_KEY
baldanders -p deepseek # DEEPSEEK_API_KEY
baldanders -p groq # GROQ_API_KEY
baldanders -p openai-api --base-url http://localhost:11434/v1 -m llama3 # any OpenAI-compatible API
baldanders -v # show exactly what leaves your machine
baldanders --no-save # don't write this conversation to disk
baldanders sessions # list saved sessions
baldanders --resume 20261002-143022
baldanders sessions --delete 20261002-143022
Scrub text without talking to any AI (useful in scripts and pipelines):
echo "Call me on +54 9 11 4567-8901" | baldanders scrub
# Call me on [PHONE_1]
baldanders scrub --json "IBAN DE89 3704 0044 0532 0130 00"
Commands inside the chat
| Command | What it does |
|---|---|
/paste |
Multi-line input (end with . on its own line) |
/map |
Show which token stands for which real value |
/raw |
Toggle scrubbing off/on for messages with nothing sensitive |
/clear |
Start a fresh conversation (keeps the token map) |
/help |
Show commands |
/quit |
Exit |
What gets scrubbed
Everywhere: emails (including non-Latin addresses), phone numbers from any country (Google's libphonenumber), credit cards (Luhn-checked), IBANs for 89 countries (length and mod-97 checked), IPv4/IPv6 and MAC addresses, crypto wallets, dates of birth, passport numbers next to a keyword, and names and street addresses with the model installed.
Secrets: API keys (AWS, GitHub, GitLab, Slack, Stripe, Google, OpenAI, Anthropic, Hugging Face, npm), JWTs, private keys, passwords in password: … / contraseña = … / database URLs.
National IDs and tax numbers, validated with python-stdnum where a checksum exists:
| Region | Identifiers |
|---|---|
| Americas | US SSN/ITIN · Canada SIN · Brazil CPF/CNPJ · Argentina DNI/CUIT/CUIL · Chile RUT · Mexico CURP/RFC · Colombia NIT · Ecuador cédula · Uruguay RUT |
| Europe | UK NINO/NHS · Spain DNI/NIE · Portugal NIF · France NIR · Italy codice fiscale · Germany Steuer-ID · Netherlands BSN · Belgium national number · Poland PESEL · Sweden/Norway/Denmark/Finland personal numbers · Switzerland AHV · Austria SVNR · Ireland PPS · Czech/Slovak birth number · Romania CNP · Bulgaria EGN · Croatia OIB · Greece AMKA · Estonia · Lithuania · Turkey TC Kimlik · Russia INN · Ukraine RNTRC |
| Asia & Pacific | India Aadhaar/PAN · Pakistan CNIC · China resident ID · Hong Kong HKID · Taiwan ID · Japan My Number · South Korea RRN · Malaysia MyKad · Singapore NRIC · Indonesia NIK · Thailand ID · Israel ID · Australia TFN · New Zealand IRD |
| Africa | South Africa ID |
| Anywhere | Any ID-shaped number right after a keyword like DNI, cédula, ID number, Ausweis, 身份证, … |
Some IDs are just a run of digits with no distinctive shape, like a BSN, PESEL or Steuer-ID. Those are scrubbed when a keyword is nearby ("BSN 111222333"). If you set paranoid: true, they're scrubbed on checksum alone.
Ordinary text is left alone: code, SQL, version numbers, order numbers, amounts, ordinary dates and city names. If something is over-scrubbed anyway, the AI only sees a token and you still get the real value back in the reply.
Configuration
~/.baldanders/config.yaml is created on first run:
regions: [AR, US] # local phone formats to recognise; empty = guess from OS locale
paranoid: false # scrub checksum-valid IDs even without a keyword nearby
# ner_threshold: 0.6 # name/address model confidence (default: names 0.7, addresses 0.4)
save_sessions: true
allowlist: # never scrub these
- my-s3-bucket-name
denylist: # always scrub these (case-insensitive) as the given type
"Project Falcon": PROJECT
custom_patterns: # extra regexes; first capturing group is scrubbed if present
customer_id: "CID-\\d{8}"
Set BALDANDERS_HOME to keep config, sessions and the model somewhere other than ~/.baldanders.
Privacy notes
- What is sent: only the scrubbed text, plus a short instruction telling the AI to keep the tokens intact. Run with
-vto see every byte. - What stays local: the token map, the model, and your config. Saved sessions (
~/.baldanders/sessions/) contain the real values so--resumeworks. They are readable only by your user. Turn them off with--no-saveorsave_sessions: false. - Subscription CLIs: Baldanders runs
claudeandcodexin an empty private directory. For Claude Code, all tools and MCP servers are disabled, so the AI can't read your files. Codex runs in its read-only sandbox, so it can still read files outside that directory if it chooses to. Prefer-p claudeor an API provider for sensitive work. These CLIs add their own context to each request (OS, working directory path, and for Claude Code your personal~/.claude/CLAUDE.mdif you have one). Baldanders doesn't control that context. - No detector is perfect. Unusual names, free-form addresses, or IDs written in unexpected ways can slip through. Check
-voutput when it matters, and add anything specific to your work to thedenylist.
Requirements
- Python 3.10+
- For
-p claude: Claude Code, logged in - For
-p chatgpt: Codex CLI (npm install -g @openai/codex, thencodex login) - For
-p grok: grok-cli (grok-cli login)
Development
pip install -e ".[dev,ner,anthropic]"
baldanders download # optional: enables the NER integration tests
pytest
Releasing
Releases go to PyPI from GitHub Actions via trusted publishing, so no API token is stored anywhere.
- One-time setup: on PyPI, add a pending publisher for project
baldanders, ownerNahuel990, repoBaldanders, workflowrelease.yml, environmentpypi. On GitHub, create an environment namedpypi. - Bump
__version__insrc/baldanders/__init__.pyand commit. - Tag and push:
git tag v0.1.0 && git push origin v0.1.0.
License
MIT
Metadata
Release files for baldanders 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| baldanders-0.1.1.tar.gz | 49.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| baldanders-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 94.6 kB
Release files / baldanders-0.1.1.tar.gz
| Download URL | baldanders-0.1.1.tar.gz |
|---|---|
| Size | 49.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
647830284221238c87b1f53942d84a8a20210ce019606568180378b63472b1dd
|
|
BLAKE2b-256 checksum How to use checksums |
f04b5e9b337af7b6bc864e31d38179ce35ddeb2222b501df549c254794c596c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / baldanders-0.1.1-py3-none-any.whl
| Download URL | baldanders-0.1.1-py3-none-any.whl |
|---|---|
| Size | 45.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d022e6f6af661d3d44621988f72f8ee760bfb8bce73a4b02f896c4d1a72a2676
|
|
BLAKE2b-256 checksum How to use checksums |
a47efaccea4a847f427bb49a0e3692b8f119061a3795f068232e28ed18502da7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency log