gentle-agent-extensions 1.0.1 → 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.
@@ -0,0 +1,329 @@
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 the gentle-agent-extensions PACKAGE: add bundled agents, overlays, routing, skills, MCPs declaratively."
4
+ license: Apache-2.0
5
+ metadata:
6
+ author: AndyTechnologies
7
+ version: "1.1"
8
+ ---
9
+
10
+ # Gentle Agent Extension Skill (Package Maintainer)
11
+
12
+ This skill teaches how to extend the **gentle-agent-extensions package itself** by adding bundled resources (agents, overlays, skills, MCPs) that are included when users install the package via `pi install npm:gentle-agent-extensions` or `pi install git:...`.
13
+
14
+ **This is for PACKAGE MAINTAINERS**, not end users. End users just install the package and get all bundled resources automatically.
15
+
16
+ ## Activation Contract
17
+
18
+ **Use this skill when:**
19
+ - Adding a new bundled agent to the package (available to all users)
20
+ - Adding a new bundled overlay to the package
21
+ - Adding a new bundled skill to the package
22
+ - Adding a new bundled MCP server to the package
23
+ - Adding a new bundled routing rule to the package
24
+ - Modifying or removing any of the above bundled resources
25
+
26
+ **Do NOT use this skill for:**
27
+ - End-user customization (they don't need this skill)
28
+ - Modifying the extension code directly (`src/extension.ts`)
29
+ - Changing Gentle AI or Gentle Pi official repositories
30
+
31
+ ## Hard Rules
32
+
33
+ | Rule | Description |
34
+ |------|-------------|
35
+ | **Bundled resources only** | All resources live in `resources/` directory of the package |
36
+ | **No user project directories** | The package does NOT use user's `agents/`, `overlays/`, `skills/` directories |
37
+ | **Extension code is stable** | Changes to `src/extension.ts` are exceptional and require architectural justification |
38
+ | **Declarative resources** | New capabilities added via files in `resources/{agents,overlays,skills,routing,mcp}/` |
39
+ | **No sync.sh/doctor.sh** | These were removed; functionality is now `/gentle-extensions:*` commands |
40
+ | **Version pinning** | peerDependencies use `^1.4.0` matching Pi 1.4.0 |
41
+
42
+ ## Decision Gates
43
+
44
+ ### Choosing the Right Bundled Resource Type
45
+
46
+ | Need | Mechanism | Location (in package) |
47
+ |------|-----------|----------------------|
48
+ | New autonomous capability with own prompt | **Bundled Agent** | `resources/agents/{name}.md` |
49
+ | Modify behavior of existing agent/orchestrator globally | **Bundled Overlay** | `resources/overlays/{target}.overlay.md` |
50
+ | Define when orchestrator delegates to bundled agent | **Bundled Routing** | `resources/routing/{agent}.md` |
51
+ | Reusable workflow/decision logic for agents | **Bundled Skill** | `resources/skills/{name}/SKILL.md` |
52
+ | External tool/API integration via MCP | **Bundled MCP Server** | `resources/mcp/{name}.mcp.json` |
53
+
54
+ ## Execution Steps
55
+
56
+ ### Procedure A: Add a New Bundled Agent
57
+
58
+ 1. **Define identity and purpose**
59
+ - Choose unique name (kebab-case, e.g., `code-reviewer`)
60
+ - Write one-line description of when to use it
61
+ - Determine model, thinking level, mode, tools needed
62
+
63
+ 2. **Create agent definition in package resources**
64
+ ```bash
65
+ cat > resources/agents/code-reviewer.md <<'EOF'
66
+ ---
67
+ name: code-reviewer
68
+ description: "Reviews code changes for correctness, style, and security"
69
+ model: anthropic/claude-opus-4
70
+ thinking: high
71
+ mode: task
72
+ tools: [read, write, edit, bash, grep]
73
+ ---
74
+
75
+ # Code Reviewer Agent
76
+
77
+ You are a senior code reviewer. Review the changes...
78
+ EOF
79
+ ```
80
+
81
+ 3. **Create routing instructions** (for semantic delegation)
82
+ ```bash
83
+ cat > resources/routing/code-reviewer.md <<'EOF'
84
+ ---
85
+ agent: code-reviewer
86
+ triggers:
87
+ - "review this code"
88
+ - "code review"
89
+ - "check my changes"
90
+ conditions:
91
+ - "User explicitly requests code review"
92
+ - "PR/MR is ready for review"
93
+ delegation: subagent_run
94
+ ---
95
+
96
+ # Routing for code-reviewer
97
+
98
+ ## When to Use
99
+ Delegate when user asks for code review or changes need review.
100
+
101
+ ## How to Delegate
102
+ Use subagent_run with agent="code-reviewer", mode="task"
103
+ EOF
104
+ ```
105
+
106
+ 4. **Create associated skill** (for semantic activation)
107
+ ```bash
108
+ mkdir -p resources/skills/code-reviewer
109
+ cat > resources/skills/code-reviewer/SKILL.md <<'EOF'
110
+ ---
111
+ name: code-reviewer
112
+ description: "Trigger: code review, review code, check changes. Delegates to code-reviewer agent for code review tasks."
113
+ license: Apache-2.0
114
+ metadata:
115
+ author: AndyTechnologies
116
+ version: "1.0"
117
+ ---
118
+
119
+ # Code Reviewer Skill
120
+
121
+ ## Activation Contract
122
+ Use when user requests code review or changes need review.
123
+
124
+ ## Hard Rules
125
+ - Only delegate via subagent_run to code-reviewer agent
126
+ - Pass specific files/changes to review in task description
127
+
128
+ ## Decision Gates
129
+ | Situation | Action |
130
+ |-----------|--------|
131
+ | User says "review" | Delegate to code-reviewer |
132
+ | General coding task | Do NOT delegate |
133
+
134
+ ## Execution Steps
135
+ 1. Identify files/changes to review
136
+ 2. Call subagent_run with agent=code-reviewer
137
+ 3. Return review results to user
138
+
139
+ ## Output Contract
140
+ - Review findings with severity levels
141
+ - Suggested fixes
142
+
143
+ ## References
144
+ - resources/agents/code-reviewer.md
145
+ - resources/routing/code-reviewer.md
146
+ EOF
147
+ ```
148
+
149
+ 5. **Test locally**
150
+ ```bash
151
+ # In package repo:
152
+ pi -e ./src/extension.ts
153
+ # Test: /gentle-extensions:status should show new agent
154
+ # Test: ask Pi to "review this code" — should invoke agent
155
+ ```
156
+
157
+ 6. **Update tests and version**
158
+ - Add test fixture if new pattern in `tests/`
159
+ - Bump version in `package.json`
160
+ - Publish: `npm publish` or `git tag vX.Y.Z && git push origin vX.Y.Z`
161
+
162
+ ### Procedure B: Add a Bundled Overlay
163
+
164
+ 1. **Identify target**
165
+ - Agent name (e.g., `gentle-ai-worker`) or `orchestrator`
166
+
167
+ 2. **Create overlay file in package resources**
168
+ ```bash
169
+ cat > resources/overlays/gentle-ai-worker.overlay.md <<'EOF'
170
+ ---
171
+ target: gentle-ai-worker
172
+ priority: 100
173
+ mode: append
174
+ ---
175
+
176
+ # Overlay for gentle-ai-worker
177
+
178
+ ## Additional Instructions
179
+
180
+ When writing tests, always use the project's test utilities.
181
+ Prefer table-driven tests over individual test cases.
182
+ EOF
183
+ ```
184
+ - `mode`: `append` (default), `prepend`, or `replace`
185
+
186
+ 3. **Test locally**
187
+ ```bash
188
+ pi -e ./src/extension.ts
189
+ # Invoke target agent, check overlay appears via /gentle-extensions:status
190
+ ```
191
+
192
+ ### Procedure C: Add a Bundled MCP Server
193
+
194
+ 1. **Define the MCP server**
195
+ - Choose unique name (kebab-case, e.g., `github`)
196
+ - Write one-line description
197
+ - Determine transport: `stdio` (command + args) or `http` (URL)
198
+ - Identify required environment variables (use `${VAR}` syntax)
199
+ - Choose tool exposure: `codemode` (default), `direct`, `deferred`, `hidden`
200
+ - List capabilities: `tools`, `resources`
201
+ - Note any agent dependencies
202
+ - Document authentication requirements
203
+
204
+ 2. **Create MCP definition in package resources**
205
+ ```bash
206
+ cat > resources/mcp/github.mcp.json <<'EOF'
207
+ {
208
+ "name": "github",
209
+ "description": "GitHub API access for issues, PRs, repos",
210
+ "transport": "http",
211
+ "url": "https://api.githubcopilot.com/mcp/",
212
+ "env": {
213
+ "GITHUB_TOKEN": "${GITHUB_TOKEN}"
214
+ },
215
+ "exposure": "deferred",
216
+ "toolExposure": {
217
+ "search_code": "direct",
218
+ "get_*": "codemode",
219
+ "delete_*": "hidden"
220
+ },
221
+ "enabled": true,
222
+ "timeout": 60,
223
+ "capabilities": ["tools"],
224
+ "agentDependencies": ["architecture-council"],
225
+ "auth": {
226
+ "type": "bearer",
227
+ "envVar": "GITHUB_TOKEN",
228
+ "description": "GitHub personal access token"
229
+ }
230
+ }
231
+ EOF
232
+ ```
233
+
234
+ 3. **Add MCP dependency to relevant agent routing**
235
+ ```bash
236
+ cat > resources/routing/architecture-council.md <<'EOF'
237
+ ---
238
+ agent: architecture-council
239
+ triggers:
240
+ - "verify architectural contract"
241
+ - "architecture council"
242
+ mcpDependencies:
243
+ - github
244
+ delegation: subagent_run
245
+ ---
246
+ EOF
247
+ ```
248
+
249
+ 4. **Test locally**
250
+ ```bash
251
+ pi -e ./src/extension.ts
252
+ # Run /gentle-extensions:status — MCP listed
253
+ # Run /gentle-extensions:mcp-health — connectivity test
254
+ # Check /mcp in Pi — server connected
255
+ ```
256
+
257
+ ### Procedure D: Add a Bundled Skill
258
+
259
+ 1. **Create skill directory and SKILL.md**
260
+ ```bash
261
+ mkdir -p resources/skills/my-skill
262
+ cat > resources/skills/my-skill/SKILL.md <<'EOF'
263
+ ---
264
+ name: my-skill
265
+ description: "Trigger: my skill trigger. What this skill does."
266
+ license: Apache-2.0
267
+ metadata:
268
+ author: AndyTechnologies
269
+ version: "1.0"
270
+ ---
271
+
272
+ # My Skill
273
+
274
+ ## Activation Contract
275
+ Use when...
276
+
277
+ ## Hard Rules
278
+ - Rule 1
279
+ - Rule 2
280
+
281
+ ## Decision Gates
282
+ | Situation | Action |
283
+ |-----------|--------|
284
+ | X | Do Y |
285
+
286
+ ## Execution Steps
287
+ 1. Step 1
288
+ 2. Step 2
289
+
290
+ ## Output Contract
291
+ - Output 1
292
+ - Output 2
293
+
294
+ ## References
295
+ - resources/skills/my-skill/SKILL.md
296
+ EOF
297
+ ```
298
+
299
+ 2. **Test locally**
300
+ ```bash
301
+ pi -e ./src/extension.ts
302
+ # Run /skill-registry:refresh — skill should appear
303
+ ```
304
+
305
+ ## Output Contract (Package Maintainer)
306
+
307
+ After executing any procedure, the following must be true:
308
+
309
+ | Output | Verification |
310
+ |--------|--------------|
311
+ | Agent file in `resources/agents/` | `ls resources/agents/{name}.md` |
312
+ | Routing file in `resources/routing/` | `ls resources/routing/{name}.md` |
313
+ | Skill dir in `resources/skills/` | `ls resources/skills/{name}/SKILL.md` |
314
+ | Overlay file in `resources/overlays/` | `ls resources/overlays/{target}.overlay.md` |
315
+ | MCP definition in `resources/mcp/` | `ls resources/mcp/{name}.mcp.json` |
316
+ | Local test passes | `pi -e ./src/extension.ts` works |
317
+ | `/gentle-extensions:status` shows new resource | Run in test Pi session |
318
+ | Version bumped in `package.json` | `cat package.json \| grep version` |
319
+ | Tests pass | `node --test tests/` |
320
+ | Published to npm/git | `npm publish` or `git tag` |
321
+
322
+ ## References
323
+
324
+ - **Extension code**: `src/extension.ts`
325
+ - **Package config**: `package.json` (pi.extensions, pi.skills)
326
+ - **Test local**: `pi -e ./src/extension.ts`
327
+ - **Gentle Pi extension API**: `~/.pi/agent/install/releases/1.4.0/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md`
328
+ - **Gentle Pi packages**: `~/.pi/agent/install/releases/1.4.0/node_modules/@earendil-works/pi-coding-agent/docs/packages.md`
329
+ - **Skill style guide**: `~/.pi/agent/install/releases/1.4.0/node_modules/gentle-pi/docs/skill-style-guide.md`