Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/skills / loader

loader

Skill loader.

Implements three-tier progressive disclosure:

  • Tier 1 (always): Skill.metadata — parsed at load time from the SKILL.md frontmatter.
  • Tier 2 (on activation): Skill.body — the loader reads the markdown body lazily; subsequent calls return the cached value.
  • Tier 3 (on demand): Skill.resources — the loader walks the skill directory lazily; resource bytes are only read when SkillResource.read is invoked.

The loader supports four sources:

  • { kind: 'folder', path } — read SKILL.md from disk.
  • { kind: 'npm-package', ... } — install via the supply-chain helper from @graphorin/security/supply-chain, then read.
  • { kind: 'git-repo', ... } — shallow-clone via the supply-chain helper, then read.
  • { kind: 'inline', skill: ... } — caller supplies the parsed payload; the loader only validates the frontmatter. Useful for tests and bundled defaults.

Interfaces

InterfaceDescription
LoadSkillOptionsOptions forwarded to loadSkillFromSource.
LoadSkillsOptionsAggregate options accepted by loadSkills.

Functions

FunctionDescription
loadSkillFromSourceLoad a single skill from any supported source. The loader runs the full frontmatter validator and resolves the supply-chain trust policy so the returned Skill is ready to be inserted into a SkillRegistry.
loadSkillsLoad multiple skills concurrently. Emits a warning diagnostic on the first encountered source error when throwOnSourceError === false; otherwise the first error propagates out unchanged.
requireHandoffInputFilterRequired handoff-filter declaration helper. Returns the typed declaration the loader parsed from frontmatter; throws InputFilterRequiredError when the skill is untrusted and the field is missing. Used by the agent runtime in Phase 12 right before instantiating an untrusted skill's sub-agent.