Skip to main content

PyPI Python License mloda

mloda-pii

mloda-pii is a Claude Code hook that replaces identifiers (emails, phone numbers, IBANs, IP addresses, card numbers, US SSNs, crypto wallets, your own names and ID formats) in tool results with tokens such as PII_EMAIL_ADDRESS_... before the model sees them. Detection runs on Microsoft Presidio; spaCy models add people's names. Your local tools and Claude's replies on your screen keep the real values. Every token is a keyed HMAC-SHA256, computed through mloda. It guards against accidental exposure and does not see everything the model gets; see Limits below.

The hook's steps ship as mloda FeatureGroups, so a pipeline can detect, tokenize and restore text columns the same way.

Setup

uv tool install --compile-bytecode --python ">=3.11,<3.15" "mloda-pii[hook,presidio]"   # or pip install it into a virtualenv that stays in place
cd your-project
mloda-pii init                      # paste your invite when asked

The hook runs on Linux and macOS, and on Windows natively (Git Bash or PowerShell) or inside WSL. On native Windows install with /quickstart-mloda-pii (in this repository's .claude/skills/, with or without uv) or pip in a virtualenv, not uv tool install. The hook needs Claude Code 2.1.152 or later; init and status warn when the claude on PATH is older. init, status and each session start warn when the license expires within 7 days.

Then restart Claude Code. Run by Claude inside a local Claude Code session, init lets that session load the hook without a restart, and the session confirms it with mloda-pii: hook active in this session.; without that line, or in a cloud session, init tells you how to restart and keep the conversation. Claude Desktop's Code tab does not show the line: there init says to type pii on, which the hook answers by blocking that prompt when it runs. On a terminal init asks for the invite with hidden input; scripts pass the invite file, - for stdin, or the token itself. Without a terminal (Claude Desktop's Code tab), mloda-pii init --browser opens a page on 127.0.0.1 to paste it into, so it never passes through the chat. Claude Cowork's cloud workspace is not supported: its shell runs in Anthropic's cloud, so init refuses there. Cloud sessions of Desktop's Code tab are not supported either: they run in Anthropic's cloud too, so your data has left your computer before any hook runs. init creates the master key, stores and verifies the license, runs the hook once on a test value, and only then registers it in .claude/settings.local.json. It also creates .mloda-pii/config.toml, kept out of git: names ([deny]) and ID formats ([patterns]) to detect, and values to keep in clear ([allow], loopback addresses and role emails such as info@ or events@ by default; also the presets documentation and private_networks; emails and URLs on the reserved example.com, .org, .net and .example names stay in clear anyway). Unknown entries are rejected, except an [allow] preset this version does not know, such as one a newer init wrote: it is skipped, so its values are pseudonymized, and only status names it. Releases up to 0.16.0 refuse it instead and block every event (0.15.0 does not know role_emails): remove the preset from the line. /pii allow <value> and /pii deny <name> add entries from the prompt (see Everyday commands). Running init again is safe, and needed after an upgrade to register new events. The first event of a session starts a warm server for the project and the session end stops it; an event the server does not answer is blocked.

Option Effect
--user Register in ~/.claude/settings.json, for every project.
--project Register in the committed .claude/settings.json; every teammate installs mloda-pii and runs init --project.
--key-file <path> Import an existing master key instead of creating one.
--shell-prefix macOS and Linux, not with --project: Claude Code runs Bash commands through a script of mloda-pii's (CLAUDE_CODE_SHELL_PREFIX), so a failed command ends with its exit code, the hook rewrites no Bash command and auto mode runs parallel Bash calls. If that script goes missing, Bash calls fail and the hook does not run, so prompts and tool results reach Claude unpseudonymized until init runs again (status names it). --no-shell-prefix removes it.

Ask for an invite at info@mloda.ai, via mloda.ai or by booking a call.

Without a valid license mloda-pii stops and Claude keeps working: prompts and tool results reach Claude unmasked, and tokens from before still restore. You are told at each session start and the first time a running session hits it. To renew, contact mloda-pii@mloda.ai or book a call (https://calendly.com/hello-mloda/30min); mloda-pii license install <file> turns protection back on. A setup from the removed local mode (MLODA_PII_MODE=local) blocks every event until mloda-pii init runs again with an invite; the master key stays, and so do the tokens and the vault.

Back up your master key

The master key lives in ~/.config/mloda-pii/master.key, on Windows too (%USERPROFILE%\.config, which Claude Desktop does not redirect). A key made in %APPDATA%\mloda-pii by an older version stays there and keeps working; in Claude Desktop's Code tab the app keeps that folder in its own package folder, and status names that file. Back it up: every token depends on it, and a lost key changes all of them. Keep a copy of the file somewhere private; mloda-pii init --key-file <copy> restores it. init and status remind you, and init never overwrites an existing key.

Everyday commands

  • mloda-pii status: the Claude Code version, the key, the license and its expiry, whether the project config loads, where the hook is registered and what an older init left out of it, how many names name memory hides, the last events. Exits 1 when something is missing (a [spacy_models] model too), the config has an error or the state dir is open to other accounts.
  • mloda-pii uninstall: removes the hook entries (same --user / --project flags) and names the other projects that still run this install: removing the install, such as with uv tool uninstall mloda-pii, blocks every prompt there. --all-projects removes this install's hooks from every recorded project and the user settings at once, after asking; a committed .claude/settings.json and hooks of another install are kept and named, and it refuses under Claude Code. --purge also deletes the master key, the stored license and the vaults in the state directory, for the whole machine, after asking (--yes skips either question).
  • mloda-pii stop: stops this project's warm hook servers now (--all-projects: every project's), such as before an upgrade on Windows, where a running server holds its install; the next event starts one again.
  • mloda-pii repair [--session <id>]: when an earlier version of the hook turned a content block's type or keys into tokens and every prompt of a session fails with a 400, restores those blocks in the project's session logs from the vault (text stays pseudonymized), keeping a .bak; then quit the session and claude --resume <id> it.
  • mloda-pii license install | status | remove: manage the license alone.
  • mloda-pii stats: per-day counts from the audit log, which never holds values; what a /pii off session let pass counts as paused, never as allowed.
  • mloda-pii explain <file> (or a text on stdin): lists what detection finds in the text under the project's config, labels and spaCy models, as label, offsets, engine and value. The output holds raw values, so they print only on your own terminal, not inside Claude Code or through a pipe. --cut reads the text cut at its tokens, as a prompt that holds tokens is read. It reads the project's vault read only, so the list is the hook's, remembered names included; nothing is stored or sent.
  • mloda-pii names: the names name memory hides in this project, with when each was first stored, so a wrong one can be ended with /pii allow <name>. Real values: run it in your own terminal, it refuses under Claude Code.
  • /pii off, typed as a prompt in Claude Code: switches the hook off for that session. Tool results and prompts then reach Claude in clear, tokens from before still restore, and the model never sees the command, since the hook answers and blocks it. /pii on switches it back, /pii shows the state, a new session starts protected. It works without a valid license. init writes the pii skill the command needs (/pii alone fails as an unknown command without it).
  • /pii resume, typed as a prompt: ends an auto-send pause (see below) for the project.
  • /pii allow <value> and /pii deny <name>, typed as a prompt: add the value to [allow] (kept in clear, for a false positive) or [deny] (always pseudonymized, as PERSON) of the project config, which applies from the next event, and take it out of the other list. The prompt is blocked and the answer names the file, never the value.
  • /pii forget, typed as a prompt: name memory forgets every name the project's vault holds; their tokens still restore, and a name found again is remembered again.

A prompt that contains raw identifiers is blocked, and mloda-pii sends Claude a pseudonymized copy instead, so work goes on with one Enter. Claude Code in a terminal keeps the blocked original in the input box (it was not sent): clear it (press Esc twice). Claude may not act on a copy that answers something it asked: if it is what you sent, reply that it was your message, without retyping it. If a sent copy never reaches Claude, auto-send pauses for 24 hours for the whole project, new sessions too, and the copy is shown to resubmit instead; /pii resume, typed as a prompt, ends the pause at once. The copy is also on the clipboard when one is reachable (MLODA_PII_CLIPBOARD=off disables that). Auto-send needs Claude Code 2.1.312 or later, in a terminal or in Claude Desktop's Code tab; claude -p, --project setups and MLODA_PII_AUTOSEND=off keep the copy to resubmit. Elsewhere no Esc advice is given, as no input box is known to keep the original.

At the end of a session, or after an hour without events if it is still open, the hook sends redaction counts per group and label, how many rewritten shell calls auto mode denied, and the session's duration, prompt and tool call counts, to PostHog EU, also when nothing was hidden; once per install, after init or at the first session, it sends an install event. Both carry a random install id and the license and customer ids from your license (never the token itself), never values, paths, tool names, commands or denial reasons. MLODA_PII_TELEMETRY=off switches it off; mloda-pii stats send --dry-run shows the exact payload.

At the first session start or prompt of a day, the hook server asks https://pypi.org/pypi/mloda-pii/json for the latest version, in the background, sending its own version as the User-Agent and nothing else. A newer release shows in mloda-pii status and at a terminal's session start (once per version, then weekly) with the upgrade command (or ask Claude to update mloda-pii, which it does only when asked), from the day after it reached PyPI, or at once and at every start for a release marked urgent. Pre-releases and yanked releases are never announced, and nothing is installed. MLODA_PII_UPDATE_CHECK=off or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 switches it off; it is skipped in CI and claude -p. Behind a firewall, allow pypi.org or switch it off; a failed check stays silent.

Variable Effect
MLODA_PII_KEY_FILE Master key file (default ~/.config/mloda-pii/master.key).
MLODA_PII_CONFIG The project config (default .mloda-pii/config.toml).
MLODA_PII_ENTITIES Presidio labels to detect (default EMAIL_ADDRESS,PHONE_NUMBER,IBAN_CODE,IP_ADDRESS,CREDIT_CARD,US_SSN,CRYPTO). +UK_NHS,-PHONE_NUMBER adjusts the defaults and keeps labels later releases add; a plain list replaces them.
MLODA_PII_WRAP_BASH On by default: most failed Bash commands exit 0, and failed PowerShell commands succeed in auto mode, with a "non-zero exit code" marker, so their output is pseudonymized too. The marker gives the code (exit code 3) for a Bash command that calls exit, for every Bash command in bypassPermissions and auto, and in auto for a native program that failed in PowerShell; in the other modes Claude Code would ask for approval of a command that reads $?. In auto it adds about 2 s to each Bash call the classifier judges, and the later Bash calls of one response are denied and sent again; init --shell-prefix avoids both and names the code in every mode. 0 turns it off; failed output then reaches the model raw.
MLODA_PII_TOKEN_STYLE hex (default, PII_EMAIL_ADDRESS_<16 hex>) or readable (PII_EMAIL_ADDRESS_1, numbered per project).
MLODA_PII_FAIL_CLOSED On by default. 0 lets an action pass when the hook itself fails, logged as failed_open.
MLODA_PII_REVERSE_MCP 1 also puts real values back into MCP tool input; a remote MCP server then receives them.
MLODA_PII_VAULT_RETENTION_DAYS Delete vault entries not seen for this many days when a hook server worker starts (default off).
MLODA_PII_WORKERS Large events the hook server runs in parallel, one process each, plus one that stays free for small events; two processes from the start, more only while events overlap (default: CPUs minus one, at most 3, so up to 4 processes). A process takes about 180 MB, with the de and en spaCy models about 670 MB: with them about 1.3 GB from the start and 2.7 GB once 4 run, as none is retired until the server stops.
MLODA_PII_AUDIT_LOG Audit log path (default ~/.local/state/mloda-pii/audit.jsonl); off disables it.
MLODA_PII_TELEMETRY On by default; off (or DO_NOT_TRACK=1) stops the redaction and denial counts.
MLODA_PII_UPDATE_CHECK On by default; off (or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1) stops the daily look at PyPI for a newer release.
MLODA_LICENSE_FILE, MLODA_LICENSE_KEY Take precedence over the stored license; init checks the one in use and self-tests with it.

Command options: mloda-pii <command> --help.

The FeatureGroups

import os
from pathlib import Path

from mloda.user import Credential, DataAccessCollection, Feature, Options, PluginLoader, mloda
from mloda_pii.feature_groups.anonymizer import derive_anon_key
from mloda_pii.user_interface.invitation_code.store import default_key_path, stored_license_path

PluginLoader.all()  # registers the feature groups with mloda

if not (os.environ.get("MLODA_LICENSE_KEY") or os.environ.get("MLODA_LICENSE_FILE")):
    os.environ["MLODA_LICENSE_FILE"] = str(stored_license_path())  # the license init stored
