Skip to content

feat(server): load OpenCode skills from .agents/skills/ directory#2811

Open
torturado wants to merge 1 commit into
pingdotgg:mainfrom
torturado:feat/opencode-skills
Open

feat(server): load OpenCode skills from .agents/skills/ directory#2811
torturado wants to merge 1 commit into
pingdotgg:mainfrom
torturado:feat/opencode-skills

Conversation

@torturado
Copy link
Copy Markdown

@torturado torturado commented May 26, 2026

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 (via skills/list RPC).

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 from SKILL.md files (supports name, description with > folding, displayName)
  • loadOpenCodeSkills() — Reads ./agents/skills/directory, parses eachSKILL.md, builds ServerProviderSkill` entries
  • Skills are included in all provider snapshot paths: makePendingOpenCodeProvider and checkOpenCodeProviderStatus (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 — passes
  • bun fmt — passes
  • bun 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.

OpenCodeProvider gains parseSkillFrontmatter (YAML name, folded description, displayName) and loadOpenCodeSkills, which scans skill directories, skips invalid entries, and builds ServerProviderSkill objects (including truncated shortDescription). makePendingOpenCodeProvider and checkOpenCodeProviderStatus both take cwd, require FileSystem / Path, and pass skills into buildServerProvider on success, pending, disabled, and error paths.

OpenCodeDriver passes serverConfig.cwd into those effects and Effect.provides merged Path.layer and NodeFileSystem.layer for 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 snapshots

  • Adds loadOpenCodeSkills in OpenCodeProvider.ts that scans <cwd>/.agents/skills/, reads each subdirectory's SKILL.md, parses YAML-like frontmatter for name, description, and displayName, and returns a list of ServerProviderSkill objects with enabled: true.
  • Updates makePendingOpenCodeProvider and checkOpenCodeProviderStatus to call loadOpenCodeSkills and include the resulting skills array in all returned ServerProviderDraft objects, including error and disabled states.
  • Wires Path.layer and NodeFileSystem.layer into the provider creation effects in OpenCodeDriver.ts and passes serverConfig.cwd to the snapshot builder.
  • Invalid or unreadable skill entries are skipped; an unreadable skills directory returns an empty list rather than failing.

Macroscope summarized 532a15e.

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
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 29fcaa84-3122-4866-8c93-8c67d980fcb7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 532a15e. Configure here.

@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 26, 2026

Approvability

Verdict: 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.

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