Skip to content

fix(execenv): write OpenCode skills to .opencode/skills/ for native discovery#2016

Open
AkosSeres wants to merge 3 commits intomultica-ai:mainfrom
AkosSeres:fix/opencode-skill-path
Open

fix(execenv): write OpenCode skills to .opencode/skills/ for native discovery#2016
AkosSeres wants to merge 3 commits intomultica-ai:mainfrom
AkosSeres:fix/opencode-skill-path

Conversation

@AkosSeres
Copy link
Copy Markdown

Background

I found that the OpenCode skill-injection path was not correct for workdir-scoped skills. Earlier code placed skills for the opencode provider under workDir/.config/opencode/skills/, but OpenCode’s workdir/project-scoped skills are discovered from .opencode/skills/ (source: https://opencode.ai/docs/skills/). As a result, injected workspace skills would not land in the path OpenCode scans for project-level skill discovery.

OpenCode still uses the user-level/global path under ~/.config/opencode/skills/<name>/SKILL.md, so the existing local-runtime import/discovery behavior for global skills remains unchanged.

Change

  • resolveSkillsDir: route opencode workspace skill injection to workDir/.opencode/skills/ so SKILL.md files and supporting assets land where OpenCode discovers workdir-scoped skills.
  • Update doc comments in context.go and runtime_config.go to reference .opencode/skills/ for OpenCode injection.
  • Update provider documentation and product overview references from .config/opencode/skills/ to .opencode/skills/ where they describe injected/project-level OpenCode skills.
  • Update TestWriteContextFilesOpencodeNativeSkills to lock in .opencode/skills/ behavior and ensure .agent_context/skills/ is no longer created for OpenCode.

Test

go test ./internal/daemon/execenv -run TestWriteContextFilesOpencodeNativeSkills -count=1
ok  github.com/multica-ai/multica/server/internal/daemon/execenv

go test ./internal/daemon/execenv ./internal/daemon -count=1
ok  github.com/multica-ai/multica/server/internal/daemon/execenv
ok  github.com/multica-ai/multica/server/internal/daemon

AI Disclosure

AI tool used: Multica Agent + Hermes Agent

@vercel
Copy link
Copy Markdown

vercel Bot commented May 3, 2026

@AkosSeres is attempting to deploy a commit to the IndexLabs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Collaborator

@Bohan-J Bohan-J left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix — the routing change to .opencode/skills/ is correct, and I verified the OpenCode docs (https://opencode.ai/docs/skills/) confirm .opencode/skills/<name>/SKILL.md is the project-scoped path while ~/.config/opencode/skills/ remains the user-level one. The doc updates and the tightened TestWriteContextFilesOpencodeNativeSkills look great. Locally I ran go test ./internal/daemon/execenv ./internal/daemon ./internal/daemon/repocache -count=1 and everything passes.

One blocking issue before merge:

server/internal/daemon/repocache/cache.go:426 and :458 still exclude the old path. Both call sites do:

for _, pattern := range []string{".agent_context", "CLAUDE.md", "AGENTS.md", ".claude", ".config/opencode"} {
    _ = excludeFromGit(worktreePath, pattern)
}

excludeFromGit writes these patterns into the worktree's .git/info/exclude so injected agent files don't show up in git status or get accidentally staged. Before this PR, OpenCode skills landed in .config/opencode/skills/, which that pattern covered. After this PR they land in .opencode/skills/, but the exclude list still references the stale .config/opencode. The new injection directory is therefore no longer hidden, so any OpenCode task whose agent runs git add -A / git commit -a could pull the injected SKILL.md files into a commit. That's a regression introduced by this PR.

Suggested fix:

for _, pattern := range []string{".agent_context", "CLAUDE.md", "AGENTS.md", ".claude", ".opencode"} {
    _ = excludeFromGit(worktreePath, pattern)
}

It would also be worth adding a small repocache test asserting the new worktree's .git/info/exclude contains .opencode, so future path moves don't silently drop the exclude again.

Unrelated to this PR but worth noting for a follow-up: the same exclude list doesn't cover .cursor/, .kimi/, .kiro/, .pi/, or .github/skills/, even though those providers also inject natively. Probably worth extracting these patterns into a shared constant alongside resolveSkillsDir so they can't drift apart again.

Happy to re-review once the exclude pattern is updated. Thanks!

@AkosSeres
Copy link
Copy Markdown
Author

Thanks @Bohan-J for the review, I fixed your finding!

What changed:

  • Replaced the stale repocache git exclude for .config/opencode with .opencode and extract the list into a shared agentGitExcludePatterns for both call sites
  • Adds TestCreateWorktreeExcludesOpenCodeSkills; I first confirmed it failed against the stale exclude, then made it pass.

Verified with:

  • go test ./internal/daemon/repocache -run TestCreateWorktreeExcludesOpenCodeSkills -count=1
  • go test ./internal/daemon/execenv ./internal/daemon ./internal/daemon/repocache -count=1

I pushed this as a separate commit, let me know if I should squash the commits instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants