@gotgenes/pi-subagents 16.3.1 → 16.5.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.
@@ -271,7 +271,7 @@ sequenceDiagram
271
271
 
272
272
  ## Module organization
273
273
 
274
- The extension has 58 source files organized into six domains plus entry-point wiring.
274
+ The extension has 62 source files organized into six domains plus entry-point wiring.
275
275
  All eight domains have directories: `config/`, `session/`, `lifecycle/`, `observation/`, `service/`, `tools/`, `ui/`, and `handlers/`.
276
276
  Issue #164 moved the 26 previously flat root-level files into five new domain directories, reducing the root to 5 files + 8 directories.
277
277
 
@@ -284,6 +284,7 @@ src/
284
284
  ├── types.ts shared type definitions
285
285
  ├── settings.ts SettingsManager (persistent operational settings)
286
286
  ├── debug.ts debug logging utility
287
+ ├── layered-settings.ts loadLayeredSettings helper (published as @gotgenes/pi-subagents/settings)
287
288
 
288
289
  ├── config/ agent type definitions and resolution
289
290
  │ ├── agent-types.ts AgentTypeRegistry class
@@ -320,7 +321,8 @@ src/
320
321
  │ ├── record-observer.ts session-event stats observer
321
322
  │ ├── notification.ts completion nudges
322
323
  │ ├── notification-state.ts per-agent notification tracking
323
- └── renderer.ts notification TUI component
324
+ ├── renderer.ts notification TUI component
325
+ │ └── subagent-events-observer.ts manager lifecycle observer (event emission + persistence + notification)
324
326
 
325
327
  ├── service/ cross-extension API boundary
326
328
  │ ├── service.ts SubagentsService interface + Symbol.for() accessors
@@ -520,7 +522,7 @@ The governing rule — **no vacant hooks**: the architecture must _admit_ a seam
520
522
  A provider seam with no consumer is a speculative abstraction that taxes every reader and that `fallow` flags as dead.
521
523
  Latent extensibility is the deliverable; a vacant hook is not.
522
524
 
