@gotgenes/pi-subagents 9.0.0 → 10.0.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/CHANGELOG.md CHANGED
@@ -5,6 +5,33 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [10.0.0](https://github.com/gotgenes/pi-packages/compare/pi-subagents-v9.0.1...pi-subagents-v10.0.0) (2026-05-27)
9
+
10
+
11
+ ### ⚠ BREAKING CHANGES
12
+
13
+ * The tool name changes from "Agent" to "subagent". Any AGENTS.md files, prompt templates, or custom agent configs that reference the tool by name will need updating.
14
+
15
+ ### Features
16
+
17
+ * rename Agent tool to subagent ([#242](https://github.com/gotgenes/pi-packages/issues/242)) ([8b1c310](https://github.com/gotgenes/pi-packages/commit/8b1c310d8fd2d797b0d116fdaf2d4b28ea5b41ce))
18
+
19
+
20
+ ### Documentation
21
+
22
+ * **pi-subagents:** add Phase 14 Step 4 — rename Agent tool to subagent ([#242](https://github.com/gotgenes/pi-packages/issues/242)) ([2a3cd9f](https://github.com/gotgenes/pi-packages/commit/2a3cd9f25dce042a77d28da1d17a6d8c7870dddf))
23
+ * plan rename Agent tool to subagent ([#242](https://github.com/gotgenes/pi-packages/issues/242)) ([41fe2a4](https://github.com/gotgenes/pi-packages/commit/41fe2a4033a49b39fbbe3938580c6afaeefa9d47))
24
+ * **retro:** add planning stage notes for issue [#242](https://github.com/gotgenes/pi-packages/issues/242) ([6211bed](https://github.com/gotgenes/pi-packages/commit/6211bede3cde8e283b05ed81cc1652e2e370cd9b))
25
+ * **retro:** add TDD stage notes for issue [#242](https://github.com/gotgenes/pi-packages/issues/242) ([7ec9ead](https://github.com/gotgenes/pi-packages/commit/7ec9eadc3544a4c73ce1d3e491cc29da3fddbe16))
26
+ * update tool name references after Agent → subagent rename ([#242](https://github.com/gotgenes/pi-packages/issues/242)) ([0b6774d](https://github.com/gotgenes/pi-packages/commit/0b6774dbe049320bb7919f1f09c6f4c090eb91c5))
27
+
28
+ ## [9.0.1](https://github.com/gotgenes/pi-packages/compare/pi-subagents-v9.0.0...pi-subagents-v9.0.1) (2026-05-27)
29
+
30
+
31
+ ### Documentation
32
+
33
+ * **retro:** add retro notes for issue [#238](https://github.com/gotgenes/pi-packages/issues/238) ([84f2e49](https://github.com/gotgenes/pi-packages/commit/84f2e49c1c7a28e83ca556f377d7e3f970b8a5d2))
34
+
8
35
  ## [9.0.0](https://github.com/gotgenes/pi-packages/compare/pi-subagents-v8.0.0...pi-subagents-v9.0.0) (2026-05-27)
9
36
 
10
37
 
package/README.md CHANGED
@@ -16,7 +16,7 @@ Run them in foreground or background, steer them mid-run, resume completed sessi
16
16
 
17
17
  ## Features
18
18
 
19
- - **Claude Code look & feel** — same tool names, calling conventions, and UI patterns (`Agent`, `get_subagent_result`, `steer_subagent`) — feels native
19
+ - **Claude Code look & feel** — same tool names, calling conventions, and UI patterns (`subagent`, `get_subagent_result`, `steer_subagent`) — feels native
20
20
  - **Parallel background agents** — spawn multiple agents that run concurrently with automatic queuing (configurable concurrency limit, default 4) and individual completion notifications
21
21
  - **Live widget UI** — persistent above-editor widget with animated spinners, live tool activity, token counts, and colored status icons
22
22
  - **Conversation viewer** — select any agent in `/agents` to open a live-scrolling overlay of its full conversation (auto-follows new content, scroll up to pause)
@@ -49,10 +49,10 @@ pi -e ./src/index.ts
49
49
 
50
50
  ## Quick Start
51
51
 
52
- The parent agent spawns sub-agents using the `Agent` tool:
52
+ The parent agent spawns sub-agents using the `subagent` tool:
53
53
 
54
54
  ```text
55
- Agent({
55
+ subagent({
56
56
  subagent_type: "Explore",
57
57
  prompt: "Find all files that handle authentication",
58
58
  description: "Find auth files",
@@ -163,7 +163,7 @@ Report findings with file paths, line numbers, severity, and remediation advice.
163
163
  Then spawn it like any built-in type:
164
164
 
165
165
  ```text
166
- Agent({ subagent_type: "auditor", prompt: "Review the auth module", description: "Security audit" })
166
+ subagent({ subagent_type: "auditor", prompt: "Review the auth module", description: "Security audit" })
167
167
  ```
168
168
 
169
169
  ### Frontmatter Fields
@@ -190,11 +190,11 @@ All fields are optional — sensible defaults for everything.
190
190
 
191
191
  Frontmatter is authoritative.
192
192
  If an agent file sets `model`, `thinking`, `max_turns`, `inherit_context`, `run_in_background`, `isolated`, or `isolation`, those values are locked for that agent.
193
- `Agent` tool parameters only fill fields the agent config leaves unspecified.
193
+ `subagent` tool parameters only fill fields the agent config leaves unspecified.
194
194
 
195
195
  ## Tools
196
196
 
197
- ### `Agent`
197
+ ### `subagent`
198
198
 
199
199
  Launch a sub-agent.
200
200
 
@@ -359,7 +359,7 @@ This prevents unintended tool escalation.
359
359
  Set `isolation: worktree` to run an agent in a temporary git worktree:
360
360
 
361
361
  ```text
362
- Agent({ subagent_type: "refactor", prompt: "...", isolation: "worktree" })
362
+ subagent({ subagent_type: "refactor", prompt: "...", isolation: "worktree" })
363
363
  ```
364
364
 
365
365
  The agent gets a full, isolated copy of the repository.
@@ -368,7 +368,7 @@ On completion:
368
368
  - **No changes:** worktree is cleaned up automatically
369
369
  - **Changes made:** changes are committed to a new branch (`pi-agent-<id>`) and returned in the result
370
370
 
371
- If the worktree cannot be created (not a git repo, no commits, or `git worktree add` fails), the `Agent` tool returns a clear error instead of running unisolated — `isolation: "worktree"` is a strict guarantee, not a hint.
371
+ If the worktree cannot be created (not a git repo, no commits, or `git worktree add` fails), the `subagent` tool returns a clear error instead of running unisolated — `isolation: "worktree"` is a strict guarantee, not a hint.
372
372
  Initialize git and commit at least once, or omit `isolation`.
373
373
 
374
374
  ## Skill Preloading
@@ -69,7 +69,7 @@ flowchart TB
69
69
 
70
70
  subgraph tools["Tools domain"]
71
71
  direction TB
72
- AgentTool["Agent tool\n(dispatch)"]
72
+ AgentTool["subagent tool\n(dispatch)"]
73
73
  ResultRenderer["result-renderer\n(pure rendering)"]
74
74
  SpawnConfig["spawn-config\n(resolve params)"]
75
75
  FgRunner["foreground-runner"]
@@ -200,14 +200,14 @@ Other terminal transitions guard against overwriting `stopped` — once an agent
200
200
  ```mermaid
201
201
  sequenceDiagram
202
202
  participant LLM as Parent LLM
203
- participant Tool as Agent tool
203
+ participant Tool as subagent tool
204
204
  participant Spawn as spawn-config
205
205
  participant Mgr as AgentManager
206
206
  participant Runner as agent-runner
207
207
  participant Asm as assembleSessionConfig
208
208
  participant Child as Child session
209
209
 
210
- LLM->>Tool: Agent(type, prompt, ...)
210
+ LLM->>Tool: subagent(type, prompt, ...)
211
211
  Tool->>Spawn: resolveSpawnConfig(params)
212
212
  Spawn-->>Tool: ResolvedSpawnConfig
213
213
  Tool->>Mgr: spawn(snapshot, type, prompt, config)
@@ -279,7 +279,7 @@ src/
279
279
  │ └── service-adapter.ts SubagentsServiceAdapter class wrapping AgentManager
280
280
 
281
281
  ├── tools/ LLM-facing tool implementations
282
- │ ├── agent-tool.ts Agent tool definition, validation, dispatch
282
+ │ ├── agent-tool.ts subagent tool definition, validation, dispatch
283
283
  │ ├── result-renderer.ts pure per-status result rendering
284
284
  │ ├── spawn-config.ts pure config resolution
285
285
  │ ├── foreground-runner.ts foreground execution loop
@@ -323,7 +323,7 @@ flowchart TD
323
323
  subgraph core["@gotgenes/pi-subagents"]
324
324
  direction TB
325
325
  exports["SubagentsService API<br/>publish / getSubagentsService<br/>SubagentRecord, SubagentStatus"]
326
- engine["Tools: Agent, get_subagent_result,<br/>steer_subagent<br/>AgentManager, agent-runner"]
326
+ engine["Tools: subagent, get_subagent_result,<br/>steer_subagent<br/>AgentManager, agent-runner"]
327
327
  ui_int["Internal UI: widget, viewer,<br/>/agents menu"]
328
328
  end
329
329
 
@@ -337,7 +337,7 @@ They declare this package as an optional peer dependency and use dynamic import
337
337
 
338
338
  ### What the core owns
339
339
 
340
- - The three tools: `Agent`, `get_subagent_result`, `steer_subagent`.
340
+ - The three tools: `subagent` (née `Agent`), `get_subagent_result`, `steer_subagent`.
341
341
  - `AgentManager` — spawn, queue, abort, resume, concurrency control.
342
342
  - `agent-runner` — session creation, turn loop, extension binding.
343
343
  - `permission-bridge` — optional cross-extension bridge to `@gotgenes/pi-permission-system`; registers each child session with `SubagentSessionRegistry` before `bindExtensions()` so the permission system detects in-process children deterministically.
@@ -679,6 +679,7 @@ Removing it simplifies `runAgent`, shrinks `AgentConfig` and `SessionConfig`, an
679
679
  | `extensions: string[]` allowlist is tool filtering disguised as lifecycle control | A: Overlap | 3 | 2 | 9 |
680
680
  | `filterActiveTools` runs twice (pre-bind + post-bind) to catch extension-registered tools | B: Complexity | 3 | 1 | 6 |
681
681
  | `ToolFilterConfig` exists solely to carry filtering state through the runner | C: Accidental | 2 | 1 | 4 |
682
+ | `Agent` tool name is PascalCase — misaligns with Pi's lowercase built-in convention | D: Convention | 2 | 1 | 3 |
682
683
 
683
684
  ### Step 1: Remove `disallowed_tools` — [#237] ✅ Complete
684
685
 
@@ -728,6 +729,24 @@ Inline the `extensions === false` passthrough into the callsite and reduce the f
728
729
  - Smell: B (accidental complexity), C (two-pass filter dance)
729
730
  - Outcome: `filterActiveTools` is a one-liner; `SessionConfig` loses one nested type; the pre-bind/post-bind dance is gone
730
731
 
732
+ ### Step 4: Rename `Agent` tool to `subagent` — [#242] ✅ Complete
733
+
734
+ Rename the `Agent` tool to `subagent` to align with Pi's built-in tool naming convention (all lowercase: `read`, `bash`, `write`, `edit`, `find`, `grep`, `ls`).
735
+ The PascalCase name was inherited from tintinweb/pi-subagents (mimicking Claude Code's convention), but Pi uses lowercase for all built-in tools.
736
+ The companion tools are already lowercase snake_case (`get_subagent_result`, `steer_subagent`), and nicobailon/pi-subagents already uses `subagent`.
737
+
738
+ 1. Rename tool name from `"Agent"` to `"subagent"` in `agent-tool.ts`.
739
+ 2. Update `label` and `promptSnippet` in the tool definition.
740
+ 3. Update `EXCLUDED_TOOL_NAMES` in `agent-runner.ts`.
741
+ 4. Update the fallback display name in `agent-tool.ts`.
742
+ 5. Update architecture docs (tool references, domain diagrams, cross-extension section).
743
+ 6. Update pi-permission-system docs that reference the `Agent` tool name.
744
+ 7. Update tests.
745
+
746
+ - Target: `tools/agent-tool.ts`, `lifecycle/agent-runner.ts`, `docs/`, `../pi-permission-system/docs/`
747
+ - Smell: D (convention mismatch — PascalCase in a lowercase ecosystem)
748
+ - Outcome: all three tools use consistent lowercase naming; aligns with Pi's built-in convention
749
+
731
750
  ### Step dependency diagram
732
751
 
733
752
  ```mermaid
@@ -735,17 +754,19 @@ flowchart LR
735
754
  S1["Step 1\nRemove disallowed_tools"]
736
755
  S2["Step 2\nRemove extensions filtering"]
737
756
  S3["Step 3\nCollapse filterActiveTools"]
757
+ S4["Step 4\nRename Agent to subagent"]
738
758
 
739
759
  S1 --> S3
740
760
  S2 --> S3
741
761
  ```
742
762
 
743
- Steps 1 and 2 are independent and can proceed in parallel.
744
- Step 3 depends on both.
763
+ Steps 1, 2, and 4 are independent and can proceed in parallel.
764
+ Step 3 depends on Steps 1 and 2.
745
765
 
746
766
  [#237]: https://github.com/gotgenes/pi-packages/issues/237
747
767
  [#238]: https://github.com/gotgenes/pi-packages/issues/238
748
768
  [#239]: https://github.com/gotgenes/pi-packages/issues/239
769
+ [#242]: https://github.com/gotgenes/pi-packages/issues/242
749
770
 
750
771
  ## Improvement roadmap (Phase 15 — domain model evolution)
751
772
 
@@ -0,0 +1,165 @@
1
+ ---
2
+ issue: 242
3
+ issue_title: "Rename `Agent` tool to `subagent`"
4
+ ---
5
+
6
+ # Rename `Agent` tool to `subagent`
7
+
8
+ ## Problem Statement
9
+
10
+ The `Agent` tool is the only PascalCase tool name in the Pi ecosystem.
11
+ Pi's built-in tools are all lowercase (`read`, `bash`, `write`, `edit`, `find`, `grep`, `ls`), and the companion tools in this package already use lowercase snake_case (`get_subagent_result`, `steer_subagent`).
12
+ The PascalCase name was inherited from tintinweb/pi-subagents, which mimicked Claude Code's convention rather than Pi's.
13
+
14
+ ## Goals
15
+
16
+ - Rename the tool from `"Agent"` to `"subagent"` — a **breaking change** (`feat!:`).
17
+ - Update `label`, `promptSnippet`, and `description` text to reference `subagent` instead of `Agent`.
18
+ - Update `EXCLUDED_TOOL_NAMES` in `agent-runner.ts`.
19
+ - Update the fallback display name in `agent-tool.ts` `renderCall`.
20
+ - Update architecture docs that reference the `Agent` tool name.
21
+ - Update `README.md` tool-name references.
22
+ - Update all affected tests.
23
+
24
+ ## Non-Goals
25
+
26
+ - Renaming the `displayName` of the general-purpose agent type (`"Agent"` in `default-agents.ts` and `agent-types.ts` fallback) — that is a UI display name for the agent *type*, not the tool name.
27
+ The widget shows "Agent" as the display name for general-purpose agents; this is a separate concern.
28
+ - Renaming the companion tools `get_subagent_result` and `steer_subagent` — they already follow the lowercase convention.
29
+ - Updating the companion tools' `label` fields (`"Steer Agent"`, `"Get Agent Result"`) — these use "Agent" in the human-readable sense, not as the tool name.
30
+ - Collapsing `filterActiveTools` (#239) — that step is independent within Phase 14.
31
+ - Updating pi-permission-system docs — verified that no docs there reference the `Agent` tool name specifically.
32
+ All "Agent" references in that package's docs refer to the agent-name concept (per-agent overrides, agent frontmatter), not the tool.
33
+
34
+ ## Background
35
+
36
+ Phase 14 of the architecture roadmap strips policy enforcement from pi-subagents.
37
+ Steps 1 and 2 (#237, #238) are complete; Step 3 (#239, collapse `filterActiveTools`) is open but independent of this rename.
38
+ This is Step 4 — the final convention-alignment step in Phase 14.
39
+
40
+ ### Files affected
41
+
42
+ | File | Current `"Agent"` references |
43
+ | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
44
+ | `src/tools/agent-tool.ts` | `name`, `label`, `promptSnippet`, description text, `renderCall` fallback (line 247) |
45
+ | `src/lifecycle/agent-runner.ts` | `EXCLUDED_TOOL_NAMES` array (line 22) |
46
+ | `README.md` | Tool name references, usage examples, tool parameter table heading |
47
+ | `docs/architecture/architecture.md` | Directory listing comment, findings table, Step 4 description |
48
+ | `test/tools/agent-tool.test.ts` | `name` and `label` assertions |
49
+ | `test/lifecycle/agent-runner-extension-tools.test.ts` | `"Agent"` in active-tools arrays and `not.toContain` assertion |
50
+ | `test/print-mode.test.ts` | `tools.get("Agent")` lookup |
51
+ | `test/widget-renderer.test.ts` | `"Agent"` in display-name comment and assertion |
52
+ | `test/tools/spawn-config.test.ts` | `displayName: "Agent"` assertions (general-purpose type display name — **no change**, these test the agent type's displayName, not the tool name) |
53
+ | `test/tools/foreground-runner.test.ts` | `displayName: "Agent"` in fixture data (**no change** — tests general-purpose type displayName) |
54
+ | `test/tools/helpers.test.ts` | `displayName: "Agent"` in fixture data (**no change** — tests result rendering, not tool name) |
55
+ | `test/display.test.ts` | `"Agent"` display name assertion (**no change** — tests `getDisplayName` for general-purpose type) |
56
+
57
+ ## Design Overview
58
+
59
+ This is a straightforward string-replacement change with no logic or type changes.
60
+ The tool's `name` field drives Pi's tool registration, system-prompt toolbox, and LLM invocations.
61
+
62
+ ### Tool definition changes
63
+
64
+ ```typescript
65
+ // Before
66
+ name: "Agent" as const,
67
+ label: "Agent",
68
+ promptSnippet: "Agent: Launch a specialized agent for complex, multi-step tasks.",
69
+
70
+ // After
71
+ name: "subagent" as const,
72
+ label: "Subagent",
73
+ promptSnippet: "subagent: Launch a specialized agent for complex, multi-step tasks.",
74
+ ```
75
+
76
+ The description body changes `"The Agent tool launches"` → `"The subagent tool launches"` and `"Agent results are returned"` → `"Subagent results are returned"`.
77
+
78
+ ### renderCall fallback
79
+
80
+ ```typescript
81
+ // Before
82
+ : "Agent";
83
+ // After
84
+ : "Subagent";
85
+ ```
86
+
87
+ This fallback shows when no `subagent_type` is provided.
88
+ Using `"Subagent"` (capitalized for display) is appropriate — it mirrors the tool's identity without conflating with the general-purpose agent type's `displayName`.
89
+
90
+ ### EXCLUDED_TOOL_NAMES
91
+
92
+ ```typescript
93
+ // Before
94
+ const EXCLUDED_TOOL_NAMES = ["Agent", "get_subagent_result", "steer_subagent"];
95
+ // After
96
+ const EXCLUDED_TOOL_NAMES = ["subagent", "get_subagent_result", "steer_subagent"];
97
+ ```
98
+
99
+ ## Module-Level Changes
100
+
101
+ ### `src/tools/agent-tool.ts`
102
+
103
+ 1. Change `name: "Agent" as const` → `name: "subagent" as const`.
104
+ 2. Change `label: "Agent"` → `label: "Subagent"`.
105
+ 3. Change `promptSnippet` to start with `subagent:` instead of `Agent:`.
106
+ 4. Change `"The Agent tool launches"` → `"The subagent tool launches"` in description.
107
+ 5. Change `"Agent results are returned"` → `"Subagent results are returned"` in description guidelines.
108
+ 6. Change fallback `"Agent"` → `"Subagent"` in `renderCall`.
109
+
110
+ ### `src/lifecycle/agent-runner.ts`
111
+
112
+ 1. Change `"Agent"` → `"subagent"` in `EXCLUDED_TOOL_NAMES`.
113
+
114
+ ### `README.md`
115
+
116
+ 1. Update tool name references in the "features" bullet (`` `Agent` `` → `` `subagent` ``).
117
+ 2. Update usage example heading and code block (`Agent({` → `subagent({`).
118
+ 3. Update tool parameter table heading (`### \`Agent\`` → `### \`subagent\``).
119
+ 4. Update prose references to the `Agent` tool ("`Agent` tool parameters", "`Agent` tool returns").
120
+ 5. Update widget example display — the widget shows `Agent` because the general-purpose type's `displayName` is `"Agent"`, so those lines stay as-is.
121
+
122
+ ### `docs/architecture/architecture.md`
123
+
124
+ 1. Update the directory listing comment: `agent-tool.ts` description → `subagent tool definition`.
125
+ 2. Update the findings table row to mark the item as resolved.
126
+ 3. Update Step 4 description to indicate completion.
127
+ 4. The `(née \`Agent\`)` parenthetical in the "What the core owns" section already anticipates the rename — keep it as-is for historical context.
128
+
129
+ ### Test files
130
+
131
+ 1. `test/tools/agent-tool.test.ts` — update `name` and `label` assertions.
132
+ 2. `test/lifecycle/agent-runner-extension-tools.test.ts` — update `"Agent"` in active-tools arrays and `.not.toContain("Agent")` → `.not.toContain("subagent")`.
133
+ 3. `test/print-mode.test.ts` — update `tools.get("Agent")` → `tools.get("subagent")`.
134
+ 4. `test/widget-renderer.test.ts` — update the comment text (the assertion tests general-purpose displayName, which stays `"Agent"`).
135
+
136
+ ## Test Impact Analysis
137
+
138
+ 1. No new tests are needed — this is a string-value change.
139
+ 2. Existing tests that assert the tool name `"Agent"` must be updated to assert `"subagent"`.
140
+ 3. Tests that assert the general-purpose agent type's `displayName` (`"Agent"`) are **not affected** — the `displayName` is an agent-type property, not the tool name.
141
+
142
+ ## TDD Order
143
+
144
+ 1. **Update tool definition and runner constant.**
145
+ Change `name`, `label`, `promptSnippet`, description text, and `renderCall` fallback in `agent-tool.ts`.
146
+ Change `EXCLUDED_TOOL_NAMES` in `agent-runner.ts`.
147
+ Update affected tests in `agent-tool.test.ts`, `agent-runner-extension-tools.test.ts`, `print-mode.test.ts`, and `widget-renderer.test.ts`.
148
+ Commit: `feat!: rename Agent tool to subagent (#242)`
149
+
150
+ 2. **Update documentation.**
151
+ Update `README.md` tool-name references and usage examples.
152
+ Update `docs/architecture/architecture.md` directory listing, findings table, and Step 4 status.
153
+ Commit: `docs: update tool name references after Agent → subagent rename (#242)`
154
+
155
+ ## Risks and Mitigations
156
+
157
+ | Risk | Mitigation |
158
+ | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
159
+ | Breaking change for users referencing `Agent` in AGENTS.md, prompt templates, or custom configs | This is intentional and documented in the issue. Fits within the Phase 14 breaking-change window. Use `feat!:` commit prefix. |
160
+ | Forgetting a test reference to `"Agent"` | Grep all test files for `"Agent"` before committing. Distinguish tool-name references from agent-type displayName references. |
161
+ | Companion tool labels (`"Steer Agent"`, `"Get Agent Result"`) use "Agent" | These use "Agent" in the human-readable sense. They are not affected by the tool-name rename and remain consistent. |
162
+
163
+ ## Open Questions
164
+
165
+ None — the issue scope is unambiguous.
@@ -37,3 +37,36 @@ Full suite: 62 files, 977 tests, all passing; type check and lint clean.
37
37
  - **ESLint auto-fix in step 2**: ESLint rewrote `extensions === false` to `!extensions` and `cfg.toolFilter.extensions === false` to `!cfg.toolFilter.extensions` after the type narrowed to `boolean`.
38
38
  Both are semantically identical; the changes were staged and included in the same commit.
39
39
  - The `resolveBoolExtensions` helper in `custom-agents.ts` is a clean seam — if `skills` is ever also simplified to `boolean`, the same pattern applies.
40
+
41
+ ## Stage: Final Retrospective (2026-05-27T01:48:04Z)
42
+
43
+ ### Session summary
44
+
45
+ All three stages (planning, TDD, shipping) completed in a single continuous session.
46
+ Six implementation commits landed as `pi-subagents-v9.0.0` (major bump from `feat!:`).
47
+ Issue #238 closed; unblocks #239 (collapse `filterActiveTools`).
48
+
49
+ ### Observations
50
+
51
+ #### What went well
52
+
53
+ - The plan’s structure closely followed the successful #237 pattern, making execution predictable.
54
+ - The implementer caught the type-narrowing cascade on the first `pnpm run check` and adapted immediately — no user intervention needed.
55
+ - The `resolveBoolExtensions` helper extraction was a clean design choice that keeps `inheritField` reusable for `skills`.
56
+ - ESLint auto-fix of `=== false` → `!` after the type narrowed to `boolean` was handled smoothly within the same commit.
57
+
58
+ #### What caused friction (agent side)
59
+
60
+ - `instruction-violation` (self-identified) — The planner did not apply the testing skill’s existing rule: “When a TDD plan lists separate steps that share a type definition, changing that type in step N breaks steps N+1…N+k.”
61
+ The plan assigned test-fixture fixes (removing `extensions: string[]` values) to steps 2–4, but the type change in step 1 broke them all immediately.
62
+ Impact: no rework — the implementer folded fixes into step 1 — but the plan’s step boundaries were misleading.
63
+ - `missing-context` — The plan recommended `debugLog` for the deprecation warning without checking its function signature (`(context: string, err: unknown)`) or its debug-only behavior.
64
+ Impact: minor — switched to `console.warn` during implementation with no rework, but the plan was wrong.
65
+
66
+ #### What caused friction (user side)
67
+
68
+ - Nothing notable — no user corrections were needed across all three stages.
69
+
70
+ ### Changes made
71
+
72
+ 1. `.pi/skills/testing/SKILL.md` — Added type-narrowing-specific TDD planning rule: when a step narrows a union type, grep test files for fixtures using the removed variant and fold those fixes into the same step.
@@ -0,0 +1,37 @@
1
+ ---
2
+ issue: 242
3
+ issue_title: "Rename `Agent` tool to `subagent`"
4
+ ---
5
+
6
+ # Retro: #242 — Rename `Agent` tool to `subagent`
7
+
8
+ ## Stage: Planning (2026-05-27T13:45:29Z)
9
+
10
+ ### Session summary
11
+
12
+ Produced a plan for renaming the `Agent` tool to `subagent` across pi-subagents source, tests, README, and architecture docs.
13
+ Verified that pi-permission-system docs do not reference the `Agent` tool name and require no changes.
14
+ Scoped the plan to two commits: one `feat!:` for source + tests, one `docs:` for documentation.
15
+
16
+ ### Observations
17
+
18
+ - The general-purpose agent type's `displayName` (`"Agent"` in `default-agents.ts` and `agent-types.ts` fallback) is a separate concept from the tool name and stays unchanged.
19
+ Several test files assert this `displayName` — they are not affected by the rename.
20
+ - Issue #239 (Step 3, collapse `filterActiveTools`) is still open but independent — #242 only changes the string value in `EXCLUDED_TOOL_NAMES`, not its structure.
21
+ - The architecture doc already contains `(née \`Agent\`)` in the "What the core owns" section, anticipating the rename.
22
+ - The `widget-renderer.test.ts` comment references `"Agent"` as the general-purpose display name, not the tool name — only the comment text needs updating for clarity.
23
+
24
+ ## Stage: Implementation — TDD (2026-05-27T13:55:33Z)
25
+
26
+ ### Session summary
27
+
28
+ Completed 2 TDD cycles: one `feat!:` commit renaming the tool in source + tests, one `docs:` commit updating `README.md` and `docs/architecture/architecture.md`.
29
+ Baseline was 977 tests; test count unchanged at 977 after the changes.
30
+ Pre-completion reviewer returned **PASS**.
31
+
32
+ ### Observations
33
+
34
+ - All changes were pure string-literal replacements in 2 source files, 4 test files, `README.md`, and the architecture doc — no logic, type, or structural changes.
35
+ - The general-purpose agent type's `displayName: "Agent"` in `default-agents.ts` and `agent-types.ts` fallback was correctly left unchanged; `display.test.ts` still passes with `"Agent"`.
36
+ - The description body inside the `agent-tool.ts` template literal needed separate edits because the guideline lines are not tab-indented (inside a backtick template literal, tab indentation does not apply).
37
+ - Pre-completion reviewer: PASS — all deterministic checks, conventional commits, documentation, code design, tests, Mermaid diagrams, and dead-code gate all passed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gotgenes/pi-subagents",
3
- "version": "9.0.0",
3
+ "version": "10.0.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/service.ts"
@@ -19,7 +19,7 @@ import { type AssemblerIO, assembleSessionConfig, type ToolFilterConfig } from "
19
19
  import type { ShellExec, SubagentType, ThinkingLevel } from "#src/types";
20
20
 
21
21
  /** Names of tools registered by this extension that subagents must NOT inherit. */
22
- const EXCLUDED_TOOL_NAMES = ["Agent", "get_subagent_result", "steer_subagent"];
22
+ const EXCLUDED_TOOL_NAMES = ["subagent", "get_subagent_result", "steer_subagent"];
23
23
 
24
24
  /**
25
25
  * Filter the session's active tool names according to extension rules.
@@ -156,12 +156,12 @@ export class AgentTool {
156
156
  const registry = this.registry;
157
157
 
158
158
  return defineTool({
159
- name: "Agent" as const,
160
- label: "Agent",
161
- promptSnippet: "Agent: Launch a specialized agent for complex, multi-step tasks.",
159
+ name: "subagent" as const,
160
+ label: "Subagent",
161
+ promptSnippet: "subagent: Launch a specialized agent for complex, multi-step tasks.",
162
162
  description: `Launch a new agent to handle complex, multi-step tasks autonomously.
163
163
 
164
- The Agent tool launches specialized agents that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.
164
+ The subagent tool launches specialized agents that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.
165
165
 
166
166
  Available agent types:
167
167
  ${typeListText}
@@ -172,7 +172,7 @@ Guidelines:
172
172
  - Use Plan for architecture and implementation planning.
173
173
  - Use general-purpose for complex tasks that need file editing.
174
174
  - Provide clear, detailed prompts so the agent can work autonomously.
175
- - Agent results are returned as text — summarize them for the user.
175
+ - Subagent results are returned as text — summarize them for the user.
176
176
  - Use run_in_background for work you don't need immediately. You will be notified when it completes.
177
177
  - Use resume with an agent ID to continue a previous agent's work.
178
178
  - Use steer_subagent to send mid-run messages to a running background agent.
@@ -244,7 +244,7 @@ Guidelines:
244
244
  renderCall(args: Record<string, unknown>, theme: any) {
245
245
  const displayName = args.subagent_type
246
246
  ? getDisplayName(args.subagent_type as string, registry)
247
- : "Agent";
247
+ : "Subagent";
248
248
  const desc = (args.description as string | undefined) ?? "";
249
249
  return new Text(
250
250
  "▸ " +