Class: TheLocal::Agent
- Inherits:
-
Data
- Object
- Data
- TheLocal::Agent
- Defined in:
- lib/the_local/agent.rb
Overview
An immutable description of one Claude Code subagent contributed by a provider (a gem or the app). Renders to a ‘.claude/agents/*.md` definition.
gem_name is the providing gem (used to filter to a host’s direct dependencies). prefix is the filename namespace (often a shorter alias, e.g. gem “keystone_ui” → prefix “keystone”). knowledge is a string or array of strings appended below the role body — the provider’s reference(s). source_path is the absolute path to the provider’s committed, pre-rendered .md file; the host installer copies it verbatim. It stays nil until a provider supplies an agents_dir, so existing providers keep working.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#gem_name ⇒ Object
readonly
Returns the value of attribute gem_name.
-
#knowledge ⇒ Object
readonly
Returns the value of attribute knowledge.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#source_path ⇒ Object
readonly
Returns the value of attribute source_path.
-
#tools ⇒ Object
readonly
Returns the value of attribute tools.
Instance Method Summary collapse
- #filename ⇒ Object
-
#initialize(source_path: nil, **args) ⇒ Agent
constructor
A new instance of Agent.
- #qualified_name ⇒ Object
- #to_markdown ⇒ Object
Constructor Details
#initialize(source_path: nil, **args) ⇒ Agent
Returns a new instance of Agent.
15 16 17 |
# File 'lib/the_local/agent.rb', line 15 def initialize(source_path: nil, **args) super end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body
14 15 16 |
# File 'lib/the_local/agent.rb', line 14 def body @body end |
#description ⇒ Object (readonly)
Returns the value of attribute description
14 15 16 |
# File 'lib/the_local/agent.rb', line 14 def description @description end |
#gem_name ⇒ Object (readonly)
Returns the value of attribute gem_name
14 15 16 |
# File 'lib/the_local/agent.rb', line 14 def gem_name @gem_name end |
#knowledge ⇒ Object (readonly)
Returns the value of attribute knowledge
14 15 16 |
# File 'lib/the_local/agent.rb', line 14 def knowledge @knowledge end |
#name ⇒ Object (readonly)
Returns the value of attribute name
14 15 16 |
# File 'lib/the_local/agent.rb', line 14 def name @name end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix
14 15 16 |
# File 'lib/the_local/agent.rb', line 14 def prefix @prefix end |
#source_path ⇒ Object (readonly)
Returns the value of attribute source_path
14 15 16 |
# File 'lib/the_local/agent.rb', line 14 def source_path @source_path end |
#tools ⇒ Object (readonly)
Returns the value of attribute tools
14 15 16 |
# File 'lib/the_local/agent.rb', line 14 def tools @tools end |
Instance Method Details
#filename ⇒ Object
23 24 25 |
# File 'lib/the_local/agent.rb', line 23 def filename "#{qualified_name}.md" end |
#qualified_name ⇒ Object
19 20 21 |
# File 'lib/the_local/agent.rb', line 19 def qualified_name "#{prefix}-#{name}" end |
#to_markdown ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/the_local/agent.rb', line 27 def to_markdown <<~MARKDOWN --- name: #{qualified_name} description: #{description} tools: #{tools} --- #{body} #{Array(knowledge).join("\n\n")} MARKDOWN end |