the_local 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -1
- data/CLAUDE.md +117 -0
- data/MIGRATING.md +478 -0
- data/PROVIDERS.md +62 -123
- data/README.md +20 -14
- data/lib/generators/the_local/provider_generator.rb +15 -90
- data/lib/the_local/agent.rb +3 -2
- data/lib/the_local/author.rb +43 -0
- data/lib/the_local/creators/develop.md +81 -0
- data/lib/the_local/creators/info.md +67 -0
- data/lib/the_local/creators/install.md +79 -0
- data/lib/the_local/disk_providers.rb +18 -10
- data/lib/the_local/format.rb +27 -0
- data/lib/the_local/front_matter.rb +26 -0
- data/lib/the_local/installer.rb +2 -2
- data/lib/the_local/interface.rb +26 -0
- data/lib/the_local/provider_check.rb +92 -0
- data/lib/the_local/rake.rb +14 -9
- data/lib/the_local/registry.rb +2 -30
- data/lib/the_local/version.rb +1 -1
- data/lib/the_local.rb +1 -20
- data/the_local/agents/the_local-develop.md +48 -0
- data/the_local/agents/the_local-info.md +40 -0
- data/the_local/agents/the_local-install.md +49 -0
- data/the_local/interface.yml +21 -0
- metadata +16 -12
- data/lib/generators/the_local/templates/guide.md.tt +0 -41
- data/lib/generators/the_local/templates/reference.rb.tt +0 -17
- data/lib/generators/the_local/templates/the_local.rb.tt +0 -49
- data/lib/the_local/builder.rb +0 -57
- data/lib/the_local/reference/guide.md +0 -179
- data/lib/the_local/reference.rb +0 -16
- data/lib/the_local/the_local/agents/the_local-develop.md +0 -187
- data/lib/the_local/the_local/agents/the_local-info.md +0 -187
- data/lib/the_local/the_local/agents/the_local-install.md +0 -187
- data/lib/the_local/the_local.rb +0 -59
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: the_local-info
|
|
3
|
-
description: Use to learn how the_local works — providers, the build/install model, the delegation trigger, and the direct-dependency scope rule.
|
|
4
|
-
tools: Read
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
You explain how the_local works, answering only from the reference: providers register locals, the_local:build renders committed .md, install/refresh copy them verbatim into a host, the CLAUDE.md delegation trigger makes the host delegate, and only direct dependencies contribute. You make no changes.
|
|
8
|
-
|
|
9
|
-
## TheLocal
|
|
10
|
-
|
|
11
|
-
> **DO NOT** explore the the_local gem source code. This reference is the
|
|
12
|
-
> complete user-facing API, embedded verbatim into every the_local local so
|
|
13
|
-
> their guidance never drifts. Keep it the single source of truth.
|
|
14
|
-
|
|
15
|
-
the_local is the engine that lets any gem or app ship resident Claude Code
|
|
16
|
-
expert subagents ("locals") that know its conventions. A provider gem registers
|
|
17
|
-
its locals once; the_local renders them to committed `.md` files and installs
|
|
18
|
-
the aggregated set from every directly-depended provider into a consuming app's
|
|
19
|
-
`.claude/agents/`, plus a delegation rule so the host's agent actually uses them.
|
|
20
|
-
|
|
21
|
-
### The model
|
|
22
|
-
|
|
23
|
-
- **Providers define locals.** A gem (or the app) calls `TheLocal.register` to
|
|
24
|
-
declare its locals; each `c.agent` becomes one local. The register block runs
|
|
25
|
-
only at build time, behind a soft `require "the_local"` guard so the gem still
|
|
26
|
-
works standalone.
|
|
27
|
-
- **`the_local:build` renders committed `.md`.** The provider runs
|
|
28
|
-
`rake the_local:build`; `TheLocal::Builder` writes each agent to its
|
|
29
|
-
`source_path` under `lib/<gem>/the_local/agents/<prefix>-<name>.md`. The
|
|
30
|
-
rendered files are committed to the provider's repo. **These committed files
|
|
31
|
-
are the contract** — they are what a host reads. The register block + `guide.md`
|
|
32
|
-
are the source of truth they're built from.
|
|
33
|
-
- **Install discovers committed `.md` on disk.** In a host, install reads each
|
|
34
|
-
direct dependency's committed `lib/**/the_local/agents/*.md` straight from its
|
|
35
|
-
gem path and copies them into `.claude/agents/` byte-for-byte — no provider
|
|
36
|
-
code is loaded and no register block runs in the host. Output depends only on
|
|
37
|
-
the provider gem version (a true carbon copy across every app), a provider needs
|
|
38
|
-
no install-time wiring to be found, and a fragile gem can't crash the install.
|
|
39
|
-
- **The delegation trigger.** Install also writes a registry-generated block into
|
|
40
|
-
the host's `CLAUDE.md`/`AGENTS.md` telling the host agent to delegate to these
|
|
41
|
-
locals. This is what makes delegation actually happen.
|
|
42
|
-
- **Direct-dependency scope.** Only the host's *direct* dependencies contribute
|
|
43
|
-
locals; transitive provider gems are filtered out, so a host gets exactly the
|
|
44
|
-
experts for the gems it chose.
|
|
45
|
-
|
|
46
|
-
### Install (in any gem or app)
|
|
47
|
-
|
|
48
|
-
1. Add `gem "the_local"` to the host's `Gemfile`, then `bundle install`.
|
|
49
|
-
2. Run `bundle exec the_local install`. This syncs every direct provider's
|
|
50
|
-
committed locals into `.claude/agents/` and writes the delegation trigger
|
|
51
|
-
into `CLAUDE.md`/`AGENTS.md`. It needs no Rails — a plain gem installs the
|
|
52
|
-
same way an app does.
|
|
53
|
-
3. Re-run `bundle exec the_local install` after any bundle change (a provider
|
|
54
|
-
added, removed, or upgraded) to bring the host's locals back in sync. The
|
|
55
|
-
shell can automate this; the gem only exposes the command.
|
|
56
|
-
|
|
57
|
-
Rails apps can equivalently run `bin/rails g the_local:install` and
|
|
58
|
-
`the_local:refresh`; a gem that already wires `require "the_local/rake"` into
|
|
59
|
-
its Rakefile also gets `rake the_local:install`. All three share one engine.
|
|
60
|
-
|
|
61
|
-
### Author a provider (turn a gem into a provider)
|
|
62
|
-
|
|
63
|
-
1. Run `bin/rails g the_local:provider <gem_name>` (pass `--scope`,
|
|
64
|
-
`--prefix`, `--worker` as needed). It scaffolds `lib/<gem>/reference.rb`, a
|
|
65
|
-
`lib/<gem>/reference/guide.md`, and a `lib/<gem>/the_local.rb` companion that
|
|
66
|
-
registers the standard interface; hooks `the_local:build` into the `Rakefile`;
|
|
67
|
-
requires the companion from the gem entrypoint; and builds the committed
|
|
68
|
-
`.md` for review.
|
|
69
|
-
2. Write `guide.md` to the canonical shape — the same sections in every
|
|
70
|
-
provider, so the consuming agent meets one structure everywhere and
|
|
71
|
-
`rake the_local:build` rejects a guide missing one:
|
|
72
|
-
- **Interface** — every public call's *exact signature* (arguments, required
|
|
73
|
-
vs optional, return) as real signatures in a code block, not prose.
|
|
74
|
-
- **Recipe** — a complete copy-paste implementation of the common task.
|
|
75
|
-
- **Install** — the exact setup steps for *this* gem.
|
|
76
|
-
- **Conventions** — what the worker enforces to keep usage consistent.
|
|
77
|
-
|
|
78
|
-
The bar: a host agent does your gem's work from the guide alone, without ever
|
|
79
|
-
opening your source. Document your own gem only; name companion gems but do
|
|
80
|
-
not explain their internals.
|
|
81
|
-
3. Tailor the register block bodies and `scope` to your gem; the standard
|
|
82
|
-
interface is `info` (read-only explainer), `install` (sets the gem up in a
|
|
83
|
-
host), and a domain worker (`develop` for libraries, `operate` for CLIs).
|
|
84
|
-
4. Run `rake the_local:build`, then **commit and ship**
|
|
85
|
-
`lib/<gem>/the_local/agents/*.md` (they must be in the gemspec's `files`).
|
|
86
|
-
This is the whole contract: a host discovers your locals by reading these
|
|
87
|
-
committed files from your gem on disk — it never loads your gem or runs your
|
|
88
|
-
register block — so if they aren't committed and shipped, you contribute
|
|
89
|
-
nothing, and if they are, you contribute everything. A drift test asserting
|
|
90
|
-
each committed file equals its `agent.to_markdown` keeps the artifact honest.
|
|
91
|
-
|
|
92
|
-
### Interface
|
|
93
|
-
|
|
94
|
-
The complete public surface — every entry point with its exact signature, so a
|
|
95
|
-
local answers from here instead of reading source.
|
|
96
|
-
|
|
97
|
-
**Register locals (provider Ruby, behind a soft `require "the_local"` guard):**
|
|
98
|
-
|
|
99
|
-
```ruby
|
|
100
|
-
TheLocal.register(gem_name, prefix: gem_name, scope: nil, agents_dir: nil) { |c| … }
|
|
101
|
-
# Registers a provider and yields a Collector. gem_name is positional and
|
|
102
|
-
# filters to a host's direct dependencies; prefix is the filename namespace
|
|
103
|
-
# (defaults to gem_name); scope is the one-line delegation phrase; agents_dir
|
|
104
|
-
# is the absolute path to the committed .md files (each agent records its
|
|
105
|
-
# source_path there for the installer to copy verbatim).
|
|
106
|
-
|
|
107
|
-
c.agent(name, description:, tools:, body:, knowledge: nil)
|
|
108
|
-
# Declares one local. name is positional; description, tools, body are
|
|
109
|
-
# required; knowledge — a String or Array of Strings, usually
|
|
110
|
-
# MyGem::Reference.content — is optional and appended below the body.
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
```ruby
|
|
114
|
-
TheLocal.register("my_gem", prefix: "my_gem", scope: "one-line domain phrase",
|
|
115
|
-
agents_dir: File.expand_path("the_local/agents", __dir__)) do |c|
|
|
116
|
-
c.agent "info",
|
|
117
|
-
description: "Use to learn what my_gem offers.",
|
|
118
|
-
tools: "Read",
|
|
119
|
-
body: "You explain my_gem, answering only from the reference. You make no changes.",
|
|
120
|
-
knowledge: MyGem::Reference.content
|
|
121
|
-
end
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
**Build (provider Rakefile, after `require "the_local/rake"`):**
|
|
125
|
-
|
|
126
|
-
- `rake the_local:build` — renders each registered agent to its committed
|
|
127
|
-
`lib/<gem>/the_local/agents/<prefix>-<name>.md`. Refuses to render a guide that
|
|
128
|
-
still holds a `TODO:` placeholder or is missing a canonical section.
|
|
129
|
-
- `rake the_local:install` — installs/refreshes this project's own locals.
|
|
130
|
-
|
|
131
|
-
**Host (consuming app or gem):**
|
|
132
|
-
|
|
133
|
-
- `bundle exec the_local install` — CLI; syncs direct providers' locals into
|
|
134
|
-
`.claude/agents/` and writes the delegation trigger. No Rails required.
|
|
135
|
-
- `bin/rails g the_local:install` and `rake the_local:refresh` — Rails equivalents.
|
|
136
|
-
- `bin/rails g the_local:provider <gem_name> [--prefix P] [--scope "…"] [--worker develop|operate]`
|
|
137
|
-
— scaffolds the provider wiring (Reference loader, guide, companion).
|
|
138
|
-
|
|
139
|
-
### Recipe
|
|
140
|
-
|
|
141
|
-
Turn a gem into a provider — the complete companion, copy-paste and rename:
|
|
142
|
-
|
|
143
|
-
```ruby
|
|
144
|
-
# lib/my_gem/the_local.rb
|
|
145
|
-
require_relative "reference"
|
|
146
|
-
|
|
147
|
-
module MyGem
|
|
148
|
-
module Companion
|
|
149
|
-
def self.register!
|
|
150
|
-
TheLocal.register("my_gem", scope: "one-line domain phrase",
|
|
151
|
-
agents_dir: File.expand_path("the_local/agents", __dir__)) do |c|
|
|
152
|
-
c.agent "info",
|
|
153
|
-
description: "Use to learn what my_gem offers.",
|
|
154
|
-
tools: "Read",
|
|
155
|
-
body: "You explain what my_gem does, answering only from your reference. " \
|
|
156
|
-
"You make no changes and never read my_gem's source.",
|
|
157
|
-
knowledge: MyGem::Reference.content
|
|
158
|
-
|
|
159
|
-
c.agent "develop",
|
|
160
|
-
description: "Use PROACTIVELY for any my_gem work.",
|
|
161
|
-
tools: "Read, Write, Edit, Grep",
|
|
162
|
-
body: "You do my_gem work by following your reference's Interface, Recipe, " \
|
|
163
|
-
"and Conventions exactly. You implement from the reference, never source.",
|
|
164
|
-
knowledge: MyGem::Reference.content
|
|
165
|
-
end
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
begin
|
|
171
|
-
require "the_local"
|
|
172
|
-
MyGem::Companion.register!
|
|
173
|
-
rescue LoadError
|
|
174
|
-
# the_local not installed — my_gem works standalone.
|
|
175
|
-
end
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
Then write `reference/guide.md` to the canonical shape, `rake the_local:build`,
|
|
179
|
-
and commit `lib/my_gem/the_local/agents/*.md`.
|
|
180
|
-
|
|
181
|
-
### Conventions
|
|
182
|
-
|
|
183
|
-
- The register block lives behind `begin require "the_local" … rescue LoadError`
|
|
184
|
-
so the gem still works when the_local is absent.
|
|
185
|
-
- `guide.md` documents the providing gem only and stays the single source of
|
|
186
|
-
truth; never let a rendered `.md` drift from `agent.to_markdown`.
|
|
187
|
-
- Commit the rendered `.md`; never render in the host at install time.
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: the_local-install
|
|
3
|
-
description: Use to add the_local to a host app and set it up correctly.
|
|
4
|
-
tools: Bash, Read, Edit
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
You set the_local up in a host gem or app, following the reference's install section exactly: add the gem (git source until it is on RubyGems), bundle, run `bundle exec the_local install` to sync locals into .claude/agents/ and write the delegation trigger, and re-run it after bundle changes. You do not invent steps the reference does not list.
|
|
8
|
-
|
|
9
|
-
## TheLocal
|
|
10
|
-
|
|
11
|
-
> **DO NOT** explore the the_local gem source code. This reference is the
|
|
12
|
-
> complete user-facing API, embedded verbatim into every the_local local so
|
|
13
|
-
> their guidance never drifts. Keep it the single source of truth.
|
|
14
|
-
|
|
15
|
-
the_local is the engine that lets any gem or app ship resident Claude Code
|
|
16
|
-
expert subagents ("locals") that know its conventions. A provider gem registers
|
|
17
|
-
its locals once; the_local renders them to committed `.md` files and installs
|
|
18
|
-
the aggregated set from every directly-depended provider into a consuming app's
|
|
19
|
-
`.claude/agents/`, plus a delegation rule so the host's agent actually uses them.
|
|
20
|
-
|
|
21
|
-
### The model
|
|
22
|
-
|
|
23
|
-
- **Providers define locals.** A gem (or the app) calls `TheLocal.register` to
|
|
24
|
-
declare its locals; each `c.agent` becomes one local. The register block runs
|
|
25
|
-
only at build time, behind a soft `require "the_local"` guard so the gem still
|
|
26
|
-
works standalone.
|
|
27
|
-
- **`the_local:build` renders committed `.md`.** The provider runs
|
|
28
|
-
`rake the_local:build`; `TheLocal::Builder` writes each agent to its
|
|
29
|
-
`source_path` under `lib/<gem>/the_local/agents/<prefix>-<name>.md`. The
|
|
30
|
-
rendered files are committed to the provider's repo. **These committed files
|
|
31
|
-
are the contract** — they are what a host reads. The register block + `guide.md`
|
|
32
|
-
are the source of truth they're built from.
|
|
33
|
-
- **Install discovers committed `.md` on disk.** In a host, install reads each
|
|
34
|
-
direct dependency's committed `lib/**/the_local/agents/*.md` straight from its
|
|
35
|
-
gem path and copies them into `.claude/agents/` byte-for-byte — no provider
|
|
36
|
-
code is loaded and no register block runs in the host. Output depends only on
|
|
37
|
-
the provider gem version (a true carbon copy across every app), a provider needs
|
|
38
|
-
no install-time wiring to be found, and a fragile gem can't crash the install.
|
|
39
|
-
- **The delegation trigger.** Install also writes a registry-generated block into
|
|
40
|
-
the host's `CLAUDE.md`/`AGENTS.md` telling the host agent to delegate to these
|
|
41
|
-
locals. This is what makes delegation actually happen.
|
|
42
|
-
- **Direct-dependency scope.** Only the host's *direct* dependencies contribute
|
|
43
|
-
locals; transitive provider gems are filtered out, so a host gets exactly the
|
|
44
|
-
experts for the gems it chose.
|
|
45
|
-
|
|
46
|
-
### Install (in any gem or app)
|
|
47
|
-
|
|
48
|
-
1. Add `gem "the_local"` to the host's `Gemfile`, then `bundle install`.
|
|
49
|
-
2. Run `bundle exec the_local install`. This syncs every direct provider's
|
|
50
|
-
committed locals into `.claude/agents/` and writes the delegation trigger
|
|
51
|
-
into `CLAUDE.md`/`AGENTS.md`. It needs no Rails — a plain gem installs the
|
|
52
|
-
same way an app does.
|
|
53
|
-
3. Re-run `bundle exec the_local install` after any bundle change (a provider
|
|
54
|
-
added, removed, or upgraded) to bring the host's locals back in sync. The
|
|
55
|
-
shell can automate this; the gem only exposes the command.
|
|
56
|
-
|
|
57
|
-
Rails apps can equivalently run `bin/rails g the_local:install` and
|
|
58
|
-
`the_local:refresh`; a gem that already wires `require "the_local/rake"` into
|
|
59
|
-
its Rakefile also gets `rake the_local:install`. All three share one engine.
|
|
60
|
-
|
|
61
|
-
### Author a provider (turn a gem into a provider)
|
|
62
|
-
|
|
63
|
-
1. Run `bin/rails g the_local:provider <gem_name>` (pass `--scope`,
|
|
64
|
-
`--prefix`, `--worker` as needed). It scaffolds `lib/<gem>/reference.rb`, a
|
|
65
|
-
`lib/<gem>/reference/guide.md`, and a `lib/<gem>/the_local.rb` companion that
|
|
66
|
-
registers the standard interface; hooks `the_local:build` into the `Rakefile`;
|
|
67
|
-
requires the companion from the gem entrypoint; and builds the committed
|
|
68
|
-
`.md` for review.
|
|
69
|
-
2. Write `guide.md` to the canonical shape — the same sections in every
|
|
70
|
-
provider, so the consuming agent meets one structure everywhere and
|
|
71
|
-
`rake the_local:build` rejects a guide missing one:
|
|
72
|
-
- **Interface** — every public call's *exact signature* (arguments, required
|
|
73
|
-
vs optional, return) as real signatures in a code block, not prose.
|
|
74
|
-
- **Recipe** — a complete copy-paste implementation of the common task.
|
|
75
|
-
- **Install** — the exact setup steps for *this* gem.
|
|
76
|
-
- **Conventions** — what the worker enforces to keep usage consistent.
|
|
77
|
-
|
|
78
|
-
The bar: a host agent does your gem's work from the guide alone, without ever
|
|
79
|
-
opening your source. Document your own gem only; name companion gems but do
|
|
80
|
-
not explain their internals.
|
|
81
|
-
3. Tailor the register block bodies and `scope` to your gem; the standard
|
|
82
|
-
interface is `info` (read-only explainer), `install` (sets the gem up in a
|
|
83
|
-
host), and a domain worker (`develop` for libraries, `operate` for CLIs).
|
|
84
|
-
4. Run `rake the_local:build`, then **commit and ship**
|
|
85
|
-
`lib/<gem>/the_local/agents/*.md` (they must be in the gemspec's `files`).
|
|
86
|
-
This is the whole contract: a host discovers your locals by reading these
|
|
87
|
-
committed files from your gem on disk — it never loads your gem or runs your
|
|
88
|
-
register block — so if they aren't committed and shipped, you contribute
|
|
89
|
-
nothing, and if they are, you contribute everything. A drift test asserting
|
|
90
|
-
each committed file equals its `agent.to_markdown` keeps the artifact honest.
|
|
91
|
-
|
|
92
|
-
### Interface
|
|
93
|
-
|
|
94
|
-
The complete public surface — every entry point with its exact signature, so a
|
|
95
|
-
local answers from here instead of reading source.
|
|
96
|
-
|
|
97
|
-
**Register locals (provider Ruby, behind a soft `require "the_local"` guard):**
|
|
98
|
-
|
|
99
|
-
```ruby
|
|
100
|
-
TheLocal.register(gem_name, prefix: gem_name, scope: nil, agents_dir: nil) { |c| … }
|
|
101
|
-
# Registers a provider and yields a Collector. gem_name is positional and
|
|
102
|
-
# filters to a host's direct dependencies; prefix is the filename namespace
|
|
103
|
-
# (defaults to gem_name); scope is the one-line delegation phrase; agents_dir
|
|
104
|
-
# is the absolute path to the committed .md files (each agent records its
|
|
105
|
-
# source_path there for the installer to copy verbatim).
|
|
106
|
-
|
|
107
|
-
c.agent(name, description:, tools:, body:, knowledge: nil)
|
|
108
|
-
# Declares one local. name is positional; description, tools, body are
|
|
109
|
-
# required; knowledge — a String or Array of Strings, usually
|
|
110
|
-
# MyGem::Reference.content — is optional and appended below the body.
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
```ruby
|
|
114
|
-
TheLocal.register("my_gem", prefix: "my_gem", scope: "one-line domain phrase",
|
|
115
|
-
agents_dir: File.expand_path("the_local/agents", __dir__)) do |c|
|
|
116
|
-
c.agent "info",
|
|
117
|
-
description: "Use to learn what my_gem offers.",
|
|
118
|
-
tools: "Read",
|
|
119
|
-
body: "You explain my_gem, answering only from the reference. You make no changes.",
|
|
120
|
-
knowledge: MyGem::Reference.content
|
|
121
|
-
end
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
**Build (provider Rakefile, after `require "the_local/rake"`):**
|
|
125
|
-
|
|
126
|
-
- `rake the_local:build` — renders each registered agent to its committed
|
|
127
|
-
`lib/<gem>/the_local/agents/<prefix>-<name>.md`. Refuses to render a guide that
|
|
128
|
-
still holds a `TODO:` placeholder or is missing a canonical section.
|
|
129
|
-
- `rake the_local:install` — installs/refreshes this project's own locals.
|
|
130
|
-
|
|
131
|
-
**Host (consuming app or gem):**
|
|
132
|
-
|
|
133
|
-
- `bundle exec the_local install` — CLI; syncs direct providers' locals into
|
|
134
|
-
`.claude/agents/` and writes the delegation trigger. No Rails required.
|
|
135
|
-
- `bin/rails g the_local:install` and `rake the_local:refresh` — Rails equivalents.
|
|
136
|
-
- `bin/rails g the_local:provider <gem_name> [--prefix P] [--scope "…"] [--worker develop|operate]`
|
|
137
|
-
— scaffolds the provider wiring (Reference loader, guide, companion).
|
|
138
|
-
|
|
139
|
-
### Recipe
|
|
140
|
-
|
|
141
|
-
Turn a gem into a provider — the complete companion, copy-paste and rename:
|
|
142
|
-
|
|
143
|
-
```ruby
|
|
144
|
-
# lib/my_gem/the_local.rb
|
|
145
|
-
require_relative "reference"
|
|
146
|
-
|
|
147
|
-
module MyGem
|
|
148
|
-
module Companion
|
|
149
|
-
def self.register!
|
|
150
|
-
TheLocal.register("my_gem", scope: "one-line domain phrase",
|
|
151
|
-
agents_dir: File.expand_path("the_local/agents", __dir__)) do |c|
|
|
152
|
-
c.agent "info",
|
|
153
|
-
description: "Use to learn what my_gem offers.",
|
|
154
|
-
tools: "Read",
|
|
155
|
-
body: "You explain what my_gem does, answering only from your reference. " \
|
|
156
|
-
"You make no changes and never read my_gem's source.",
|
|
157
|
-
knowledge: MyGem::Reference.content
|
|
158
|
-
|
|
159
|
-
c.agent "develop",
|
|
160
|
-
description: "Use PROACTIVELY for any my_gem work.",
|
|
161
|
-
tools: "Read, Write, Edit, Grep",
|
|
162
|
-
body: "You do my_gem work by following your reference's Interface, Recipe, " \
|
|
163
|
-
"and Conventions exactly. You implement from the reference, never source.",
|
|
164
|
-
knowledge: MyGem::Reference.content
|
|
165
|
-
end
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
begin
|
|
171
|
-
require "the_local"
|
|
172
|
-
MyGem::Companion.register!
|
|
173
|
-
rescue LoadError
|
|
174
|
-
# the_local not installed — my_gem works standalone.
|
|
175
|
-
end
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
Then write `reference/guide.md` to the canonical shape, `rake the_local:build`,
|
|
179
|
-
and commit `lib/my_gem/the_local/agents/*.md`.
|
|
180
|
-
|
|
181
|
-
### Conventions
|
|
182
|
-
|
|
183
|
-
- The register block lives behind `begin require "the_local" … rescue LoadError`
|
|
184
|
-
so the gem still works when the_local is absent.
|
|
185
|
-
- `guide.md` documents the providing gem only and stays the single source of
|
|
186
|
-
truth; never let a rendered `.md` drift from `agent.to_markdown`.
|
|
187
|
-
- Commit the rendered `.md`; never render in the host at install time.
|
data/lib/the_local/the_local.rb
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "reference"
|
|
4
|
-
|
|
5
|
-
module TheLocal
|
|
6
|
-
# Registers the_local's own locals (info / install / develop) with the_local,
|
|
7
|
-
# so the engine dogfoods the same provider model every other gem uses.
|
|
8
|
-
module Companion
|
|
9
|
-
SCOPE = "Claude Code locals: gems register subagents, the_local builds " \
|
|
10
|
-
"committed .md and installs them into a host app"
|
|
11
|
-
|
|
12
|
-
# rubocop:disable Metrics/MethodLength, Metrics/BlockLength
|
|
13
|
-
def self.register!
|
|
14
|
-
TheLocal.register(
|
|
15
|
-
"the_local",
|
|
16
|
-
scope: SCOPE,
|
|
17
|
-
agents_dir: File.expand_path("the_local/agents", __dir__)
|
|
18
|
-
) do |c|
|
|
19
|
-
c.agent "info",
|
|
20
|
-
description: "Use to learn how the_local works — providers, the build/install " \
|
|
21
|
-
"model, the delegation trigger, and the direct-dependency scope rule.",
|
|
22
|
-
tools: "Read",
|
|
23
|
-
body: "You explain how the_local works, answering only from the reference: providers " \
|
|
24
|
-
"register locals, the_local:build renders committed .md, install/refresh copy " \
|
|
25
|
-
"them verbatim into a host, the CLAUDE.md delegation trigger makes the host " \
|
|
26
|
-
"delegate, and only direct dependencies contribute. You make no changes.",
|
|
27
|
-
knowledge: TheLocal::Reference.content
|
|
28
|
-
|
|
29
|
-
c.agent "install",
|
|
30
|
-
description: "Use to add the_local to a host app and set it up correctly.",
|
|
31
|
-
tools: "Bash, Read, Edit",
|
|
32
|
-
body: "You set the_local up in a host gem or app, following the reference's install " \
|
|
33
|
-
"section exactly: add the gem (git source until it is on RubyGems), bundle, run " \
|
|
34
|
-
"`bundle exec the_local install` to sync locals into .claude/agents/ and write " \
|
|
35
|
-
"the delegation trigger, and re-run it after bundle changes. You do not invent " \
|
|
36
|
-
"steps the reference does not list.",
|
|
37
|
-
knowledge: TheLocal::Reference.content
|
|
38
|
-
|
|
39
|
-
c.agent "develop",
|
|
40
|
-
description: "Use PROACTIVELY to turn a gem into a the_local provider — scaffolding " \
|
|
41
|
-
"the companion, authoring the guide, and committing the rendered locals. " \
|
|
42
|
-
"MUST BE USED instead of wiring a provider by hand.",
|
|
43
|
-
tools: "Read, Write, Edit, Grep",
|
|
44
|
-
body: "You turn a gem into a the_local provider following the reference's " \
|
|
45
|
-
"provider-author workflow: run `the_local:provider`, write guide.md as the " \
|
|
46
|
-
"single source of truth (your own gem only), tailor the register block, and " \
|
|
47
|
-
"hook the_local:build into the Rakefile. The deliverable is the committed, " \
|
|
48
|
-
"shipped lib/<gem>/the_local/agents/*.md — that is the whole contract a host " \
|
|
49
|
-
"reads from disk; a host never loads the gem, so unless those files are built, " \
|
|
50
|
-
"committed, and in the gemspec, the gem contributes nothing. You keep them in " \
|
|
51
|
-
"sync with agent.to_markdown.",
|
|
52
|
-
knowledge: TheLocal::Reference.content
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
# rubocop:enable Metrics/MethodLength, Metrics/BlockLength
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
TheLocal::Companion.register!
|