/cloak:cloakfrom cloak
Use a sensitive value (API key, token, password, private key) in a command WITHOUT reading its plaintext. Trigger whenever a task needs a credential but you must not see, print, or store the raw value. The user hands a secret over by typing it into the chat box; a UserPromptSubmit hook intercepts it before it reaches you, so you only ever work with an opaque handle like {{secret:openai_api_key}}. A resolver uses the secret outside your context and redacts it from output.
Ships in cloak. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You can use secrets without ever reading them. A secret's plaintext
must never enter your context. You only ever work with an opaque handle
(a name like openai_api_key).
Commands below use the cloak command. This plugin puts it on the Bash PATH
automatically — there is no install step. Just call cloak ....
The user registers a secret by typing, on its own line in the chat box:
secret-set openai_api_key sk-realkey...
A UserPromptSubmit hook intercepts that line before it reaches you: it stores the plaintext and blocks the message, so the raw value never lands in your context or the transcript. You will instead receive a short receipt naming the handle (e.g. "stored handle openai_api_key"). That is expected — just acknowledge it and continue; do not ask the user to repeat the value.
You never need to register secrets yourself, and you must never ask the user to
paste a secret as ordinary chat text outside this secret-set line.
List the available handles — this returns names only, never values:
cloak list
Pick the handle whose name fits the task. If the one you need is missing, ask
the user to register it with a secret-set <handle> <value> line in chat.
Two ways, both keep the plaintext out of your context:
Inline placeholder — put {{secret:NAME}} where the value goes and run
the command through the resolver:
cloak run -- \
curl -s -H "Authorization: Bearer {{secret:openai_api_key}}" \
https://api.openai.com/v1/models
Environment injection — declare the handle with --secret NAME; it is
exposed to the child process as $CLOAK_NAME (uppercased,
non-alphanumerics become _):
cloak run --secret openai_api_key -- \
bash -c 'curl -s -H "Authorization: Bearer $CLOAK_OPENAI_API_KEY" https://api.openai.com/v1/models'
The command's stdout/stderr come back to you redacted — any occurrence of
the resolved value (and common encodings of it) is replaced with ***.
cat/grep/less on the store file,
python -c to load it, or base64 -d its contents. (A PreToolUse hook also
blocks this.)--debug/-v
flags whose purpose is to dump the secret. Don't write it to a file you then
read. Don't expand $CLOAK_* outside cloak run.secret-set line, which the hook intercepts.cloak listcloak rm openai_api_keyCLOAK_VALUE='...' cloak set openai_api_key{{secret:openai_api_key}}) freely.run.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub yewandou7/cloak --plugin cloak