Cloakroom

Built by modmyclaude

Check your secrets at the door. Claude gets a ticket; the real value only comes back where you allow it.

Safetyv0.1.5
Cloakroom in Claude Code: recognizable values replaced by session tickets.
Cloakroom in Claude Code: recognizable values replaced by session tickets. Open Cloakroom image at original size
Tests316 passing
Model callsnone
Commands1
Settings1

Keep recognizable secrets out of the conversation

Cloakroom replaces recognizable API keys and passwords with session tickets before they reach Claude. The model sees tickets; approved local writes can receive the original values. This reduces exposure, but is not a security boundary.

When to use it

  • Paste a diagnostic log without repeating a recognizable key in the conversation.
  • Let Claude edit a local configuration file using tickets instead of copying the secret into its answer.
  • Check older transcripts for possible exposures so you can decide what to rotate.

Try it in your session

  1. Let masking work during normal work. A recognized value becomes a session ticket; do not use a real secret for a demonstration.

  2. List ticket names and kinds without printing their values.

    /cloakroom
  3. Check past transcripts for possible exposures. Audit findings stay in the on-screen pane, but cannot undo an earlier exposure.

    /cloakroom audit
  4. If you need to inspect a value yourself, replace <ticket> with a ticket from the list. It appears briefly on your screen, not in the transcript. Keep it out of screen shares.

    /cloakroom show <ticket>

Choose the behavior

In /config, choose Cloakroom and leave enabled on. It is the only setting. Verify masking notices and the ticket list in a new session.

enabledReviewed default: true
Turn it off only when you want masking disabled.

Where it works

The reviewed version draws its list, audit pane and holds in Terminal and Desktop. See current platform guidance separately; source-defined UI is not a manual compatibility test.

Check current platform versions and installation guidance

Know the limits

  • No model calls or network requests of its own. Tickets exist only in session memory and do not survive restart or reload.
  • Unrecognized values and secrets in images or PDFs can pass through. Direct environment or file reads outside the conversation can expose values.
  • Other mods and settings hooks can see values on separate paths. Restored values may appear in permission UI and auto-mode model requests. Rotate exposed credentials; masking cannot take them back.

Reviewed version 0.1.5, source reviewed 2026-10-15. Read the pinned README (8628e8f). This walkthrough describes that version, not a new live Claude Code test. Catalogue updates may describe a newer version.

Reported behavior and access

Files Project .env files and explicit transcript audits

Reads project .env files and transcripts for an explicit audit. Rewrites records for your configured OpenTelemetry collector and can submit an approved retry prompt.

Shell commands None reported

Reads project .env files and transcripts for an explicit audit. Rewrites records for your configured OpenTelemetry collector and can submit an approved retry prompt.

Network Optional: used through claude code or subprocesses

Reads project .env files and transcripts for an explicit audit. Rewrites records for your configured OpenTelemetry collector and can submit an approved retry prompt.

Added model calls None reported

The reviewed README reports no model calls of its own. Ordinary Claude Code work still uses your model.

Sound Not reviewed

Behavior has not been source-reviewed for this version. Check the README before relying on its access.

Handled events config.set "cloakroom.enabled", session.start, tool.call, prompt.submit, prompt.attachment, prompt.context, prompt.compose, skill.prompt, session.append, session.send, session.receive, telemetry.log collector, ui.render AbovePrompt, ui.render Pane, command.run /cloakroom

Event registration does not mean blocking. Read the source for whether an event observes, changes or holds an action.

README-reported behavior, not a sandbox guarantee. Source v0.1.5, 54f71c0, reviewed 22 Oct 2026

Original Claude Code validator report

reads files

Can read files, but cannot write them.

commands

Does not run commands.

network

Does not make network requests.

model

Does not call a model.

sound

Does not play sound.

Validator hook registrations

Uses hooks: config.set, tool.call, prompt.submit, session.append, session.send, session.receive, telemetry.log.

Static validator signals can miss indirect effects, optional configuration and engine-managed storage.

How it works

Slash commands

/cloakroom

List this session's secret tickets, or show, forget or audit

Settings

enabledDefault: true
Switch cloakroom off without uninstalling it. The modmyclaude hub flips this too.

Hook events

config.set "cloakroom.enabled"session.starttool.callprompt.submitprompt.attachmentprompt.contextprompt.composeskill.promptsession.appendsession.sendsession.receivetelemetry.log collectorui.render AbovePromptui.render Panecommand.run /cloakroom

