opencode-policyOpenCode plugin for blocked file patterns and prompt injection policies
20
47
9 in 7 days
34.9
Multi-signal model
3 months ago
2026-04-24
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-policy@0.1.4"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-policy@0.1.4"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-policyopencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
OpenCode security plugin with:
You can review the full rule sets there and add or remove patterns to fit your workspace.
Unsafe tool patterns
Prompt injection patterns
Use it when you want stronger workspace safety out of the box: it helps prevent secret exposure, exfiltration, unsafe shell execution, reverse shells, denial-of-service commands, cross-workspace access, and common instruction-override attacks. Matching events are logged to .opencode/opencode-policy.log for review.
Simple install
opencode plugin opencode-policy@latest --global
Install from npm
Install the package:
npm install opencode-policy
Then add it to one of these OpenCode config files:
~/.config/opencode/opencode.jsonfor your useropencode.jsonin your project root for one project
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-policy"]
}
License
Thanks
Pattern research and source material were adapted in part from vakovalskii/topsha