Class: Ask::Skills::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/ask/skills/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sources) ⇒ Registry

Returns a new instance of Registry.



6
7
8
9
10
# File 'lib/ask/skills/registry.rb', line 6

def initialize(sources)
  @skills = {}
  @sources = sources
  load_all
end

Instance Attribute Details

#skillsObject (readonly)

Returns the value of attribute skills.



4
5
6
# File 'lib/ask/skills/registry.rb', line 4

def skills
  @skills
end

Instance Method Details

#[](name) ⇒ Object



12
13
14
# File 'lib/ask/skills/registry.rb', line 12

def [](name)
  @skills[name]
end

#always_active_skillsObject

Full instructions for skills with always: true in their frontmatter. These skills are auto-injected into the system prompt rather than being listed for the LLM to load on demand.



28
29
30
# File 'lib/ask/skills/registry.rb', line 28

def always_active_skills
  @skills.values.select { |s| s.["always"] == "true" || s.["always"] == true }
end

#format_for_promptObject



20
21
22
23
# File 'lib/ask/skills/registry.rb', line 20

def format_for_prompt
  return "" if @skills.empty?
  Formatter.new(@skills).to_prompt_section
end

#namesObject



16
17
18
# File 'lib/ask/skills/registry.rb', line 16

def names
  @skills.keys
end