Skip to main content

Module loader

Module loader 

Source
Expand description

SKILL.md parsing, {baseDir}/${CLAUDE_PLUGIN_ROOT} substitution, and discovery.

Task 21 (spec §7.6) — LAZY skill bodies: boot discovery reads ONLY the bounded frontmatter (never one body byte), records an immutable source fingerprint, and defers body read/substitution/validation to exact selection, which re-verifies the fingerprint before returning content.

Constants§

DISCOVERY_MAX_METADATA_BYTES
Deterministic cap on total retained metadata bytes (names + descriptions + paths) across the whole discovery pass.
DISCOVERY_MAX_SKILLS
Deterministic cap on discovered skills (first-wins across roots).
SKILL_DESCRIPTION_MAX_BYTES
Bounded retained skill description: the retained copy is a BOUNDED PROJECTION (UTF-8-safe truncation via BoundedText) used only for display/search; selection verification always uses the exact frontmatter byte digest, never this projection.
SKILL_FILE_MAX_BYTES
Hard cap on a SKILL.md regular file; larger files are skipped at discovery (stat only) and refused at selection.
SKILL_FRONTMATTER_MAX_BYTES
Hard bound on the boot-time frontmatter scan: the scan reads through the closing --- delimiter and never past this many bytes.
SKILL_NAME_MAX_BYTES
Bounded retained skill name.

Functions§

default_roots
The four default discovery roots, in priority order (local first, global second).
load_all
Walk the given roots and discover all plugins and skills. Deduplicates on (plugin_name, skill_name); first occurrence wins.
load_skill_file
Discover a SKILL.md into a LAZY LoadedSkill (Task 21): bounded frontmatter scan ONLY — zero body bytes read, no substitution. The open-handle fstat fingerprint (device/inode/size/mtime/ctime + frontmatter digest + body offset) is recorded so selection can verify the exact same content before trusting one body byte.