Skip to content

feat(core): refresh global, external, and HTTP skill sources without restart#38804

Open
neerajvipparla wants to merge 2 commits into
anomalyco:devfrom
neerajvipparla:skill-v2-hotreload
Open

feat(core): refresh global, external, and HTTP skill sources without restart#38804
neerajvipparla wants to merge 2 commits into
anomalyco:devfrom
neerajvipparla:skill-v2-hotreload

Conversation

@neerajvipparla

@neerajvipparla neerajvipparla commented Jul 25, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #37426

Type of change

  • New feature
  • Bug fix
  • Refactor / code improvement
  • Documentation

What does this PR do?

Extends V2 skill-content refresh beyond skill files inside watched git project Locations.

The issue: project .opencode/skills content already invalidates through the Location filesystem watcher, but global compatibility roots, explicitly configured external directories, non-git Locations, and cached HTTP catalogs had no continuous invalidation path. Replaying an unchanged source registration also did not clear its cached content.

Changes made:

  • Added a config-external-skill plugin that registers ~/.claude/skills, ~/.agents/skills, and project-relative .claude/.agents skill directories as SkillV2.DirectorySource sources.
  • SkillV2 now watches each directory source by its real path and invalidates cached skills when the watcher reports changes.
  • SkillV2 manages its own per-source watch scopes, so skill refresh works whether or not the Location filesystem watcher is enabled.
  • SkillV2 clears cached URL sources on a 60-minute schedule so remote catalogs can be observed while OpenCode remains running.
  • A reconcile pass clears cache entries for removed sources and tears down watches for directories that are no longer registered, so skill removal is reflected on the next safe boundary.
  • Added opencode debug skill-v2 and a --watch flag for live skill listing.
  • Added/updated tests covering project, global, external, non-git, and HTTP source behavior in packages/core and packages/opencode.

How did you verify your code works?

  • Ran the affected skill tests in packages/core: bun test test/skill.test.ts test/config/external-skill.test.ts test/plugin/skill.test.ts (9 pass).
  • Ran the affected skill tests in packages/opencode: bun test test/skill/skill.test.ts (pass).
  • Ran bun typecheck in packages/core and packages/opencode (pass).
  • Ran oxlint on the changed files (0 errors).
  • The CLI help-snapshot test failure is pre-existing on dev (process exits -1 in the test harness but not when run directly), so it is not introduced by this PR.

Screenshots / recordings

N/A - this is not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

- Introduced `ConfigExternalSkillPlugin` to register global and project skill directories from `.claude` and `.agents`.
- Enhanced `SkillV2` to support directory source caching and invalidation on filesystem watcher events.
- Updated configuration handling to prioritize injected settings.
- Improved error handling and state management in skill loading processes.
- Added tests for external skill registration and directory source behavior.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jul 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

Refresh global, external, and HTTP skill sources without restart

1 participant