anonym-legal-guard · for Claude Code · Preview

The privacy firewall for Claude Code.

Prompts, files and command output pass the firewall before they reach the model. Detected names, emails and IBANs become placeholders, and a request that still carries a known real value is blocked. The answers come back with the real names in the terminal and in the desktop app (as long as no remote access is attached); other surfaces show placeholders. Files Claude writes get the real values. For Claude Code on your machine (terminal and desktop app); not supported in Claude Code on the web.

Protection against accidents, not against intent or prompt injection. What detection misses reaches the model. Detection runs at anonym.legal. See Limits

Diagram: your request passes anonym-legal-guard before it reaches Claude. On the way out, detected values become placeholders and a request that still carries a known real value is blocked. On the way back, the real values are restored in the terminal, in the desktop app and in files Claude writes.YouClaude (model)anonym-legal-guardAnna Berg‹PERSON_1›‹PERSON_1›Anna Berg
  • on the way out: detect · replace · block
  • Blocked by the firewall
  • on the way back: real values in the terminal, the desktop app and files
When Claude Code runs on your machine (terminal or desktop app), the mapping between placeholder and real value stays in the session there.

How the privacy firewall works

  1. Inspect

    Prompts, read files, command output and attachments are sent to anonym.legal for detection, in your account's detection languages, before the model sees them. By default, images and documents are dropped, not scanned.

  2. Replace

    Detected names, emails, IBANs and phone numbers become placeholders such as ‹PERSON_1›. Claude works with those. Names written in lowercase are not replaced.

  3. Block

    With default settings: a request still carrying a known IBAN, email, phone number or full name is stopped, outbound tools get placeholders, shell encoders and uploads are refused, and in local Claude Code no prompt goes out without detection.

  4. Restore

    Answers show the real values again in the terminal and in the desktop app (as long as no remote access is attached). Other surfaces, such as a phone attached via Remote Control, show placeholders, because there the mod cannot reliably tell that the display stays local. Files Claude writes get the real values back. With Claude Code installed on your machine, the mapping stays there; anonym.legal does not keep it. Claude Code's local transcript holds clear text.

One session, seen from both sides

claude · ~/kanzlei
> Summarize akte-berg.txt and draft a payment reminder.
anonym.legal3 values replaced: PERSON · EMAIL_ADDRESS · IBAN_CODE

Before the request leaves, detection at anonym.legal finds the values and the guard swaps them for placeholders.

Claude sees"… ‹PERSON_1› … ‹EMAIL_1› … ‹IBAN_1› …"

The model receives placeholders for the detected values.

reminder.txt"Dear Anna Berg, … DE89 3704 0044 0532 0130 00"

The file on your disk gets the real values back.

Illustration with test data. Placeholders are shortened; real ones carry a session tag such as ‹PERSON_1·k7p›.

Without and with the firewall

Without the mod

Claude receives

Write a payment reminder to Anna Berg, IBAN DE89 3704 0044 0532 0130 00.

You read

Dear Anna Berg, the amount is still open for IBAN DE89 3704 0044 0532 0130 00.

With anonym-legal-guard

Claude receives

Write a payment reminder to ‹PERSON_1›, IBAN ‹IBAN_1›.

You read

Dear Anna Berg, the amount is still open for IBAN DE89 3704 0044 0532 0130 00.

Blocked by the firewall

A request to the model still contains DE89 3704 0044 0532 0130 00 in clear text, for example from a part that was not scanned. With leak_guard at its default (block), the request is stopped before it is sent.

Where it works

Works in Claude Code in the terminal and the desktop app. Not supported: Claude Code on the web, cloud sessions in the Claude mobile app and Claude in Slack.

  • Claude Code in the terminal (CLI)

    Supported (measured)

    Protection, status line, side panel and band. Answers show the real names.

  • Claude Code desktop app

    Supported (measured)

    Same as the terminal. Real names in answers only while no other surface is attached (for example Remote Control).

  • Headless (claude -p, CI, scripts)

    Protection runs

    No status line, side panel or dialogs. A withheld prompt ends with an error message. /pii prints its text where commands print text.

  • Remote Control (phone or browser attached to a local session)

    Placeholders only

    The attached device shows placeholders, not real names.

  • Claude Code on the web (claude.ai/code)

    Not supported

    Anthropic receives the prompt in plain text first (the session title is built from it). The mapping would sit on Anthropic's cloud machine, and answers keep the placeholders.

  • Claude mobile app (cloud sessions)

    Not supported

    Cloud sessions run like Claude Code on the web.

  • Claude in Slack

    Not supported

    Runs in Anthropic's cloud like Claude Code on the web.

  • claude.ai chat (not Claude Code)

    Not applicable

    The mod is for Claude Code only. For chats in the browser, our Chrome extension detects and anonymizes personal data before you send a message to Claude, ChatGPT, Gemini and other AI chatbots.

