【opencode】opencode插件

1. opencode插件安装位置

Linux/macOS :~/.config/opencode/plugins/
Windows :%USERPROFILE%.config\opencode\plugins

说明:

2. 最简单的插件

新增两个插件:

复制代码
C:\Users\Administrator\.config\opencode\plugins\plugin-a.js
C:\Users\Administrator\.config\opencode\plugins\plugin-b.js

plugin-a.js:

typescript 复制代码
export const PluginA = async ({ client, directory }) => {
  return {
    'experimental.chat.system.transform': async (_input, output) => {
      (output.system ||= []).push('<EXTREMELY_IMPORTANT>plugin-a</EXTREMELY_IMPORTANT>');
    }
  };
};

plugin-b.js:

typescript 复制代码
export const PluginB = async ({ client, directory }) => {
  return {
    'experimental.chat.system.transform': async (_input, output) => {
      (output.system ||= []).push('<EXTREMELY_IMPORTANT>plugin-b</EXTREMELY_IMPORTANT>');
    }
  };
};

效果:

重启opencode:

说明:

  • 我们这时候问:"你的system prompt里有什么特殊标记?",可以从里面发现我们两个插件system prompt追加的东西已经带进去了。
  • 现在很多开源的skills核心能力就是在发送LLM前修改系统prompt,换句话说我们现在具备开发skills能力的前提了。
相关推荐
楚国的小隐士2 小时前
在生产环境中和AI协作编程
ai·大模型·编程·软件工程·ai编程·软件架构
wangruofeng3 小时前
一个 Markdown 文件攒下 37k 星,i-have-adhd 给 AI 输出立了 10 条规矩
github·aigc·ai编程
全栈弄潮儿6 小时前
需求不清时,如何让 AI 帮你补全问题,而不是瞎写代码
aigc·openai·ai编程
一航jason6 小时前
Android平台推理框架及试用场景模型对比
android·人工智能·ai·架构·ai编程·llama
一航jason6 小时前
Android 端侧大模型推理框架对比
android·人工智能·ai·ai编程·llama·ai-native
angered8 小时前
「AI 应用 / AI Agent」行业日报 · 2026-09-08
人工智能·ai编程
学者猫头鹰9 小时前
RAG检索增强生成:文档加载解析
ai编程
J_bean9 小时前
避免 Claude Code 误删数据的方法
ai编程
PeterHan_Enjoy12 小时前
用 AI 做了半年项目,我把省下的时间算了笔账
ai编程·vibecoding