Class: Ask::Skills::Registry
- Inherits:
-
Object
- Object
- Ask::Skills::Registry
- Defined in:
- lib/ask/skills/registry.rb
Instance Attribute Summary collapse
-
#skills ⇒ Object
readonly
Returns the value of attribute skills.
Instance Method Summary collapse
- #[](name) ⇒ Object
-
#always_active_skills ⇒ Object
Full instructions for skills with
always: truein their frontmatter. - #format_for_prompt ⇒ Object
-
#initialize(sources) ⇒ Registry
constructor
A new instance of Registry.
- #names ⇒ Object
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
#skills ⇒ Object (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_skills ⇒ Object
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_prompt ⇒ Object
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 |
#names ⇒ Object
16 17 18 |
# File 'lib/ask/skills/registry.rb', line 16 def names @skills.keys end |