tools / composed_skills.py
Compile recurring tool-call sequences into reusable macros with conditional branching and parameter templating.
Data shapes
| Type | Fields |
|---|---|
SkillStep | tool_name · description · param_template · branch_condition · branch_target · optional |
ComposedSkill | name · trigger_description · steps · branches · usage_count · success_count · last_used · created_at |
Templates
param_template uses $variable syntax; resolved against the runtime params when the macro is dispatched.
Registry
- Up to 50 skills in memory; persisted to
composed_skills.json. - Least-used skill evicted on overflow.
compile_from_pattern(pattern_name, tool_sequence, description)creates a macro from a detected sequence.execute(skill_name, executor_fn, params)runs steps sequentially; evaluatesbranch_conditionagainst each result;optional=truesteps don't abort on failure.record_usage(skill_name, success)updates counters.
LLM exposure
to_tool_definitions() renders each composed skill as an OpenAI-style tool definition so the LLM sees it like any other tool.