Class FileSystemSkillStore

java.lang.Object
com.tnsai.skills.FileSystemSkillStore
All Implemented Interfaces:
SkillStore

public final class FileSystemSkillStore extends Object implements SkillStore
Disk-backed SkillStore reading the Claude Code-compatible <root>/<skill-name>/SKILL.md layout (TNS-289).

Skills are scanned at construction time. Re-scan via refresh() to pick up newly-added or modified files; the framework intentionally does NOT install a file-system watcher (that's a v2 quality-of-life concern, see TNS-289 out-of-scope list).

Supporting files (e.g. reference.md, examples.md, scripts/*) sitting alongside SKILL.md are not loaded eagerly — they would bloat memory and most never get referenced. The skill body declares them by relative path; consumers fetch on demand.

Concurrency

Reads are lock-free (backed by a ConcurrentMap). refresh() is safe to call concurrently with reads but should be invoked from a single thread to avoid lost-update races between two refreshing callers.
Since:
0.10.0 (TNS-289)
  • Constructor Details

    • FileSystemSkillStore

      public FileSystemSkillStore(Path root)
      Construct a store rooted at root. The directory does not have to exist at construction time — an empty store is returned if the path is missing or empty.
  • Method Details

    • refresh

      public void refresh()
      Re-scan the root directory. Removes skills that no longer have a corresponding SKILL.md; updates skills that changed; adds skills newly present. Programmatic registrations made via register(Skill) that don't shadow a disk skill are preserved.
    • findByName

      public Optional<Skill> findByName(String name)
      Description copied from interface: SkillStore
      Look up a skill by its declared name.
      Specified by:
      findByName in interface SkillStore
    • list

      public List<Skill> list()
      Description copied from interface: SkillStore
      Enumerate every registered skill. Used by SkillResolver to rank candidates against a user message and by tooling that needs to render a skill catalog.
      Specified by:
      list in interface SkillStore
    • register

      public void register(Skill skill)
      Description copied from interface: SkillStore
      Register or replace a skill. Implementations MAY reject registration (e.g. read-only stores) by throwing UnsupportedOperationException.
      Specified by:
      register in interface SkillStore
    • root

      public Path root()
      Root directory this store scans.