Files
nexus/wiki/sources/readme.md

41 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "OpenCode Integration"
type: source
tags: []
date: 2026-04-26
---
## Source File
- [[raw/Agent/agency-agents/scripts/i18n/README.md]]
## Summary用中文描述
- 核心主题OpenCode 的子 Agent 集成机制——如何将 .md 文件格式的 Agent 转换为 OpenCode 可调用的子代理
- 问题域OpenCode IDE 中的多 Agent 协作与按需调用
- 方法/机制:通过 YAML frontmatter 中的 `mode: subagent` 标记,将具名 Agent 从 Tab 循环列表中分离,改为按需 `@agent-name` 调用;颜色通过命名颜色到十六进制的自动映射实现
- 结论/价值:提供了一种轻量级、无需修改主 Agent 系统的子 Agent 扩展方案,支持项目级和全局级两种安装范围
## Key Claims用中文描述
- OpenCode Agent 通过在 `.opencode/agents/` 目录存储 .md 文件(带 YAML frontmatter实现——文件格式与 The Agency 的 Agent 定义格式兼容
- `mode: subagent` 配置使 Agent 仅在 `@agent-name` 触发时出现,不会在 Tab 循环列表中占位——保持主 Agent 列表的简洁性
- 命名颜色(如 `cyan`)在安装脚本中被自动转换为十六进制颜色代码——无需手动查表
- Agent 支持两种安装范围:项目级(`.opencode/agents/`)和全局级(`~/.config/opencode/agents/`)——通过不同路径实现作用域隔离
- 转换脚本 `./scripts/convert.sh --tool opencode` 负责将 The Agency 的标准 Agent 文件转换为 OpenCode 兼容格式
## Key Quotes
> "mode: subagent — agent is available on-demand, not shown in the primary Tab-cycle list"
> — Agent YAML frontmatter 的核心语义,说明 subagent 模式与普通 agent 的本质区别
## Key Concepts
- [[Subagent]]:按需调用的辅助 Agent通过 `@agent-name` 语法触发,不参与 Tab 循环
- [[OpenCode]]:一个支持多 Agent 协作的 IDE/编辑器扩展平台
## Key Entities
- [[The Agency]]OpenCode Agent 的来源框架,提供 147 个专业化 Agent 定义
## Connections
- [[contributing]] ← 贡献来源 ← [[Agent/agency-agents/integrations/opencode/README.md]]
- [[The Agency]] ← Agent 定义来源 ← [[Agent/agency-agents/integrations/opencode/README.md]]
## Contradictions
- (未检测到与其他页面的明显冲突)