Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(execenv): write OpenCode skills to .opencode/skills/ for native discovery (#2016)
Ákos Seres64c605e227e9
diff --git a/apps/docs/content/docs/guides/agents.zh.mdx b/apps/docs/content/docs/guides/agents.zh.mdxindex 4d2a8dcfe1..b489d64450 100644--- a/apps/docs/content/docs/guides/agents.zh.mdx+++ b/apps/docs/content/docs/guides/agents.zh.mdx@@ -40,7 +40,7 @@ The daemon auto-detects which CLIs are available on your PATH and registers themMultica supports two layers of skills:-- **Local skills** — Skills already installed in your local runtime (e.g., `.claude/skills/`, `.config/opencode/skills/`) are automatically discovered and used by agents. You do **not** need to upload them to Multica.+- **Local skills** — Skills already installed in your local runtime (e.g., `.claude/skills/`, `.opencode/skills/`) are automatically discovered and used by agents. You do **not** need to upload them to Multica.- **Workspace skills** — Skills created or imported in the Multica Skills page are shared across the workspace. They are automatically injected into agent runs as supplementary context, so every team member's agents benefit from them.Workspace skills are designed for team-wide sharing and collaboration — codify your team's best practices once, and every agent can leverage them:diff --git a/apps/docs/content/docs/providers.mdx b/apps/docs/content/docs/providers.mdxindex a2ece008b1..50be7d7d37 100644--- a/apps/docs/content/docs/providers.mdx+++ b/apps/docs/content/docs/providers.mdx@@ -21,7 +21,7 @@ For guidance on picking a tool when creating an agent, see [Creating and configu| **Hermes** | Nous Research | ✅ | ❌ | `.agent_context/skills/` (fallback) | Dynamic discovery || **Kimi** | Moonshot | ✅ | ❌ | `.kimi/skills/` | Dynamic discovery || **Kiro CLI** | Amazon | ✅ | ❌ | `.kiro/skills/` | Dynamic discovery |-| **OpenCode** | SST | ✅ | ❌ | `.config/opencode/skills/` | Dynamic discovery |+| **OpenCode** | SST | ✅ | ❌ | `.opencode/skills/` | Dynamic discovery || **OpenClaw** | Open source | ✅ | ❌ | `.agent_context/skills/` (fallback) | Bound to the agent, can't be switched per task || **Pi** | Inflection AI | ✅ (session is a file path) | ❌ | `.pi/skills/` | Dynamic discovery |@@ -103,7 +103,7 @@ Each tool uses **its own** skill discovery path. Before a task runs, the Multica| Cursor | `.cursor/skills/` | ✅ Native || Kimi | `.kimi/skills/` | ✅ Native || Kiro CLI | `.kiro/skills/` | ✅ Native |-| OpenCode | `.config/opencode/skills/` | ✅ Native |+| OpenCode | `.opencode/skills/` | ✅ Native || Pi | `.pi/skills/` | ✅ Native || Gemini | `.agent_context/skills/` | ⚠️ Generic fallback || Hermes | `.agent_context/skills/` | ⚠️ Generic fallback |diff --git a/apps/docs/content/docs/providers.zh.mdx b/apps/docs/content/docs/providers.zh.mdxindex 98b5105895..ddea6051a8 100644--- a/apps/docs/content/docs/providers.zh.mdx+++ b/apps/docs/content/docs/providers.zh.mdx@@ -21,7 +21,7 @@ Multica 内置支持 **11 款 AI 编程工具**。它们都实现了同一套接| **Hermes** | Nous Research | ✅ | ❌ | `.agent_context/skills/` (fallback)| 动态发现 || **Kimi** | Moonshot | ✅ | ❌ | `.kimi/skills/` | 动态发现 || **Kiro CLI** | Amazon | ✅ | ❌ | `.kiro/skills/` | 动态发现 |-| **OpenCode** | SST | ✅ | ❌ | `.config/opencode/skills/` | 动态发现 |+| **OpenCode** | SST | ✅ | ❌ | `.opencode/skills/` | 动态发现 || **OpenClaw** | 开源项目 | ✅ | ❌ | `.agent_context/skills/` (fallback)| 绑定在智能体上,不能在任务里切换 || **Pi** | Inflection AI | ✅(session 为文件路径)| ❌ | `.pi/skills/` | 动态发现 |@@ -103,7 +103,7 @@ Inflection AI 出品,极简主义。**会话恢复机制特殊**——session| Cursor | `.cursor/skills/` | ✅ 原生 || Kimi | `.kimi/skills/` | ✅ 原生 || Kiro CLI | `.kiro/skills/` | ✅ 原生 |-| OpenCode | `.config/opencode/skills/` | ✅ 原生 |+| OpenCode | `.opencode/skills/` | ✅ 原生 || Pi | `.pi/skills/` | ✅ 原生 || Gemini | `.agent_context/skills/` | ⚠️ 通用 fallback || Hermes | `.agent_context/skills/` | ⚠️ 通用 fallback |diff --git a/docs/product-overview.md b/docs/product-overview.mdindex 8c85f0daff..8057422c3b 100644--- a/docs/product-overview.md+++ b/docs/product-overview.md@@ -372,7 +372,7 @@ skill3. **注入**:当 agent 认领任务时,daemon 把挂载的 skill 内容写到任务工作目录的 **provider 原生位置**:- Claude Code → `.claude/skills/{name}/SKILL.md`- Codex → `CODEX_HOME/skills/{name}/`- - OpenCode → `.config/opencode/skills/{name}/SKILL.md`+ - OpenCode → `.opencode/skills/{name}/SKILL.md`- Pi → `.pi/skills/{name}/SKILL.md`- Cursor → `.cursor/skills/{name}/SKILL.md`- GitHub Copilot → `.github/skills/{name}/SKILL.md`diff --git a/server/internal/daemon/execenv/context.go b/server/internal/daemon/execenv/context.goindex 6c78a4726e..dfac6066fb 100644--- a/server/internal/daemon/execenv/context.go+++ b/server/internal/daemon/execenv/context.go@@ -15,7 +15,7 @@ import (// Claude: skills → {workDir}/.claude/skills/{name}/SKILL.md (native discovery)// Codex: skills → handled separately in Prepare via codex-home// Copilot: skills → {workDir}/.github/skills/{name}/SKILL.md (native project-level discovery)-// OpenCode: skills → {workDir}/.config/opencode/skills/{name}/SKILL.md (native discovery)+// OpenCode: skills → {workDir}/.opencode/skills/{name}/SKILL.md (native discovery)// Pi: skills → {workDir}/.pi/skills/{name}/SKILL.md (native discovery)// Cursor: skills → {workDir}/.cursor/skills/{name}/SKILL.md (native discovery)// Kimi: skills → {workDir}/.kimi/skills/{name}/SKILL.md (native discovery)@@ -131,8 +131,8 @@ func resolveSkillsDir(workDir, provider string) (string, error) {// See: https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-config-dir-referenceskillsDir = filepath.Join(workDir, ".github", "skills")case "opencode":- // OpenCode natively discovers skills from .config/opencode/skills/ in the workdir.- skillsDir = filepath.Join(workDir, ".config", "opencode", "skills")+ // OpenCode natively discovers skills from .opencode/skills/ in the workdir.+ skillsDir = filepath.Join(workDir, ".opencode", "skills")case "pi":// Pi natively discovers skills from .pi/skills/ in the workdir.skillsDir = filepath.Join(workDir, ".pi", "skills")diff --git a/server/internal/daemon/execenv/execenv_test.go b/server/internal/daemon/execenv/execenv_test.goindex b77ec0b85d..b724fee1c9 100644--- a/server/internal/daemon/execenv/execenv_test.go+++ b/server/internal/daemon/execenv/execenv_test.go@@ -740,17 +740,17 @@ func TestWriteContextFilesOpencodeNativeSkills(t *testing.T) {t.Fatalf("writeContextFiles failed: %v", err)}- // Skills should be in .config/opencode/skills/ (native discovery).- skillMd, err := os.ReadFile(filepath.Join(dir, ".config", "opencode", "skills", "go-conventions", "SKILL.md"))+ // Skills should be in .opencode/skills/ (native discovery).+ skillMd, err := os.ReadFile(filepath.Join(dir, ".opencode", "skills", "go-conventions", "SKILL.md"))if err != nil {- t.Fatalf("failed to read .config/opencode/skills/go-conventions/SKILL.md: %v", err)+ t.Fatalf("failed to read .opencode/skills/go-conventions/SKILL.md: %v", err)}if !strings.Contains(string(skillMd), "Follow Go conventions.") {t.Error("SKILL.md missing content")}- // Supporting files should also be under .config/opencode/skills/.- supportFile, err := os.ReadFile(filepath.Join(dir, ".config", "opencode", "skills", "go-conventions", "templates", "example.go"))+ // Supporting files should also be under .opencode/skills/.+ supportFile, err := os.ReadFile(filepath.Join(dir, ".opencode", "skills", "go-conventions", "templates", "example.go"))if err != nil {t.Fatalf("failed to read supporting file: %v", err)}diff --git a/server/internal/daemon/execenv/runtime_config.go b/server/internal/daemon/execenv/runtime_config.goindex 6cedcfe1ea..6e89747cc7 100644--- a/server/internal/daemon/execenv/runtime_config.go+++ b/server/internal/daemon/execenv/runtime_config.go@@ -48,7 +48,7 @@ func formatProjectResource(r ProjectResourceForEnv) string {// For Claude: writes {workDir}/CLAUDE.md (skills discovered natively from .claude/skills/)// For Codex: writes {workDir}/AGENTS.md (skills discovered natively via CODEX_HOME)// For Copilot: writes {workDir}/AGENTS.md (skills discovered natively from .github/skills/)-// For OpenCode: writes {workDir}/AGENTS.md (skills discovered natively from .config/opencode/skills/)+// For OpenCode: writes {workDir}/AGENTS.md (skills discovered natively from .opencode/skills/)// For OpenClaw: writes {workDir}/AGENTS.md (skills discovered natively from .openclaw/skills/)// For Hermes: writes {workDir}/AGENTS.md (skills fall back to .agent_context/skills/; AGENTS.md points there)// For Gemini: writes {workDir}/GEMINI.md (discovered natively by the Gemini CLI)diff --git a/server/internal/daemon/repocache/cache.go b/server/internal/daemon/repocache/cache.goindex 968a6a0208..ef5eab4bc8 100644--- a/server/internal/daemon/repocache/cache.go+++ b/server/internal/daemon/repocache/cache.go@@ -50,6 +50,8 @@ func gitEnv() []string {)}+var agentGitExcludePatterns = []string{".agent_context", "CLAUDE.md", "AGENTS.md", ".claude", ".opencode"}+// RepoInfo describes a repository to cache.type RepoInfo struct {URL string@@ -435,7 +437,7 @@ func (c *Cache) CreateWorktree(params WorktreeParams) (*WorktreeResult, error) {return nil, fmt.Errorf("update existing worktree: %w", err)}- for _, pattern := range []string{".agent_context", "CLAUDE.md", "AGENTS.md", ".claude", ".config/opencode"} {+ for _, pattern := range agentGitExcludePatterns {_ = excludeFromGit(worktreePath, pattern)}@@ -475,7 +477,7 @@ func (c *Cache) CreateWorktree(params WorktreeParams) (*WorktreeResult, error) {}// Exclude agent context files from git tracking.- for _, pattern := range []string{".agent_context", "CLAUDE.md", "AGENTS.md", ".claude", ".config/opencode"} {+ for _, pattern := range agentGitExcludePatterns {_ = excludeFromGit(worktreePath, pattern)}diff --git a/server/internal/daemon/repocache/cache_test.go b/server/internal/daemon/repocache/cache_test.goindex f41b141ac0..4ec45f73ca 100644--- a/server/internal/daemon/repocache/cache_test.go+++ b/server/internal/daemon/repocache/cache_test.go@@ -502,6 +502,55 @@ func TestCreateWorktree(t *testing.T) {}}+func TestCreateWorktreeExcludesOpenCodeSkills(t *testing.T) {+ t.Parallel()+ sourceRepo := createTestRepo(t)+ cacheRoot := t.TempDir()++ cache := New(cacheRoot, testLogger())+ if err := cache.Sync("ws-1", []RepoInfo{{URL: sourceRepo}}); err != nil {+ t.Fatalf("sync failed: %v", err)+ }++ workDir := t.TempDir()+ result, err := cache.CreateWorktree(WorktreeParams{+ WorkspaceID: "ws-1",+ RepoURL: sourceRepo,+ WorkDir: workDir,+ AgentName: "OpenCode",+ TaskID: "opencode-exclude-test",+ })+ if err != nil {+ t.Fatalf("CreateWorktree failed: %v", err)+ }++ exclude := gitInfoExclude(t, result.Path)+ if !strings.Contains(exclude, ".opencode\n") {+ t.Fatalf("expected .git/info/exclude to contain .opencode, got:\n%s", exclude)+ }+ if strings.Contains(exclude, ".config/opencode") {+ t.Fatalf("expected .git/info/exclude to not contain stale .config/opencode, got:\n%s", exclude)+ }+}++func gitInfoExclude(t *testing.T, worktreePath string) string {+ t.Helper()+ cmd := exec.Command("git", "-C", worktreePath, "rev-parse", "--git-dir")+ out, err := cmd.Output()+ if err != nil {+ t.Fatalf("git rev-parse --git-dir failed in %s: %v", worktreePath, err)+ }+ gitDir := strings.TrimSpace(string(out))+ if !filepath.IsAbs(gitDir) {+ gitDir = filepath.Join(worktreePath, gitDir)+ }+ data, err := os.ReadFile(filepath.Join(gitDir, "info", "exclude"))+ if err != nil {+ t.Fatalf("read .git/info/exclude failed: %v", err)+ }+ return string(data)+}+func TestCreateWorktreeNotCached(t *testing.T) {t.Parallel()cacheRoot := t.TempDir()