Skip to content

SKILL reference not update after edit the SKILL #19050

Closed as not planned
Closed as not planned

Description

@Afauria

Description

The SKILL reference will not update after edit the SKILL. Until restart the opencode client (TUI or Desktop).

Plugins

No response

OpenCode version

1.3.2

Steps to reproduce

  1. create a skill in project space.
  2. open the opencode (TUI or Desktop)
  3. It will load skill from project space. I can use '/skill-name' to reference the skill.
  4. when I edit the skill and save (add oneline label 'test1'). It will not load the skill from disk. And we can see the reference by '/skill-name' is still old version. (without 'test1')
  5. It will not solve by open new session. Just restart the opencode.

The problem is that sometimes models will ask that the reference is different with script. And maybe revert my edit. Because model think the reference is new version.

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 25, 2026
  2. added a commit that references this issue on Mar 25, 2026
    b35b599
  3. jwm4 commented on Mar 25, 2026

    @jwm4

    I took a stab at this with draft PR #19136, but after manual testing I found the fix doesn't actually solve the problem for the default configuration.

    What the PR does: Adds a Skill.invalidate() method that clears the cached skills, and wires it to FileWatcher.Event.Updated so that editing a SKILL.md triggers a cache reload. The Command cache also rebuilds when skills are invalidated.

    Why it doesn't work in practice: FileWatcher only watches Instance.directory when OPENCODE_EXPERIMENTAL_FILEWATCHER=true (see src/file/watcher.ts:123). Without that flag, only .git/HEAD is watched, so FileWatcher.Event.Updated never fires for SKILL.md changes. Most users won't have the experimental flag enabled.

    There's also a secondary gap: even with the flag on, the watcher only covers CWD. Skills loaded from parent directories (monorepo .claude/skills/) or global directories (~/.claude/skills/) wouldn't trigger invalidation.

    The cache invalidation logic itself works — Skill.invalidate() correctly clears the cache and the next Skill.all()/Skill.get() call re-reads from disk. All automated tests pass. The gap is in how invalidation gets triggered.

    Possible approaches a maintainer might consider:

    1. Dedicated watcher for skill directories — After the initial skill load, set up fs.watch or parcel watcher subscriptions on just the known skill directories (state.dirs). Independent of the experimental flag.
    2. Poll-based mtime checks — On each ensure() call, stat the loaded SKILL.md files and invalidate if any mtime has changed. Simple but adds disk I/O per call.
    3. Broaden the experimental watcher scope — Extend FileWatcher to also cover skill directories when enabled, and eventually promote it out of experimental.

    Happy to update the PR if a maintainer has a preferred direction.

  4. abread commented on Apr 10, 2026

    @abread

    Is the skill cache even useful? I doubt the increased memory usage and complexity is worth it.

    What extra information does opencode have about skill usage patterns that can make it do a better job than whatever LRU approximation the OS is already doing for us?

  5. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  6. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions