Skip to content

manager

diapason.skills.manager

SkillManager — coordinates skill discovery, catalog, tool wrapping, and execution.

SkillManager

Coordinate skill discovery, resolution, catalog generation, and execution.

Parameters

bus: Event bus for publishing lifecycle events. capability_policy: Optional capability policy passed through to tool executors.

discover(paths=None)

Scan directories in order and register skills.

First-seen name wins (workspace path listed first = highest precedence). After loading, the full dependency graph is validated and any sidecar overlays in overlay_dir are applied to discovered skills.

Parameters

paths: Directories to scan. If None or empty, no skills are loaded from disk — but _load_overlays() still runs (in case the caller had previously seeded self._skills directly).

discover_from_traces(trace_store, *, min_frequency=3, min_outcome=0.5, output_dir=None)

Mine the trace store for recurring tool sequences.

For each recurring sequence found by :class:SkillDiscovery, write a TOML skill manifest into output_dir (default ~/.diapason/skills/discovered/). Returns a list of dicts with name and path for each manifest written.

Names are normalized to spec-compliant kebab-case (lowercase with hyphens, no underscores) so the resulting manifests load cleanly through the discovery walker.

execute(name, context=None)

Resolve and execute a skill by name.

Parameters

name: Skill name to execute. context: Initial context dict passed to the executor.

Returns

SkillResult

find_installed_paths(name, *, roots=None)

Return on-disk skill directories matching name.

A directory matches when it contains skill.toml or SKILL.md and either the directory name equals name or its parsed manifest's name field equals name.

get_catalog_xml()

Generate an <available_skills> XML catalog.

Skills with disable_model_invocation=True are excluded so that internal or automation-only skills are not surfaced to the model.

get_few_shot_examples()

Return formatted few-shot example strings ready for system prompt.

Pulls from manifest.metadata.diapason.few_shot for every registered skill. Returns one formatted string per example.

get_skill_tools(*, tool_executor=None)

Wrap each registered skill as a :class:SkillTool (a :class:BaseTool).

Parameters

tool_executor: Tool executor to use when running skill pipelines. Falls back to the one set via :meth:set_tool_executor if not provided here.

Returns

list[BaseTool] One :class:SkillTool per registered skill.

remove(name, *, roots=None)

Remove an installed skill by name.

Returns the list of directories that were removed. Raises :class:FileNotFoundError when no matching skill exists on disk.

resolve(name)

Return the manifest for a skill by name.

Raises

KeyError If name is not registered.

set_tool_executor(tool_executor)

Attach a :class:ToolExecutor for running tool steps in skill pipelines.

skill_names()

Return the names of all registered skills.