Skip to content

About

Keeps secrets and personal data out of Claude Code and Codex. Local, deterministic, no model to download: Python's standard library only.

Topics

Resources

Contributing

Security policy

Stars

12 stars

Watchers

0 watching

Forks

Latest commit

 

History

3,728 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maisecrets

version license Claude Code Codex Python telemetry

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.

maisecrets demo: values with a lock on your screen, placeholders for the AI

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.

What it does

  • 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-hygiene checks 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.

Install

Claude Code (CLI, desktop app, Cowork):

claude plugin marketplace add Mcpgate-de/maisecrets
claude plugin install maisecrets@maisecrets     # then start a new session

When 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@maisecrets

Then 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.

Requirements

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.

Update and uninstall

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 plugin
claude plugin uninstall maisecrets@maisecrets
codex plugin remove maisecrets@maisecrets

Uninstalling 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 --yes

or delete the maisecrets items in Keychain Access or Credential Manager and the ~/.maisecrets folder by hand. wipe reports when an item refused to go.

Check that it works

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.

Where you can use it today

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.

How well it detects

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.

Everyday commands

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 all adds 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.

What it does not protect

  • 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.

What the Claude Code mod does

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 (or mod-values, mod-reveal, mod-demo, mod-settings, mod-result). On Windows it tries py -3, then python, 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.append masks 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.call and tool.run note a refused call, so its reason reaches the AI. The mod registers no classic.* 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. /compact and 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.render and ui.close (drawing on your screen), session.start (the screen key), command.run (/maisecrets without a model turn), turn.step (the demo), tool.call (refuses a call with a pairing nonce) and turn.complete (panel status).
  • Prompt suggestions in the demo: the mod sets CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION off 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.

Documentation by reader

Licence

Apache-2.0. The licensor is named in NOTICE; the vendored rule sets carry their own licences.

Moved sections

The sections below moved to the documents by reader. Each heading keeps the old link to its section.

Quick start

Moved to docs/USING.md.

How it works

Moved to docs/HOW-IT-WORKS.md.

What it looks like

Moved to docs/USING.md.

Status

Moved to docs/HOW-IT-WORKS.md.

Client support

Moved to docs/CLIENTS.md.

For administrators

Moved to docs/ADMIN.md.

What the plugin runs, sends and fetches

Moved to docs/HOW-IT-WORKS.md.

Secret hygiene skill

Moved to docs/USING.md.

Options

Moved to docs/USING.md.

Settings you decide

Moved to docs/USING.md.

Where your secrets went

Moved to docs/USING.md.

Vault

Moved to docs/USING.md.

Check a value first: ms:(…)

Moved to docs/USING.md.

Handing a value to Claude on purpose

Moved to docs/USING.md.

Invisible characters

Moved to docs/HOW-IT-WORKS.md.

Disguised values in tool results

Moved to docs/HOW-IT-WORKS.md.

Password exports in tool results

Moved to docs/HOW-IT-WORKS.md.

Reporting a wrong detection

Moved to docs/USING.md.

Reporting an internal failure

Moved to docs/USING.md.

Gates around a resolve

Moved to docs/HOW-IT-WORKS.md.

SSH consent (optional)

Moved to docs/ADMIN.md.

Rehydration policy (optional)

Moved to docs/ADMIN.md.

Test data that maisecrets leaves alone

Moved to docs/USING.md.

Detection rules

Moved to docs/HOW-IT-WORKS.md.

Rules of your own

Moved to docs/ADMIN.md.

PDFs and images

Moved to docs/USING.md.

Terms: names, case numbers, customer names

Moved to docs/USING.md.

Values from your own tools

Moved to docs/ADMIN.md.

Vault references

Moved to docs/ADMIN.md.

Sensitive References

Moved to docs/ADMIN.md.

Names from a service (optional)

Moved to docs/ADMIN.md.

Known gaps (measured or documented)

Moved to docs/KNOWN-GAPS.md.

About

Keeps secrets and personal data out of Claude Code and Codex. Local, deterministic, no model to download: Python's standard library only.

Topics

Resources

Contributing

Security policy

Stars

12 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages