gentle-agent-extensions 1.0.0 → 1.2.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.
- package/README.md +177 -287
- package/package.json +17 -14
- package/resources/agents/architecture-council.md +158 -0
- package/resources/overlays/orchestrator.overlay.md +162 -0
- package/resources/routing/architecture-council.md +65 -0
- package/resources/skills/architecture-quest/SKILL.md +238 -0
- package/resources/skills/gentle-agent-extension/SKILL.md +329 -0
- package/src/extension.ts +544 -0
- package/.manifest.json +0 -15
- package/agents/.gitkeep +0 -0
- package/assets/.gitkeep +0 -0
- package/docs/conventions.md +0 -278
- package/extensions/gentle-agent-extensions.ts +0 -547
- package/mcp/.gitkeep +0 -31
- package/overlays/.gitkeep +0 -0
- package/routing/.gitkeep +0 -0
- package/scripts/doctor.sh +0 -509
- package/scripts/install.sh +0 -206
- package/scripts/sync.sh +0 -513
- package/skills/gentle-agent-extension/SKILL.md +0 -360
- package/tests/gentle-extensions.test.ts +0 -653
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gentle-agent-extension
|
|
3
|
-
description: "Trigger: gentle-agent-extensions, extend gentle-ai, extend gentle-pi, add agent, add overlay. How to extend Gentle AI/Pi via gentle-agent-extensions project: add agents, overlays, routing, skills declaratively."
|
|
4
|
-
license: Apache-2.0
|
|
5
|
-
metadata:
|
|
6
|
-
author: gentleman-programming
|
|
7
|
-
version: "1.0"
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Gentle Agent Extension Skill
|
|
11
|
-
|
|
12
|
-
This skill teaches how to extend Gentle AI and Gentle Pi through the `gentle-agent-extensions` project using declarative files only — no code changes to the extension itself.
|
|
13
|
-
|
|
14
|
-
## Activation Contract
|
|
15
|
-
|
|
16
|
-
**Use this skill when:**
|
|
17
|
-
- Creating a new custom agent for Gentle Pi
|
|
18
|
-
- Adding an overlay to an existing agent or the orchestrator
|
|
19
|
-
- Defining routing rules for when a custom agent should be delegated to
|
|
20
|
-
- Creating a new project skill for use within gentle-agent-extensions
|
|
21
|
-
- Modifying or removing any of the above
|
|
22
|
-
|
|
23
|
-
**Do NOT use this skill for:**
|
|
24
|
-
- One-off tasks that don't extend the agent system
|
|
25
|
-
- Modifying the gentle-agent-extensions extension code directly
|
|
26
|
-
- Changing Gentle AI or Gentle Pi official repositories
|
|
27
|
-
|
|
28
|
-
## Hard Rules
|
|
29
|
-
|
|
30
|
-
| Rule | Description |
|
|
31
|
-
|------|-------------|
|
|
32
|
-
| **No official file modification** | Never modify files managed by Gentle Pi (`~/.pi/agent/agents/`, `~/.pi/agent/subagents/`, `subagents.json`, `.atl/skill-registry.md`) |
|
|
33
|
-
| **No duplicate registries** | Do not create parallel agent registries or skill indexes. Use native discovery. |
|
|
34
|
-
| **Declarative only** | New capabilities added via files in `agents/`, `overlays/`, `routing/`, `skills/` — not by editing extension code |
|
|
35
|
-
| **Extension code is stable** | Changes to `extensions/gentle-agent-extensions.ts` are exceptional and require architectural justification |
|
|
36
|
-
| **Manifest ownership** | Only files listed in `.manifest.json` are project-owned. Sync never touches unlisted files. |
|
|
37
|
-
| **Idempotent sync** | Running `sync.sh` repeatedly with same config produces no changes |
|
|
38
|
-
| **Profile awareness** | Respect installation profile (pi, gentle-shell, gentle-shell-linked) — different agent homes |
|
|
39
|
-
|
|
40
|
-
## Decision Gates
|
|
41
|
-
|
|
42
|
-
### Choosing the Right Extension Mechanism
|
|
43
|
-
|
|
44
|
-
| Need | Mechanism | Location |
|
|
45
|
-
|------|-----------|----------|
|
|
46
|
-
| New autonomous capability with own prompt | **New Agent** | `agents/{name}.md` |
|
|
47
|
-
| Modify behavior of existing agent/orchestrator | **Overlay** | `overlays/{target}.overlay.md` |
|
|
48
|
-
| Define when orchestrator delegates to agent | **Routing** | `routing/{agent}.md` |
|
|
49
|
-
| Reusable workflow/decision logic for agents | **Skill** | `skills/{name}/SKILL.md` |
|
|
50
|
-
| External tool/API integration via MCP | **MCP Server** | `mcp/{name}.mcp.json` |
|
|
51
|
-
| New programmatic capability not possible declaratively | **Extension Code** | `extensions/` (rare, justify) |
|
|
52
|
-
|
|
53
|
-
### Agent vs Overlay vs Skill
|
|
54
|
-
|
|
55
|
-
| Situation | Action |
|
|
56
|
-
|-----------|--------|
|
|
57
|
-
| Capability needs its own model/tools/mode | Create Agent + Routing + Skill |
|
|
58
|
-
| Existing agent needs extra instructions | Create Overlay targeting that agent |
|
|
59
|
-
| Orchestrator needs global routing rules | Create Overlay targeting `orchestrator` |
|
|
60
|
-
| Delegation logic is reusable across tasks | Create Skill with Activation Contract |
|
|
61
|
-
| Simple one-time instruction addition | Use Overlay (simpler than Agent) |
|
|
62
|
-
|
|
63
|
-
## Execution Steps
|
|
64
|
-
|
|
65
|
-
### Procedure A: Add a New Agent
|
|
66
|
-
|
|
67
|
-
1. **Define identity and purpose**
|
|
68
|
-
- Choose unique name (kebab-case, e.g., `code-reviewer`)
|
|
69
|
-
- Write one-line description of when to use it
|
|
70
|
-
- Determine model, thinking level, mode, tools needed
|
|
71
|
-
|
|
72
|
-
2. **Create agent definition**
|
|
73
|
-
```bash
|
|
74
|
-
# Create agent file
|
|
75
|
-
cat > agents/code-reviewer.md <<'EOF'
|
|
76
|
-
---
|
|
77
|
-
name: code-reviewer
|
|
78
|
-
description: "Reviews code changes for correctness, style, and security"
|
|
79
|
-
model: anthropic/claude-opus-4
|
|
80
|
-
thinking: high
|
|
81
|
-
mode: task
|
|
82
|
-
tools: [read, write, edit, bash, grep]
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
# Code Reviewer Agent
|
|
86
|
-
|
|
87
|
-
You are a senior code reviewer. Review the changes...
|
|
88
|
-
EOF
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
3. **Create routing instructions** (if semantic delegation needed)
|
|
92
|
-
```bash
|
|
93
|
-
cat > routing/code-reviewer.md <<'EOF'
|
|
94
|
-
---
|
|
95
|
-
agent: code-reviewer
|
|
96
|
-
triggers:
|
|
97
|
-
- "review this code"
|
|
98
|
-
- "code review"
|
|
99
|
-
- "check my changes"
|
|
100
|
-
conditions:
|
|
101
|
-
- "User explicitly requests code review"
|
|
102
|
-
- "PR/MR is ready for review"
|
|
103
|
-
delegation: subagent_run
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
# Routing for code-reviewer
|
|
107
|
-
|
|
108
|
-
## When to Use
|
|
109
|
-
Delegate when user asks for code review or changes need review.
|
|
110
|
-
|
|
111
|
-
## How to Delegate
|
|
112
|
-
Use subagent_run with agent="code-reviewer", mode="task"
|
|
113
|
-
EOF
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
4. **Create associated skill** (for semantic activation)
|
|
117
|
-
```bash
|
|
118
|
-
mkdir -p skills/code-reviewer
|
|
119
|
-
cat > skills/code-reviewer/SKILL.md <<'EOF'
|
|
120
|
-
---
|
|
121
|
-
name: code-reviewer
|
|
122
|
-
description: "Trigger: code review, review code, check changes. Delegates to code-reviewer agent for code review tasks."
|
|
123
|
-
license: Apache-2.0
|
|
124
|
-
metadata:
|
|
125
|
-
author: gentleman-programming
|
|
126
|
-
version: "1.0"
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
# Code Reviewer Skill
|
|
130
|
-
|
|
131
|
-
## Activation Contract
|
|
132
|
-
Use when user requests code review or changes need review.
|
|
133
|
-
|
|
134
|
-
## Hard Rules
|
|
135
|
-
- Only delegate via subagent_run to code-reviewer agent
|
|
136
|
-
- Pass specific files/changes to review in task description
|
|
137
|
-
|
|
138
|
-
## Decision Gates
|
|
139
|
-
| Situation | Action |
|
|
140
|
-
|-----------|--------|
|
|
141
|
-
| User says "review" | Delegate to code-reviewer |
|
|
142
|
-
| General coding task | Do NOT delegate |
|
|
143
|
-
|
|
144
|
-
## Execution Steps
|
|
145
|
-
1. Identify files/changes to review
|
|
146
|
-
2. Call subagent_run with agent=code-reviewer
|
|
147
|
-
3. Return review results to user
|
|
148
|
-
|
|
149
|
-
## Output Contract
|
|
150
|
-
- Review findings with severity levels
|
|
151
|
-
- Suggested fixes
|
|
152
|
-
|
|
153
|
-
## References
|
|
154
|
-
- agents/code-reviewer.md
|
|
155
|
-
- routing/code-reviewer.md
|
|
156
|
-
EOF
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
5. **Run sync**
|
|
160
|
-
```bash
|
|
161
|
-
scripts/sync.sh
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
6. **Verify**
|
|
165
|
-
- Run `scripts/doctor.sh` — should pass
|
|
166
|
-
- Start Pi, run `/gentle-extensions:status` — agent listed
|
|
167
|
-
- Test delegation: ask Pi to "review this code" — should invoke agent
|
|
168
|
-
|
|
169
|
-
7. **Update tests and docs**
|
|
170
|
-
- Add test fixture if new pattern
|
|
171
|
-
- Update README if new capability type
|
|
172
|
-
|
|
173
|
-
### Procedure B: Add an Overlay
|
|
174
|
-
|
|
175
|
-
1. **Identify target**
|
|
176
|
-
- Agent name (e.g., `gentle-ai-worker`) or `orchestrator`
|
|
177
|
-
|
|
178
|
-
2. **Create overlay file**
|
|
179
|
-
```bash
|
|
180
|
-
cat > overlays/gentle-ai-worker.overlay.md <<'EOF'
|
|
181
|
-
---
|
|
182
|
-
target: gentle-ai-worker
|
|
183
|
-
priority: 100
|
|
184
|
-
mode: append
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
# Overlay for gentle-ai-worker
|
|
188
|
-
|
|
189
|
-
## Additional Instructions
|
|
190
|
-
|
|
191
|
-
When writing tests, always use the project's test utilities.
|
|
192
|
-
Prefer table-driven tests over individual test cases.
|
|
193
|
-
EOF
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
3. **Validate target exists**
|
|
197
|
-
- Run `scripts/doctor.sh` — warns if target unknown
|
|
198
|
-
- Target can be global agent, project agent, or `orchestrator`
|
|
199
|
-
|
|
200
|
-
4. **Run sync**
|
|
201
|
-
```bash
|
|
202
|
-
scripts/sync.sh
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
5. **Verify**
|
|
206
|
-
- Start Pi, invoke target agent
|
|
207
|
-
- Check overlay instructions appear in agent's prompt (via `/gentle-extensions:status` or debug)
|
|
208
|
-
|
|
209
|
-
6. **Document**
|
|
210
|
-
- Note overlay purpose in PR/docs
|
|
211
|
-
|
|
212
|
-
## Output Contract
|
|
213
|
-
|
|
214
|
-
After executing either procedure, the following must be true:
|
|
215
|
-
|
|
216
|
-
| Output | Verification |
|
|
217
|
-
|--------|--------------|
|
|
218
|
-
| Agent file in `agents/` | `ls agents/{name}.md` |
|
|
219
|
-
| Routing file in `routing/` | `ls routing/{name}.md` |
|
|
220
|
-
| Skill dir in `skills/` | `ls skills/{name}/SKILL.md` |
|
|
221
|
-
| Overlay file in `overlays/` | `ls overlays/{target}.overlay.md` |
|
|
222
|
-
| Sync completes without errors | `scripts/sync.sh` exits 0 |
|
|
223
|
-
| Doctor passes | `scripts/doctor.sh` exits 0 |
|
|
224
|
-
| Agent discoverable by Gentle Pi | `/gentle-extensions:status` shows agent |
|
|
225
|
-
| Overlay applied at runtime | Target agent receives additional instructions |
|
|
226
|
-
| Skill indexed by registry | `/skill-registry:refresh` includes skill |
|
|
227
|
-
| No official files modified | `git status ~/.pi/agent` clean |
|
|
228
|
-
| Manifest updated | `.manifest.json` lists new files |
|
|
229
|
-
|
|
230
|
-
## Procedure C: Add an MCP Server
|
|
231
|
-
|
|
232
|
-
1. **Define the MCP server**
|
|
233
|
-
- Choose unique name (kebab-case, e.g., `github`)
|
|
234
|
-
- Write one-line description of what it provides
|
|
235
|
-
- Determine transport: `stdio` (command + args) or `http` (URL)
|
|
236
|
-
- Identify required environment variables (use `${VAR}` syntax)
|
|
237
|
-
- Choose tool exposure: `codemode` (default), `direct`, `deferred`, `hidden`
|
|
238
|
-
- List capabilities: `tools`, `resources`
|
|
239
|
-
- Note any agent dependencies
|
|
240
|
-
- Document authentication requirements
|
|
241
|
-
|
|
242
|
-
2. **Create MCP definition file**
|
|
243
|
-
```bash
|
|
244
|
-
cat > mcp/github.mcp.json <<'EOF'
|
|
245
|
-
{
|
|
246
|
-
"name": "github",
|
|
247
|
-
"description": "GitHub API access for issues, PRs, repos",
|
|
248
|
-
"transport": "http",
|
|
249
|
-
"url": "https://api.githubcopilot.com/mcp/",
|
|
250
|
-
"env": {
|
|
251
|
-
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
|
|
252
|
-
},
|
|
253
|
-
"exposure": "deferred",
|
|
254
|
-
"toolExposure": {
|
|
255
|
-
"search_code": "direct",
|
|
256
|
-
"get_*": "codemode",
|
|
257
|
-
"delete_*": "hidden"
|
|
258
|
-
},
|
|
259
|
-
"enabled": true,
|
|
260
|
-
"timeout": 60,
|
|
261
|
-
"capabilities": ["tools"],
|
|
262
|
-
"agentDependencies": ["code-reviewer", "repo-manager"],
|
|
263
|
-
"auth": {
|
|
264
|
-
"type": "bearer",
|
|
265
|
-
"envVar": "GITHUB_TOKEN",
|
|
266
|
-
"description": "GitHub personal access token"
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
EOF
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
3. **Create or update agent routing with MCP dependencies**
|
|
273
|
-
```bash
|
|
274
|
-
cat > routing/code-reviewer.md <<'EOF'
|
|
275
|
-
---
|
|
276
|
-
agent: code-reviewer
|
|
277
|
-
triggers:
|
|
278
|
-
- "review this code"
|
|
279
|
-
- "code review"
|
|
280
|
-
mcpDependencies:
|
|
281
|
-
- github
|
|
282
|
-
- filesystem
|
|
283
|
-
delegation: subagent_run
|
|
284
|
-
---
|
|
285
|
-
EOF
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
4. **Run sync**
|
|
289
|
-
```bash
|
|
290
|
-
scripts/sync.sh
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
5. **Verify**
|
|
294
|
-
- Run `scripts/doctor.sh` — should pass
|
|
295
|
-
- Start Pi, run `/gentle-extensions:status` — MCP server listed
|
|
296
|
-
- Check `/mcp` in Pi — server connected
|
|
297
|
-
- Test delegation: ask Pi to use the MCP tools
|
|
298
|
-
|
|
299
|
-
6. **Document**
|
|
300
|
-
- Note MCP server purpose and dependencies in PR/docs
|
|
301
|
-
|
|
302
|
-
### Procedure D: Add MCP Dependencies to an Existing Agent
|
|
303
|
-
|
|
304
|
-
1. **Update agent routing file** to include `mcpDependencies`:
|
|
305
|
-
```bash
|
|
306
|
-
cat > routing/my-agent.md <<'EOF'
|
|
307
|
-
---
|
|
308
|
-
agent: my-agent
|
|
309
|
-
triggers:
|
|
310
|
-
- "search code"
|
|
311
|
-
- "find files"
|
|
312
|
-
mcpDependencies:
|
|
313
|
-
- github
|
|
314
|
-
- filesystem
|
|
315
|
-
delegation: subagent_run
|
|
316
|
-
---
|
|
317
|
-
EOF
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
2. **Run sync** and verify
|
|
321
|
-
```bash
|
|
322
|
-
scripts/sync.sh
|
|
323
|
-
scripts/doctor.sh
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
3. **Test** - The orchestrator will see available MCP servers and their capabilities.
|
|
327
|
-
|
|
328
|
-
## Updated Output Contract
|
|
329
|
-
|
|
330
|
-
After executing any procedure, the following must be true:
|
|
331
|
-
|
|
332
|
-
| Output | Verification |
|
|
333
|
-
|--------|--------------|
|
|
334
|
-
| Agent file in `agents/` | `ls agents/{name}.md` |
|
|
335
|
-
| Routing file in `routing/` | `ls routing/{name}.md` |
|
|
336
|
-
| Skill dir in `skills/` | `ls skills/{name}/SKILL.md` |
|
|
337
|
-
| Overlay file in `overlays/` | `ls overlays/{target}.overlay.md` |
|
|
338
|
-
| MCP definition in `mcp/` | `ls mcp/{name}.mcp.json` |
|
|
339
|
-
| Sync completes without errors | `scripts/sync.sh` exits 0 |
|
|
340
|
-
| Doctor passes | `scripts/doctor.sh` exits 0 |
|
|
341
|
-
| Agent discoverable by Gentle Pi | `/gentle-extensions:status` shows agent |
|
|
342
|
-
| Overlay applied at runtime | Target agent receives additional instructions |
|
|
343
|
-
| Skill indexed by registry | `/skill-registry:refresh` includes skill |
|
|
344
|
-
| MCP server registered | `/mcp` in Pi shows server connected |
|
|
345
|
-
| No official files modified | `git status ~/.pi/agent` clean |
|
|
346
|
-
| Manifest updated | `.manifest.json` lists new files |
|
|
347
|
-
|
|
348
|
-
## References
|
|
349
|
-
|
|
350
|
-
- **Architecture**: `docs/conventions.md`
|
|
351
|
-
- **Extension code**: `extensions/gentle-agent-extensions.ts`
|
|
352
|
-
- **Install script**: `scripts/install.sh`
|
|
353
|
-
- **Sync script**: `scripts/sync.sh`
|
|
354
|
-
- **Doctor script**: `scripts/doctor.sh`
|
|
355
|
-
- **Gentle Pi agent config**: `~/.pi/agent/npm/node_modules/gentle-pi/lib/agents-config.ts`
|
|
356
|
-
- **Gentle Pi skill registry**: `~/.pi/agent/npm/node_modules/gentle-pi/extensions/skill-registry.ts`
|
|
357
|
-
- **System prompt append**: `~/.pi/agent/npm/node_modules/gentle-pi/lib/append-system-prompt.ts`
|
|
358
|
-
- **Child context filtering**: `~/.pi/agent/npm/node_modules/gentle-pi/lib/child-context-files.ts`
|
|
359
|
-
- **Skill style guide**: `~/.pi/agent/npm/node_modules/gentle-pi/docs/skill-style-guide.md`
|
|
360
|
-
- **Gentle Shell reference**: `~/.pi/agent/npm/node_modules/gentle-pi/docs/gentle-shell.md`
|