Module: Clacky::Agent::SkillEvolution

Included in:
Clacky::Agent
Defined in:
lib/clacky/agent/skill_evolution.rb

Overview

Unified entry point for skill self-evolution system. Coordinates two scenarios:

1. Auto-create new skills from complex task patterns
2. Reflect on executed skills and suggest improvements

Triggered at the end of Agent#run (post-run hooks), only for main agents.

Instance Method Summary collapse

Instance Method Details

#run_skill_evolution_hooksObject

Main entry point - runs all skill evolution checks Called from Agent#run after the main loop completes.

The two scenarios are mutually exclusive by design:

* If a skill just ran (@skill_execution_context is set), the user's
  need was already served by an existing skill. Run Scenario 2
  (reflect + possibly improve that skill) and skip Scenario 1 —
  otherwise we would auto-extract a near-duplicate "auto-*" skill
  from the same task, polluting the skills directory.

* If no skill ran, the task was solved with raw tools. That is the
  signal for Scenario 1: if the pattern is complex/repeatable enough,
  consider extracting it into a new skill.


26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/clacky/agent/skill_evolution.rb', line 26

def run_skill_evolution_hooks
  return unless skill_evolution_enabled?
  return if @is_subagent

  if @skill_execution_context
    # Scenario 2: Reflect on executed skill (may invoke skill-creator
    # to UPDATE the existing skill, but will not create a new one).
    maybe_reflect_on_skill
  else
    # Scenario 1: Auto-create new skill from complex task.
    maybe_create_skill_from_task
  end
end