Module: Clacky::Agent::SkillReflector
- Included in:
- Clacky::Agent
- Defined in:
- lib/clacky/agent/skill_reflector.rb
Overview
Scenario 2: Reflect on skill execution and suggest improvements.
After a skill completes, forks a subagent to analyze:
- Were instructions clear enough?
- Any missing edge cases?
- Any improvements needed?
If the LLM identifies concrete improvements, it invokes skill-creator to update the skill.
Constant Summary collapse
- MIN_SKILL_ITERATIONS =
Minimum iterations for a skill execution to warrant reflection. This counts iterations within the skill execution only, not session-cumulative.
5
Instance Method Summary collapse
-
#maybe_reflect_on_skill ⇒ Object
Check if we should reflect on the skill that just executed Called from SkillEvolution#run_skill_evolution_hooks.
Instance Method Details
#maybe_reflect_on_skill ⇒ Object
Check if we should reflect on the skill that just executed Called from SkillEvolution#run_skill_evolution_hooks
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/clacky/agent/skill_reflector.rb', line 21 def maybe_reflect_on_skill return unless should_reflect_on_skill? skill_name = @skill_execution_context[:skill_name] subagent = fork_subagent result = subagent.run(build_skill_reflection_prompt(skill_name)) cost = absorb_subagent_cost(result) if result @skill_execution_context = nil "#{skill_name} ยท $#{cost.round(4)}" if cost end |