Class: Insika::Tools::LoadSkill
- Inherits:
-
RubyLLM::Tool
- Object
- RubyLLM::Tool
- Insika::Tools::LoadSkill
- Defined in:
- lib/insika/tools/load_skill.rb
Overview
Level 2 of progressive disclosure: loads the full SKILL.md body on demand. Respects the agent's allowlist (the model does not load a skill that the policy did not expose).
require "ruby_llm" stays in THIS file (it inherits from
RubyLLM::Tool), which is why it does NOT enter lib/insika.rb: the Executor
loads it lazily inside create_chat.
Instance Method Summary collapse
- #execute(name:) ⇒ Object
-
#initialize(catalog, allowed_names, trace_recorder: nil, state: nil, agent: nil) ⇒ LoadSkill
constructor
trace_recorder/state are OPTIONAL (nil = no trace, parity): this tool is deliberately NOT enveloped (ToolAssembly#wrap_tools), and the envelope is what records the tool trace — so without recording HERE, the one call an operator most needs to audit is the only one missing from the Studio's trace.
-
#name ⇒ Object
RubyLLM::Tool#name derives from self.class.name — for a nested class it produces "insika--tools--load_skill", not "load_skill" (which wire_callbacks/ :skill_activated and SkillCatalog#format_for_prompt assume).
Constructor Details
#initialize(catalog, allowed_names, trace_recorder: nil, state: nil, agent: nil) ⇒ LoadSkill
trace_recorder/state are OPTIONAL (nil = no trace, parity): this tool is
deliberately NOT enveloped (ToolAssembly#wrap_tools), and the envelope is
what records the tool trace — so without recording HERE, the one call an
operator most needs to audit is the only one missing from the Studio's
trace. Same shape as ToolSearch, which also emits its own event.
agent selects WHICH body a name resolves to: an agent that specialized a
shared skill must be served its own version, under the same bare name. nil =
the shared scope only (parity).
34 35 36 37 38 39 40 41 |
# File 'lib/insika/tools/load_skill.rb', line 34 def initialize(catalog, allowed_names, trace_recorder: nil, state: nil, agent: nil) @catalog = catalog @allowed = Array(allowed_names).map(&:to_s) @trace_recorder = trace_recorder @state = state @agent = agent super() end |
Instance Method Details
#execute(name:) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/insika/tools/load_skill.rb', line 43 def execute(name:) started = Process.clock_gettime(Process::CLOCK_MONOTONIC) result = load(name) trace(name, result, started) result end |
#name ⇒ Object
RubyLLM::Tool#name derives from self.class.name — for a nested class it produces
"insika--tools--load_skill", not "load_skill" (which wire_callbacks/
:skill_activated and SkillCatalog#format_for_prompt assume). Explicit
override. Coexists with
param :name (verified: the param is still present).
24 |
# File 'lib/insika/tools/load_skill.rb', line 24 def name = "load_skill" |