Misrules
opencode plugin: persistent session rules that survive compaction
1
43
近 7 天 6
30.9
生态多维模型
1 个月前
2026-09-15
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-misrules@0.1.2"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-misrules@0.1.2"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-misrulesOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Keep your project conventions in the agent's head — for good.
Load the .md files you need (code style, examples, agreements) and the agent follows them for the whole session. Even after compaction, they're never forgotten. No relying on skills deciding on their own whether to kick in — you control exactly what the agent follows.
opencode plugin opencode-misrules -g
Manual install
The plugin is a single self-contained file. Copy it into your global plugin folder and restart opencode:
mkdir -p ~/.config/opencode/plugin
cp plugin/misrules.ts ~/.config/opencode/plugin/misrules.ts
@opencode-ai/plugin is already available under
~/.config/opencode/node_modules, so no extra install step is needed.
Use
Ask the agent to load your project docs:
Load
docs/style.mdanddocs/testing/as rules.
Behind the scenes the agent calls misrules_add. From then on, those rules are always in effect — no re-reading, no reminding.
| Tool | What it does |
|---|---|
misrules_add |
Load .md files or folders as session rules |
misrules_remove |
Stop following rules |
misrules_list |
See what's loaded |
Lock it down
.opencode/misrules.json (or ~/.config/opencode/misrules.json) — block sensitive files from ever being loaded:
{ "denyPatterns": ["*.env*", "*secret*"] }
License
MIT
同类生态推荐
Persona
opencode-persona
OpenCode plugin that asks for the user's professional role once, persists it in Engram, and injects role instructions, communication preferences, and project conventions at the start of every session
Fast Jev Opencode
fast-jev-opencode
Verbatim context pruning for OpenCode v1 and v2: prune stale tool calls and truncate bulky tool results from the outgoing model request using TypeSafe Jev decisions, instead of summarizing context.
Router
@s-berdia/opencode-router
Automatic model routing and quota failover for OpenCode Go, Go Plus, and Free. Switches models before you hit your limit.