Package com.tnsai.skills
Class FileSystemSkillStore
java.lang.Object
com.tnsai.skills.FileSystemSkillStore
- All Implemented Interfaces:
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 aConcurrentMap). 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 Summary
Constructors -
Method Summary
-
Constructor Details
-
FileSystemSkillStore
Construct a store rooted atroot. 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 correspondingSKILL.md; updates skills that changed; adds skills newly present. Programmatic registrations made viaregister(Skill)that don't shadow a disk skill are preserved. -
findByName
Description copied from interface:SkillStoreLook up a skill by its declaredname.- Specified by:
findByNamein interfaceSkillStore
-
list
Description copied from interface:SkillStoreEnumerate every registered skill. Used bySkillResolverto rank candidates against a user message and by tooling that needs to render a skill catalog.- Specified by:
listin interfaceSkillStore
-
register
Description copied from interface:SkillStoreRegister or replace a skill. Implementations MAY reject registration (e.g. read-only stores) by throwingUnsupportedOperationException.- Specified by:
registerin interfaceSkillStore
-
root
Root directory this store scans.
-