skills: switch to directory-based resource scanning - #101
Merged
Conversation
Port of microsoft/agent-framework#5078 and #5205. Replace markdown-link-based resource extraction with directory-based scanning per the Agent Skills specification: - Scan 'references/' and 'assets/' subdirectories by default (non-recursive) - Add Config.ResourceDirectories to customize scanned directories - Add Config.AllowedResourceExtensions to customize file extensions - Use '.' to opt into skill root scanning; SKILL.md always excluded - Validate directory names with filepath.IsLocal; skip absolute/'..' paths - Normalize paths with filepath.Clean + filepath.ToSlash - Update example to use os.Root.FS for symlink-safe access - Add comprehensive tests for directory scanning, extension filtering, deduplication, nested paths, and config validation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates skill resource discovery to match the Agent Skills spec by scanning configured directories (vs parsing markdown links), with configurable directories/extensions and updated examples/tests.
Changes:
- Replace markdown-link-based resource extraction with non-recursive directory scanning (
references/,assets/by default), including path normalization/validation. - Add configuration for resource directories and allowed resource extensions.
- Update example to use
os.OpenRoot().FS()and expand test coverage for discovery/config behaviors.
Show a summary per file
| File | Description |
|---|---|
| memory/skills/loader.go | Implements directory-based resource discovery, config normalization/validation, and extension filtering. |
| memory/skills/skills.go | Wires new config fields into loader creation and updates New() guidance for safer FS usage. |
| memory/skills/skills_test.go | Updates existing tests and adds extensive new tests for directory/extension scanning behavior. |
| examples/skills/01_basic_skills/main.go | Switches example from os.DirFS to os.OpenRoot().FS() for symlink-escape hardening. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 3
Distinguish fs.ErrNotExist (silently skip) from other ReadDir errors (log a warning) to avoid masking permission or I/O issues during resource discovery.
George Adams (gdams)
approved these changes
Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of microsoft/agent-framework#5078 and microsoft/agent-framework#5205.
Summary
Replace markdown-link-based resource extraction with directory-based scanning per the Agent Skills specification.
Changes
Resource discovery (loader.go)
references/andassets/(per the spec)..md,.json,.yaml,.yml,.csv,.xml,.txt."."inResourceDirectoriesto scan the skill root;SKILL.mdis always excluded.filepath.IsLocalto reject absolute paths and..segments. Normalizes withfilepath.Clean+filepath.ToSlash.extractResourcePaths,validateResources,resourceLinkRegex.Config (skills.go)
Config.ResourceDirectories-- configurable directories (replaces defaults when set).Config.AllowedResourceExtensions-- configurable extensions (replaces defaults when set).New()doc to recommendos.Root.FSoveros.DirFSfor symlink protection.Example
01_basic_skillsto useos.OpenRoot().FS().Tests