@gotgenes/pi-subagents 17.5.0 → 18.0.1
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 +20 -0
- package/README.md +22 -31
- package/docs/architecture/architecture.md +24 -19
- package/docs/decisions/0004-reconsider-ui-direction.md +17 -0
- package/docs/plans/0441-remove-agent-definition-management-subtree.md +180 -0
- package/docs/plans/0442-dissolve-agents-conversation-viewer.md +195 -0
- package/docs/plans/0443-consolidate-remaining-test-clone-families.md +268 -0
- package/docs/plans/0470-refresh-readme-command-surface.md +159 -0
- package/docs/retro/0441-remove-agent-definition-management-subtree.md +97 -0
- package/docs/retro/0442-dissolve-agents-conversation-viewer.md +108 -0
- package/docs/retro/0443-consolidate-remaining-test-clone-families.md +28 -0
- package/docs/retro/0463-file-snapshot-source-evicted-agents.md +54 -0
- package/docs/retro/0470-refresh-readme-command-surface.md +40 -0
- package/package.json +1 -1
- package/src/index.ts +4 -31
- package/src/ui/session-navigation.ts +1 -1
- package/src/ui/session-navigator.ts +3 -3
- package/src/ui/subagents-settings.ts +2 -2
- package/src/ui/agent-config-editor.ts +0 -199
- package/src/ui/agent-creation-wizard.ts +0 -233
- package/src/ui/agent-file-ops.ts +0 -59
- package/src/ui/agent-file-writer.ts +0 -55
- package/src/ui/agent-menu.ts +0 -331
- package/src/ui/conversation-viewer.ts +0 -241
- package/src/ui/message-formatters.ts +0 -195
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ 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
|
+
## [18.0.1](https://github.com/gotgenes/pi-packages/compare/pi-subagents-v18.0.0...pi-subagents-v18.0.1) (2026-06-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Documentation
|
|
12
|
+
|
|
13
|
+
* **pi-subagents:** refresh README for /subagents:settings and /subagents:sessions ([#470](https://github.com/gotgenes/pi-packages/issues/470)) ([945341f](https://github.com/gotgenes/pi-packages/commit/945341fc5527a2e9371d261e0eb1340d09b72f31))
|
|
14
|
+
|
|
15
|
+
## [18.0.0](https://github.com/gotgenes/pi-packages/compare/pi-subagents-v17.5.0...pi-subagents-v18.0.0) (2026-06-23)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### ⚠ BREAKING CHANGES
|
|
19
|
+
|
|
20
|
+
* **pi-subagents:** The /agents command is removed. Its responsibilities are now served by: /subagents:settings (configure concurrency and turn limits), /subagents:sessions (read-only session transcript viewing), and the always-on background widget (running-agent visibility).
|
|
21
|
+
* **pi-subagents:** the /subagents-settings and /subagent-sessions commands are renamed to /subagents:settings and /subagents:sessions.
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* **pi-subagents:** dissolve /agents and remove the conversation-viewer subtree ([cb813f2](https://github.com/gotgenes/pi-packages/commit/cb813f2c5fac7c0b5fa62eecf7f0665671382c1c))
|
|
26
|
+
* **pi-subagents:** namespace commands under subagents: ([23bf99e](https://github.com/gotgenes/pi-packages/commit/23bf99e8662a2b89b2816a14e5f2801fd6c74159))
|
|
27
|
+
|
|
8
28
|
## [17.5.0](https://github.com/gotgenes/pi-packages/compare/pi-subagents-v17.4.0...pi-subagents-v17.5.0) (2026-06-23)
|
|
9
29
|
|
|
10
30
|
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Run them in foreground or background, steer them mid-run, resume completed sessi
|
|
|
18
18
|
- **In-process & native** — agents run inside the same pi runtime (no spawned subprocesses), sharing tool names, calling conventions, and UI patterns (`subagent`, `get_subagent_result`, `steer_subagent`) — feels native
|
|
19
19
|
- **Parallel background agents** — spawn multiple agents that run concurrently with automatic queuing (configurable concurrency limit, default 4) and individual completion notifications
|
|
20
20
|
- **Live widget UI** — persistent above-editor widget with animated spinners, live tool activity, token counts, and colored status icons
|
|
21
|
-
- **
|
|
21
|
+
- **Session transcripts** — open any subagent's full session transcript (running or evicted) in pi's native read-only viewer via `/subagents:sessions`
|
|
22
22
|
- **Custom agent types** — define agents in `.pi/agents/<name>.md` with YAML frontmatter: custom system prompts, model selection, thinking levels, tool restrictions
|
|
23
23
|
- **Mid-run steering** — inject messages into running agents to redirect their work without restarting
|
|
24
24
|
- **Session resume** — pick up where an agent left off, preserving full conversation context
|
|
@@ -116,7 +116,7 @@ The LLM receives structured `<task-notification>` XML for parsing, while the use
|
|
|
116
116
|
The `general-purpose` agent is a **parent twin** — it receives the parent's entire system prompt plus a sub-agent context bridge, so it follows the same rules the parent does.
|
|
117
117
|
Explore and Plan use `replace` mode: the parent prompt is the cacheable base and their specialist read-only instructions are appended last, giving them the final say.
|
|
118
118
|
|
|
119
|
-
Default agents can be **
|
|
119
|
+
Default agents can be **overridden** by creating a `.md` file with the same name (e.g. `.pi/agents/general-purpose.md`), or **disabled** per-project with `enabled: false` frontmatter.
|
|
120
120
|
|
|
121
121
|
## Custom Agents
|
|
122
122
|
|
|
@@ -223,31 +223,22 @@ The message interrupts after the current tool execution.
|
|
|
223
223
|
|
|
224
224
|
## Commands
|
|
225
225
|
|
|
226
|
-
| Command
|
|
227
|
-
|
|
|
228
|
-
| `/
|
|
226
|
+
| Command | Description |
|
|
227
|
+
| --------------------- | ------------------------------------------------------ |
|
|
228
|
+
| `/subagents:settings` | Configure subagent settings (concurrency, turn limits) |
|
|
229
|
+
| `/subagents:sessions` | View a subagent's session transcript (read-only) |
|
|
229
230
|
|
|
230
|
-
|
|
231
|
+
### `/subagents:settings`
|
|
231
232
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
Interactive list to tune runtime settings — max concurrency, default max turns, and grace turns.
|
|
234
|
+
Changes persist across pi restarts (see [Persistent Settings](#persistent-settings)).
|
|
235
|
+
|
|
236
|
+
### `/subagents:sessions`
|
|
237
|
+
|
|
238
|
+
Pick any subagent — running or already evicted — and read its full session transcript in pi's native per-entry viewer.
|
|
239
|
+
Read-only: no steering, no session takeover (steering lives in the `steer_subagent` tool and the background widget).
|
|
238
240
|
|
|
239
|
-
|
|
240
|
-
Select an agent to manage it:
|
|
241
|
-
- **Default agents** (no override): Eject (export as `.md`), Disable
|
|
242
|
-
- **Default agents** (ejected/overridden): Edit, Disable, Reset to default, Delete
|
|
243
|
-
- **Custom agents**: Edit, Disable, Delete
|
|
244
|
-
- **Disabled agents**: Enable, Edit, Delete
|
|
245
|
-
- **Eject** — writes the embedded default config as a `.md` file to project or personal location, so you can customize it
|
|
246
|
-
- **Disable/Enable** — toggle agent availability.
|
|
247
|
-
Disabled agents stay visible in the list (marked `✕`) and can be re-enabled
|
|
248
|
-
- **Create new agent** — choose project/personal location, then manual wizard (step-by-step prompts for name, tools, model, thinking, system prompt) or AI-generated (describe what the agent should do and a sub-agent writes the `.md` file).
|
|
249
|
-
Any name is allowed, including default agent names (overrides them)
|
|
250
|
-
- **Settings** — configure max concurrency, default max turns, and grace turns at runtime
|
|
241
|
+
Creating and editing agent definitions is not a command — write an agent `.md` file in your editor, or ask a pi session to generate one (see [Custom Agents](#custom-agents)).
|
|
251
242
|
|
|
252
243
|
## Graceful Max Turns
|
|
253
244
|
|
|
@@ -274,13 +265,13 @@ Foreground agents bypass the queue — they block the parent anyway.
|
|
|
274
265
|
|
|
275
266
|
## Persistent Settings
|
|
276
267
|
|
|
277
|
-
Runtime tuning values set via `/
|
|
268
|
+
Runtime tuning values set via `/subagents:settings` (max concurrency, default max turns, grace turns) persist across pi restarts.
|
|
278
269
|
Two files, merged on load:
|
|
279
270
|
|
|
280
271
|
- **Global:** `~/.pi/agent/subagents.json` — your machine-wide defaults.
|
|
281
|
-
Edit by hand; the `/
|
|
272
|
+
Edit by hand; the `/subagents:settings` command never writes here.
|
|
282
273
|
- **Project:** `<cwd>/.pi/subagents.json` — per-project overrides.
|
|
283
|
-
Written by `/
|
|
274
|
+
Written by `/subagents:settings`.
|
|
284
275
|
|
|
285
276
|
**Precedence:** project overrides global on any field present in both.
|
|
286
277
|
Missing fields fall back to the hardcoded defaults (max concurrency `4`, default max turns unlimited, grace turns `5`).
|
|
@@ -297,10 +288,10 @@ cat > ~/.pi/agent/subagents.json <<'EOF'
|
|
|
297
288
|
EOF
|
|
298
289
|
```
|
|
299
290
|
|
|
300
|
-
Every project now starts with concurrency 16 and grace 10, without ever touching the
|
|
301
|
-
Individual projects can still override via `/
|
|
291
|
+
Every project now starts with concurrency 16 and grace 10, without ever touching the command.
|
|
292
|
+
Individual projects can still override via `/subagents:settings`.
|
|
302
293
|
|
|
303
|
-
**Failure behavior:** missing file is silent; malformed JSON logs a `[pi-subagents] Ignoring malformed settings at …` warning to stderr; invalid/out-of-range field values are dropped per-field; write failures downgrade the `/
|
|
294
|
+
**Failure behavior:** missing file is silent; malformed JSON logs a `[pi-subagents] Ignoring malformed settings at …` warning to stderr; invalid/out-of-range field values are dropped per-field; write failures downgrade the `/subagents:settings` toast to a warning with `(session only; failed to persist)`.
|
|
304
295
|
|
|
305
296
|
## Events
|
|
306
297
|
|
|
@@ -315,7 +306,7 @@ Agent lifecycle events are emitted via `pi.events.emit()` so other extensions ca
|
|
|
315
306
|
| `subagents:steered` | Steering message sent | `id`, `message` |
|
|
316
307
|
| `subagents:compacted` | Agent's session successfully compacted | `id`, `type`, `description`, `reason` (`"manual"` / `"threshold"` / `"overflow"`), `tokensBefore`, `compactionCount` |
|
|
317
308
|
| `subagents:settings_loaded` | Persisted settings applied at extension init | `settings` (merged global + project) |
|
|
318
|
-
| `subagents:settings_changed` | `/
|
|
309
|
+
| `subagents:settings_changed` | `/subagents:settings` mutation was applied | `settings`, `persisted` (`boolean` — `false` on write failure) |
|
|
319
310
|
|
|
320
311
|
`tokens.total` = `input + output + cacheWrite`.
|
|
321
312
|
`cacheRead` is excluded — each turn's `cacheRead` is the cumulative cached prefix re-read on that one API call, so summing per-message would over-count it.
|
|
@@ -81,8 +81,8 @@ flowchart TB
|
|
|
81
81
|
subgraph ui["UI domain"]
|
|
82
82
|
direction TB
|
|
83
83
|
Widget["agent-widget<br/>(live status)"]
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
Sessions["session-navigator<br/>(session view)"]
|
|
85
|
+
Settings["subagents-settings<br/>(settings command)"]
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
AgentTool --> SubagentManager
|
|
@@ -341,14 +341,10 @@ src/
|
|
|
341
341
|
├── ui/ user-facing presentation
|
|
342
342
|
│ ├── agent-widget.ts above-editor live status widget
|
|
343
343
|
│ ├── widget-renderer.ts pure rendering for widget
|
|
344
|
-
│ ├──
|
|
345
|
-
│ ├──
|
|
346
|
-
│ ├──
|
|
347
|
-
│
|
|
348
|
-
│ ├── message-formatters.ts pure per-message-type formatters (extracted from conversation-viewer)
|
|
349
|
-
│ ├── agent-file-ops.ts filesystem abstraction
|
|
350
|
-
│ ├── agent-file-writer.ts overwrite-guard + write + reload + notify helper
|
|
351
|
-
│ └── display.ts pure formatters and shared types
|
|
344
|
+
│ ├── display.ts pure formatters and shared types
|
|
345
|
+
│ ├── subagents-settings.ts /subagents:settings command handler
|
|
346
|
+
│ ├── session-navigation.ts pure session-selection and transcript-source logic
|
|
347
|
+
│ └── session-navigator.ts /subagents:sessions command handler
|
|
352
348
|
│
|
|
353
349
|
└── handlers/ event handlers
|
|
354
350
|
├── index.ts barrel re-export
|
|
@@ -363,7 +359,7 @@ Record statistics (tool uses, token usage, compaction counts) and live activity
|
|
|
363
359
|
This is the single per-child session subscription — all run state lives on the `Subagent` record.
|
|
364
360
|
|
|
365
361
|
The widget reads agent state by polling the records exposed via `SubagentManager.listAgents()` every 80 ms; that poll loop is now started by the manager's lifecycle notifications (the widget subscribes as a `SubagentManagerObserver` fanned out through `CompositeSubagentObserver`), not by inbound calls from the spawn tools.
|
|
366
|
-
The
|
|
362
|
+
The `/subagents:sessions` navigator reads messages via `Subagent.agentMessages` and subscribes to updates via `Subagent.subscribeToUpdates()` — no direct `AgentSession` reference (#277).
|
|
367
363
|
|
|
368
364
|
## Cross-extension architecture
|
|
369
365
|
|
|
@@ -373,7 +369,7 @@ flowchart TD
|
|
|
373
369
|
direction TB
|
|
374
370
|
exports["SubagentsService API<br/>publish / getSubagentsService<br/>SubagentRecord, SubagentStatus"]
|
|
375
371
|
engine["Tools: subagent, get_subagent_result,<br/>steer_subagent<br/>SubagentManager, createSubagentSession, SubagentSession"]
|
|
376
|
-
ui_int["Internal UI: widget,
|
|
372
|
+
ui_int["Internal UI: widget, session-navigator,<br/>subagents-settings"]
|
|
377
373
|
end
|
|
378
374
|
|
|
379
375
|
core -- "Symbol.for on globalThis" --> sched["scheduling extension<br/>(hypothetical)"]
|
|
@@ -406,7 +402,7 @@ They declare this package as an optional peer dependency and use dynamic import
|
|
|
406
402
|
- Token usage tracking.
|
|
407
403
|
- Session directory derivation and persisted `SessionManager` for subagent transcripts.
|
|
408
404
|
- Settings persistence.
|
|
409
|
-
- Internal UI (widget,
|
|
405
|
+
- Internal UI (widget, `/subagents:sessions` session navigator, `/subagents:settings` command) — the conversation viewer and `/agents` menu were removed in Phase 19 (Steps 5–6, [#442], [#441]) per [ADR-0004].
|
|
410
406
|
|
|
411
407
|
### What the core dropped
|
|
412
408
|
|
|
@@ -560,7 +556,7 @@ In the target state, pi-subagents publishes events and a provider seam; other pa
|
|
|
560
556
|
|
|
561
557
|
- **pi-permission-system** (observational) subscribes to child-session lifecycle events, detects subagent execution context in the child, and gates tool calls at runtime.
|
|
562
558
|
- **pi-subagents-worktrees** (generative) registers a `WorkspaceProvider` that prepares a git worktree at run-start and tears it down after, supplying the child's cwd.
|
|
563
|
-
- **pi-subagents-ui** (future, under reconsideration — see the [first-principles refinement](#first-principles-refinement-and-the-deeper-target)) subscribes to the broadcast and the query/behavior interfaces;
|
|
559
|
+
- **pi-subagents-ui** (future, under reconsideration — see the [first-principles refinement](#first-principles-refinement-and-the-deeper-target)) subscribes to the broadcast and the query/behavior interfaces; the conversation viewer and `/agents` menu were removed in Phase 19 per [ADR-0004]; the surviving UI (widget, session navigator, settings command) stays in-core.
|
|
564
560
|
- **Any future extension** (OTel, auditing, cost tracking) subscribes to the same events without pi-subagents knowing.
|
|
565
561
|
|
|
566
562
|
Composition test: install neither extension, only permissions, only workspaces, or both — the core is byte-for-byte identical in all four cases, and the two extensions never reference each other.
|
|
@@ -1055,7 +1051,7 @@ Coverage is in-session evictions (the sweep's only targets); old-session orphan
|
|
|
1055
1051
|
|
|
1056
1052
|
`Release: independent`
|
|
1057
1053
|
|
|
1058
|
-
### Step 5 — Dissolve `/agents` and remove the conversation-viewer subtree ([#442])
|
|
1054
|
+
### ✅ Step 5 — Dissolve `/agents` and remove the conversation-viewer subtree ([#442])
|
|
1059
1055
|
|
|
1060
1056
|
Smell: Category A (dead subsystem) plus Category B (oversized) — once Steps 2–4 re-home all four menu responsibilities, the `/agents` command and everything reachable only from `agent-menu.ts` is an unreferenced subtree.
|
|
1061
1057
|
This is the first of two deletion commits (split by subtree).
|
|
@@ -1070,11 +1066,16 @@ Target files:
|
|
|
1070
1066
|
Running-agent visibility is now owned by the background widget (Step 3); session navigation replaces the bespoke overlay (Step 4); settings live in `/subagents-settings` (Step 2).
|
|
1071
1067
|
Deleting the hub in one move avoids any surgical edit to the doomed file and leaves the definition-management leaves orphaned for Step 6.
|
|
1072
1068
|
|
|
1073
|
-
|
|
1069
|
+
Actual approach (vs. original plan): a tidy-first preparatory commit first extracted `MenuUI` from `agent-menu.ts` into a new `src/ui/menu-ui.ts` module, breaking the bidirectional type cycle — the hub imported the wizard/editor classes while the leaves imported back the `MenuUI` type.
|
|
1070
|
+
Without the prep commit, deleting either subtree first would have left the other half referencing a deleted module.
|
|
1071
|
+
`index.ts` also shed the now-dead `join` (node:path) and `buildParentSnapshot` imports in addition to the two module imports.
|
|
1072
|
+
The `menu-ui.ts` module is transient and is removed with the wizard/editor in Step 6.
|
|
1073
|
+
|
|
1074
|
+
Outcome: ✅ `/agents` dissolved; −767 LOC source (menu hub + viewer + formatters); −812 LOC test; largest test function eliminated; `index.ts` dewired.
|
|
1074
1075
|
|
|
1075
1076
|
`Release: batch "dissolve-agents"`
|
|
1076
1077
|
|
|
1077
|
-
### Step 6 — Remove the orphaned agent-definition management subtree ([#441])
|
|
1078
|
+
### ✅ Step 6 — Remove the orphaned agent-definition management subtree ([#441])
|
|
1078
1079
|
|
|
1079
1080
|
Smell: Category A (dead subsystem) — the creation wizard and config editor are removed per ADR-0004 Decision C; after Step 5 deletes their only importer (`agent-menu.ts`), they and their file-ops helpers are pure orphans.
|
|
1080
1081
|
This is the second deletion commit (split by subtree).
|
|
@@ -1091,6 +1092,10 @@ These files are orphaned by Step 5, so this is a pure `git rm` with no surviving
|
|
|
1091
1092
|
|
|
1092
1093
|
Outcome: −546 LOC source (wizard + editor + file-ops + file-writer); −948 LOC test; production duplication → 0 lines; 1 production and 1 test clone group eliminated.
|
|
1093
1094
|
|
|
1095
|
+
Landed ([#441]): deleted `agent-creation-wizard.ts`, `agent-config-editor.ts`, `agent-file-ops.ts`, `agent-file-writer.ts`, and `menu-ui.ts` (orphaned transient) from `src/ui/`, plus their four test files.
|
|
1096
|
+
`test/helpers/ui-stubs.ts` pruned to `makeMenuUI` only (still consumed by `subagents-settings.test.ts`); `makeFileOps`, `makeMenuManager`, and `createTestSubagentConfig` removed with their `ui-stubs.test.ts` describe blocks.
|
|
1097
|
+
Production duplication: 0 lines (confirmed by `fallow dupes`); `fallow dead-code`: clean. 16 test clone groups remain — Step 7 consolidation target.
|
|
1098
|
+
|
|
1094
1099
|
`Release: batch "dissolve-agents"`
|
|
1095
1100
|
|
|
1096
1101
|
### Step 7 — Consolidate remaining test clone families ([#443])
|
|
@@ -1119,8 +1124,8 @@ flowchart LR
|
|
|
1119
1124
|
S4["✅ Step 4 - Native session nav slice (#445)"]
|
|
1120
1125
|
S4a["✅ Step 4a - Renderer to TUI components (#462)"]
|
|
1121
1126
|
S4b["✅ Step 4b - File-snapshot source (#463)"]
|
|
1122
|
-
S5["Step 5 - Dissolve /agents + viewer (#442)"]
|
|
1123
|
-
S6["Step 6 - Remove definition mgmt (#441)"]
|
|
1127
|
+
S5["✅ Step 5 - Dissolve /agents + viewer (#442)"]
|
|
1128
|
+
S6["✅ Step 6 - Remove definition mgmt (#441)"]
|
|
1124
1129
|
S7["Step 7 - Test clones (#443)"]
|
|
1125
1130
|
|
|
1126
1131
|
S1 --> S4
|
|
@@ -255,6 +255,23 @@ The cleanup sweep instead stashes a lightweight `EvictedSubagent` descriptor (la
|
|
|
255
255
|
This covers in-session evictions — the sweep's only targets, since a fresh manager per session never reloads prior-process subagents.
|
|
256
256
|
The "render from the file snapshot" mechanism for an evicted agent (above) is unchanged; only the candidate-set _enumeration_ is pinned to descriptors.
|
|
257
257
|
|
|
258
|
+
## Addendum 3 (2026-06-23): adopt the `subagents:` colon namespace, superseding Criterion 4
|
|
259
|
+
|
|
260
|
+
This addendum reverses **Criterion 4**, which confirmed flat, hyphenated command names (`/subagents-settings`) and rejected `/subagents:settings`.
|
|
261
|
+
The two registered commands are renamed: `/subagents-settings` → `/subagents:settings` and `/subagent-sessions` → `/subagents:sessions`.
|
|
262
|
+
This is a breaking change to the command surface.
|
|
263
|
+
|
|
264
|
+
**Why revise.**
|
|
265
|
+
Criterion 4 surveyed only in-repo siblings (`agents`, `colgrep-reindex`, `permission-system`) and concluded a `:` namespace would be inconsistent with every existing command.
|
|
266
|
+
That survey missed the broader Pi ecosystem: `@eko24ive/pi-ask` establishes the colon convention with `answer:again` and `ask:replay`, grouping a package's commands under a shared prefix.
|
|
267
|
+
The colon namespace reads as a deliberate grouping gesture (`subagents:settings`, `subagents:sessions` clearly belong to one package) where the hyphen form blurs into an ordinary command name.
|
|
268
|
+
The newer ecosystem signal outweighs the original in-repo-only consistency argument.
|
|
269
|
+
|
|
270
|
+
**Scope.**
|
|
271
|
+
This change is pi-subagents-only.
|
|
272
|
+
Whether the colon convention becomes repo-wide (renaming `colgrep-reindex`, `permission-system`, etc.) is deferred — not decided here.
|
|
273
|
+
`/agents` is intentionally left flat: it is slated for removal in the Phase 18 / Step 5 menu retirement, so namespacing it would be churn on a command being deleted.
|
|
274
|
+
|
|
258
275
|
[#444]: https://github.com/gotgenes/pi-packages/issues/444
|
|
259
276
|
[#445]: https://github.com/gotgenes/pi-packages/issues/445
|
|
260
277
|
[#446]: https://github.com/gotgenes/pi-packages/issues/446
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
---
|
|
2
|
+
issue: 441
|
|
3
|
+
issue_title: "pi-subagents: remove the orphaned agent-definition management subtree"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Remove the orphaned agent-definition management subtree
|
|
7
|
+
|
|
8
|
+
## Release Recommendation
|
|
9
|
+
|
|
10
|
+
**Release:** ship now — batch "dissolve-agents" tail (this issue completes the batch)
|
|
11
|
+
|
|
12
|
+
This issue is Phase 19 Step 6, the tail of release batch "dissolve-agents" (Steps 5–6) in `docs/architecture/architecture.md`.
|
|
13
|
+
Step 5 ([#442], commit `cb813f2c`) landed a breaking `feat(pi-subagents)!:` that is still **unreleased** — it sits after the latest tag `pi-subagents-v17.5.0`.
|
|
14
|
+
Landing this tail completes the batch and lets release-please cut the major bump that carries Step 5's `/agents` removal.
|
|
15
|
+
|
|
16
|
+
## Problem Statement
|
|
17
|
+
|
|
18
|
+
ADR-0004 Decision C removes both agent-definition surfaces: creating a new agent is better done by asking a Pi session directly (more capable than a fixed wizard) or by writing the `.md` file in an editor, and viewing or editing definitions is better served by opening the `.md` files in an editor or IDE.
|
|
19
|
+
Phase 19 Step 5 ([#442]) deleted `agent-menu.ts` — the only importer of the creation wizard, config editor, and their file-ops helpers — so this subtree is now pure dead code.
|
|
20
|
+
This step is the second of two deletion commits in the Phase 19 terminal cut: a clean `git rm` of the orphaned modules, with no surviving references and no edit to any doomed file.
|
|
21
|
+
|
|
22
|
+
## Goals
|
|
23
|
+
|
|
24
|
+
- Delete the orphaned creation wizard, config editor, and their two file-ops helper modules, plus their tests.
|
|
25
|
+
- Delete the transient `menu-ui.ts` module, orphaned once its only consumers (the wizard and editor) are gone.
|
|
26
|
+
- Prune the now-unused helpers from `test/helpers/ui-stubs.ts`, keeping only the helper a surviving test still uses.
|
|
27
|
+
- Drive the package's remaining production duplication to zero (the 11-line internal clone in `disableAgent`/`ejectAgent` dies with `agent-config-editor.ts`).
|
|
28
|
+
- This is **not** a breaking change at this step: the modules are already unreachable after Step 5, so deleting them changes no observable behavior — the user-facing removal already shipped (unreleased) in Step 5's `feat!:`.
|
|
29
|
+
|
|
30
|
+
## Non-Goals
|
|
31
|
+
|
|
32
|
+
- No change to `index.ts` — it already references none of the deleted symbols (verified by grep); the dewiring happened in Step 5.
|
|
33
|
+
- No change to the surviving UI modules (`agent-widget.ts`, `display.ts`, `session-navigation.ts`, `session-navigator.ts`, `subagents-settings.ts`, `widget-renderer.ts`).
|
|
34
|
+
- No change to `subagents-settings.ts`, which carries its own `SubagentsSettingsUI` interface and never depended on `MenuUI`.
|
|
35
|
+
- Test clone consolidation (Phase 19 Step 7, [#443]) — runs after this cut so no surviving helper is extracted into a doomed file.
|
|
36
|
+
|
|
37
|
+
## Background
|
|
38
|
+
|
|
39
|
+
Relevant modules and their current dependency facts (verified against `main`):
|
|
40
|
+
|
|
41
|
+
- `src/ui/agent-creation-wizard.ts` (235 LOC) — `AgentCreationWizard` class; imports `AgentFileOps`, `writeAgentFile`, and `MenuUI` from its siblings.
|
|
42
|
+
- `src/ui/agent-config-editor.ts` (201 LOC) — `AgentConfigEditor` class plus `buildMenuOptions`/`buildEjectContent`; imports `AgentFileOps`, `writeAgentFile`, and `MenuUI`.
|
|
43
|
+
Contains the package's only remaining production clone (the 11-line `disableAgent`/`ejectAgent` block).
|
|
44
|
+
- `src/ui/agent-file-ops.ts` (59 LOC) — `AgentFileOps` interface + `FsAgentFileOps`; only consumers were the wizard and editor.
|
|
45
|
+
- `src/ui/agent-file-writer.ts` (55 LOC) — `writeAgentFile` + narrow interfaces; only consumers were the wizard and editor.
|
|
46
|
+
- `src/ui/menu-ui.ts` (9 LOC) — the `MenuUI` interface, extracted in Step 5's tidy-first prep commit (`bb03efd7`) to break a bidirectional type cycle.
|
|
47
|
+
After this step deletes the wizard and editor, `menu-ui.ts` has zero importers.
|
|
48
|
+
The architecture doc marks it for removal here: its current-state directory listing reads `menu-ui.ts transient: MenuUI interface (removed with wizard/editor in #441)` (line 346), and the Step 5 entry states "The `menu-ui.ts` module is transient and is removed with the wizard/editor in Step 6" (line 1076).
|
|
49
|
+
|
|
50
|
+
Orphan verification (grep across `src/`, excluding the doomed files themselves): **no** surviving importer of any of the five modules or their exported symbols (`AgentCreationWizard`, `AgentConfigEditor`, `FsAgentFileOps`, `writeAgentFile`, `MenuUI`).
|
|
51
|
+
`src/index.ts` references none of them.
|
|
52
|
+
|
|
53
|
+
Test-helper facts (`test/helpers/ui-stubs.ts`), evaluated **after** the four doomed test files are deleted:
|
|
54
|
+
|
|
55
|
+
- `makeMenuUI` — still imported by `test/ui/subagents-settings.test.ts` → **survives**.
|
|
56
|
+
- `makeFileOps` — only remaining importer is its own self-test `ui-stubs.test.ts` → orphan.
|
|
57
|
+
- `makeMenuManager` (including the wizard `spawnAndWait` relay) — only remaining importer is `ui-stubs.test.ts` → orphan.
|
|
58
|
+
- `createTestSubagentConfig` (and its private `DEFAULT_TEST_AGENT_CONFIG`) — only remaining importer is `ui-stubs.test.ts` → orphan.
|
|
59
|
+
|
|
60
|
+
AGENTS.md constraints that apply:
|
|
61
|
+
|
|
62
|
+
- Run `pnpm fallow dead-code` locally before pushing — CI gates on it.
|
|
63
|
+
- Conventional Commits; reference the issue as `(#441)` in the subject, never `Closes #441`.
|
|
64
|
+
- `pnpm` only; package-scoped scripts via `pnpm --filter @gotgenes/pi-subagents`.
|
|
65
|
+
|
|
66
|
+
## Design Overview
|
|
67
|
+
|
|
68
|
+
This is a deletion-only change — no new collaborators, no shared-interface edits, no behavior moved.
|
|
69
|
+
There is nothing to extract and no decision model beyond "delete the orphans, leave `fallow` clean."
|
|
70
|
+
|
|
71
|
+
Two clarifications where the issue body is less precise than the authoritative architecture doc:
|
|
72
|
+
|
|
73
|
+
1. **`menu-ui.ts` is in scope.**
|
|
74
|
+
The issue body's "Proposed change" lists only the four modules, but `menu-ui.ts` is orphaned by the same cut and the architecture doc (lines 346, 1076) explicitly schedules its removal here.
|
|
75
|
+
Deleting it in the same commit as the wizard/editor avoids a dangling `import type { MenuUI }` and a `fallow dead-code` flag.
|
|
76
|
+
|
|
77
|
+
2. **`makeMenuManager` is removed whole, not just its `spawnAndWait` field.**
|
|
78
|
+
The issue body says to prune the "wizard `spawnAndWait` relay," but after the four test files are deleted, `makeMenuManager`'s only remaining caller is its own self-test.
|
|
79
|
+
A test helper whose sole consumer is its own unit test is exactly the residual clutter the Phase 19 cut eliminates, so the whole helper (and its `describe` block) goes.
|
|
80
|
+
The architecture doc's Step 6 phrasing — "delete … `spawnAndWait` from `makeMenuManager` **if no surviving consumer remains**; delete the file outright once all consumers are gone" — licenses this: no real consumer remains.
|
|
81
|
+
`ui-stubs.ts` itself survives because `makeMenuUI` still has a real consumer.
|
|
82
|
+
|
|
83
|
+
End state of `test/helpers/ui-stubs.ts`: a single `makeMenuUI` export plus its file header.
|
|
84
|
+
End state of `test/helpers/ui-stubs.test.ts`: the `makeMenuUI` `describe` block only.
|
|
85
|
+
|
|
86
|
+
Commit-type rationale: deleting already-unreachable code is `refactor(pi-subagents):` — it neither adds a feature nor fixes a bug, and it changes no observable behavior at this step.
|
|
87
|
+
The release is driven by Step 5's unreleased `feat!:` already in the queue, not by this commit's type.
|
|
88
|
+
|
|
89
|
+
## Module-Level Changes
|
|
90
|
+
|
|
91
|
+
Source (deleted):
|
|
92
|
+
|
|
93
|
+
- `src/ui/agent-creation-wizard.ts` — deleted (235 LOC).
|
|
94
|
+
- `src/ui/agent-config-editor.ts` — deleted (201 LOC); removes the 11-line internal production clone.
|
|
95
|
+
- `src/ui/agent-file-ops.ts` — deleted (59 LOC).
|
|
96
|
+
- `src/ui/agent-file-writer.ts` — deleted (55 LOC).
|
|
97
|
+
- `src/ui/menu-ui.ts` — deleted (9 LOC); orphaned once the wizard and editor are gone.
|
|
98
|
+
|
|
99
|
+
Tests (deleted):
|
|
100
|
+
|
|
101
|
+
- `test/ui/agent-creation-wizard.test.ts` — deleted (296 LOC).
|
|
102
|
+
- `test/ui/agent-config-editor.test.ts` — deleted (392 LOC).
|
|
103
|
+
- `test/ui/agent-file-ops.test.ts` — deleted (112 LOC).
|
|
104
|
+
- `test/ui/agent-file-writer.test.ts` — deleted (148 LOC).
|
|
105
|
+
|
|
106
|
+
Tests (pruned, not deleted):
|
|
107
|
+
|
|
108
|
+
- `test/helpers/ui-stubs.ts` — remove `makeFileOps`, `makeMenuManager`, `createTestSubagentConfig`, and the private `DEFAULT_TEST_AGENT_CONFIG`; keep `makeMenuUI`.
|
|
109
|
+
Also drop the file's `import type { AgentConfig }` — it serves only the removed helpers, and `makeMenuUI` references no package-local type.
|
|
110
|
+
- `test/helpers/ui-stubs.test.ts` — remove the `makeFileOps`, `makeMenuManager`, and `createTestSubagentConfig` `describe` blocks and the now-unused imports; keep the `makeMenuUI` `describe` block.
|
|
111
|
+
|
|
112
|
+
Docs (updated):
|
|
113
|
+
|
|
114
|
+
- `docs/architecture/architecture.md` — in the current-state directory tree (lines ~341–346), remove the five deleted `ui/` entries including the `menu-ui.ts` transient line; add a `Landed` note to the Step 6 entry and mark it ✅, mirroring the Step 5 entry's format.
|
|
115
|
+
- `.pi/skills/package-pi-subagents/SKILL.md` — update the UI domain-table row: module count `11` → `6`, and drop "creation wizard, config editor" from the responsibility summary.
|
|
116
|
+
|
|
117
|
+
Doc-reference grep results (the removed symbols / mechanism):
|
|
118
|
+
|
|
119
|
+
- `docs/plans/*` and `docs/retro/*` and `docs/architecture/history/*` mention the deleted modules only as **historical record** of prior phases (extraction, narrowing, clone removal).
|
|
120
|
+
Per markdown conventions these are immutable records of completed work — do not rewrite them.
|
|
121
|
+
- The only **current-state** docs that describe the live layout are `architecture.md` (directory tree + Step 6 entry) and `SKILL.md` (UI domain row), both listed above.
|
|
122
|
+
|
|
123
|
+
## Test Impact Analysis
|
|
124
|
+
|
|
125
|
+
This is a deletion, not an extraction, so the standard extraction lenses invert:
|
|
126
|
+
|
|
127
|
+
1. **New tests enabled:** none — nothing new is created.
|
|
128
|
+
2. **Tests that become redundant:** all four deleted test files exercised only the deleted modules; they go with their subjects.
|
|
129
|
+
The three pruned `ui-stubs.test.ts` `describe` blocks tested helpers that no longer exist.
|
|
130
|
+
3. **Tests that must stay as-is:** `test/ui/subagents-settings.test.ts` (the surviving real consumer of `makeMenuUI`) and the `makeMenuUI` `describe` block in `ui-stubs.test.ts` — both genuinely exercise the surviving helper.
|
|
131
|
+
|
|
132
|
+
After the cut, `pnpm --filter @gotgenes/pi-subagents run test` must stay green with the reduced suite.
|
|
133
|
+
|
|
134
|
+
## Invariants at risk
|
|
135
|
+
|
|
136
|
+
This step touches surfaces that Phase 19 Step 5 ([#442]) and earlier phases refactored, but only by deleting them, so no earlier `Outcome:` is regressed — it is fulfilled:
|
|
137
|
+
|
|
138
|
+
- Step 5's outcome ("`/agents` dissolved; the definition-management leaves orphaned for Step 6") is the precondition this step consumes.
|
|
139
|
+
Verification that the leaves are still orphaned is the grep in Background (no surviving importer) — the standing guarantee that nothing re-wired them between Step 5 landing and this step.
|
|
140
|
+
- The "production duplication → 0 lines" target in the Phase 19 health-metrics table is met when `agent-config-editor.ts` is deleted.
|
|
141
|
+
Pin: `pnpm fallow dupes` after the cut shows no production clone group.
|
|
142
|
+
|
|
143
|
+
No green-suite regression risk exists because no surviving code path is modified; the type checker and `fallow dead-code` are the guards that the deletion is complete and clean.
|
|
144
|
+
|
|
145
|
+
## Step Order
|
|
146
|
+
|
|
147
|
+
This is a pure-deletion plan with no red→green cycles, so it routes to `/build-plan`, not `/tdd-plan`.
|
|
148
|
+
Two commits, ordered for reviewability.
|
|
149
|
+
|
|
150
|
+
1. **Remove the orphaned subtree and prune the test helpers.**
|
|
151
|
+
`git rm` the five source modules and four test files; prune `test/helpers/ui-stubs.ts` and `test/helpers/ui-stubs.test.ts` to `makeMenuUI` only.
|
|
152
|
+
The `menu-ui.ts` deletion and the four-module deletion go together — deleting them in one commit means no dangling `import type { MenuUI }` ever exists at the type-check boundary.
|
|
153
|
+
The helper prune rides in the same commit as the test-file deletion that orphans the helpers, so `fallow dead-code` sees a consistent state.
|
|
154
|
+
Verify: `pnpm --filter @gotgenes/pi-subagents run check`, `… run test`, `pnpm fallow dead-code`, and `pnpm fallow dupes` (expect no production clone group) all green.
|
|
155
|
+
Commit: `refactor(pi-subagents): remove orphaned agent-definition management subtree (#441)`.
|
|
156
|
+
|
|
157
|
+
2. **Update the current-state docs.**
|
|
158
|
+
Edit `docs/architecture/architecture.md` (directory tree + Step 6 `Landed`/✅ note) and `.pi/skills/package-pi-subagents/SKILL.md` (UI domain row count + summary).
|
|
159
|
+
Verify: `pnpm run lint` (rumdl) green.
|
|
160
|
+
Commit: `docs(pi-subagents): record agent-definition subtree removal (#441)`.
|
|
161
|
+
|
|
162
|
+
## Risks and Mitigations
|
|
163
|
+
|
|
164
|
+
- **Risk:** a non-obvious importer of one of the five modules exists and the deletion breaks the type check.
|
|
165
|
+
**Mitigation:** the Background grep already confirms zero `src/` importers and `index.ts` is clean; the Step 1 `check` is the backstop.
|
|
166
|
+
- **Risk:** pruning `ui-stubs.ts` removes a helper a surviving test still imports.
|
|
167
|
+
**Mitigation:** verified `makeMenuUI` is the only helper imported outside the doomed test files (by `subagents-settings.test.ts`); it is explicitly kept.
|
|
168
|
+
- **Risk:** deleting `menu-ui.ts` was not anticipated by the issue body and could be seen as scope creep.
|
|
169
|
+
**Mitigation:** it is mandated by the architecture doc (lines 346, 1076) and is a forced consequence of the orphan analysis; documented in Design Overview.
|
|
170
|
+
- **Risk:** `refactor:` commit type fails to trigger the batch release.
|
|
171
|
+
**Mitigation:** Step 5's unreleased `feat(pi-subagents)!:` (`cb813f2c`, after `v17.5.0`) is already queued; release-please cuts the major bump on the next release regardless of this commit's type.
|
|
172
|
+
`/ship-issue` reads the `**Release:** ship now — batch tail` marker and releases.
|
|
173
|
+
|
|
174
|
+
## Open Questions
|
|
175
|
+
|
|
176
|
+
None.
|
|
177
|
+
The two interpretation points (deleting `menu-ui.ts`; removing `makeMenuManager` whole) are resolved in Design Overview against the authoritative architecture doc and orphan analysis, not deferred.
|
|
178
|
+
|
|
179
|
+
[#442]: https://github.com/gotgenes/pi-packages/issues/442
|
|
180
|
+
[#443]: https://github.com/gotgenes/pi-packages/issues/443
|