523
- The [first-principles refinement](#first-principles-refinement-the-deeper-target) below sharpens this two-surface split.
525
+ The [first-principles refinement](#first-principles-refinement-and-the-deeper-target) below sharpens this two-surface split.
524
526
  The awaited, behavior-affecting lifecycle events (notably `session-created` before `bindExtensions`) are _hooks_ — the child's own extension surface applied recursively, generative because the core waits on the handler before deciding what to do next.
525
527
  The observational surface then carries only fire-and-forget broadcasts of immutable snapshots, which no consumer can use to change the core.
526
528
 
@@ -554,14 +556,14 @@ In the target state, pi-subagents publishes events and a provider seam; other pa
554
556
 
555
557
  - **pi-permission-system** (observational) subscribes to child-session lifecycle events, detects subagent execution context in the child, and gates tool calls at runtime.
556
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.
557
- - **pi-subagents-ui** (future, under reconsideration — see the [first-principles refinement](#first-principles-refinement-the-deeper-target)) subscribes to the broadcast and the query/behavior interfaces; whether the inherited widget, conversation viewer, and `/agents` menu survive is judged on our principles, not preserved by default.
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; whether the inherited widget, conversation viewer, and `/agents` menu survive is judged on our principles, not preserved by default.
558
560
  - **Any future extension** (OTel, auditing, cost tracking) subscribes to the same events without pi-subagents knowing.
559
561
 
560
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.
561
563
 
562
564
  This is achieved across phases: Phase 14 (strip policy), Phase 16 (invert dependencies — extensions on a minimal core), and Phase 18 (reconsider UI).
563
565
 
564
- ### First-principles refinement (the deeper target)
566
+ ### First-principles refinement and the deeper target
565
567
 
566
568
  The two-surface model above is correct but coarse.
567
569
  Pushing it against our own principles — construct complete, state owns its mutations, tell-don't-ask, dependency inversion — surfaces sharper boundaries that the current code draws through the middle of classes.
@@ -643,17 +645,17 @@ That method — testability friction as a boundary probe, with its limits — is
643
645
 
644
646
  ### Health metrics
645
647
 
646
- | Metric | Value |
647
- | -------------------------- | --------------------------------------- |
648
- | Health score | 78/100 (B) |
649
- | Total LOC | 8,356 (61 files, as of Phase 17 Step 5) |
650
- | Dead code | 0 files, 0 exports |
651
- | Maintainability index | 90.8 (good) |
652
- | Avg cyclomatic complexity | 1.4 |
653
- | P90 cyclomatic complexity | 2 |
654
- | Production duplication | 11 lines (1 internal clone group) |
655
- | Test duplication | 42 clone groups, 661 lines |
656
- | Fallow refactoring targets | 0 |
648
+ | Metric | Value |
649
+ | -------------------------- | -------------------------------------------- |
650
+ | Health score | 78/100 (B) |
651
+ | Total LOC | 7,751 (62 files, end of Phase 17) |
652
+ | Dead code | 0 files, 0 exports |
653
+ | Maintainability index | 90.8 (good) |
654
+ | Avg cyclomatic complexity | 1.4 |
655
+ | P90 cyclomatic complexity | 2 |
656
+ | Production duplication | 11 lines (1 internal clone group) |
657
+ | Test duplication | 28 clone groups, 503 lines (end of Phase 17) |
658
+ | Fallow refactoring targets | 0 |
657
659
 
658
660
  ### Dependency bag inventory
659
661
 
@@ -877,191 +879,163 @@ All five steps are closed: [#261], [#262], [#263], [#264], [#265].
877
879
  The earlier "agent collaborator architecture" framing (#256 superseded, #257 parked, #258 and #259 closed not-planned) was abandoned; its structural win was reached cleanly via the workspace seam.
878
880
  See [phase-16-invert-dependencies.md](history/phase-16-invert-dependencies.md) for details.
879
881
 
880
- ## Improvement roadmap (Phase 17 — core consolidation)
882
+ ## Phase 17 (complete)
883
+
884
+ Phase 17 consolidated the core's remaining structural debt before the UI reconsideration (Phase 18).
885
+ The `Subagent` record/executor duality was resolved by extracting `SubagentState` (status, result, timestamps, metrics) into a private owned value object and making `SubagentExecution` a mandatory constructor collaborator — eliminating ~20 optional fields and the two "not configured for execution" runtime throws.
886
+ The concurrency queue was replaced with a thunk-based `ConcurrencyLimiter` that knows nothing about agents or IDs.
887
+ Run collaborators (`RunListeners`, `WorkspaceBracket`) were extracted from the 455-LOC `Subagent` class.
888
+ The inline `SubagentManagerObserver` literal was promoted to `SubagentEventsObserver`, making its three concerns (event emission, record persistence, notification dispatch) unit-testable in isolation.
889
+ Widget delegation and the post-construction `runtime.widget =` write were removed from `SubagentRuntime` by dissolving the notification→widget cycle via `AgentWidget.seedFinishedAgents`.
890
+ Lifecycle, UI/tools, and cross-package test fixture clones were consolidated.
891
+ `loadLayeredSettings<T>` was extracted to `src/layered-settings.ts` and published via the `@gotgenes/pi-subagents/settings` subpath export, eliminating the 23-line production clone with `pi-subagents-worktrees`.
892
+ All nine steps are closed: [#381], [#373], [#374], [#375], [#376], [#377], [#378], [#379], [#380].
893
+ [#412] unified the overlapping session-mock builders identified during Step 7.
894
+ [#415] migrated `pi-subagents-worktrees` to `loadLayeredSettings` after the Step 9 published release.
895
+ See [phase-17-core-consolidation.md](history/phase-17-core-consolidation.md) for the full findings, step outcomes, dependency diagram, and tracks.
896
+
897
+ ## Phase 18 Reconsider UI from first principles
898
+
899
+ After 17 phases the core is in very good shape: health 78/100 (B), zero dead code, zero fallow refactoring targets, average cyclomatic 1.4.
900
+ The one structural debt that remains is not spread thin across the core — it is concentrated in a single place: the UI's live-streaming state (the "activity tier") is woven into the core's runtime, spawn tools, the LLM-facing `subagent` tool, and the notification path.
901
+ This is the entanglement the [first-principles refinement](#first-principles-refinement-and-the-deeper-target) predicted — "the activity/metrics push tier is provisional; its only reactive consumer is the inherited widget" — observed in the code.
902
+ Disentangling it is what lets the core reach a great state, and it is the prerequisite to any "reconsider the UI" decision: today the UI cannot be a clean consumer because the core does its streaming bookkeeping for it.
903
+
904
+ ### Findings
905
+
906
+ Six findings tell one story — the activity tier has metastasized out of the UI and into the core.
907
+
908
+ 1. **UI state lives on the core runtime.**
909
+ `SubagentRuntime.agentActivity: Map<string, AgentActivityTracker>` puts a UI streaming-state map on the core composition root.
910
+ `SubagentRuntime` owns session-scoped lifecycle state; `AgentActivityTracker` (active tools, response text, turn count) is pure rendering state the core never reads.
911
+ Category C (coupling).
912
+ 2. **Core spawn tools wire UI streaming.**
913
+ `foreground-runner.ts` and `background-spawner.ts` construct `AgentActivityTracker`, call `subscribeUIObserver` (a second session subscription parallel to the core's own `record-observer`), call `setSession`, and populate or delete the activity map and drive the widget (`ensureTimer`, `update`, `markFinished`).
914
+ Their own doc comments list "AgentActivityTracker creation, UI observer subscription" as responsibilities.
915
+ Category C (mixed responsibility, parameter relay).
916
+ 3. **The LLM-facing tool depends on the widget.**
917
+ `AgentTool` takes a 4-method `widget` dependency plus `runtime.agentActivity` and calls `this.widget.setUICtx(ctx.ui)`.
918
+ Every `AgentTool` unit test must stub the widget and the activity map (`createToolDeps`), although the tool's real concern is dispatch — testability friction marking a domain seam.
919
+ Category C/D.
920
+ 4. **Two parallel observers split the run-metric domain.**
921
+ Each child session gets two subscriptions: `record-observer` accumulates `SubagentState` (tool uses, usage, compactions) and `ui-observer` accumulates `AgentActivityTracker` (active tools, response text, turn count).
922
+ `turnCount` is a genuine run metric that lives only in the UI tracker, so `notification.ts` and the foreground result text reach into the tracker to recover it.
923
+ Category C (anemic split, duplication).
924
+ 5. **A core observation concern reaches into UI state.**
925
+ `NotificationManager` holds the activity map and reads `turnCount`/`maxTurns` from it to build notification details, and deletes entries from it.
926
+ Category C (Law of Demeter).
927
+ 6. **The public event contract is both vacant and incomplete.**
928
+ `SUBAGENT_EVENTS.ACTIVITY = "subagents:activity"` is declared in the service surface and the doc's lifecycle-events table but is never emitted anywhere — a vacant hook the doc's own "no vacant hooks" rule forbids.
929
+ Meanwhile three emitted channels (`subagents:failed`, `subagents:compacted`, `subagents:created`) are absent from the constant map.
930
+ Category A/E.
881
931
 
882
- Phase 17 consolidates the core's remaining structural debt before the UI reconsideration (now Phase 18).
883
- The findings come from the standard discovery pass — fallow suite, entry-point trace, design-review checklist, and test-constructibility audit — run after Phase 16 landed.
884
-
885
- Phase 17 is the consolidation slice of the [first-principles refinement](#first-principles-refinement-the-deeper-target), not the full domain split.
886
- It lands the first cut of the lifecycle-state domain (Step 2's `SubagentState`) plus the wiring, queue, and duplication cleanups.
887
- The fuller four-domain split — metrics as a projection, result delivery as its own domain, the hook/broadcast reclassification, and the push/pull (DIP) inversion — is recorded in the refinement and sequenced into later phases.
888
-
889
- ### Findings summary
890
-
891
- Updated health metrics (fallow, package-wide including tests):
892
-
893
- | Metric | Phase 16 baseline | Current |
894
- | -------------------------- | ------------------------------ | --------------------------------------------- |
895
- | Health score | 78/100 (B) | 78/100 (B) |
896
- | Source LOC | 7,778 (57 files) | 8,356 (61 files, landed Phase 17 Step 5) |
897
- | Dead code | 0 files, 0 exports | 0 files, 0 exports |
898
- | Maintainability index | 90.8 (good) | 90.8 (good) |
899
- | Avg / P90 cyclomatic | 1.4 / 2 | 1.4 / 2 |
900
- | Production duplication | 11 lines (1 internal group) | 34 lines (1 internal + 1 cross-package group) |
901
- | Test duplication | 42 groups, 661 lines | 44 groups, ~750 lines |
902
- | Fallow refactoring targets | 0 | 0 |
903
- | Top churn hotspot | `index.ts` 65.0 ▲ accelerating | `index.ts` 31.3 ▼ cooling |
904
-
905
- The syntactic metrics are healthy and stable — the remaining debt is structural, mostly invisible to fallow, and concentrated in three places:
906
-
907
- 1. **`Subagent` construction duality.**
908
- `SubagentInit` carries ~20 fields, nearly all optional with "required for run(), optional for tests" semantics, and `run()` compensates with runtime throws ("not configured for execution").
909
- This violates principle 8 (construct complete): the class is simultaneously a passive record (tests build display-only snapshots) and an executor (production wires factory, observer, run config, workspace provider).
910
- The symptoms are in the tests: external writes `record.promise = …` (manager, queue callback, four test files) and `record.notification = new NotificationState(…)` (seven test sites) are output-argument smells on fields the object should own.
911
- This duality is the two most visible of four domains fused into `Subagent`; Phase 17 resolves it (Step 2) and defers the remaining split (metrics, result delivery) to a later phase per the [first-principles refinement](#first-principles-refinement-the-deeper-target).
912
- 2. **Wiring debt in `index.ts`.**
913
- Two forward references (settings → queue, queue → manager) are replicated with an `eslint-disable prefer-const` dance in `test/lifecycle/subagent-manager.test.ts`; the queue's start callback (`record.promise = record.run()` after a status check) is duplicated verbatim between `index.ts` and the test helper.
914
- A ~70-line inline `SubagentManagerObserver` literal mixes three concerns (event emission, `appendEntry` persistence, notification dispatch).
915
- `runtime.widget` is assigned post-construction behind five relay-only delegation methods on `SubagentRuntime`.
916
- 3. **Duplication.**
917
- A 23-line cross-package production clone (`settings.ts:198-211` ↔ `pi-subagents-worktrees/src/config.ts:51-73`: the layered global/project settings-file loader) and 44 test clone groups (~750 lines), with clone families concentrated in `test/lifecycle/` and `test/ui/`.
932
+ ### Health metrics
918
933
 
919
- Deferred findings (scored below the priority cut, tracked here rather than as steps): the `resolveModel` error-as-string union return (callers branch on `typeof resolved === "string"`), the file-top SDK `eslint-disable` headers in 14 files (re-audit when the Pi SDK exports improve), missing unit tests for `observation/renderer.ts` (the top CRAP-risk file), and the 11-line internal clone in `ui/agent-config-editor.ts` (folds into the Phase 18 UI extraction).
934
+ | Metric | Value |
935
+ | ---------------------------------------- | ------------------------------------------------------------------ |
936
+ | Health score | 78/100 (B) |
937
+ | Source LOC | 7,751 (62 files) |
938
+ | Dead code | 0 files, 0 exports |
939
+ | Maintainability index | 90.9 (good) |
940
+ | Avg cyclomatic complexity | 1.4 |
941
+ | P90 cyclomatic complexity | 2 |
942
+ | Fallow refactoring targets | 0 |
943
+ | Production duplication | 11 lines (1 internal clone group in `agent-config-editor.ts`) |
944
+ | Test duplication | 28 clone groups, 503 lines |
945
+ | Activity-tier modules slated for removal | `ui-observer.ts` (61) + `agent-activity-tracker.ts` (84) = 145 LOC |
920
946
 
921
947
  ### Steps
922
948
 
923
- Priority = Impact × (6 Risk).
924
-
925
- | Step | Title | Category | Impact | Risk | Priority |
926
- | ---- | ------------------------------------------------------------------------------------ | -------- | ------ | ---- | -------- |
927
- | 1 | Replace ConcurrencyQueue with a thunk-based ConcurrencyLimiter | A/C | 4 | 2 | 16 |
928
- | 2 | Extract `SubagentState`; make `Subagent` execution deps mandatory | B/D | 4 | 3 | 12 |
929
- | 3 | Encapsulate run start and notification attachment on Subagent | C | 3 | 2 | 12 |
930
- | 4 | Extract run-listener and workspace-bracket collaborators from Subagent | B/C | 3 | 2 | 12 |
931
- | 5 | Extract the manager observer from index.ts into a class | B/E | 3 | 2 | 12 |
932
- | 6 | Split widget delegation out of SubagentRuntime | C | 3 | 3 | 9 |
933
- | 7 | Consolidate lifecycle test fixtures | D | 3 | 1 | 15 |
934
- | 8 | Consolidate UI and tools test fixtures | D | 2 | 1 | 10 |
935
- | 9 | Resolve the cross-package settings-loader duplication | A | 2 | 2 | 8 |
936
-
937
- #### Step 1 Replace ConcurrencyQueue with a thunk-based ConcurrencyLimiter ([#381]) Complete
938
-
939
- - Targets: `src/lifecycle/concurrency-queue.ts` (→ `concurrency-limiter.ts`), `src/lifecycle/subagent-manager.ts`, `src/index.ts`, `test/lifecycle/concurrency-queue.test.ts`, `test/lifecycle/subagent-manager.test.ts`.
940
- - Smell: Category C (forward references: the queue's ID-registry design forces a start callback that reaches back into the manager, duplicated between `index.ts` and the test helper) and Category A (dual counting: the queue's `running` counter is fed by `markStarted`/`markFinished` relays in the manager's observer, mirroring state the agents already carry).
941
- - Change: replace the ID-registry queue with a `ConcurrencyLimiter` that schedules thunks FIFO against a dynamic `getLimit()` — the injected limiter knows nothing about agents, IDs, or the manager.
942
- Spawn gates background runs with `limiter.schedule(() => record.start())` — `start()` owns the abort-while-queued status guard and stores the promise internally; foreground and `bypassQueue` runs invoke `record.start()` directly.
943
- The settings `onMaxConcurrentChanged` hook wires to `limiter.recheck()` in `index.ts`; `dispose()` calls `limiter.clear()` to drop pending thunks.
944
- - Outcome: dependency direction is strictly manager → limiter (no callback back-edge; the `prefer-const` eslint-disable in the test helper is deleted); the observer's two queue relays are gone; every spawned agent has a `promise` at spawn, collapsing `waitForAll`'s `while (true)` drain loop and its eslint-disable.
945
-
946
- #### Step 2 Extract `SubagentState`; make `Subagent` execution deps mandatory ([#373]) Complete
947
-
948
- - Targets: `src/lifecycle/subagent.ts` (state fields, transition/accumulation methods, constructor, `run()` guards), `src/lifecycle/subagent-manager.ts` (`spawn`), `test/helpers/make-subagent.ts`, `test/lifecycle/subagent.test.ts`, `test/observation/record-observer.test.ts`.
949
- - Smell: Category B (god interface — ~20 fields) and Category D (constructibility: "optional for tests" fields with compensating runtime throws).
950
- The record/executor duality is the two most visible of the four conflated domains (see [First-principles refinement](#first-principles-refinement-the-deeper-target)).
951
- - Change: extract the passive-record state status, result, error, timestamps, and the stats (toolUses, lifetimeUsage, compactionCount) — into a `SubagentState` value object that owns the transition and accumulation methods.
952
- `Subagent` holds one privately; its existing getters and `markX`/`incrementX`/`addUsage` methods become one-line delegations, so the ~40 read sites and the mutation callers are unchanged.
953
- This is not reach-through: `SubagentState` is a private owned value, not a foreign collaborator (contrast [#277], which removed reach-through to the raw SDK session).
954
- With the readable state extracted, the remaining execution inputs (snapshot, prompt, model, maxTurns, thinkingLevel, parentSession, signal, createSubagentSession, observer, getRunConfig, getWorkspaceProvider, baseCwd) collapse into a single **mandatory** `SubagentExecution` collaborator: production always supplies it (the one `spawn()` site), the passive-record construction moves entirely into `make-subagent.ts`, and `run()`'s two "not configured" throws vanish by construction.
955
- - Outcome: state-machine and observer tests target `SubagentState` directly (no stub execution); `Subagent` is construct-complete with no optional execution fields and no runtime throws (grep-verifiable: no "not configured for execution" in `subagent.ts`); the record-vs-executor duality is resolved, not type-encoded.
956
- - Scope boundary: stats stay on `SubagentState` for now.
957
- Hoisting **metrics** into a projection over the child session's event stream and extracting **result delivery** (`notification`/`resultConsumed`) into its own domain are the remaining two of the four domains, deferred to a later phase per the refinement.
958
- - Landed: `SubagentState` (`src/lifecycle/subagent-state.ts`) owns status/result/error/timestamps/stats and the transition/accumulation methods; `Subagent` delegates getters and `markX`/`incrementX`/`addUsage` to it.
959
- `subscribeSubagentObserver` targets `SubagentState`, so observer and state-machine tests no longer stub execution.
960
- `SubagentExecution` is a mandatory constructor collaborator (production wires it in the single `spawn()` site; passive records build via `make-subagent.ts`), and the two `run()` throws are gone.
961
-
962
- #### Step 3 Encapsulate run start and notification attachment on Subagent ([#374]) ✅ Complete
963
-
964
- - Targets: `src/lifecycle/subagent.ts`, `src/lifecycle/subagent-manager.ts`, `test/tools/get-result-tool.test.ts`, `test/lifecycle/subagent-manager.test.ts`, `test/service/service-adapter.test.ts`, `test/observation/notification.test.ts`, `test/helpers/make-subagent.test.ts`, `test/lifecycle/subagent.test.ts`.
965
- - Smell: Category C output arguments: external writes to `record.promise` (2 production sites in `subagent-manager.ts`, 4 test sites) and `record.notification` (7 test sites; the production path was resolved in Step 2 — the constructor creates `notification` from `execution.parentSession?.toolCallId`, so Step 3's remaining work is making the field read-only and updating tests to supply it via `parentSession`).
966
- - Change: add `Subagent.start()` that runs and stores its own promise (plus an awaitable accessor for `spawnAndWait`/`waitForAll`); make `promise` and `notification` externally read-only (private `_promise`/`_notification` fields backed by public getters); the abort-while-queued status guard folds into `start()`, removing the inline check from the limiter callback; tests use `createTestSubagent({ toolCallId })` or spawn with `parentSession.toolCallId` instead of post-construction assignment.
967
- - Outcome: zero external writes to `Subagent` fields outside its own methods (grep-verifiable: `\.promise =` and `\.notification =` appear only inside `subagent.ts`); 6 new unit tests for `start()` behaviour; test count +6 (975 → 981).
968
- - Landed: `Subagent.start()` (immediate path) and `Subagent.scheduleVia(schedule)` (queued path) own the promise and the shared `guardedRun()` status guard; `SubagentManager.spawn()` calls one or the other; `TestSubagentOptions.toolCallId` wires notification state via the constructor path.
969
- - Correction (post-merge): the first cut used `void this.limiter.schedule(() => record.start())`, which left a queued agent's `promise` unset until its slot opened — silently regressing Step 1's "every spawned agent has a `promise` at spawn" invariant.
970
- Fixed by inverting control: `scheduleVia` captures the limiter promise eagerly inside the agent (no external `.promise =` write), restoring the invariant.
971
- Lesson: a step's acceptance criteria must include the cross-step invariants it could regress, not only its own grep-verifiable outcome.
972
-
973
- #### Step 4 Extract run-listener and workspace-bracket collaborators from Subagent ([#375]) Complete
974
-
975
- - Targets: `src/lifecycle/subagent.ts` (455 LOC after Step 2 extracted SubagentStatestill the largest source file).
976
- - Smell: Category B (oversized class; per-run listener fields declared mid-class) and Category C (state owns its mutations: workspace dispose logic appears in `run()`'s catch, `completeRun`, and `failRun`).
977
- - Change: extract a `RunListeners` object owning the observer-unsubscribe and signal-detach handles (`wireSignal`/`attachObserver`/`release`), and a `WorkspaceBracket` collaborator owning prepare/dispose-with-addendum, centralising the dispose logic.
978
- - Outcome: `subagent.ts` ≤ 450 LOC; workspace disposal logic in exactly one place; listener handles no longer raw nullable fields.
979
- - Landed: `RunListeners` (`src/lifecycle/run-listeners.ts`) owns the signal-detach and observer-unsub handles with a single `release()` call; `WorkspaceBracket` (`src/lifecycle/workspace-bracket.ts`) owns prepare-at-run-start and dispose-with-addendum — `completeRun` and `failRun` call `workspaceBracket.dispose(outcome)` and receive the addendum string (or `""`) without reaching through to the workspace object directly.
980
- `Subagent.wireSignal`, `attachObserver`, and `releaseListeners` are removed.
981
- `subagent.ts`: 488 → 448 LOC.
982
- Test count: 982 → 994 (+12: 7 RunListeners + 13 WorkspaceBracket − 8 redundant Subagent listener tests).
983
-
984
- #### Step 5 — Extract the manager observer from index.ts into a class ([#376]) ✅ Complete
985
-
986
- - Targets: `src/index.ts` (inline `SubagentManagerObserver` literal, ~70 lines), new module under `src/observation/`.
987
- - Smell: Category B/E — `index.ts` is the dominant churn hotspot (31.3, 91 commits); the literal mixes event emission, record persistence (`appendEntry`), and notification dispatch; principle 9 (state and behavior belong in classes, not closure-captured literals).
988
- - Change: extract a class (e.g. `SubagentEventsObserver`) constructed with narrow deps (`emit`, `appendEntry`, the `NotificationSystem`).
989
- - Outcome: `index.ts` < 170 lines; the observer's three concerns unit-tested directly without booting the extension.
990
- - Landed: `src/observation/subagent-events-observer.ts` (new, 97 LOC); `index.ts` 226 → 177 lines; 60 → 61 source files; 994 → 1009 tests (+15 covering all four observer methods).
991
-
992
- #### Step 6 — Split widget delegation out of SubagentRuntime ([#377]) ✅ Complete
993
-
994
- - Targets: `src/runtime.ts`, `src/tools/agent-tool.ts` (`AgentToolRuntime`), `src/handlers/tool-start.ts` (`ToolStartRuntime`), `src/observation/notification.ts` (`NotificationManager` constructor), `src/ui/agent-widget.ts`, `src/index.ts`.
995
- - Smell: Category C — relay-only dependency (five delegation methods that only forward to `widget`) and a post-construction `runtime.widget =` write violating principle 8.
996
- - Constraint discovered in planning: "pass the handle directly to the consumers" is infeasible for `NotificationManager`, which is a _transitive dependency_ of the widget (`NotificationManager → widget → manager → observer → NotificationManager`).
997
- The `runtime.widget` lazy field exists to break exactly this cycle; removing it forces the one late seam to move, and the operator's principles (no setters, instantiate ready-to-work) rule out relocating it to a setter or forward-ref `let`.
998
- - Change (tidy-first): first dissolve the cycle by giving `AgentWidget.update()` self-seeding of `finishedTurnAge` for finished agents it observes via `listAgents()`, then drop the `markFinished`/`updateWidget` callbacks from `NotificationManager` (it keeps `agentActivity.delete` + nudge scheduling).
999
- With the cycle gone, the widget is constructed as a `const` after the manager and injected directly into `AgentTool` and `ToolStartHandler`; the `widget` field, the five relay methods, and the post-construction write delete cleanly, and `AgentToolRuntime` narrows to its context-query slice.
1000
- - Outcome: `SubagentRuntime` has zero widget knowledge; no post-construction field writes in `index.ts`; the construction graph is a cycle-free DAG (`notifications → observer → manager → widget → {AgentTool, ToolStartHandler}`).
1001
- - Landed: `AgentWidget.seedFinishedAgents` owns completion detection; `NotificationManager` has no widget dependency (2-arg constructor); `AgentToolWidget` (in `agent-tool.ts`) and `ToolStartWidget` (in `tool-start.ts`) are narrow per-consumer interfaces the real widget satisfies structurally; tool fixtures stub a `widget` separate from the narrowed `runtime` mock.
1002
- Behavior-preserving: the widget timer runs through every background completion, so self-seeding lands ≤80ms later within the same turn (linger is turn-based).
1003
- Test count: 1009 → 1005 (+3 widget self-seed tests, −7 removed relay/field tests).
1004
-
1005
- #### Step 7 — Consolidate lifecycle test fixtures ([#378])
1006
-
1007
- - Targets: `test/lifecycle/subagent-manager.test.ts` (766 LOC), `test/lifecycle/subagent.test.ts`, `test/lifecycle/subagent-session.test.ts`, `test/lifecycle/create-subagent-session.test.ts`, `test/lifecycle/create-subagent-session-extension-tools.test.ts`, `test/lifecycle/concurrency-limiter.test.ts`, `test/helpers/`.
1008
- - Smell: Category D — fallow reports five clone families across the lifecycle tests.
1009
- - Change: extract the repeated spawn/run/factory arrangements into shared helpers, migrating incrementally (lift-and-shift, never a single-step rewrite of a large test file).
1010
- - Outcome: lifecycle clone families 5 → ≤ 1; package test duplication below 600 lines.
1011
-
1012
- #### Step 8 — Consolidate UI and tools test fixtures ([#379])
1013
-
1014
- - Targets: `test/ui/agent-creation-wizard.test.ts`, `test/ui/agent-config-editor.test.ts`, `test/ui/ui-observer.test.ts`, `test/tools/foreground-runner.test.ts`, `test/tools/background-spawner.test.ts`, `test/session/session-config.test.ts`.
1015
- - Smell: Category D — remaining clone families outside the lifecycle tree.
1016
- - Change: extract per-file repeated arrangements into local helpers or `test/helpers/` where shared across files.
1017
- - Outcome: package clone groups 44 → ≤ 25; overall duplication ≤ 0.6%.
1018
-
1019
- #### Step 9 — Resolve the cross-package settings-loader duplication ([#380])
1020
-
1021
- - Targets: `src/settings.ts:198-211`, `packages/pi-subagents-worktrees/src/config.ts:51-73`.
1022
- - Smell: Category A — 23-line production clone: the layered global/project JSON read-sanitize-warn-merge loader.
1023
- - Change: decide explicitly between (a) exporting a small `loadLayeredSettings` helper from pi-subagents' public surface for worktrees to consume, and (b) documenting the duplication as intentional (separate release cadences, registry-resolved dependency) with a recorded fallow suppression.
1024
- The issue weighs the public-API cost (type bundle, `verify:public-types`, docs for third-party authors) against living with the flag.
1025
- - Outcome: `pnpm fallow:dupes` no longer reports the pair, via extraction or recorded suppression.
1026
-
1027
- ### Step dependencies
949
+ The spine (Steps 1–5) removes the activity-tier entanglement, leaving the core a pure orchestrator whose run state lives in one place and whose UI is a reactive consumer of broadcast events plus discrete queries.
950
+ Steps 6–7 are independent hygiene.
951
+ Step 8 is the user-driven UI reconsideration the disentangled core finally makes possible — a decision about the UI's distribution once it is substitutable, not optional.
952
+
953
+ The deeper target in the [first-principles refinement](#first-principles-refinement-and-the-deeper-target) metrics as a pure observer projection rather than mutable fields — is deliberately **not** forced here.
954
+ Folding the live activity onto the record (the single owner of run state, consistent with Phase 17's `SubagentState`) removes the duplication without inventing the asynchronous-observation seam the `improvement-discovery` skill warns is essential, not structural.
955
+
956
+ 1. **Fold run metrics and live activity onto the core record (pure addition).**
957
+ ([#420]) Target: `lifecycle/subagent-state.ts`, `observation/record-observer.ts`, `lifecycle/subagent.ts`.
958
+ Extend the single owned run-state value object with `turnCount`, active tools, and response text; have the already-subscribed `record-observer` handle `turn_end`, `tool_execution_start`, `message_start`, `message_update`; expose read-only `turnCount`/`maxTurns`/`activeTools`/`responseText` getters on `Subagent`.
959
+ `AgentActivityTracker` still exists; nothing reads the new getters yet (tidy-first).
960
+ Smell: Category C. Outcome: `Subagent` is the single home for all run state; getters available for migration.
961
+ 2. **Migrate every activity reader to the record getters.**
962
+ ([#421]) Target: `ui/widget-renderer.ts`, `ui/conversation-viewer.ts`, `ui/agent-menu.ts`, `tools/foreground-runner.ts`, `observation/notification.ts`.
963
+ Switch each reader from `AgentActivityTracker` to the record getters added in Step 1 (widget-renderer reads activity off `listAgents()`; viewer/menu drop the `activity` param; notification reads `turnCount`/`maxTurns` off the record).
964
+ Smell: Category C (Law of Demeter).
965
+ Outcome: no consumer references `AgentActivityTracker`.
966
+ 3. **Delete `AgentActivityTracker` and `ui-observer`; drop the activity map from the runtime and spawn tools.**
967
+ ([#422]) Target: `ui/agent-activity-tracker.ts` (delete), `ui/ui-observer.ts` (delete), `runtime.ts`, `tools/foreground-runner.ts`, `tools/background-spawner.ts`.
968
+ The spawn tools stop constructing trackers, subscribing, and populating maps; `SubagentRuntime.agentActivity` is removed.
969
+ Smell: Category A + C. Outcome: −145 LOC, one session subscription per child, runtime holds zero UI state.
970
+ 4. **Make the widget self-drive from lifecycle events.**
971
+ ([#423]) Target: `ui/agent-widget.ts`, `lifecycle/subagent-manager.ts` (observer), `index.ts`.
972
+ The widget starts/stops its timer in response to started/created/completed notifications instead of tool calls; spawn tools no longer call `ensureTimer`/`update`/`markFinished`.
973
+ Smell: Category C (coupling direction).
974
+ Outcome: the widget is a reactive consumer; no inbound calls from core spawn tools.
975
+ 5. **Drop the widget and activity-map dependencies from the `subagent` tool.**
976
+ ([#424]) Target: `tools/agent-tool.ts`, `test/helpers/make-deps.ts`.
977
+ `AgentTool` loses its `widget` and `agentActivity` constructor params (UICtx capture stays in `ToolStartHandler`); `createToolDeps` sheds the widget and map stubs.
978
+ Smell: Category C/D.
979
+ Outcome: the LLM tool depends only on manager/runtime/settings/registry; fixture drops 2 fields.
980
+ 6. **Reconcile the public event contract.**
981
+ ([#425]) Target: `service/service.ts`, this document's lifecycle-events table.
982
+ Remove the vacant `ACTIVITY` channel (or emit a real broadcast for it) and add the emitted `failed`/`compacted`/`created` channels so declared constants match emitted events.
983
+ Smell: Category A/E.
984
+ Outcome: declared channels equal emitted channels; no vacant hook.
985
+ 7. **Consolidate residual test clone families.**
986
+ ([#426]) Target: `test/settings.test.ts` + `test/layered-settings.test.ts`, `test/lifecycle/create-subagent-session.test.ts`, `test/ui/agent-config-editor.test.ts`.
987
+ Extract shared fixtures for the clone families fallow reports that the spine does not already rewrite.
988
+ Smell: Category D. Outcome: test clone groups drop below 15.
989
+ 8. **Reconsider the UI direction (first-principles ADR).**
990
+ ([#427]) Target: `docs/decisions/`, `ui/`.
991
+ The spine already made the UI _substitutable_; this step decides its _distribution_, not whether the experiment is possible.
992
+ The goal is **substitutable, not optional**: a human needs some surface, but the specific UI is replaceable the way Pi ships a default TUI built on the same public API any extension targets.
993
+ The disentangled core stays byte-for-byte identical whether or not a given UI consumer is installed (the composition test), so a replacement UI is a downstream concern even though _some_ UI is not.
994
+ Unlike the worktrees provider seam (generative, rationed one provider the core consults), the UI is an observational consumer (unlimited, the core never waits on it) reading the broadcast-plus-query surface, which is why packaging it is the secondary question and decoupling it was the real win.
995
+ Two standing concerns are the evidence this decision weighs and the better boundaries the reconsideration is meant to surface:
996
+ - **Truncated transcript.**
997
+ The conversation viewer shows a truncated view, yet `Subagent.messages` already exposes the full history and the core already persists each child as a standard Pi session JSONL (`outputFile`) — the limit is the bespoke overlay's rendering, not data access.
998
+ - **Foreground widget redundancy.**
999
+ In foreground the tool's inline `onUpdate` stream already shows progress, so the above-editor widget duplicates it; the widget earns its keep only for background agents — a per-mode judgment the fused UI cannot vary.
1000
+ Candidate redesign to record: replace the bespoke overlay with "open the child session in the same viewer Pi uses for any session," following the recursive-Pi insight and the already-persisted session file.
1001
+ Judge the widget, conversation viewer, and `/agents` menu per component keep, shrink, extract to `@gotgenes/pi-subagents-ui`, or remove and capture the decision in an ADR that gateways Phase 19.
1002
+ Smell: Category E (organization / boundary).
1003
+ Outcome: a recorded per-component decision motivated by the two concerns; the inherited UI is substitutable and no longer preserved by default.
1004
+
1005
+ ### Step dependency diagram
1028
1006
 
1029
1007
  ```mermaid
1030
1008
  flowchart TB
1031
- S1["Step 1 (#381)<br/>ConcurrencyLimiter replacement"]
1032
- S2["Step 2 (#373)<br/>SubagentState extraction"]
1033
- S3["Step 3 (#374)<br/>Encapsulate start + notification"]
1034
- S4["Step 4 (#375)<br/>Run collaborators extraction"]
1035
- S5["Step 5 (#376)<br/>Observer class from index.ts"]
1036
- S6["Step 6 (#377)<br/>Widget handle out of runtime"]
1037
- S7["Step 7 (#378)<br/>Lifecycle test fixtures"]
1038
- S8["Step 8 (#379)<br/>UI/tools test fixtures"]
1039
- S9["Step 9 (#380)<br/>Settings-loader duplication"]
1040
-
1041
- S1 --> S3
1042
- S2 --> S3
1043
- S3 --> S4
1044
- S4 --> S7
1045
- S5 --> S6
1009
+ S1["1 — Fold metrics + activity onto record (#420)"]
1010
+ S2["2 — Migrate readers to record getters (#421)"]
1011
+ S3["3 Delete tracker + ui-observer, drop activity map (#422)"]
1012
+ S4["4 — Widget self-drives on events (#423)"]
1013
+ S5["5 Drop widget dep from subagent tool (#424)"]
1014
+ S6["6 Reconcile public event contract (#425)"]
1015
+ S7["7 — Consolidate test clone families (#426)"]
1016
+ S8["8 — Reconsider UI direction, ADR (#427)"]
1017
+
1018
+ S1 --> S2 --> S3 --> S4 --> S5 --> S8
1019
+ S6
1020
+ S7
1046
1021
  ```
1047
1022
 
1048
- Steps 8 and 9 have no dependencies and can run at any point.
1049
-
1050
- ### Tracks
1051
-
1052
- | Track | Steps | Theme |
1053
- | ----------------------------- | ------------- | ---------------------------------------------------------------------------------- |
1054
- | A — Subagent constructibility | 2 → 3 → 4 → 7 | Construct complete; encapsulate run state; then consolidate the tests that churned |
1055
- | B — Wiring debt | 1, 5 → 6 | Shrink index.ts; eliminate forward references and relay delegation |
1056
- | C — Test hygiene | 8 | Clone families outside the lifecycle tree |
1057
- | D — Duplication policy | 9 | Cross-package clone decision |
1023
+ ### Parallel tracks
1058
1024
 
1059
- Tracks A and B intersect only at Step 3 (which needs Step 1's queue relocation); otherwise they proceed in parallel.
1060
- Tracks C and D are fully independent.
1025
+ - **Track A Disentangle the activity tier (spine):** Steps 1, 2, 3.
1026
+ Strictly ordered; each is a safe lift-and-shift over the previous.
1027
+ - **Track B — Decouple widget and tool wiring:** Steps 4, 5.
1028
+ Begins once the activity map is gone (Step 3).
1029
+ - **Track C — Public-contract hygiene:** Step 6.
1030
+ Independent; can land any time.
1031
+ - **Track D — Test consolidation:** Step 7.
1032
+ Independent; can land any time.
1033
+ - **Track E — UI reconsideration:** Step 8.
1034
+ Gated on the spine and Track B (the UI must be a clean consumer first).
1061
1035
 
1062
1036
  ## Refactoring history
1063
1037
 
1064
- Phases 1–5, 7–16 are complete.
1038
+ Phases 1–5, 7–17 are complete.
1065
1039
  Phase 6 (UI extraction to a separate package) is deferred → Phase 18.
1066
1040
  Detailed records are preserved in per-phase history files:
1067
1041
 
@@ -1083,29 +1057,31 @@ Detailed records are preserved in per-phase history files:
1083
1057
  | 14 | Strip policy from core | Complete | [phase-14-strip-policy.md](history/phase-14-strip-policy.md) |
1084
1058
  | 15 | Domain model evolution | Complete | [phase-15-domain-model-evolution.md](history/phase-15-domain-model-evolution.md) |
1085
1059
  | 16 | Invert dependencies (extensions on a minimal core) | Complete | [phase-16-invert-dependencies.md](history/phase-16-invert-dependencies.md) |
1086
- | 17 | Core consolidation | Planned | |
1087
- | 18 | Reconsider UI (first principles) | Planned | |
1060
+ | 17 | Core consolidation | Complete | [phase-17-core-consolidation.md](history/phase-17-core-consolidation.md) |
1061
+ | 18 | Reconsider UI (first principles) | Proposed | this document, [Phase 18](#phase-18-reconsider-ui-from-first-principles) |
1088
1062
 
1089
1063
  ### Structural refactoring issues
1090
1064
 
1091
- | Phase | Issue | Summary |
1092
- | -------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
1093
- | Foundation | #69, #71, #76, #80 | SubagentRuntime, pure assembler, cwd injection, config consolidation |
1094
- | Core decomposition | #84, #72, #87, #70 | WorktreeManager, AgentManager DI, runtime methods, handler extraction |
1095
- | Interface polish | #66, #77 | SDK types, projectAgentsDir |
1096
- | Features | #61 | JSONL session transcripts |
1097
- | AgentManager | #98, #99, #100, #102 | Record state machine, ParentSnapshot, session-event observation, test factory |
1098
- | Encapsulation | #108, #109, #110, #111, #112, #113, #114, #115, #116, #118 | Registry, settings, activity tracker, record lifecycle, observer, spawn options, deps narrowing, tool split, type housekeeping |
1099
- | Testability | #131, #132, #133, #134, #135, #136 | Shared fixtures, session-config IO, runner SDK boundary, as-any reduction, display extraction, menu decomposition |
1100
- | Observation/ctx | #144, #145, #146, #147, #148 | Observation consolidation, execute decomposition, UI context, text wrapping injection, widget rendering split |
1101
- | Phase 10 | #164, #165, #166, #167, #168, #169, #170, #171, #172 | Domain directories, ResolvedSpawnConfig, ParentSessionInfo, RunnerIO split, ToolFilterConfig, RunContext, buildContentLines, renderResult, content-items |
1102
- | Phase 11 | #192, #193, #194, #195, #196 | SessionContext, runtime queries, interface alignment, tool classes, runner/menu classes, index.ts simplification |
1103
- | Phase 12 | #205, #206, #207, #208 | renderWidgetLines, showAgentDetail, widget update, shared test fixtures |
1104
- | Phase 13 | #214, #215, #216, #217, #218, #219 | Closure-to-class, buildParentContext, startAgent decomp, overwrite guard, settings SDK, test duplication |
1105
- | Phase 14 | #237, #238, #239, #242 | Remove disallowed_tools, remove extensions filtering, collapse filterActiveTools, rename Agent to subagent |
1106
- | Phase 15 | #227, #228, #231, #229, #230, #232 | Agent domain model, async startAgent, runner self-contained, Agent.run(), ConcurrencyQueue, Agent.resume() |
1107
- | Phase 16 | #261, #262, #263, #264, #265 | Lifecycle events (retire permission-bridge), WorkspaceProvider seam, extract worktrees package, remove isolated, born-complete execution / dissolve runner |
1108
- | Phase 16 (abandoned) | #256 (superseded), #257 (parked), #258, #259 (not planned) | Agent collaborator architecture — replaced by the inversion approach above ([ADR-0002]) |
1065
+ | Phase | Issue | Summary |
1066
+ | -------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1067
+ | Foundation | #69, #71, #76, #80 | SubagentRuntime, pure assembler, cwd injection, config consolidation |
1068
+ | Core decomposition | #84, #72, #87, #70 | WorktreeManager, AgentManager DI, runtime methods, handler extraction |
1069
+ | Interface polish | #66, #77 | SDK types, projectAgentsDir |
1070
+ | Features | #61 | JSONL session transcripts |
1071
+ | AgentManager | #98, #99, #100, #102 | Record state machine, ParentSnapshot, session-event observation, test factory |
1072
+ | Encapsulation | #108, #109, #110, #111, #112, #113, #114, #115, #116, #118 | Registry, settings, activity tracker, record lifecycle, observer, spawn options, deps narrowing, tool split, type housekeeping |
1073
+ | Testability | #131, #132, #133, #134, #135, #136 | Shared fixtures, session-config IO, runner SDK boundary, as-any reduction, display extraction, menu decomposition |
1074
+ | Observation/ctx | #144, #145, #146, #147, #148 | Observation consolidation, execute decomposition, UI context, text wrapping injection, widget rendering split |
1075
+ | Phase 10 | #164, #165, #166, #167, #168, #169, #170, #171, #172 | Domain directories, ResolvedSpawnConfig, ParentSessionInfo, RunnerIO split, ToolFilterConfig, RunContext, buildContentLines, renderResult, content-items |
1076
+ | Phase 11 | #192, #193, #194, #195, #196 | SessionContext, runtime queries, interface alignment, tool classes, runner/menu classes, index.ts simplification |
1077
+ | Phase 12 | #205, #206, #207, #208 | renderWidgetLines, showAgentDetail, widget update, shared test fixtures |
1078
+ | Phase 13 | #214, #215, #216, #217, #218, #219 | Closure-to-class, buildParentContext, startAgent decomp, overwrite guard, settings SDK, test duplication |
1079
+ | Phase 14 | #237, #238, #239, #242 | Remove disallowed_tools, remove extensions filtering, collapse filterActiveTools, rename Agent to subagent |
1080
+ | Phase 15 | #227, #228, #231, #229, #230, #232 | Agent domain model, async startAgent, runner self-contained, Agent.run(), ConcurrencyQueue, Agent.resume() |
1081
+ | Phase 16 | #261, #262, #263, #264, #265 | Lifecycle events (retire permission-bridge), WorkspaceProvider seam, extract worktrees package, remove isolated, born-complete execution / dissolve runner |
1082
+ | Phase 16 (abandoned) | #256 (superseded), #257 (parked), #258, #259 (not planned) | Agent collaborator architecture — replaced by the inversion approach above ([ADR-0002]) |
1083
+ | Phase 17 | #381, #373, #374, #375, #376, #377, #378, #379, #380 | ConcurrencyLimiter, SubagentState, run-start encapsulation, run collaborators, events observer, widget decoupling, lifecycle test fixtures, UI/tools test fixtures, settings-loader extraction |
1084
+ | Phase 17 (follow-on) | #412, #415 | Session-mock builder unification, worktrees settings-helper migration |
1109
1085
 
1110
1086
  The remaining open issue is #22 (parent-session resolution), a cross-extension track that does not gate the structural work.
1111
1087
 
@@ -1159,4 +1135,14 @@ The upstream test suite is run periodically as a regression canary for the sessi
1159
1135
  [#379]: https://github.com/gotgenes/pi-packages/issues/379
1160
1136
  [#380]: https://github.com/gotgenes/pi-packages/issues/380
1161
1137
  [#381]: https://github.com/gotgenes/pi-packages/issues/381
1138
+ [#412]: https://github.com/gotgenes/pi-packages/issues/412
1139
+ [#415]: https://github.com/gotgenes/pi-packages/issues/415
1140
+ [#420]: https://github.com/gotgenes/pi-packages/issues/420
1141
+ [#421]: https://github.com/gotgenes/pi-packages/issues/421
1142
+ [#422]: https://github.com/gotgenes/pi-packages/issues/422
1143
+ [#423]: https://github.com/gotgenes/pi-packages/issues/423
1144
+ [#424]: https://github.com/gotgenes/pi-packages/issues/424
1145
+ [#425]: https://github.com/gotgenes/pi-packages/issues/425
1146
+ [#426]: https://github.com/gotgenes/pi-packages/issues/426
1147
+ [#427]: https://github.com/gotgenes/pi-packages/issues/427
1162
1148
  [ADR-0002]: ../decisions/0002-extensions-on-a-minimal-core.md