anomalyco / anomalyco/opencode

core: project skills missing from session when instruction baseline is captured before config skill plugin loads

Open
#50,147 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 2m
Merged PRs (30d)
384

Description

Project .opencode/skills/* are sometimes missing from a session's <available_skills> for the whole session, even though they load fine by ID and GET /api/skill lists them for the same location.

Cause: skill discovery is async (the location-scoped ConfigSkillPlugin in packages/core/src/config/plugin/skill.ts scans and registers after boot), but SkillInstructions.load (packages/core/src/skill/instructions.ts) snapshots Skill.list() during SessionContext.select without waiting for that scan. A session started before it completes freezes an incomplete baseline in instruction_state.initial_values that is never corrected.

OpenCode version: v2.0.10

Plugins: none

Steps to reproduce

  1. In a project containing .opencode/skills/foo/SKILL.md, start a session in a location that has not booted yet.
  2. The session's <available_skills> omits foo and stays that way.
  3. Later in the same location, GET /api/skill?location[directory]=<dir> lists foo.

Direct evidence of the race — same fresh directory, repeated calls:

call 1 -> []
call 2 -> ['opencode','report']
call 3 -> ['browser','opencode','openwebui-backend-testing','openwebui-fork-deploy']

Affected sessions have instruction_state.initial_values containing only built-in skills (or built-ins plus global skills), with through_seq frozen at the first step and no instruction_entry rows. Intermittent: some sessions in the same project captured the full list.

Operating System: Linux 6.18.33.2-microsoft-standard-WSL2 (WSL2)

Terminal: xterm-256color

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/core/src/config/plugin/skill.ts and packages/core/src/skill/instructions.ts, then trace SessionContext.select and the Skill.list() call. Reproduce in a fresh project location using the provided repeated-call sequence. Done means a session started before discovery completes retains the project skill in its available_skills for the whole session.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.