Keeps passwords, tokens and personal data out of Claude Code and Codex. A value becomes a placeholder before the
model sees it, and goes back in on your machine only where a command or a file needs it. No model, no download, no
package: Python's standard library only (the optional name service, /maisecrets ner local, downloads a container of
about 690 MB). Install takes two commands.
Claude works with the placeholders. The real value goes back in only when a command or a tool call runs on your machine, and the output comes back masked again. More examples: What it looks like.
- Blocks or rewrites a prompt that carries a secret: the model gets a placeholder such as
⟦SECRET_c1⟧, never the value. - Masks tool output (files, commands, MCP results) before the model reads it.
- Puts the value back locally when the agent uses the placeholder in a command or a file.
- Checks a value first:
ms:(your value)tells you whether it would be caught, without sending it. - Finds what leaked before: maisecrets protects from the moment it runs.
/maisecrets:secret-hygienechecks a repository, its git history and your earlier sessions for secrets that got out before; rotate what it finds. - Your own rules, terms and imports: team rule folders,
/maisecrets term add Jan Kowalski, values from your own NER. - PDFs and images: a PDF goes to the model as masked text only, or you are asked first.
- Local and deterministic: no model, no telemetry, no network request except for a service you set up: a name service, a gateway, or a server with vault references.
Claude Code (CLI, desktop app, Cowork):
claude plugin marketplace add Mcpgate-de/maisecrets
claude plugin install maisecrets@maisecrets # then start a new sessionWhen Cowork runs in the cloud (a new task on Pro, Max and Ultra) or you use Claude Code on the web or Remote Control, the prompt you type reaches Anthropic before maisecrets runs: maisecrets keeps the value from the model there, not from Anthropic's servers. In Claude Code on your own computer, the value does not leave it (Known gaps).
Codex (CLI, IDE extension, and the Codex agent inside the ChatGPT desktop app):
codex plugin marketplace add https://github.com/Mcpgate-de/maisecrets.git
codex plugin add maisecrets@maisecretsThen open /hooks in Codex and trust the maisecrets entries. Codex runs no hook of a plugin until you trust it, and it
asks again after each update.
Updates, the install for a team, and what an update does to an open session: docs/ADMIN.md.
Python 3.9 or newer on the PATH the client gives its hooks (python3 --version).
The stock python3 of macOS (3.9) is enough; nothing to install on a Mac.
Windows: install Python for all users, as an administrator:
winget install --id Python.Python.3.12 --exact --scope machine. Codex on Windows
runs commands as a sandbox user, and that user cannot start a Python installed for one
person only (docs/CLIENTS.md, "Codex on Windows: the sandbox user"). Linux: your package manager, plus
openssl for the vault and xclip if you want the clipboard. Without it the
plugin blocks every prompt and names the missing piece.
Claude Code does not update a marketplace outside Anthropic's by itself, so new sessions keep starting the old
version: turn on auto-update for maisecrets in /plugin under Marketplaces, or fetch it before the update. A
running session keeps its version until it restarts.
claude plugin marketplace update maisecrets # fetch the newest release first
claude plugin update maisecrets@maisecrets # or a new session with an org-synced pluginclaude plugin uninstall maisecrets@maisecrets
codex plugin remove maisecrets@maisecretsUninstalling keeps the stored values until their TTL ends. To delete them, the metadata and the logs at once, run
wipe before you uninstall, while the plugin folder is still there (/maisecrets status prints the folder):
bash <plugin folder>/hooks/run.sh wipe --yesor delete the maisecrets items in Keychain Access or Credential Manager and
the ~/.maisecrets folder by hand. wipe reports when an item refused to go.
Start a new session and run /maisecrets status test (in Codex, send maisecrets: status test). It prints a test
value that the AI only sees as ⟦SELFTEST⟧; type that value as your next prompt, and maisecrets answers "Self-test
passed" without sending it.
To try it with real data, send maisecrets: demo on in a new session. Your messages show with their values locked,
and no prompt goes to the AI until /clear. More.
Only the clients that are built and measured (in the harness of this repository, or seen live):
| Client | Prompt | Values back in commands and files | Tool output |
|---|---|---|---|
| Claude Code (CLI, desktop app, Cowork) | ✓ replaced (from Claude Code 2.1.287; before that blocked; in Cowork after the first tool call) | ✓ | ✓ |
| Codex (CLI, ChatGPT desktop app) | ✓ blocked; you send the cleaned prompt again | ✓ | ✓ |
Not yet: Gemini CLI, Cursor, Copilot CLI, OpenCode. Why: docs/CLIENTS.md.
Measured on data that no rule was written from. Method and all numbers: mcpgate.de/maisecrets/built-to-be-checked.
- Personal data in four public datasets (0.9.12): precision 0.92 to 0.997, and the best F1 of four tools on three of them (against Presidio, Preserve, pii-anon). Names are the weak point; the optional name service masks more.
- Secrets in GitHub issues (3,761 values, 0.8.2): recall 0.72; Betterleaks 0.55, gitleaks 0.53.
- A sealed holdout of 872 texts (0.9.12): 2 false alarms, precision 0.997.
In Claude Code (/ms NAME is the same; /maisecrets:NAME needs the mod; a change is the text you type; Codex:
docs/USING.md):
/maisecrets status: does it protect this session? One short line per check;/maisecrets status alladds the details.ms:(your value): would this value be caught? Nothing is sent. More./maisecrets: one panel in Claude Code for your settings, stored values and the name service, with no model turn. More./maisecrets list: the stored values, masked, never a secret. More.maisecrets: not a secret KEY: a wrong hit; never mask this exact value again. More./maisecrets:secret-hygiene: the secrets that leaked before you installed maisecrets. More.
- A process that runs as you, or an agent that deliberately runs code to switch maisecrets off (threat model, C22).
- A name without a label. maisecrets masks the names on your term list, and more with the optional name service.
- A value that a command changes with an encoding before it prints it.
- A client without hooks: the chat apps, the web and the mobile apps.
- The output of a failed command in Claude Code, a secret inside a PDF or an image, and the other measured limits: docs/KNOWN-GAPS.md.
In Claude Code, maisecrets also loads a mod, claude-mod/maisecrets-mod.mjs. These are the facts of its code:
- What it reads: the prompts you send (to put placeholders in place of values), each tool result before Claude Code keeps it (to mask what the hook missed), and the messages and tool rows that Claude Code draws on your screen (to show you the values). What it draws on the screen never goes to the model. It also reads the session id, the working directory, the kind of screen and whether a message is in view (to draw values only there). It keeps one counter in the plugin's Claude Code store (how often it showed its screen hint). The screen facts and the counter stay on this computer.
- What it starts: the mod itself starts only the plugin's
hooks/dispatch.py, in the plugin folder, with a fixed command line:python3 hooks/dispatch.py mod-prompt(ormod-values,mod-reveal,mod-demo,mod-settings,mod-result). On Windows it triespy -3, thenpython, with the same arguments. It does not start a shell. For the local name service of the panel, that Python starts another Python, which starts its container with Docker or Podman. - What it sends: the text of the question (a prompt, a tool result, the keys or references to show, a panel
action), with the session id and, for a prompt, the working directory and where the prompt came from (the prompt box or
Remote Control), goes to that local Python process on stdin, as JSON. The mod itself makes no network request.
The Python process sends text off this computer only to a service you set up: the name service of
/maisecrets ner, or a server you added that offers vault references or Sensitive References (/maisecrets sref login). The details: What the plugin runs, sends and fetches. - The hooks on results and prompts:
session.appendmasks a tool result that the maisecrets result hook did not check, before Claude Code keeps it; if that fails, it withholds the output. It knows a checked result by the receipt that the result hook leaves in the maisecrets home (a hash of the result with a keyed proof).tool.callandtool.runnote a refused call, so its reason reaches the AI. The mod registers noclassic.*hook, because an organization passes over those of a plugin you installed. - The demo (
/maisecrets demo on): each model step gets one line from the mod instead of a request./compactand the side requests that Claude Code makes on its own (a title by/rename,/btw,/recap) still go to the AI, with placeholders only, never a stored value: the mod has no hook on them, because an organization passes over such hooks. Without an answer from the plugin's Python, the mod answers the step too, so nothing goes out by mistake. - Its other hooks:
prompt.submit(placeholders in your prompt),ui.renderandui.close(drawing on your screen),session.start(the screen key),command.run(/maisecretswithout a model turn),turn.step(the demo),tool.call(refuses a call with a pairing nonce) andturn.complete(panel status). - Prompt suggestions in the demo: the mod sets
CLAUDE_CODE_ENABLE_PROMPT_SUGGESTIONoff for the demo, and after it back to the default of Claude Code (not to a value you set). If that reset fails, suggestions stay off until the next session.
- Using it: docs/USING.md.
- Administering it: docs/ADMIN.md.
- How it works: docs/HOW-IT-WORKS.md, and what is defended: docs/THREAT-MODEL.md.
- Known gaps: docs/KNOWN-GAPS.md.
- Clients: docs/CLIENTS.md.
- Benchmarks: mcpgate.de/maisecrets/built-to-be-checked; docs/BENCHMARKS.md is an older snapshot (October 2026).
- Contributing: CONTRIBUTING.md, docs/TESTING.md, docs/REPO-STANDARDS.md.
- Changes, privacy, security: CHANGELOG.md, PRIVACY.md, SECURITY.md.
Apache-2.0. The licensor is named in NOTICE; the vendored rule sets carry their own licences.
The sections below moved to the documents by reader. Each heading keeps the old link to its section.
Moved to docs/USING.md.
Moved to docs/HOW-IT-WORKS.md.
Moved to docs/USING.md.
Moved to docs/HOW-IT-WORKS.md.
Moved to docs/CLIENTS.md.
Moved to docs/ADMIN.md.
Moved to docs/HOW-IT-WORKS.md.
Moved to docs/USING.md.
Moved to docs/USING.md.
Moved to docs/USING.md.
Moved to docs/USING.md.
Moved to docs/USING.md.
Moved to docs/USING.md.
Moved to docs/USING.md.
Moved to docs/HOW-IT-WORKS.md.
Moved to docs/HOW-IT-WORKS.md.
Moved to docs/HOW-IT-WORKS.md.
Moved to docs/USING.md.
Moved to docs/USING.md.
Moved to docs/HOW-IT-WORKS.md.
Moved to docs/ADMIN.md.
Moved to docs/ADMIN.md.
Moved to docs/USING.md.
Moved to docs/HOW-IT-WORKS.md.
Moved to docs/ADMIN.md.
Moved to docs/USING.md.
Moved to docs/USING.md.
Moved to docs/ADMIN.md.
Moved to docs/ADMIN.md.
Moved to docs/ADMIN.md.
Moved to docs/ADMIN.md.
Moved to docs/KNOWN-GAPS.md.
