Skip to content

skill_optimizer

diapason.learning.agents.skill_optimizer

SkillOptimizer — per-skill DSPy/GEPA optimization wrapper (Plan 2A).

Buckets traces by skill name, runs the underlying optimizer on each skill's bucket, and writes the result as a sidecar overlay file in ~/.diapason/learning/skills/<skill-name>/optimized.toml.

The actual DSPy/GEPA invocation is done in _run_dspy / _run_gepa, which are isolated for easy mocking in tests. In Plan 2A these are deliberately minimal — they call the existing optimizer modules and extract the description + few-shot examples. Plan 2B will measure the impact via benchmarks.

SkillOptimizationResult dataclass

Result of optimizing a single skill.

SkillOptimizer

Per-skill optimization wrapper around DSPyAgentOptimizer / GEPA.

Parameters

min_traces_per_skill: Minimum trace count for a skill to be eligible for optimization. optimizer: "dspy" or "gepa". Determines which underlying optimizer is called inside _run_dspy / _run_gepa.

optimize(trace_store, skill_manager, *, overlay_dir=None)

Run the per-skill optimization loop.

Returns a dict mapping skill name to result. Writes overlay TOML files for each skill that produced output.