feat(server): load OpenCode skills from .agents/skills/ directory#2811
feat(server): load OpenCode skills from .agents/skills/ directory#2811torturado wants to merge 1 commit into
Conversation
The OpenCode driver was not exposing skills in the provider snapshot, which meant skills defined in .agents/skills/SKILL.md files were not available when using the OpenCode provider in t3code. This adds: - parseSkillFrontmatter() to parse YAML frontmatter from SKILL.md files - loadOpenCodeSkills() to read .agents/skills/ directory and build ServerProviderSkill entries - Wiring of skills into makePendingOpenCodeProvider and checkOpenCodeProviderStatus so they appear in the provider snapshot - Provider layer setup in OpenCodeDriver for FileSystem and Path
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 532a15e. Configure here.
| .map((line) => line.replace(/^\s*\|?\s*/, "")) | ||
| .join(" ") | ||
| .trim(); | ||
| } |
There was a problem hiding this comment.
Folded description truncates lines
Medium Severity
In parseSkillFrontmatter, folded description: > blocks are parsed with a regex that ends at the first line boundary, so only the first continuation line is captured. Additional folded lines are dropped before join/trim, so skill tooltips and descriptions can be wrong whenever SKILL.md uses multi-line folded YAML.
Reviewed by Cursor Bugbot for commit 532a15e. Configure here.
ApprovabilityVerdict: Needs human review This PR introduces a new feature for loading skills from the filesystem, adding new user-facing capability. Additionally, there is an unresolved comment identifying a bug in the YAML frontmatter parsing logic that could cause incorrect skill descriptions. You can customize Macroscope's approvability policy. Learn more. |


Problem
When using the OpenCode provider in t3code, skills defined in
./agents/skills/were not available in the slash command menu (triggered by$``). This is because the OpenCode driver never loaded skills into the provider snapshot — only the Codex driver did (viaskills/listRPC).The Codex driver calls
client.request("skills/list", { cwds: [cwd] })and includes the result in the provider snapshot. The OpenCode driver only loads models and agents, never skills.Solution
Add skill loading directly in the OpenCode provider by reading
./agents/skills/` directory on disk:parseSkillFrontmatter()— Parses YAML frontmatter fromSKILL.mdfiles (supportsname,descriptionwith>folding,displayName)loadOpenCodeSkills()— Reads./agents/skills/directory, parses eachSKILL.md, buildsServerProviderSkill` entriesmakePendingOpenCodeProviderandcheckOpenCodeProviderStatus(including error cases)Changes
apps/server/src/provider/Layers/OpenCodeProvider.ts— +119 lines (skill loading + wiring)apps/server/src/provider/Drivers/OpenCodeDriver.ts— +17 lines (pass cwd, provide FileSystem/Path layers)Verification
bun typecheck— passesbun fmt— passesbun lint— passes (0 errors, warnings are pre-existing)This is a small, focused fix that mirrors the Codex driver's behavior for skills.
Note
Low Risk
Read-only local filesystem discovery with graceful empty fallback; no auth or runtime behavior changes beyond enriching the provider snapshot.
Overview
The OpenCode provider now loads agent skills from the workspace (
.agents/skills/*/SKILL.md) and attaches them to every provider snapshot, so slash-command skill menus work the same way they already do for Codex.OpenCodeProvidergainsparseSkillFrontmatter(YAMLname, foldeddescription,displayName) andloadOpenCodeSkills, which scans skill directories, skips invalid entries, and buildsServerProviderSkillobjects (including truncatedshortDescription).makePendingOpenCodeProviderandcheckOpenCodeProviderStatusboth takecwd, requireFileSystem/Path, and passskillsintobuildServerProvideron success, pending, disabled, and error paths.OpenCodeDriverpassesserverConfig.cwdinto those effects andEffect.provides mergedPath.layerandNodeFileSystem.layerfor the initial snapshot and status check.Reviewed by Cursor Bugbot for commit 532a15e. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Load OpenCode skills from
.agents/skills/directory into provider snapshotsloadOpenCodeSkillsin OpenCodeProvider.ts that scans<cwd>/.agents/skills/, reads each subdirectory'sSKILL.md, parses YAML-like frontmatter forname,description, anddisplayName, and returns a list ofServerProviderSkillobjects withenabled: true.makePendingOpenCodeProviderandcheckOpenCodeProviderStatusto callloadOpenCodeSkillsand include the resulting skills array in all returnedServerProviderDraftobjects, including error and disabled states.Path.layerandNodeFileSystem.layerinto the provider creation effects in OpenCodeDriver.ts and passesserverConfig.cwdto the snapshot builder.Macroscope summarized 532a15e.