How do you install the mod?

Three steps: copy your API token, install the mod and enter the token, check with /pii. In Claude Code, /pii-setup walks you through it and opens the settings dialog. You need an anonym.legal account on Basic, Pro or Business. Works in Claude Code in the terminal and the desktop app; not supported in Claude Code on the web, in cloud sessions of the Claude mobile app or in Claude in Slack.

1. Copy your API token

  1. 1Sign in at anonym.legal.
  2. 2Open Settings → Developer.
  3. 3The card API Access Token shows your token. It is created the first time you open the tab.
  4. 4Copy it with the copy button. Keep it secret: Regenerate stops the old token at once, also in the Chrome extension.
Open Settings → Developer

2. Install the mod and enter the token

In Claude Code (terminal)

/plugin install anonym-legal-guard --marketplace georgecurta/anonym-legal-guard

Or from a shell

claude plugin marketplace add georgecurta/anonym-legal-guard
claude plugin install anonym-legal-guard@anonym-legal

Then

  1. 1Answer y to add the marketplace and choose the scope.
  2. 2Type /pii-setup: it shows where to copy the token and opens the settings dialog. Or type /plugin, choose anonym-legal-guard, then Configure.
  3. 3Paste your API token into the first field (api_key) and save. Only this field needs a value; all other options have default values, shown in their titles.

3. Check with /pii

  1. 1Type /pii. The status line shows 🛡 anonym.legal · protected only after the check with the anonym.legal server has succeeded.
  2. 2If something is wrong, for example no token, a wrong token (HTTP 401) or a Free plan (HTTP 403), a band above the input names the problem and the next step, and prompts are withheld.
  3. 3/pii also shows what the mod replaced in this session.

Claude desktop app

  1. 1Desktop app: Plugins → Add → Add marketplace → URL georgecurta/anonym-legal-guard → Sync, then install the mod.
  2. 2Then install the mod. If you already installed it in the terminal, the desktop app has it too (Installed locally); adding the marketplace again reports that a marketplace with the same name already exists.
  3. 3Open the mod's Configure dialog and paste your API token into api_key. The desktop app shows real names in answers as long as no remote access is attached.

Change the token later

  1. 1In a Claude Code session: type /pii-setup, or /plugin, choose anonym-legal-guard, then Configure. Type the new token into the first field; an empty field keeps the old token.
  2. 2From a shell: claude plugin configure anonym-legal-guard shows the options and which are not set.
  3. 3The token is stored by Claude Code's configure dialog (Claude Code keeps sensitive values in secure storage), not in your project files. The mod itself cannot set the token.

Update the mod

  1. 1From a shell: claude plugin marketplace update anonym-legal, then claude plugin update anonym-legal-guard.
  2. 2Or in a Claude Code session: type /plugin, open Marketplaces, choose anonym-legal, then Update.
  3. 3Restart Claude Code. claude plugin list shows the installed version; your token and options stay.

Uninstall or switch off

  1. 1From a shell: claude plugin uninstall anonym-legal-guard, then claude plugin marketplace remove anonym-legal.
  2. 2To switch it off for a while: claude plugin disable anonym-legal-guard; claude plugin enable anonym-legal-guard turns it back on.
  3. 3After a restart your prompts go to the model without replacement. To stop the token as well, click Regenerate under Settings → Developer on anonym.legal.

What the firewall shows you

States and counts, never the values themselves.

Status line

🛡 anonym.legal · protected · N replaced · M blocked. It says protected only after a successful check with the anonym.legal server; otherwise a note below the input says what to do next.

Side panel

In the terminal and the desktop app, /pii opens the firewall side panel on the right (it needs a wide window): state, last check and counts per type, such as names or IBANs. In the terminal, a short notice appears at the top right when the mod stops something, for example a shell command; /pii shows the details.

Blocking band

If a prompt is withheld, for example because the token is missing or wrong, a band above the input names the problem and the next step.

Status line, side panel and band appear in the terminal and in the desktop app. In Claude Code on the web none of these views appear.

What does the Claude Code mod do?

Everything below applies to values the detection finds. What it misses is not replaced — see Limits.

WhereWhat happens
PromptsDetected personal data is replaced with placeholders before the prompt goes to the model.
Files, command output, attachments, summariesText the model reads from files, command output, attachments and summaries is checked the same way. base64 and hex sections are decoded and checked.
Known valuesA value found once is replaced everywhere in the session, also in different upper or lower case, without a new detection request.
Files the model writesThe mod puts the real values back locally, so the file on your disk contains them. Strict mode file_values: deny stops the model from writing files that contain placeholders, so no real values are written to disk.
Outbound toolsWebFetch, WebSearch, MCP tools, Agent, Monitor and the shell receive placeholders. An argument that contains a known value in plain text is refused.
Every request to the modelEach request is searched for known values, also in encoded form. A clear leak stops the request.
Shell commandsConverters and uploads (base64 file, xxd, curl -d @file …) are refused. scp, sftp, rsync and tar c … | ask for confirmation.
Token countingClaude Code's count_tokens requests are not let out, because they would carry text before redaction.
Placeholder mappingWhen Claude Code runs on your machine (terminal or desktop app), the mapping between placeholder and value stays in the session there. anonym.legal does not hold it.
/piiChecks the connection to anonym.legal and shows what the mod did in the current session. In the terminal and the desktop app it also opens the firewall side panel.

Which plans include the mod?

  • Claude Code with mod support, version 2.1.325 or newer, running on your machine in the terminal or the desktop app. Claude Code on the web (claude.ai/code) is not supported. The mod API is early access.
  • An anonym.legal account on Basic, Pro or Business with an API token. The Free plan does not include it.
  • Each check is billed in tokens like an API call. Plans and token amounts are on the pricing page.
  • The code is MIT-licensed and public on GitHub. The detection service needs a plan.
View pricing

What does the mod not protect against?

The mod reduces how much personal data reaches the model. It does not remove the need to check what you share. Read these points before you rely on it:

  • •It protects against accidents, not against instructions planted in documents Claude reads (prompt injection) and not against deliberate misuse.
  • •Detection misses values. Whatever it misses goes to the model. Other encodings (rot13 and similar) pass through. Names written in lower case are not replaced.
  • •Claude Code's own local transcript (~/.claude/projects/) contains plain text. That file belongs to Claude Code, not to the mod.
  • •In auto mode, Claude Code's approval model can receive real values. With leak_guard: block (the default) the mod stops that request.
  • •--safe-mode, or three crashes of the mod runtime, switch the mod off.
  • •After --resume, old placeholders can no longer be translated back.
  • •By default the mod uses the detection languages saved in your anonym.legal account (Settings → Language); or set codes such as de or de,en. Each extra language checks every text again and costs tokens.
  • •The mod's messages are in English by default; set Interface language to de for German.
  • •Central rollout for organisations is in preparation; until then each person installs the mod.
  • •Real names on screen in the terminal and in the desktop app (as long as no remote access is attached). Other surfaces, such as a phone attached via Remote Control, show placeholders, because there the mod cannot reliably tell that the display stays local; with remote access attached, the desktop app shows placeholders too. Files Claude writes still get the real values (file_values: real).
  • •Not supported in Claude Code on the web (claude.ai/code): Anthropic receives the prompt there in plain text first (the session title, for example, is built from it); the mapping between placeholder and value would sit on Anthropic's cloud machine instead of your computer; and answers keep the placeholders, without status line or side panel.

Where does your data go?

Detection at anonym.legal

To find personal data, the mod sends the text to anonym.legal (/api/mcp/analyze, over HTTPS). anonym.legal sees this text for detection.

Mapping on your machine

When Claude Code runs on your machine (terminal or desktop app), which placeholder stands for which value stays in the Claude Code session there. anonym.legal does not hold the mapping. In Claude Code on the web it would sit on Anthropic's cloud machine; that is one reason the web is not supported.

Model provider

The model receives the text with placeholders for detected values. Your contract with the model provider is your own matter.

Local transcript

When Claude Code runs on your machine (terminal or desktop app), it writes its own transcript to ~/.claude/projects/. It contains plain text.

Mod, hook or MCP server: which keeps Claude from seeing personal data?

Three ways to use anonym.legal with Claude Code. They differ in when the text is replaced.

ApproachHow it worksDoes Claude see the plain text?
Hook (UserPromptSubmit, via the MCP server)Attaches an anonymized version of the prompt as additional context.Yes. The original prompt still goes to Claude.
MCP serverProvides tools that the model calls itself.Yes. The model has already seen the text when it calls the tool.
Mod anonym-legal-guardReplaces detected values before the model sees the text.Not for detected values. Values the detection misses reach the model.

If Claude should not see the plain text, the mod is the way to go. The hook and the MCP server remain useful for other tasks, for example anonymizing a text on request. MCP server and hook →

Source code

anonym-legal-guard is open source under the MIT licence. You can read the code, report issues and follow changes in the repository.

github.com/georgecurta/anonym-legal-guard →

A worked example

A team works with Claude Code in a project that holds client files: read a file, summarise it, write a note, run a command.

Read the use case →

Frequently Asked Questions

What does the anonym-legal-guard mod for Claude Code do?

