Skip to content

Conversation

@ben-vargas
Copy link
Contributor

@ben-vargas ben-vargas commented Jan 26, 2026

Summary

Add a minimal skills_discover extension hook to the ResourceLoader pipeline, plus an example extension that walks upward to discover .pi/skills.

Motivation

The v0.50.0 loader architecture (#645) is flexible but still doesn’t allow extensions to contribute additional skill directories during discovery (e.g., ancestor traversal). This hook enables that without changing default discovery rules.

What’s Included

  • New skills_discover hook surfaced in the extension API and runner.
  • ResourceLoader calls skills_discover before loading skills and merges any returned directories.
  • Example extension: upward discovery of .pi/skills via skills_discover.

What’s NOT Included

  • No changes to default skill discovery behavior.
  • No changelog edits (per CONTRIBUTING.md).

Tests

  • npm run check (ran; auto‑formatted one comment in extensions/runner.ts)
  • ./test.sh (ran; no failed tests, some skipped as expected)
  • npm run build (ran)

Note: npm test output includes expected errors from package‑manager tests that hit nonexistent-package / nonexistent git repo; the test run still completed with no failing test cases.

@ben-vargas
Copy link
Contributor Author

Consider this a proposal for some kind of skills_discover hook so users can create their own extension to customize skill discovery, I don't mind if this is closed if there's a preferred alternative approach - but today we don't have the hooks necessary to inject additional discovery logic without doing a full reload of skills and causing unnecessary duplicative reloading.

@ben-vargas ben-vargas force-pushed the feat-skills-discover-hook branch from 49f4f5c to f228408 Compare January 26, 2026 18:54
@badlogic
Copy link
Owner

I think this should could be even more flexible by simply providing additional paths for extensions, skills, prompt templates, and themes to be loaded along side the default? What do you think?

@ben-vargas
Copy link
Contributor Author

Yeah, that would work for me. If a startup hook can return additional paths for skills/prompts/themes (and optionally extensions if a second pass or /reload is acceptable), then recursive logic can be implemented entirely in an extension. I’d be happy with that.

@badlogic
Copy link
Owner

I thought a bit harder about it, extensions returning extensions is rather tricky, as extensions can contribute CLI flags (would also need to catch recursiveness here). So I think instead we want extensions to just be able to return additional skills/prompts/themes. I'll fix that on my end!

@ben-vargas
Copy link
Contributor Author

Sounds good, you get what I'm going after - feel free to close this PR.

@ben-vargas ben-vargas force-pushed the feat-skills-discover-hook branch from f228408 to 9c17133 Compare January 27, 2026 03:21
Extensions can now provide additional skill directories via the skills_discover
event, which fires during skill discovery before the session starts.

This enables use cases like:
- Traversing ancestor directories for shared skills
- Dynamic skill directories based on project structure
- Team/organization skill repositories

Changes:
- Add SkillsDiscoverEvent and SkillsDiscoverResult types
- Add emitSkillsDiscover() method to ExtensionRunner
- Reorder sdk.ts to load extensions before skill discovery
- Add extensionDirectories option to loadSkills()
- Update docs with usage examples

feat(coding-agent): allow skills_discover during resource load

fix(coding-agent): include extension providers in skills_discover
Required by CONTRIBUTING.md (npm run check)
@ben-vargas ben-vargas force-pushed the feat-skills-discover-hook branch from 9c17133 to 4b1427a Compare January 29, 2026 04:34
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