Class: Silas::Tools::LoadSkill

Inherits:
Silas::Tool show all
Defined in:
lib/silas/tools/load_skill.rb

Overview

The built-in progressive-disclosure tool (eve's mechanism): skill descriptions are advertised in the instructions; the body loads on demand and — because the body IS the tool result — rides the ledger and replays byte-identically for free. Loading also registers the skill on the session so subsequent turns inline it directly.

Instance Attribute Summary

Attributes inherited from Silas::Tool

#session

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Silas::Tool

approval, #approval_policy, at_most_once!, description, effect_mode, #effect_mode, idempotent!, param, schema, transactional!, validate_signature!

Class Method Details

.tool_nameObject



12
# File 'lib/silas/tools/load_skill.rb', line 12

def self.tool_name = "load_skill"

Instance Method Details

#call(name:) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/silas/tools/load_skill.rb', line 14

def call(name:)
  skill = Silas.skills.find { |s| s.name == name }
  return { "error" => "unknown skill #{name.inspect}" } unless skill

  unless session.loaded_skills.include?(name)
    session.update!(loaded_skills: session.loaded_skills + [ name ])
  end
  { "skill" => name, "content" => skill.body }
end