Classes

SkillRegistry

Class: SkillRegistry

Defined in: src/lib/injection-engine/SkillRegistry.ts:63

Constructors

Constructor

new SkillRegistry(opts?): SkillRegistry

Defined in: src/lib/injection-engine/SkillRegistry.ts:72

Construct an empty registry. Optional { surfaceMode, providerHint } fields set registry-level defaults; absent both, the registry is a pure container (the v2.4 surface).

Parameters

opts?

SkillRegistryOptions = {}

Returns

SkillRegistry

Accessors

providerHint

Get Signature

get providerHint(): string | undefined

Defined in: src/lib/injection-engine/SkillRegistry.ts:82

Registry-level provider hint, or undefined if unset.

Returns

string | undefined


size

Get Signature

get size(): number

Defined in: src/lib/injection-engine/SkillRegistry.ts:149

Number of registered skills.

Returns

number


surfaceMode

Get Signature

get surfaceMode(): SurfaceMode | undefined

Defined in: src/lib/injection-engine/SkillRegistry.ts:77

Registry-level default surfaceMode, or undefined if unset.

Returns

SurfaceMode | undefined

Methods

clear()

clear(): void

Defined in: src/lib/injection-engine/SkillRegistry.ts:154

Drop all registrations.

Returns

void


get()

get(id): Injection | undefined

Defined in: src/lib/injection-engine/SkillRegistry.ts:134

Look up by id. Returns undefined if not registered.

Parameters

id

string

Returns

Injection | undefined


has()

has(id): boolean

Defined in: src/lib/injection-engine/SkillRegistry.ts:139

True iff a skill with the given id is registered.

Parameters

id

string

Returns

boolean


list()

list(): readonly Injection[]

Defined in: src/lib/injection-engine/SkillRegistry.ts:144

All registered skills. Order matches registration order.

Returns

readonly Injection[]


register()

register(skill): this

Defined in: src/lib/injection-engine/SkillRegistry.ts:91

Register a skill. Throws if skill.flavor !== 'skill' or if a skill with the same id is already registered (use .replace(...) to overwrite intentionally).

Parameters

skill

Injection

Returns

this


replace()

replace(id, skill): this

Defined in: src/lib/injection-engine/SkillRegistry.ts:107

Replace an existing skill by id. Throws if id is not registered.

Parameters

id

string

skill

Injection

Returns

this


resolveForSkill()

resolveForSkill(skillOrId, provider?, model?): "system-prompt" | "tool-only" | "both"

Defined in: src/lib/injection-engine/SkillRegistry.ts:219

Resolve the effective surfaceMode for a skill, applying the cascade:

  1. If the skill's own metadata.surfaceMode is concrete ('system-prompt' / 'tool-only' / 'both'), return it. Per-skill explicit choice always wins.
  2. Else if the registry was constructed with a concrete surfaceMode, return that.
  3. Else delegate to resolveSurfaceMode(provider, model) using the explicit provider arg (or this.providerHint if omitted). Falls back to 'tool-only' when no provider is known.

Forward-compat for Block C / v2.5 per-mode runtime routing: the runtime calls this with the agent's provider + model to decide how to materialize the skill's body into slots.

Throws if the skill is not registered (catches typos at the caller site rather than silently resolving against a stranger).

Parameters

skillOrId

string | Injection

A registered Skill Injection OR its id.

provider?

string

Provider name override (wins over providerHint).

model?

string

Model name for the per-provider attention rule.

Returns

"system-prompt" | "tool-only" | "both"


toTools()

toTools(): SkillToolPair

Defined in: src/lib/injection-engine/SkillRegistry.ts:186

Materialize the LLM-facing skill discovery tools from the current registry contents. Returns { listSkills, readSkill }:

  • list_skills — no-arg tool the LLM calls to enumerate { id, description } for every registered skill. Lets the LLM discover skills without paying the prompt-token cost of a static catalog in the system prompt.

  • read_skill({ id }) — activates the named skill for the NEXT iteration. The Agent's tool-calls subflow inspects this tool call by name and updates scope.activatedInjectionIds so the InjectionEngine on iter N+1 includes the skill in the active set (body lands in the system slot; gated tools land in the tools slot).

Both entries are undefined when the registry is empty — filter before adding to a tool list:

const { listSkills, readSkill } = registry.toTools(); const tools = [listSkills, readSkill, ...other].filter(Boolean) as Tool[];

Composes with gatedTools from agentfootprint/tool-providers so PermissionPolicy can scope which roles see the skill discovery surface.

Returns

SkillToolPair

A SkillToolPair ({ listSkills, readSkill }).


unregister()

unregister(id): this

Defined in: src/lib/injection-engine/SkillRegistry.ts:128

Remove a skill by id. No-op if not registered.

Parameters

id

string

Returns

this

On this page