@howaboua/opencode-per-agent-skillsFilter OpenCode skills on a per-agent basis using configurable allowlists and blocklists
0
10
近 7 天 1
13.3
生态多维模型
8 个月前
2025-12-22
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@howaboua/opencode-per-agent-skills@0.1.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@howaboua/opencode-per-agent-skills@0.1.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @howaboua/opencode-per-agent-skillsopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Filter OpenCode skills on a per-agent basis using configurable allowlists and blocklists.
Prevent skill leakage, enforce agent roles, and keep your system prompt clean.
Installation
Add to your OpenCode config:
// opencode.jsonc
{
"plugin": ["@howaboua/opencode-per-agent-skills@latest"],
}
Using @latest ensures you always get the newest version automatically when OpenCode starts.
Restart OpenCode. The plugin will automatically start filtering skills based on your configuration.
Configuration
The plugin uses its own config file:
- Global:
~/.config/opencode/per-agent-skills.jsonc, created automatically on first run.
Default Configuration (click to expand)
{
// ===========================================================================
// OpenCode Per-Agent Skills Configuration
// ===========================================================================
// 1. Global Filtering (Applies to ALL agents)
"global": {
// Skills to show to EVERY agent (overrides agent-specific excludes)
// "include": ["basic-file-ops"],
// Skills to hide from EVERY agent
// "exclude": ["deprecated-skill"]
},
// 2. Per-Agent Configuration
"agents": {
// Example: Restricted "compaction" agent
"compaction": {
"include": ["git-release", "code-summary"],
"exclude": ["code-modification"],
},
// Example: Broad "exploration" agent
"exploration": {
"include": ["*-analysis", "*-docs", "file-discovery"],
"exclude": ["git-push"],
},
},
// 3. Metadata Filters (Advanced)
"metadataFilters": {
"category": {
"review": {
"include": ["security", "linting"],
},
},
},
// 4. Debugging
"verbose": false,
}
Features
- Per-Agent Filtering: Define specific allowlists (
include) and blocklists (exclude) for each agent. - Global Rules: Set baseline rules that apply to all agents.
- Wildcard Support: Use
git-*,*-analysis, or*patterns. - Metadata Filtering: Filter skills based on frontmatter metadata in their
SKILL.mdfiles. - Safe Defaults: If no config exists, all skills are shown.
How It Works
- Intercept: The plugin hooks into
experimental.chat.system.transform. - Identify: It determines the current agent from the active session.
- Filter: It filters the
<available_skills>XML block in the system prompt based on your configuration.
Development
To install from source for development:
- Clone the repository:
git clone https://github.com/IgorWarzocha/Opencode-per-agent-skills-plugin.git cd Opencode-per-agent-skills-plugin - Install dependencies and build:
bun install && bun run build - Link in your OpenCode config:
{ "plugins": ["/path/to/Opencode-per-agent-skills-plugin"], }
License
MIT