【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能力的前提了。
相关推荐
搬砖的小码农_Sky4 小时前
AI Agent:如何处理Claude Code 最近版本(2026年更新)引入的模型上下文限制
人工智能·windows·ai·ai编程
全栈弄潮儿6 小时前
一次真实失败:AI 代码看起来没问题,为什么还是翻车了?
aigc·openai·ai编程
李航19837 小时前
AI定制柜建模,需要详细的建模规范和标准流程
人工智能·python·计算机视觉·ai·ai编程
长弓三石8 小时前
用纯 Java 做一个企业级 Agent Harness 平台:BizBuddy 的设计与取舍
开源·agent·ai编程
zhangfeng113311 小时前
Ag / Cu / Au / Ru / Ir / Rh银 铜 金 钌铱 铑 纳米尺度下的 导电性 + 扩散/迁移缺点
人工智能·华为·ai编程·npu
蒸蒸yyyyzwd12 小时前
CUDA 学习笔记
ai编程
Web3_Basketball12 小时前
Ollama本地函数调用发布72小时,我替你试完了
ai编程
9i编程12 小时前
1. 教 AI 上班:带出我的数字同事 —— 把开发习惯交给 Qoder,从零搭脚手架
人工智能·openai·ai编程
用户55635255605612 小时前
[避坑] AI工具雷达避坑 | frontend-design的真实问题
ai编程