key_file = Path(os.environ.get("MLODA_PII_KEY_FILE") or default_key_path())  # the key `mloda-pii status` names
credentials = {
    "pii-key": Credential(key=derive_anon_key(key_file.read_bytes())),
    "pii-vault": Credential(path="pii-vault/vault.sqlite"),  # holds the raw values: keep it out of git
}

feature = Feature("email__hmac_sha256_pseudonymized", Options(group={"pii_key_handle": "pii-key"}))
handles = {"pii_key_handle": "pii-key", "pii_vault_handle": "pii-vault"}
text = Feature("notes__pii_marked_hash_pseudonymized", Options(group=handles))

data = {"Customers": {"email": ["jane@corp.de"], "notes": ["Write to jane@corp.de"]}}
access = DataAccessCollection(credentials=credentials)
print(mloda.run_all([feature, text], compute_frameworks=["PyArrowTable"], api_data=data, data_access_collection=access))

Where status names another master key file, set MLODA_PII_KEY_FILE to it and MLODA_LICENSE_FILE to your license. On Windows, after an init in Claude Desktop's Code tab, a pipeline run outside the app does not see the key and license the app keeps for it, and may find an older key at the same path: set both to the real paths that status names when run in the Code tab.

Tokens come from the license-gated anonymizer_binary, so a pipeline needs the hook extra (a text feature also presidio) and a license in MLODA_LICENSE_FILE or MLODA_LICENSE_KEY. <column>__hmac_sha256_pseudonymized returns the 64-hex keyed HMAC-SHA256 token of a string column, or of each element of a list column. pii_key_handle names the credential whose key field holds the 64-hex key; derive_anon_key derives it from the master key, so a pipeline gets the hook's tokens. Handles are group options, and their credentials go in the DataAccessCollection. Installed with the hook extra, mloda-pii's PiiAnonymizerFeatureGroup takes over every __hmac_sha256_pseudonymized feature from mloda-enterprise's AnonymizerFeatureGroup: it adds list columns and gives the same tokens.

<column>__pii_<marked_hash|counter>_pseudonymized replaces the identifiers in a text column with tokens, as the hook does; <column>__pii_<strategy>_restored maps them back from the vault whose path is the path field of the credential pii_vault_handle names. <column>__pii_spans returns the detected spans and publishes their count per label as the result attribute pii.spans.<LABEL> for an mloda Extender (never values). Detection needs the presidio extra; on an Apple silicon Mac with an arm64 Python it installs thinc-apple-ops, which becomes thinc's backend for the whole process, your own spaCy pipelines included (uninstall the package to keep the generic one). The context option pii_config_file is the path of a config.toml (the hook's project config: allow list, deny words, patterns, spaCy models, and [detection] context_boost for Presidio's context scores, see the hook README's Names), such as .mloda-pii/config.toml relative to the project the pipeline runs in (a relative path is read from the working folder); without it the defaults apply, and a file it names that is missing or unreadable fails the run. A text column's name counts as written before each of its texts, so an ip_address column keeps 10.0.0.1 as an address; pii_field_column names a column with one field name per row instead. A spans or pseudonymized feature reads its context keys in the feature groups below it, so list every key of its context in cascade_context_keys; a key left out does not reach those groups. The handles reach them on their own. The removed options that named environment variables (pii_key_env, pii_vault_path_env, pii_config_env) stop the run with the fix instead of being ignored.

