opencode-secret-redactorOpenCode plugin that redacts secrets from LLM context and restores them for tool execution
3
182
67 in 7 days
31.5
Multi-signal model
4 months ago
2026-04-04
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-secret-redactor@0.5.1"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-secret-redactor@0.5.1"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-secret-redactoropencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
An OpenCode plugin that prevents secrets from leaking
into LLM context. Secrets detected in tool output are replaced with
🔒label🔓 tokens before the model sees them, then transparently
restored when a tool needs the real value for execution.
Detected secret types
AWS keys, GitHub/GitLab tokens, OpenAI/Anthropic keys, Google Cloud
credentials, Stripe keys, Slack tokens, JWTs, private keys, database
connection strings, and many more. See
src/patterns.ts for the full list.
Setup
Add the plugin to your opencode.json:
{
"plugin": ["opencode-secret-redactor@0.5.1"]
}
The plugin hooks into tool execution automatically -- no further configuration is required.
How it works
- After
bashorreadtool output, the plugin scans for secrets using pattern matching and stores any matches in an in-memory vault. - The output sent to the LLM contains only redacted placeholders.
- Before
bash,write, oredittool execution, placeholders in the tool arguments are replaced with the original values so commands run correctly.