anonym-legal-guard is a mod (plugin) for Claude Code, currently a preview. It replaces detected personal data — names, email addresses, IBANs, phone numbers and more — with placeholders such as ‹PERSON_1·k7p› before text goes to the model. It checks prompts, files the model reads, command output, attachments and summaries, and decodes base64 and hex sections. Answers show the real values again in the terminal and in the desktop app (as long as no remote access is attached); other surfaces show placeholders. When the model writes a file, the mod puts the real values back locally. It works in Claude Code on your machine (terminal or desktop app), not in Claude Code on the web. Use /pii to check the protection and see what it did in the current session.

What is the difference between the Claude Code mod, the hook and the MCP server?

The hook (UserPromptSubmit) attaches an anonymized version of the prompt as additional context; the original prompt still goes to Claude. The MCP server provides tools that the model calls itself, so the model has already seen the text. The mod replaces detected values before the model sees the text. If Claude should not see the plain text, the mod is the way to go.

Does anonym.legal see my text when I use the Claude Code mod?

Yes. Detection runs at anonym.legal (/api/mcp/analyze, over HTTPS), and anonym.legal sees the text for detection. When Claude Code runs on your machine (terminal or desktop app), the mapping between placeholders and real values stays in the session there; anonym.legal does not hold it. The model receives the text with placeholders for detected values. Your contract with the model provider is your own matter. Claude Code on the web is not supported: there Anthropic receives the prompt in plain text first, and the mapping would sit on Anthropic's cloud machine.

What does the Claude Code mod not protect against?

It protects against accidents, not against instructions planted in documents (prompt injection) and not against deliberate misuse. Detection misses values, and what it misses goes to the model; other encodings such as rot13 pass through, and names written in lower case are not replaced. Claude Code's local transcript (~/.claude/projects/) contains plain text. In auto mode the approval model can receive real values; with leak_guard: block (the default) the mod stops that request. --safe-mode switches off a mod you installed yourself, and after --resume old placeholders cannot be translated back. Claude Code on the web (claude.ai/code) is not supported, and real names on screen appear only in the terminal and in the desktop app (as long as no remote access is attached); other surfaces, such as Remote Control, show placeholders.

Which plan do I need for the Claude Code mod?

A Basic, Pro or Business plan with an API token. The Free plan does not include it. Each check is billed in tokens like an API call; see the pricing page for plans and token amounts. You also need Claude Code with mod support (version 2.1.325 or newer; the mod API is early access), running on your machine in the terminal or the desktop app. Claude Code on the web is not supported. The code itself is MIT-licensed on GitHub.

How do I install the Claude Code mod?

Three steps. 1. Copy your API token: sign in at anonym.legal, open Settings → Developer and copy the token from the card API Access Token (Basic, Pro or Business). 2. Install the mod and enter the token: in Claude Code (terminal) type /plugin install anonym-legal-guard --marketplace georgecurta/anonym-legal-guard, answer y and choose the scope; from a shell: claude plugin marketplace add georgecurta/anonym-legal-guard, then claude plugin install anonym-legal-guard@anonym-legal. In the desktop app: Plugins → Add → Add marketplace → URL georgecurta/anonym-legal-guard → Sync, then install the mod (if you installed it in the terminal already, the desktop app has it too). Then /plugin → anonym-legal-guard → Configure and paste the token into api_key; all other options have default values. 3. Type /pii: the status line shows 🛡 anonym.legal · protected once the check with the server has succeeded.

How should an organisation roll out the Claude Code mod?

Central rollout for organisations is in preparation; until then each person installs the mod. By default the mod uses the detection languages saved in each user's anonym.legal account; set codes such as de or de,en to fix them for everyone. Strict mode file_values: deny keeps real values off the disk for files the model writes. Tell users that Claude Code's local transcript contains plain text and that Claude Code on the web is not supported. The mod's messages are in English by default; Interface language de switches them to German.

How do I update or uninstall the Claude Code mod?

Update: claude plugin marketplace update anonym-legal, then claude plugin update anonym-legal-guard, and restart Claude Code; your token and options stay. Uninstall: claude plugin uninstall anonym-legal-guard and claude plugin marketplace remove anonym-legal. To switch it off for a while, use claude plugin disable anonym-legal-guard. Without the mod, prompts go to the model without replacement. Regenerate under Settings → Developer stops the token.

Try the Claude Code mod

Needs a Basic, Pro or Business plan with an API token and Claude Code on your machine (terminal or desktop app). The mod is a preview.

Limitations / Important note

  • It protects against accidents, not against instructions planted in documents Claude reads (prompt injection) and not against deliberate misuse.
  • Detection misses values. Whatever it misses goes to the model. Other encodings (rot13 and similar) pass through. Names written in lower case are not replaced.

How we measure — our methodology