fix(execenv): write OpenCode skills to .opencode/skills/ for native discovery#2016
fix(execenv): write OpenCode skills to .opencode/skills/ for native discovery#2016AkosSeres wants to merge 3 commits intomultica-ai:mainfrom
Conversation
|
@AkosSeres is attempting to deploy a commit to the IndexLabs Team on Vercel. A member of the Team first needs to authorize it. |
Bohan-J
left a comment
There was a problem hiding this comment.
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!
|
Thanks @Bohan-J for the review, I fixed your finding! What changed:
Verified with:
I pushed this as a separate commit, let me know if I should squash the commits instead. |
Background
I found that the OpenCode skill-injection path was not correct for workdir-scoped skills. Earlier code placed skills for the
opencodeprovider underworkDir/.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: routeopencodeworkspace skill injection toworkDir/.opencode/skills/soSKILL.mdfiles and supporting assets land where OpenCode discovers workdir-scoped skills.context.goandruntime_config.goto reference.opencode/skills/for OpenCode injection..config/opencode/skills/to.opencode/skills/where they describe injected/project-level OpenCode skills.TestWriteContextFilesOpencodeNativeSkillsto lock in.opencode/skills/behavior and ensure.agent_context/skills/is no longer created for OpenCode.Test
AI Disclosure
AI tool used: Multica Agent + Hermes Agent