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 35 36 37 |
# 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] @ui&.show_info("Reflecting on skill execution: #{skill_name}") subagent = fork_subagent result = subagent.run(build_skill_reflection_prompt(skill_name)) if result subagent_cost = result[:total_cost_usd] || 0.0 @total_cost += subagent_cost @ui&.(cost: @total_cost, cost_source: @cost_source) end @skill_execution_context = nil end |