Module: TheLocal

Defined in:
lib/the_local.rb,
lib/the_local/cli.rb,
lib/the_local/sync.rb,
lib/the_local/agent.rb,
lib/the_local/scope.rb,
lib/the_local/builder.rb,
lib/the_local/railtie.rb,
lib/the_local/refresh.rb,
lib/the_local/version.rb,
lib/the_local/registry.rb,
lib/the_local/installer.rb,
lib/the_local/reference.rb,
lib/the_local/the_local.rb,
lib/the_local/process_rules.rb,
lib/the_local/disk_providers.rb,
lib/the_local/trigger_writer.rb,
lib/the_local/process_doc_writer.rb,
lib/generators/the_local/install_generator.rb,
lib/generators/the_local/provider_generator.rb

Overview

Resident Claude Code expert subagents (“locals”), contributed by the gems and app that register with it and installed into a consuming app’s .claude/agents/.

Defined Under Namespace

Modules: Companion, DiskProviders, Generators, ProcessRules, Reference, Refresh, Scope Classes: Agent, Builder, CLI, Collector, Error, Installer, ProcessDocWriter, Provider, Railtie, Registry, Sync, TriggerWriter

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.register(gem_name, prefix: gem_name, scope: nil, agents_dir: nil) {|Collector.new(gem_name, prefix, registry, agents_dir: agents_dir)| ... } ⇒ Object

Providers (gems or the app) call this at load time to contribute their agents. The first argument is the providing gem’s name (used to filter to a host’s direct dependencies); prefix is the agent filename namespace and defaults to the gem name; scope is a one-line phrase describing the provider’s domain, used to generate the delegation trigger. agents_dir is the absolute path to the provider’s committed, pre-rendered .md files (e.g. File.expand_path(“the_local/agents”, __dir__)); when given, each agent records its source_path there for the host installer to copy:

TheLocal.register("keystone_ui", prefix: "keystone", scope: "UI work") do |c|
  c.agent "scaffold", description: "", tools: "", body: "", knowledge: ""
end

Yields:



36
37
38
39
# File 'lib/the_local.rb', line 36

def register(gem_name, prefix: gem_name, scope: nil, agents_dir: nil)
  registry.add_provider(Provider.new(gem_name: gem_name, prefix: prefix, scope: scope))
  yield Collector.new(gem_name, prefix, registry, agents_dir: agents_dir)
end

.registryObject



20
21
22
# File 'lib/the_local.rb', line 20

def registry
  @registry ||= Registry.new
end

.reset!Object



41
42
43
# File 'lib/the_local.rb', line 41

def reset!
  registry.clear
end