pii_keep_clear is a group option, so pass it under group, which reaches every group below as is: Options(group={"pii_keep_clear": ("mloda-pii", "claude-code"), **handles}). Under context it needs cascade_context_keys too; set there alone, it never reaches the detection engines, so the blocks' words are still found. It lists keep-clear blocks by name: words that are never names and values kept in clear, added on top of detection's core block (code and docstring words, sentence starters, formal German pronouns). Unset, a pipeline gets the core block alone, so a lone Claude or Edit is a name. The hook always adds the mloda-pii block (its own words and support address) and the claude-code block (Claude's client, model, tool and product names, and everyday words such as Mark or Will that are no name alone); a pipeline on Claude Code text lists them as ("mloda-pii", "claude-code"). A package ships a block as a KeepClear under the mloda_pii.keep_clear entry points. With spaCy models for two or more languages, under any block, a name only one model finds is dropped where another model reads the line as its own language and knows every word of the name (the German model's Fix in an English sentence, the English model's Rechnung in a German one); a surname that is such a word and has no title before it (König of Gestern hat König angerufen.) is then found only through [deny]. Under any block and with one model too, a well-known company right after a preposition (arbeitet bei Siemens, bei der Telekom) is no name unless another model also names it. With two models, so is one that opens a sentence going on in a lowercase word while the other model labels it an organization (Siemens hat angerufen.), and a run after von that the other model reads as an article and words (Die Rechnung von Siemens). A person of such a surname alone after a preposition or opening a sentence (bei Porsche, Porsche hat angerufen.) is then found only through [deny] or name memory; a company elsewhere in a sentence can still read as a name.

Limits

  • The hook guards against accidental exposure, not a model that tries to recover values: a Bash command gets the real value and can return it disguised, which detection misses.
  • In auto permission mode a Bash or PowerShell command that holds a token is denied, since auto mode would send its restored real values to its classifier model or quote them back to Claude. So is a file write with a token outside the working folder, on a path with a part starting with . or to a file name Claude Code protects; inside the folder it writes the real value, so Claude is told to use Write, Edit or NotebookEdit there instead of a command. For a file named after a value, Claude writes the token with .slug in the Write path (people/PII_PERSON_3.slug.md), and the hook names the file with the value's slug (people/anna-mueller.md: lower case, ä ö ü ß as ae oe ue ss, accents dropped, any other run as -), in any mode. The slug is then hidden like the value in the results the hook sees, as its own token, but not in what hooks never see, such as the git status Claude Code adds. A slug with no Latin letter (a name in another script), under four or over 100 characters, or a lone common word is refused. What else only a command can do with a real value needs switching out of auto. Under a server-side setting, a wrapped command can be denied once in auto and resent by Claude (see MLODA_PII_WRAP_BASH); with init --shell-prefix no Bash command is wrapped.
  • In any mode, a restored Bash, PowerShell, Grep or Glob call that a permission deny rule may block is denied by the hook, since Claude Code's denial would quote its real values; a word or path it merely mentions counts. Rules the hook cannot read, such as a macOS MDM profile, still leak that way.
  • Hooks never see @file mentions, CLAUDE.md and memory files, the client's own reminders and context (such as its git status, or later changes to a file Claude wrote unless it reads the file again, which the hook asks for when the file holds identifiers it saw), images or compaction summaries; those reach the model unchanged, as do results of Claude Code's own account memory MCP tools (the client drops their rewrites).
  • Untested: whether tools that claude mcp serve runs for another MCP client go through the hooks, so do not serve a project that holds personal data that way; and whether /resume or compaction sends the original structured MCP result the local transcript keeps next to the rewrite.
  • A prompt the hook blocked stays as typed in Claude Code's local transcript under ~/.claude/projects/, in queue-operation records no hook can change. The blocked turn does not send them to the model; untested: whether /resume or compaction does.
  • In Claude Desktop's Code tab, Claude Code sends a session's first prompt to its session-title model as typed, before any hook runs. init turns these titles off; a setup from an earlier init is exposed until init runs again. The Desktop window also names a session from its first prompt itself, which the switch does not stop (seen on Windows). It can ask Claude Code for that name with the prompt as typed, before any hook runs: in a replay that request held a value the hook blocked, and in the window a session was named from a first prompt the hook had blocked. Start a Code tab session with a first prompt that holds no personal data, such as hi.
  • Detection finds emails, phone numbers, IBANs, IP addresses, card numbers (Luhn valid), US SSNs written NNN-NN-NNNN, checksum-valid Bitcoin addresses, Ethereum addresses (0x plus 40 hex characters, any case) and people's names once the project config names a spaCy model per language ([spacy_models] with de and en, installed from the release wheels at https://github.com/explosion/spacy-models/releases, as "Names" in the hook's README shows; init names them in a new config when they are installed, and the quickstart skill installs them unless told not to); without them names are found only under [deny]; in code a name is mostly found only in a string of a call that starts the line (print('Anna Schmidt')), so one in indented code or a grep hit stays in clear. A full name found once stays hidden in its later forms (anna schmidt, A. Schmidt, Anna Schmitt), also in later events; /pii allow ends that for a word remembered by mistake, /pii forget for every name at once. Places only with MLODA_PII_ENTITIES=+LOCATION. Postal addresses and your ID formats are found only through [deny] or [patterns]; anything else passes in clear. A value a command cuts off at a line or output end (head -c) is found from seven characters on only as a [deny] word cut mid-word or a vault value with a digit or @ (see the hook's README); a phone the vault does not hold yet passes raw. Add a Presidio pattern label such as UK_NHS with MLODA_PII_ENTITIES=+UK_NHS (URL and DATE_TIME also match file names and dates). A [patterns] regex with nested repetition can run long enough to block every event it scans. A path that holds a detected value (an email in a file name) reaches the model as a token, and local tools get the real path back; a file format that is no top-level domain, such as .json, stays outside the token when the domain keeps a dot (a@b.com.json), and so does a prefix such as notes- once the address after it is known.
  • Known false positives and misses: anything shaped name@x.y reads as an email unless its domain ends in a file format that is no top-level domain, also with a - or _ suffix or a rotation number or date, so the file names icon@2x.png, icon@2x.png-1 and app@host.log.1 stay, or is a version (every part starts with a digit or is x, the first may start with v, a word follows only three parts and a -, and four plain numbers are an address: react@18.3.1, @types/node@18.3.1, lodash@4.x, pkg@v1.2.3, pkg@2.0.0-alpha.beta, while ops@1.2.corp.ai and a@v1.2.com stay emails), or its user is git (git@github.com:org/repo.git, while git@10.0.0.5 keeps the address hidden); an email on such a domain (ops@build.bin, ops@1.2026, any host starting with three numbers and a - such as x@1.2.3-corp.ai) or to a git@ mailbox is missed unless a [deny] entry lists it; a bare 10-digit number valid in the US or Canadian plan reads as a phone unless it sits deep in a URL or path (/runs/, #issuecomment-), so a lone ID still becomes a phone token, and so does every copy of it; in any region a run of digits, or a build number of 4+ dotted parts, without + right after an ID word (id, run, job, build) is no phone, so a phone written that way there is missed, and a UUID's digits are none; a number of 7 digits without + or a phone or caller word (caller_id:, wa_id, WhatsApp:) before it is no phone (order number 030 1234), so a switchboard such as 030 2270 is missed unless a [patterns] entry covers it; without such a word, a date beside a two-digit number is no phone either (lic-12-2026-10-29, 2026-10-29 12), nor is an ISO date after a number of up to four digits not led by 0 (line 119 2026-11-10), nor are two digit runs joined by - and glued to a word by -, as in a worktree folder (github-issue-4821-773190), so Rückruf-0171-5551001 is missed unless the vault holds it; outside the US and Canada an unlabeled bare national number (9876543210) is missed unless a [patterns] entry covers it or the vault, the same tool result or prompt, or the same pipeline run holds that phone spelled out (+91 98765 43210); a phone of only digits and dots right after <digit>. or starting 0., or dotted or 0-led and spaced in a grouping its region does not use (0151.1234.5678, 01 2345 6789) without a phone or caller word before it, is missed, as is a number its region's plan does not allow, such as a digit too few (+49 151 5550123), which test data often holds, and a short float such as 4.96901940872 can still read as a +49 phone; a 4-part version with a part of 32 or more (1.0.0.123) becomes an IP token unless a version sign such as upgraded to or pkg== comes right before it, and an address after such a sign is missed unless an address sign, the vault or the same run keeps it; a 13 to 17 digit ID or either part of a decimal-comma number (314292388910493,12) that passes the Luhn check and starts like a card becomes a card token, and in a file name or other value the hook does not rewrite it makes the verifier end the turn or warn (see [verifier] mode below). Cards starting with 1 (UATP) or 56 to 59 (some Maestro) are missed, as are SSNs written without dashes and a card glued to a decimal point and digit on either side (0.4111111111111111, 4111111111111111.5), also in a file name (export-4532015112830366.7z); pipelines using the presidio engine with en among the languages detect the same. Any 0x plus 40 hex characters but one repeated digit (the zero address) becomes a CRYPTO token, also a contract address or a 0x-prefixed SHA-1, with the same verifier effect; other cryptocurrencies are missed. [allow] keeps exact values in clear.
  • An IPv4 address with every part below 32 (10.0.0.1) is read as a version and stays in clear unless a port, CIDR suffix, URL, a tcpdump, netstat, arp or ip neigh line or a word like ip or host comes with it, in the hook and in pipelines alike; the nearest MCP field name or the pipeline column name (client_ip, ips) counts too, and for a structured value leaf also the key above it ({"client_ip": {"value": ...}}) or a sibling name or key ({"name": "client_ip", "value": ...}); an outer key above any other key does not. An address tokenized once is tokenized bare in every field or row of the same run, and an IPv4 address the vault holds in later events, a version string equal to it too. A bare copy shown before the address was tokenized stays in the conversation, and a small IPv6 address is not carried to later events, so there the model can still pair the token with the address. An IPv6 address of at most two decimal groups (2001::1) or two names of up to three characters (a::b) needs the same sign, since it reads like a Python slice or a scope; in a subscript, two groups that are decimal or up to three characters (a[1::2], a[b::2]), and a bare ::, always stay in clear.
  • A prompt, tool call or tool result passes as it is when Claude Code's timeout for its hook, a week as init sets it, ends before the hook answers: when the machine sleeps longer than that during the event (Claude Code counts the timeout through a sleep), or when the hook process hangs before its own wait starts, the turn waiting until then. Hooks written by an earlier init time out after 60 s, which a short sleep outlasts; status names them, and init run again fixes them. A sleep longer than 30 minutes while a prompt is sent for you drops that send, and the prompt stays blocked.
  • A tool result reaches the model as it is when the hook process itself crashes, and so does a failed tool other than Bash or PowerShell, a failed PowerShell command outside auto or one that ends early (exit, return, a terminating error as under $ErrorActionPreference = 'Stop', a parse error, a trailing backtick), a failed Bash command the wrapper cannot reach (exec, an exit after the command sets its own EXIT trap, most syntax errors, and outside bypassPermissions a sourced file that exits, a trailing \ or a failing open heredoc without an exit), or a timed-out one that Claude Code kills instead of moving it to the background (one that starts with sleep, or any with CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1). By default ([verifier] mode = "warn") the verifier then lets the model read it with a warning; with "block" or "warn-names" it ends the turn, but the result stays in the conversation and the model reads it on the next turn.
  • Claude Code adds some tool text after the hook's rewrite, which no hook can change: the Artifact tool's page guidance (also your organization's Artifact types and design-system READMEs), and short wording from tools such as ScheduleWakeup, Skill or SendMessage, and its denial of a call (auto mode's "no verdict", a deny rule). By default ([verifier] mode = "warn" in .mloda-pii/config.toml) a match there reaches Claude, which is asked to tell you which result was flagged. With mode = "block" any match there, also a false positive such as a version string read as an email, ends the turn, and mode = "warn-names" warns only on names spaCy guessed. The message names the tool call and the labels found, never the value: type continue to let Claude read the result, run /rewind to go back to before the call, or type /pii allow with a harmless value, whole as it appears in the result. In a terminal a stop or a warning also lists each flagged value as a ready /pii allow line (see the hook's README). Until you type, a subagent's report or a task's notice is held back with its pseudonymized copy instead of waking Claude; a hook server that stopped meanwhile forgets the hold, and a prompt sent before the stop still wakes it.
  • A tool result is scanned whole, so a large one takes longer. The hook blocks an event its server does not answer within about 25 s (waiting behind other sessions' and subagents' events included), or whose server is still starting after 45 s (50 s in all; the start goes on for a later event), so a slow machine may block every event: result withheld, call denied, prompt blocked. MLODA_PII_FAIL_CLOSED=0 lets it pass instead. On one 20-thread Windows machine a start took about 4 s at rest with bytecode and 11 to 30 s without; past 45 s it went with every core busy and no bytecode, and once, at 92 s, for no known reason. The install commands here and the quickstart skills compile bytecode, and init compiles most of what the hook loads. On an 8 vCPU Linux machine with a warm server, a dense customer export is answered up to about 700 KB (10000 rows) and withheld from about 1.5 MB, sizes in between not yet measured; text without identifiers fits about 1.7 MB, and with [spacy_models] only tens of KB. Values already in the vault and a busy server lower these. With [spacy_models] the server starts two workers, so right after a start a third large result at once, or a small event behind two large ones, waits for a worker to load the models and may be withheld on a slower machine. A result of 100 KB or more withheld at the wait names its size: read a large file in parts.
  • Clients shown working in a real session: Claude Code in a terminal on Linux, macOS and WSL, and Claude Desktop's Code tab in a local session on macOS and on native Windows with Git for Windows. Not supported: a terminal claude on native Windows (every event blocks, see the hook's README), cloud sessions of the Code tab and Cowork's cloud workspace. Untested: the VS Code and JetBrains extension panels (their integrated terminal counts as a terminal), Desktop Chat, the Code tab's WSL and SSH sessions, the Code tab on native Windows without Git for Windows, local Cowork and claude mcp serve.
  • A Claude Code below 2.1.152 may skip every hook (untested), and one below 2.1.121 ignores the rewritten output of built-in tools in any case. init warns only about the claude on PATH; status also names the client that last ran the hook in the project (Desktop, an IDE), with the version from its CLAUDE_CODE_EXECPATH or its transcript. A Claude Code release that changes the hook interface can let values through unnoticed until mloda-pii follows. Supported platforms are listed under Setup.
  • Claude Code checks an Edit's old_string before any hook runs, so an Edit whose old_string holds a token fails. The hook tells the model to use a Bash command or Write instead; a Bash command may ask for permission, and a Write replaces the whole file. Claude Code lets a Write run after a partial Read, and for newer models with no Read at all; the hook denies one it restored a token in, or of a file with identifiers, over a file the model has not read in full as it is now. An Edit or NotebookEdit whose path holds a token fails the same way; the session note tells the model not to call them on such a path and to use Bash or Write.
  • An older release rejects a config entry it does not know, such as a section, key, label or [verifier] mode a newer init or release added, and blocks every event until the entry is removed or mloda-pii upgraded; an [allow] preset is skipped instead, from the release after 0.16.0 on.
  • The license gate is a speed bump: a token is a standard keyed HMAC-SHA256, which whoever holds the master key can recompute without a license.
  • Tokens are still personal data under GDPR; whoever holds the key can recompute them.
  • The local vault under ~/.local/state/mloda-pii/ (or $XDG_STATE_HOME) maps tokens back to raw values. It keeps them until MLODA_PII_VAULT_RETENTION_DAYS expires them or uninstall --purge deletes it; an expired token no longer maps back. On Windows that folder is %USERPROFILE%\.local\state\mloda-pii, which a roaming profile copies to its server; move the state to a local folder and set XDG_STATE_HOME there to keep raw values on the machine. Vaults an older version made in %LOCALAPPDATA%\mloda-pii keep being used there, where Claude Desktop's Code tab keeps them in its package folder, which removing the app deletes.

License

mloda-pii is proprietary and source-available, under the mloda-pii License in the LICENSE file of the package. Use in your daily work is permitted with a license key from mloda, also when the key is free. The license text is binding over this summary.

  • mloda: declarative data and feature access, the framework mloda-pii runs on.
  • mloda-registry: plugins and guides for mloda.

Metadata

Release files for mloda-pii 0.17.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mloda-pii 0.17.0
File Size Uploaded Provenance Actions
mloda_pii-0.17.0.tar.gz 367.4 kB With provenance Details for mloda_pii-0.17.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mloda-pii 0.17.0
File Interpreter ABI Platform Actions
mloda_pii-0.17.0-py3-none-any.whl Python 3 none any Details for mloda_pii-0.17.0-py3-none-any.whl

Total release size: 759.9 kB

Release files / mloda_pii-0.17.0.tar.gz

Download URL mloda_pii-0.17.0.tar.gz
Size 367.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b8fba0645462f33b9a04f2402e5c031cb2e5f59848bbb31fb517fca9acdebc3f
BLAKE2b-256 checksum
How to use checksums
103890ad90d96a102a244b8c8e740d8301a7cbadf0d9f3c614e1eb1e76bc1138
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Release files / mloda_pii-0.17.0-py3-none-any.whl

Download URL mloda_pii-0.17.0-py3-none-any.whl
Size 392.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c5a409e05b4d0839581d283d2c20f645233899f5ef8f6994334589f285a0018
BLAKE2b-256 checksum
How to use checksums
b2d36a999db087bcce49c65a7f54a062c553721b34fe8dfe3a4cf8f0f6cc13c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Security for mloda-pii 0.17.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mloda_pii-0.17.0.tar.gz

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 Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page