Class: Brute::Tools::SkillLoad
- Inherits:
-
RubyLLM::Tool
- Object
- RubyLLM::Tool
- Brute::Tools::SkillLoad
- Defined in:
- lib/brute/tools/skill_load.rb
Overview
The skill tool — stages 2 (activation) and 3 (execution) of the Agent
Skills progressive-disclosure lifecycle (https://agentskills.io).
Stage 1 (discovery) happens in the system prompt: Brute::Prompts::Skills lists each skill's name + description only (~100 tokens each). When a task matches, the model calls this tool with the skill name to pull the full SKILL.md body into the conversation (stage 2).
The output also reports the skill's base directory and a capped listing of
bundled files. That is stage 3: skills bundle scripts/, references/, and
assets/ that the model runs or reads through the agent's existing tools
(shell, read) by relative path. There is no separate skill runtime.
The tool must scan the same directories as Prompts::Skills, or it would advertise skills it cannot load. Both default to Dir.pwd; agents that point the prompt at a custom root (e.g. ctx.merge(cwd: dir)) should build the tool with the matching cwd: Brute::Tools::SkillLoad.new(cwd: dir).
Reference: opencode's tool/skill.ts.
Constant Summary collapse
- FILE_LIMIT =
10
Instance Method Summary collapse
- #execute(name:) ⇒ Object
-
#initialize(cwd: Dir.pwd) ⇒ SkillLoad
constructor
A new instance of SkillLoad.
- #name ⇒ Object
Constructor Details
#initialize(cwd: Dir.pwd) ⇒ SkillLoad
Returns a new instance of SkillLoad.
45 46 47 48 |
# File 'lib/brute/tools/skill_load.rb', line 45 def initialize(cwd: Dir.pwd) super() @cwd = cwd end |
Instance Method Details
#execute(name:) ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/brute/tools/skill_load.rb', line 50 def execute(name:) skill = Brute::Skill.get(name, cwd: @cwd) return unknown_skill(name) unless skill directory = File.dirname(skill.location) files = bundled_files(directory) render(skill, directory, files) end |
#name ⇒ Object
43 |
# File 'lib/brute/tools/skill_load.rb', line 43 def name; "skill"; end |