The prompt

Details

Check your secrets at the door. Claude gets a ticket; the real value only comes back where you allow it.

What it can and cannot do

Read this first. Cloakroom lowers the chance that a secret ends up somewhere it should not. It does not make that impossible, and it never claims to prevent exfiltration.

It CAN:

  • Keep secrets out of the model request, the saved transcript, screen shares and exports (all but Claude Code's own permission box, see the CANNOT list), at every door it hooks: tool results (every tool, MCP included), your prompt and pastes, @-mentioned files, CLAUDE.md and the first message's context, the system prompt's sections, reminders and settings-hook output, skill text, every row the conversation stores, messages to and from other agents and sessions, and records sent to your own OpenTelemetry collector. A secret becomes a ticket such as [secret:STRIPE_SECRET_KEY#k3x9qa].
  • Learn the secret-named values in your project's .env files when the session starts (those long and varied enough to be a real secret, see Limits), then hide them wherever they show up later, including their base64, URL-encoded and JSON-escaped forms. That catches an echo or printenv that no pattern would.
  • Turn tickets back into real values only inside Write, Edit and NotebookEdit, and inside a Bash command made only of local file tools (see "Which Bash commands get the real value"), so Claude can still write your .env. Web fetches, MCP tools, subagent prompts, messages to other sessions and questions shown to you keep the ticket.
  • Hold any other Bash command that carries a known secret until you press Allow once: one that names a network program (curl, wget, nc, ssh, scp, rsync to a remote, git push, bash's /dev/tcp, a remote URL beside the value), and one it cannot vouch for at all (sh -c, bash -c, eval, source, node, python, npm, make, find, xargs to a shell, a script, a variable used as the program). A hold needs a positive reason to pass, never the absence of a known threat.
  • Find secrets already written into your past Claude Code transcripts (/cloakroom audit), so you know what to rotate. The findings are drawn in a pane on your screen, never sent to Claude.

It CANNOT:

  • Stop a malicious mod installed beside it. A mod whose hooks run before cloakroom's sees values before they are hidden; one whose tool hooks run after it sees restored values.
  • See into your settings hooks (hooks in settings.json). They receive tool inputs and outputs on their own path.
  • Stop a secret that never enters the conversation. printenv | curl ..., a $STRIPE_SECRET_KEY reference, or a script that reads .env itself all pass: cloakroom only holds a command when it can see the value in it. That is also the recommended way to use a secret in a command, and Claude is told so.
  • Tell where a local program's output goes once it is on disk. A value cloakroom wrote into .env with echo can be read and sent by the next command, which it checks on its own when the value is literal in it, and cannot when the command reads the file.
  • Vouch for a local port. A command that hands a value to curl http://localhost:3000 is held like any other network call, because a local port can forward anywhere.
  • Tell a program by anything but its name. ./echo or /tmp/cat is taken for the real echo or cat; a script that borrows a local tool's name is the same case as a script that reads .env itself.
  • Read images, PDFs or other media. A key in a screenshot reaches Claude.
  • Undo exposure that already happened. Rotate anything /cloakroom audit finds.
  • Keep a restored value off your screen when Claude Code asks permission. The permission dialog shows a Bash command or file content after the ticket was swapped back. In auto mode, the permission classifier reads it too, and that is a model request. Writing $STRIPE_SECRET_KEY in commands instead of the value avoids both. Cloakroom tells Claude to prefer that.
  • Remember anything across a restart. Tickets live in the mod's memory only, so a ticket from before a restart or reload is refused in tools rather than written as text. Paste the value again, or use its environment variable.

What the validator sees it reach (claude plugin validate --strict):

hooks: config.set{key="cloakroom.enabled"}, session.start, tool.call, prompt.submit, prompt.attachment, prompt.context, prompt.compose, skill.prompt, session.append, session.send, session.receive, telemetry.log{to=collector}, ui.render{component=AbovePrompt}, ui.render{component=Pane, requestId=cloakroom-audit}, command.run{command=cloakroom}
answers its own command: command.run{command=cloakroom}
gating hook without .catch: config.set{key="cloakroom.enabled"}
gating hook with .catch: tool.call, prompt.submit, session.append, session.send, session.receive, telemetry.log{to=collector}
calls: $.clock.after (via show), $.clock.now, $.command.register, $.env.get (via runAudit), $.fs.list (via listDir), $.fs.read (via runAudit, seed), $.prompt.submit, $.session.surfaces (via audit, show), $.ui.invalidate (via redraw, rescanAll, rescanCached), $.ui.open (via audit), $.ui.resolve, $.ui.toast
env writes: nothing
env reads: CLAUDE_CONFIG_DIR, HOME, USERPROFILE
hooks telemetry for: collector

Which Bash commands get the real value

A real value is swapped into a Bash command only when every program on the line is on this list, and nothing on the line points at the network:

echo printf cat tee head tail wc uniq cut tr rev fold paste column grep egrep fgrep cmp diff comm jq test [ true false cp mv mkdir rmdir touch ls stat chmod chown ln readlink realpath basename dirname pwd cd date sleep base64 xxd od hexdump md5sum sha1sum sha256sum shasum, plus the shell's own export unset set local declare typeset readonly shift return break continue exit read wait umask, and if for while case and the other shell keywords. Heredoc bodies are data. sudo, env, timeout, nice and nohup are looked through to the program they run.

Everything else is held with the red band, for example sh -c '...', eval, node -e, python -c, npm run, make, find, xargs ... sh, ./script.sh, $PROGRAM ..., sed, awk and sort (all three can run other programs), and any curl, wget, nc, ssh, git push or remote URL. The band names the program, Allow once runs that exact command one time, and Claude is told to prefer the variable ($STRIPE_SECRET_KEY), which passes untouched because it carries no value.

Use it

There is nothing to turn on. From the next session, a secret that would reach Claude arrives as a ticket instead:

STRIPE_SECRET_KEY=[secret:STRIPE_SECRET_KEY#k3x9qa]

The same value keeps the same ticket for the whole session. The random part is drawn fresh each session and never computed from the value. When you paste a key into a prompt, a short notice says it was swapped. Claude reads one added line in its instructions: tickets turn back into real values only in Write, Edit, NotebookEdit and Bash, and it should prefer environment variables in commands.

The red band. When a Bash command carries a secret and cloakroom cannot vouch for it, Claude is told the call was held, and a band appears above the prompt:

held: STRIPE_SECRET_KEY#k3x9qa was about to leave via curl to paste.example
Claude was told to wait. Allow once lets this exact command run one time.
[ Deny ]  [ Allow once ]

or, for a command that is not made of local file tools:

held: STRIPE_SECRET_KEY#k3x9qa is in a command cloakroom cannot vouch for: sh is not on its local-only list

Shell syntax it cannot follow is named as the feature it is, such as process substitution <( ) can run a program.

The band never takes the keyboard by itself. Click it, or press ctrl+x tab, and the focus starts on Deny (d also denies). Allow once has no key, so a stray keystroke cannot press it; click it or move to it on purpose. Allow once lets that exact command run one time within 10 minutes and tells Claude it may run it again. Deny leaves it refused. While a hold waits for you, it is drawn on its own (other mods' bands come back once you answer), so nothing another mod draws can hide Deny.

Commands:

  • /cloakroom lists this session's tickets: the name, the kind, where it was found, and how often it was hidden and restored. It never prints a value. Like any command's output, the list is a transcript row that Claude reads; Claude already sees the tickets themselves.
  • /cloakroom show <ticket> draws the value in the band above the prompt for 30 seconds, with a Hide button. It goes to your screen only, never into the transcript or to Claude. Control characters in a value show as U+FFFD.
  • /cloakroom forget <ticket> stops hiding that value for the rest of the session (for a false positive). Its ticket stops working in tools.
  • /cloakroom audit checks your past transcripts and lists each exposed secret by kind and date, with a preview such as sk_live_...9f2, in a pane on your screen only. Claude is told only that the results are in the pane: not a preview, name, date or file. Values under 16 characters show only their length. Run it again to continue past the time budget.

show, forget and audit run only when you type them (in the terminal, the desktop app or Remote Control). Another plugin, a peer session, a channel or a prompt-injected Claude running them is refused. The plain list runs from anywhere.

Settings

  • On: on by default. Off, cloakroom hides nothing, restores nothing, holds nothing and reads no file: every door passes what Claude Code sends as it is, so a secret that reaches Claude while it is off reaches it as written. A ticket Claude already holds stays its ticket text (written as text into a file, say); the real value never comes back while it is off. What was hidden before stays hidden. Switching off drops any held command, Allow once and shown value. Switching on reads the .env files (if the session started off) and has the cached prompt parts checked again; switching reloads the mod, so tickets from before it are refused in tools, as after a restart. /cloakroom says it is off. /config or the modmyclaude hub flips it, live; another mod, or a /config sent over Remote Control, can switch it on but not off.

What it can touch

  • Files read: your project's .env and .env.* files at session start, at the root and up to two folder levels down (apps/web/.env), skipping node_modules, .git, build output and hidden folders, at most 120 folders. An @-mentioned file is not read by cloakroom: it is scrubbed as the attachment Claude Code makes of it, its line count kept, so #L10-20 still names the same lines. Your transcripts under ~/.claude/projects (or $CLAUDE_CONFIG_DIR/projects), only when you run /cloakroom audit, newest first, at most 4 MiB per file and about 6 seconds and 96 MB per run.
  • Files written: none: no store, no settings, no plugin state, no copy of any file. A real value is never written to disk by cloakroom.
  • Memory: the ticket-to-value map and the last audit's results, in the mod's own memory, gone when the session ends or the mod reloads.
  • Shown to Claude: the plain /cloakroom list and the one-line answers of show, forget and audit, as any command's output is. Never a value, and never the audit's findings.
  • Environment: reads CLAUDE_CONFIG_DIR, HOME and USERPROFILE (to find transcripts). Writes none.
  • Prompts sent: one, only after you press Allow once, telling Claude it may run the held command again.
  • Telemetry: rewrites records bound for your own OpenTelemetry collector when one is configured. It never touches Anthropic's own analytics.
  • Network, processes, model calls: none.

Limits

  • Detection is pattern-based: known key formats (AWS, GitHub, Anthropic, OpenAI, Stripe, Slack, Google, Twilio, Resend, SendGrid, Mailgun, npm, PyPI, GitLab, Hugging Face and more), private key blocks, JWTs, Bearer and Basic headers, passwords in connection URLs, and values written next to a secret-like name. A secret in an unknown format with no telling name can be missed. Stripe publishable keys (pk_) and documentation examples are left alone on purpose.
  • Only a value that is at least 8 characters, varied enough (about 3 bits of entropy per character), not a filesystem path and not a common default (postgres, password, admin, changeme, localhost and the like) is learned and hidden everywhere it appears. A short or common-default value is not learned and is only caught by shape: DB_PASSWORD=hunter2 is hidden where it sits next to its name, but the bare word hunter2 later in a log is not, and POSTGRES_PASSWORD=postgres is left alone so postgres in image names, lockfiles and package lists stays readable. A path next to a password-like name (PWD, OLDPWD, PASSWORD_STORE_DIR) is never treated as a secret.
  • Every pattern runs in linear time. A test sends 1 MB and 5 MB of text built to stall pattern matchers through a real tool call, best of three runs each, and requires the 5 MB run to take under 8 times as long as the 1 MB one (linear is about 5 times, quadratic 25), with a 15-second backstop (alone, 5 MB measured about 0.6 seconds on a laptop). Text over 16 MB, text whose check overruns 4 seconds, or a value nested too deep to walk is withheld rather than passed on unchecked.
  • If a check fails, the text is withheld, not sent. A tool result becomes [cloakroom: result withheld, redaction failed], a prompt is not sent (it says why), an attachment (an @-mentioned file among them) is withheld, and a call that could not be checked does not run.
  • The band (holds and show) draws in the terminal and the desktop app. In VS Code and on mobile there is no band: a held command stays refused (run it yourself), and show says it needs one of the other two. So does audit, whose pane is drawn only there too.
  • Some things are written by Claude Code itself, outside the doors cloakroom hooks: a large tool output it saves to its tool-results folder, and its own prompt history (what the up arrow recalls), which may keep a pasted key as you typed it.
  • A row may flash on screen, or reach an SDK stream or Remote Control, just before cloakroom rewrites it. Neither the model nor the transcript file reads that form. Tool results are rewritten before they are drawn.
  • Context another mod attaches to a tool result cannot be changed at that point (Claude Code requires it word for word). It is scrubbed when it reaches Claude, as an attachment and as a stored row.
  • show puts the value in the band. Another mod that draws around the band can read it there.

Built from a prompt

This mod was built from prompts/cloakroom.md.

added 9 Oct 2026updated 17 Oct 2026MITSource on GitHub

Pairs well with