@gotgenes/pi-subagents 18.0.1 → 18.0.2
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 +7 -0
- package/docs/architecture/architecture.md +157 -204
- package/docs/architecture/history/phase-19-implement-ui-decisions.md +282 -0
- package/package.json +5 -6
- package/src/lifecycle/subagent.ts +5 -9
- package/src/observation/notification.ts +23 -10
- package/src/observation/subagent-events-observer.ts +1 -3
- package/src/tools/get-result-report.ts +60 -0
- package/src/tools/get-result-tool.ts +25 -40
- package/src/types.ts +1 -1
- package/src/ui/session-navigator.ts +0 -2
- package/.prettierignore +0 -5
- package/AGENTS.md +0 -7
- package/docs/plans/0048-implement-subagents-api.md +0 -304
- package/docs/plans/0049-remove-group-join-output-file-rpc.md +0 -180
- package/docs/plans/0051-update-adr-0001-hard-fork.md +0 -77
- package/docs/plans/0052-remove-scheduled-subagents.md +0 -133
- package/docs/plans/0053-extract-model-resolution-from-execute.md +0 -181
- package/docs/plans/0054-decompose-index-into-modules.md +0 -302
- package/docs/plans/0057-structured-debug-logging.md +0 -154
- package/docs/plans/0061-session-format-transcript.md +0 -284
- package/docs/plans/0066-replace-as-any-with-sdk-types.md +0 -215
- package/docs/plans/0069-create-subagent-runtime.md +0 -345
- package/docs/plans/0070-extract-event-handlers.md +0 -306
- package/docs/plans/0071-extract-session-config-assembler.md +0 -362
- package/docs/plans/0072-inject-agent-manager-collaborators.md +0 -329
- package/docs/plans/0076-inject-cwd-into-agent-manager.md +0 -102
- package/docs/plans/0077-inject-project-agents-dir.md +0 -115
- package/docs/plans/0080-consolidate-agent-config-lookup.md +0 -247
- package/docs/plans/0084-extract-git-worktree-manager.md +0 -142
- package/docs/plans/0087-evolve-subagent-runtime-methods.md +0 -240
- package/docs/plans/0098-extract-agent-record-state-machine.md +0 -435
- package/docs/plans/0099-replace-ctx-with-parent-snapshot.md +0 -488
- package/docs/plans/0100-replace-callback-threading-with-session-subscription.md +0 -454
- package/docs/plans/0102-consolidate-test-record-factory.md +0 -176
- package/docs/plans/0108-extract-agent-type-registry.md +0 -322
- package/docs/plans/0109-extract-settings-manager.md +0 -276
- package/docs/plans/0110-agent-activity-tracker.md +0 -297
- package/docs/plans/0111-split-agent-record-lifecycle.md +0 -582
- package/docs/plans/0112-replace-agent-manager-callbacks.md +0 -241
- package/docs/plans/0113-disambiguate-spawn-options.md +0 -155
- package/docs/plans/0114-narrow-agent-tool-menu-deps.md +0 -279
- package/docs/plans/0115-decompose-agent-tool.md +0 -337
- package/docs/plans/0116-type-housekeeping.md +0 -351
- package/docs/plans/0118-settings-manager-apply-methods.md +0 -271
- package/docs/plans/0123-remove-vi-fn-cast-smell.md +0 -179
- package/docs/plans/0131-consolidate-shared-test-fixtures.md +0 -207
- package/docs/plans/0132-inject-io-into-session-config.md +0 -219
- package/docs/plans/0133-inject-sdk-boundary-into-agent-runner.md +0 -373
- package/docs/plans/0134-reduce-as-any-casts.md +0 -366
- package/docs/plans/0135-extract-display-helpers.md +0 -182
- package/docs/plans/0136-decompose-agent-menu.md +0 -300
- package/docs/plans/0144-consolidate-observation-model.md +0 -263
- package/docs/plans/0145-decompose-execute-push-ctx-to-boundary.md +0 -290
- package/docs/plans/0146-narrow-ui-context.md +0 -319
- package/docs/plans/0147-inject-wrap-text-into-conversation-viewer.md +0 -166
- package/docs/plans/0148-split-agent-widget-rendering.md +0 -255
- package/docs/plans/0152-add-prompt-snippet.md +0 -91
- package/docs/plans/0164-reorganize-into-domain-directories.md +0 -409
- package/docs/plans/0165-decompose-resolved-spawn-config.md +0 -157
- package/docs/plans/0166-extract-parent-session-info.md +0 -231
- package/docs/plans/0167-narrow-runner-io.md +0 -150
- package/docs/plans/0168-extract-tool-filter-config.md +0 -173
- package/docs/plans/0169-extract-run-context-from-run-options.md +0 -194
- package/docs/plans/0170-reduce-build-content-lines-complexity.md +0 -225
- package/docs/plans/0171-reduce-render-result-complexity.md +0 -200
- package/docs/plans/0172-extract-turn-formatting.md +0 -206
- package/docs/plans/0180-reorder-append-prompt-for-kv-cache.md +0 -100
- package/docs/plans/0185-remove-persistent-agent-memory.md +0 -161
- package/docs/plans/0188-replace-any-casts-with-sdk-types.md +0 -162
- package/docs/plans/0192-define-session-context-interface.md +0 -107
- package/docs/plans/0193-runtime-owns-context-queries.md +0 -245
- package/docs/plans/0194-align-tool-interfaces-for-structural-typing.md +0 -139
- package/docs/plans/0195-convert-tool-factories-to-classes.md +0 -264
- package/docs/plans/0196-convert-runner-menu-to-classes.md +0 -268
- package/docs/plans/0205-decompose-render-widget-lines.md +0 -140
- package/docs/plans/0206-decompose-show-agent-detail.md +0 -211
- package/docs/plans/0207-decompose-agent-widget-update.md +0 -242
- package/docs/plans/0208-extract-shared-test-fixtures.md +0 -298
- package/docs/plans/0214-convert-remaining-closure-factories-to-classes.md +0 -261
- package/docs/plans/0215-decompose-build-parent-context.md +0 -166
- package/docs/plans/0216-decompose-start-agent.md +0 -255
- package/docs/plans/0217-extract-overwrite-guard.md +0 -176
- package/docs/plans/0218-push-sdk-boundary-in-settings.md +0 -172
- package/docs/plans/0219-reduce-test-duplication-top-3-clone-families.md +0 -162
- package/docs/plans/0227-evolve-agent-record-into-agent.md +0 -322
- package/docs/plans/0228-async-start-agent-dissolve-run-handle.md +0 -288
- package/docs/plans/0229-agent-born-complete.md +0 -564
- package/docs/plans/0230-extract-concurrency-queue.md +0 -265
- package/docs/plans/0231-push-exec-registry-to-runner.md +0 -245
- package/docs/plans/0232-agent-resume-internal-observer-lifecycle.md +0 -180
- package/docs/plans/0237-remove-disallowed-tools.md +0 -180
- package/docs/plans/0238-remove-extensions-filtering.md +0 -191
- package/docs/plans/0239-collapse-filter-active-tools.md +0 -217
- package/docs/plans/0242-rename-agent-tool-to-subagent.md +0 -165
- package/docs/plans/0256-extract-worktree-isolation.md +0 -256
- package/docs/plans/0257-extract-child-session-factory.md +0 -285
- package/docs/plans/0262-add-workspace-provider-seam.md +0 -264
- package/docs/plans/0264-remove-extension-lifecycle-control.md +0 -277
- package/docs/plans/0265-born-complete-subagent-session.md +0 -333
- package/docs/plans/0270-type-consumable-public-surface.md +0 -204
- package/docs/plans/0272-export-workspace-collaborator-types.md +0 -147
- package/docs/plans/0277-encapsulate-agent-session.md +0 -304
- package/docs/plans/0280-rename-agent-to-subagent.md +0 -197
- package/docs/plans/0360-custom-agents-default-append.md +0 -132
- package/docs/plans/0373-extract-subagent-state.md +0 -250
- package/docs/plans/0374-encapsulate-subagent-start-notification.md +0 -268
- package/docs/plans/0375-extract-run-listener-workspace-bracket.md +0 -300
- package/docs/plans/0376-extract-manager-observer.md +0 -232
- package/docs/plans/0377-split-widget-delegation-from-runtime.md +0 -254
- package/docs/plans/0378-consolidate-lifecycle-test-fixtures.md +0 -243
- package/docs/plans/0379-consolidate-ui-tools-test-fixtures.md +0 -335
- package/docs/plans/0380-extract-layered-settings-loader.md +0 -223
- package/docs/plans/0381-replace-concurrency-queue-with-limiter.md +0 -267
- package/docs/plans/0400-include-parent-prompt-in-replace-mode.md +0 -199
- package/docs/plans/0403-abort-subagents-on-interrupt.md +0 -180
- package/docs/plans/0412-unify-session-mock-builders.md +0 -146
- package/docs/plans/0420-fold-run-metrics-live-activity-onto-record.md +0 -228
- package/docs/plans/0421-migrate-activity-readers-to-record-getters.md +0 -309
- package/docs/plans/0422-delete-activity-tracker-ui-observer.md +0 -204
- package/docs/plans/0423-widget-self-drive-from-lifecycle.md +0 -264
- package/docs/plans/0424-drop-widget-dep-from-subagent-tool.md +0 -166
- package/docs/plans/0425-reconcile-subagent-events-contract.md +0 -144
- package/docs/plans/0426-consolidate-residual-test-clone-families.md +0 -235
- package/docs/plans/0427-reconsider-ui-direction.md +0 -212
- package/docs/plans/0441-remove-agent-definition-management-subtree.md +0 -180
- package/docs/plans/0442-dissolve-agents-conversation-viewer.md +0 -195
- package/docs/plans/0443-consolidate-remaining-test-clone-families.md +0 -268
- package/docs/plans/0444-shrink-widget-to-background-agents.md +0 -156
- package/docs/plans/0445-native-session-navigation.md +0 -365
- package/docs/plans/0446-spike-session-navigation-entry-criteria.md +0 -171
- package/docs/plans/0447-extract-subagents-settings-command.md +0 -220
- package/docs/plans/0448-block-disabled-agent-spawn.md +0 -207
- package/docs/plans/0462-navigation-renderer-tui-components.md +0 -338
- package/docs/plans/0463-file-snapshot-source-evicted-agents.md +0 -306
- package/docs/plans/0470-refresh-readme-command-surface.md +0 -159
- package/docs/retro/0048-implement-subagents-api.md +0 -44
- package/docs/retro/0049-remove-group-join-output-file-rpc.md +0 -49
- package/docs/retro/0051-update-adr-0001-hard-fork.md +0 -39
- package/docs/retro/0053-extract-model-resolution-from-execute.md +0 -40
- package/docs/retro/0054-decompose-index-into-modules.md +0 -53
- package/docs/retro/0057-structured-debug-logging.md +0 -77
- package/docs/retro/0061-session-format-transcript.md +0 -41
- package/docs/retro/0066-replace-as-any-with-sdk-types.md +0 -44
- package/docs/retro/0069-create-subagent-runtime.md +0 -43
- package/docs/retro/0070-extract-event-handlers.md +0 -49
- package/docs/retro/0071-extract-session-config-assembler.md +0 -60
- package/docs/retro/0072-inject-agent-manager-collaborators.md +0 -46
- package/docs/retro/0076-inject-cwd-into-agent-manager.md +0 -35
- package/docs/retro/0077-inject-project-agents-dir.md +0 -33
- package/docs/retro/0080-consolidate-agent-config-lookup.md +0 -35
- package/docs/retro/0084-extract-git-worktree-manager.md +0 -37
- package/docs/retro/0087-evolve-subagent-runtime-methods.md +0 -42
- package/docs/retro/0098-extract-agent-record-state-machine.md +0 -46
- package/docs/retro/0099-replace-ctx-with-parent-snapshot.md +0 -37
- package/docs/retro/0100-replace-callback-threading-with-session-subscription.md +0 -36
- package/docs/retro/0102-consolidate-test-record-factory.md +0 -30
- package/docs/retro/0108-extract-agent-type-registry.md +0 -41
- package/docs/retro/0109-extract-settings-manager.md +0 -55
- package/docs/retro/0110-agent-activity-tracker.md +0 -44
- package/docs/retro/0111-split-agent-record-lifecycle.md +0 -61
- package/docs/retro/0112-replace-agent-manager-callbacks.md +0 -35
- package/docs/retro/0113-disambiguate-spawn-options.md +0 -29
- package/docs/retro/0114-narrow-agent-tool-menu-deps.md +0 -38
- package/docs/retro/0115-decompose-agent-tool.md +0 -51
- package/docs/retro/0116-type-housekeeping.md +0 -42
- package/docs/retro/0118-settings-manager-apply-methods.md +0 -40
- package/docs/retro/0123-remove-vi-fn-cast-smell.md +0 -49
- package/docs/retro/0131-consolidate-shared-test-fixtures.md +0 -46
- package/docs/retro/0132-inject-io-into-session-config.md +0 -33
- package/docs/retro/0133-inject-sdk-boundary-into-agent-runner.md +0 -45
- package/docs/retro/0134-reduce-as-any-casts.md +0 -56
- package/docs/retro/0135-extract-display-helpers.md +0 -38
- package/docs/retro/0136-decompose-agent-menu.md +0 -43
- package/docs/retro/0144-consolidate-observation-model.md +0 -39
- package/docs/retro/0145-decompose-execute-push-ctx-to-boundary.md +0 -56
- package/docs/retro/0146-narrow-ui-context.md +0 -70
- package/docs/retro/0147-inject-wrap-text-into-conversation-viewer.md +0 -90
- package/docs/retro/0148-split-agent-widget-rendering.md +0 -39
- package/docs/retro/0152-add-prompt-snippet.md +0 -34
- package/docs/retro/0164-reorganize-into-domain-directories.md +0 -82
- package/docs/retro/0165-decompose-resolved-spawn-config.md +0 -78
- package/docs/retro/0166-extract-parent-session-info.md +0 -66
- package/docs/retro/0167-narrow-runner-io.md +0 -63
- package/docs/retro/0168-extract-tool-filter-config.md +0 -76
- package/docs/retro/0169-extract-run-context-from-run-options.md +0 -68
- package/docs/retro/0170-reduce-build-content-lines-complexity.md +0 -72
- package/docs/retro/0171-reduce-render-result-complexity.md +0 -77
- package/docs/retro/0172-extract-turn-formatting.md +0 -80
- package/docs/retro/0180-reorder-append-prompt-for-kv-cache.md +0 -62
- package/docs/retro/0185-remove-persistent-agent-memory.md +0 -73
- package/docs/retro/0188-replace-any-casts-with-sdk-types.md +0 -69
- package/docs/retro/0192-define-session-context-interface.md +0 -59
- package/docs/retro/0193-runtime-owns-context-queries.md +0 -75
- package/docs/retro/0194-align-tool-interfaces-for-structural-typing.md +0 -62
- package/docs/retro/0195-convert-tool-factories-to-classes.md +0 -84
- package/docs/retro/0196-convert-runner-menu-to-classes.md +0 -73
- package/docs/retro/0205-decompose-render-widget-lines.md +0 -64
- package/docs/retro/0206-decompose-show-agent-detail.md +0 -67
- package/docs/retro/0207-decompose-agent-widget-update.md +0 -92
- package/docs/retro/0208-extract-shared-test-fixtures.md +0 -102
- package/docs/retro/0214-convert-remaining-closure-factories-to-classes.md +0 -66
- package/docs/retro/0215-decompose-build-parent-context.md +0 -61
- package/docs/retro/0216-decompose-start-agent.md +0 -80
- package/docs/retro/0217-extract-overwrite-guard.md +0 -63
- package/docs/retro/0218-push-sdk-boundary-in-settings.md +0 -72
- package/docs/retro/0219-reduce-test-duplication-top-3-clone-families.md +0 -64
- package/docs/retro/0227-evolve-agent-record-into-agent.md +0 -80
- package/docs/retro/0228-async-start-agent-dissolve-run-handle.md +0 -80
- package/docs/retro/0229-agent-born-complete.md +0 -89
- package/docs/retro/0230-extract-concurrency-queue.md +0 -38
- package/docs/retro/0231-push-exec-registry-to-runner.md +0 -71
- package/docs/retro/0232-agent-resume-internal-observer-lifecycle.md +0 -109
- package/docs/retro/0237-remove-disallowed-tools.md +0 -78
- package/docs/retro/0238-remove-extensions-filtering.md +0 -72
- package/docs/retro/0239-collapse-filter-active-tools.md +0 -70
- package/docs/retro/0242-rename-agent-tool-to-subagent.md +0 -82
- package/docs/retro/0256-extract-worktree-isolation.md +0 -89
- package/docs/retro/0257-extract-child-session-factory.md +0 -33
- package/docs/retro/0262-add-workspace-provider-seam.md +0 -89
- package/docs/retro/0264-remove-extension-lifecycle-control.md +0 -91
- package/docs/retro/0265-born-complete-subagent-session.md +0 -97
- package/docs/retro/0270-type-consumable-public-surface.md +0 -108
- package/docs/retro/0272-export-workspace-collaborator-types.md +0 -38
- package/docs/retro/0277-encapsulate-agent-session.md +0 -80
- package/docs/retro/0280-rename-agent-to-subagent.md +0 -96
- package/docs/retro/0360-custom-agents-default-append.md +0 -81
- package/docs/retro/0373-extract-subagent-state.md +0 -94
- package/docs/retro/0374-encapsulate-subagent-start-notification.md +0 -171
- package/docs/retro/0375-extract-run-listener-workspace-bracket.md +0 -104
- package/docs/retro/0376-extract-manager-observer.md +0 -81
- package/docs/retro/0377-split-widget-delegation-from-runtime.md +0 -105
- package/docs/retro/0378-consolidate-lifecycle-test-fixtures.md +0 -100
- package/docs/retro/0379-consolidate-ui-tools-test-fixtures.md +0 -52
- package/docs/retro/0380-extract-layered-settings-loader.md +0 -97
- package/docs/retro/0381-replace-concurrency-queue-with-limiter.md +0 -95
- package/docs/retro/0400-include-parent-prompt-in-replace-mode.md +0 -84
- package/docs/retro/0403-abort-subagents-on-interrupt.md +0 -90
- package/docs/retro/0412-unify-session-mock-builders.md +0 -80
- package/docs/retro/0420-fold-run-metrics-live-activity-onto-record.md +0 -90
- package/docs/retro/0421-migrate-activity-readers-to-record-getters.md +0 -105
- package/docs/retro/0422-delete-activity-tracker-ui-observer.md +0 -97
- package/docs/retro/0423-widget-self-drive-from-lifecycle.md +0 -112
- package/docs/retro/0424-drop-widget-dep-from-subagent-tool.md +0 -89
- package/docs/retro/0425-reconcile-subagent-events-contract.md +0 -101
- package/docs/retro/0426-consolidate-residual-test-clone-families.md +0 -100
- package/docs/retro/0427-reconsider-ui-direction.md +0 -102
- package/docs/retro/0441-remove-agent-definition-management-subtree.md +0 -97
- package/docs/retro/0442-dissolve-agents-conversation-viewer.md +0 -108
- package/docs/retro/0443-consolidate-remaining-test-clone-families.md +0 -28
- package/docs/retro/0444-shrink-widget-to-background-agents.md +0 -81
- package/docs/retro/0445-native-session-navigation.md +0 -122
- package/docs/retro/0446-spike-session-navigation-entry-criteria.md +0 -99
- package/docs/retro/0447-extract-subagents-settings-command.md +0 -91
- package/docs/retro/0448-block-disabled-agent-spawn.md +0 -75
- package/docs/retro/0462-navigation-renderer-tui-components.md +0 -105
- package/docs/retro/0463-file-snapshot-source-evicted-agents.md +0 -103
- package/docs/retro/0470-refresh-readme-command-surface.md +0 -40
- package/src/observation/notification-state.ts +0 -27
- package/vitest.config.ts +0 -14
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 54
|
|
3
|
-
issue_title: "refactor: decompose src/index.ts into tool + menu modules"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #54 — decompose index.ts into tool + menu modules
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-18T02:20:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Decomposed `src/index.ts` from 1,619 lines to 265 lines across 8 commits.
|
|
13
|
-
Extracted 7 new modules (`tools/helpers.ts`, `renderer.ts`, `notification.ts`, `tools/agent-tool.ts`, `tools/get-result-tool.ts`, `tools/steer-tool.ts`, `ui/agent-menu.ts`) with 66 new tests (379 → 445 total).
|
|
14
|
-
Released as `pi-subagents-v4.1.1`.
|
|
15
|
-
Filed follow-up #66 (replace `as any` casts with proper SDK types) and #67 (flaky `pi-autoformat` acceptance test).
|
|
16
|
-
|
|
17
|
-
### Observations
|
|
18
|
-
|
|
19
|
-
#### What went well
|
|
20
|
-
|
|
21
|
-
- Leaf-first extraction order worked cleanly — helpers, then renderer, then notification, then tools, then menu.
|
|
22
|
-
Each step left the repo green with no cascading breakage.
|
|
23
|
-
- The `createNotificationSystem` factory pattern with arrow-closure capture of `widget` (assigned after `AgentManager` construction) preserved the existing deferred-reference semantics without restructuring initialization order.
|
|
24
|
-
|
|
25
|
-
#### What caused friction (agent side)
|
|
26
|
-
|
|
27
|
-
- `wrong-abstraction` — Applied the code-style skill's "keep Pi SDK imports out of business-logic modules" rule to tool/menu modules, which are SDK consumers, not business logic.
|
|
28
|
-
Used `unknown` for `ExtensionContext`, `AgentSession`, `ModelRegistry` in factory dep interfaces, requiring 9 `as any` casts in `index.ts`.
|
|
29
|
-
User caught this post-ship.
|
|
30
|
-
Impact: filed #66 as a follow-up cleanup; the casts are cosmetic (no runtime effect) but degrade type safety.
|
|
31
|
-
Fixed the code-style skill to clarify the boundary. (user-caught)
|
|
32
|
-
|
|
33
|
-
- `missing-context` — Four test files (`notification.test.ts`, `get-result-tool.test.ts`, `steer-tool.test.ts`, `agent-tool.test.ts`) omitted `compactionCount: 0` from `AgentRecord` factories.
|
|
34
|
-
Caught at the final `pnpm run check` step, not during test writing.
|
|
35
|
-
The testing skill already says "grep for ALL test files that construct a compatible mock."
|
|
36
|
-
Impact: one extra fix cycle delegated to a subagent, no rework beyond that step. (self-identified)
|
|
37
|
-
|
|
38
|
-
- `other` — `Edit` tool failed 3 times matching the UTF-8 middle dot (`·`, U+00B7) in the steer tool's `stateParts.join(" · ")` line.
|
|
39
|
-
The third attempt produced a partial match that left the file in a broken state (dangling orphan code after the replacement anchor).
|
|
40
|
-
Required `git restore` and a fallback to `python3` line-range replacement.
|
|
41
|
-
The same `python3` approach for the menu extraction lost the closing `}` of the default export function.
|
|
42
|
-
Impact: ~5 minutes of rework across the two extraction steps, plus one `git restore`.
|
|
43
|
-
|
|
44
|
-
#### What caused friction (user side)
|
|
45
|
-
|
|
46
|
-
- The `as any` casts could have been caught earlier if the user had flagged the `unknown` types during the planning phase.
|
|
47
|
-
However, the plan didn't prescribe exact interface types — that was an implementation decision.
|
|
48
|
-
The user's post-ship review ("Why did we have to cast `as any`?
|
|
49
|
-
Take a look at `packages/pi-permission-system/` as a model") was an efficient redirect that immediately scoped the investigation.
|
|
50
|
-
|
|
51
|
-
### Changes made
|
|
52
|
-
|
|
53
|
-
1. `.pi/skills/code-style/SKILL.md` — Clarified SDK-boundary guidance: tool definitions, event handlers, and command handlers may import SDK types directly; the restriction targets pure helpers and domain modules.
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 57
|
|
3
|
-
issue_title: "feat: structured debug logging for silenced catch blocks"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #57 — structured debug logging for silenced catch blocks
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-19T10:30:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Added `src/debug.ts` with `debugLog` and `isDebug()`, then threaded `debugLog` into ~20 silent `catch` blocks across 9 files.
|
|
13
|
-
All 7 TDD cycles went green on the first pass with no rework.
|
|
14
|
-
Shipped as `pi-subagents-v5.1.0`, then followed up with a `refactor:` commit converting `DEBUG` (module-level constant) to `isDebug()` (function getter) during the retro.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- The plan's "Non-Goals" section correctly excluded `usage.ts` and `settings.ts` before implementation started, and a post-TDD `grep -rn 'catch\s*{'` confirmed only those two in-scope-excluded files remained.
|
|
21
|
-
Closing the loop with a verification query is worth repeating.
|
|
22
|
-
- The scope of the change was so well-defined (the issue listed exact file names) that no `ask_user` call was needed during planning.
|
|
23
|
-
|
|
24
|
-
#### What caused friction (agent side)
|
|
25
|
-
|
|
26
|
-
- `missing-context` — When loading the `ask-user` skill I guessed `.pi/skills/ask-user/SKILL.md` before reading the actual `<location>` tag in `AGENTS.md`, triggering an ENOENT error and a follow-up `find` call.
|
|
27
|
-
Impact: 2 extra tool calls, no rework. (self-identified)
|
|
28
|
-
|
|
29
|
-
- `other` — The plan's TDD Order step 1 stated *"the test skill documents this pattern"* for `vi.resetModules()` + dynamic import when testing module-level env constants — but the testing skill does not have that entry.
|
|
30
|
-
The aspiration was recorded rather than verified.
|
|
31
|
-
During the retro, the user's question ("should that be a function getter instead?") led to a better outcome: replace the module-level constant with `isDebug()` so `vi.stubEnv()` alone works, consistent with how every other `process.env` read in this codebase is structured.
|
|
32
|
-
Impact: one retro-phase `refactor:` commit; the approach shipped in `v5.1.0` was technically correct but unnecessarily complex to test.
|
|
33
|
-
|
|
34
|
-
#### What caused friction (user side)
|
|
35
|
-
|
|
36
|
-
- The initial issue proposal chose the module-level-constant pattern (common in Node.js tooling like the `debug` package).
|
|
37
|
-
A note in the issue or plan about preferring function-based env reads for testability would have caught this at design time rather than post-ship.
|
|
38
|
-
That said, the retro question was efficient — a single targeted redirect resolved it cleanly.
|
|
39
|
-
|
|
40
|
-
### Changes made
|
|
41
|
-
|
|
42
|
-
1. `packages/pi-subagents/src/debug.ts` — replaced `export const DEBUG` with `export function isDebug()`.
|
|
43
|
-
2. `packages/pi-subagents/test/debug.test.ts` — simplified to static import + `vi.stubEnv()` only; removed all `vi.resetModules()` + dynamic `import()` calls.
|
|
44
|
-
3. `.pi/skills/testing/SKILL.md` — added bullet: prefer reading `process.env` inside functions; `vi.stubEnv()` alone is insufficient for module-level constants.
|
|
45
|
-
|
|
46
|
-
## Follow-up Retrospective (2026-05-19T11:15:00Z)
|
|
47
|
-
|
|
48
|
-
### Session summary
|
|
49
|
-
|
|
50
|
-
The user asked how many `process.*` reads exist in `pi-subagents`.
|
|
51
|
-
Audit found 9 sites: 4 acceptable (wiring layer, detection functions, injectable defaults), 2 genuine injection gaps, and 1 mild case.
|
|
52
|
-
Filed #76 (`AgentManager.dispose()` reads `process.cwd()` without a stored `cwd`) and #77 (`createAgentsMenuHandler` hardcodes `process.cwd()` when `AgentMenuDeps` already injects the personal-side equivalent).
|
|
53
|
-
|
|
54
|
-
### Observations
|
|
55
|
-
|
|
56
|
-
#### What went well
|
|
57
|
-
|
|
58
|
-
- The `isDebug()` refactor naturally led the user to ask a broader design question about `process.*` access patterns, producing two well-scoped follow-up issues without manual triage.
|
|
59
|
-
- The audit categorization (genuinely problematic vs. acceptable) was clean — presenting a table with verdicts per site let the user decide scope without re-reading source.
|
|
60
|
-
|
|
61
|
-
#### What caused friction (agent side)
|
|
62
|
-
|
|
63
|
-
- `premature-convergence` — The original plan accepted the module-level `DEBUG` constant without checking how the rest of the codebase reads `process.env`.
|
|
64
|
-
The code-style skill said "keep IO at the edges" but didn't name `process.*` specifically, so the rule wasn't applied.
|
|
65
|
-
Impact: one post-ship `refactor:` commit to replace `DEBUG` with `isDebug()`; the pattern was technically correct but inconsistent with codebase conventions. (user-caught)
|
|
66
|
-
|
|
67
|
-
#### What caused friction (user side)
|
|
68
|
-
|
|
69
|
-
- Nothing notable.
|
|
70
|
-
The user's two redirecting questions ("should that be a function?"
|
|
71
|
-
and "how many places access `process.*`?") were well-timed interventions that broadened scope productively.
|
|
72
|
-
|
|
73
|
-
### Changes made
|
|
74
|
-
|
|
75
|
-
1. `.pi/skills/code-style/SKILL.md` — added bullet: do not read `process.env`, `process.cwd()`, or `process.platform` inside library/utility functions; accept the value as a parameter.
|
|
76
|
-
2. Filed #76 — inject `cwd` into `AgentManager` constructor.
|
|
77
|
-
3. Filed #77 — add `projectAgentsDir` to `AgentMenuDeps`.
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 61
|
|
3
|
-
issue_title: "feat: port subagent transcript logging to Pi's official JSONL session format"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #61 — port subagent transcript logging to Pi's official JSONL session format
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-20T17:15:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Planned, implemented, and shipped a migration from the bespoke `output-file.ts` transcript format to Pi's official JSONL session format via `SessionManager.create()`.
|
|
13
|
-
The change replaced 143 lines of manual streaming code with 3 lines leveraging the SDK's native persistence, nested subagent sessions under the parent session directory with `parentSession` header linking.
|
|
14
|
-
Released as `pi-subagents-v6.0.0` (major version bump due to breaking transcript format change).
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- The plan-to-implementation translation was clean: 6 TDD steps mapped to 7 commits (one extra `fix:` for biome lint).
|
|
21
|
-
No steps needed reordering or merging.
|
|
22
|
-
- The `ask_user` design decision gates during planning (persistence strategy, file location) produced clear answers that avoided rework during implementation.
|
|
23
|
-
- Research into nicobailon/pi-subagents, edxeth/pi-subagents, and HazAT/pi-interactive-subagents provided useful reference for the session directory layout, confirming the parent-relative nesting pattern.
|
|
24
|
-
- The biome lint catch on the unused `cwd` parameter led to a better design — incorporating `cwd` into the temp fallback path for project namespacing — rather than a mechanical underscore prefix.
|
|
25
|
-
|
|
26
|
-
#### What caused friction (agent side)
|
|
27
|
-
|
|
28
|
-
- `missing-context` — The plan listed test impact for `agent-runner.test.ts` but didn't grep for other test files mocking `SessionManager` or `ctx.sessionManager`.
|
|
29
|
-
Three additional files needed updating: `agent-runner-extension-tools.test.ts`, `print-mode.test.ts`, and `test/tools/agent-tool.test.ts`.
|
|
30
|
-
The testing skill explicitly says "grep for ALL test files that construct a compatible mock — not just factory helpers."
|
|
31
|
-
Impact: ~5 minutes of reactive fixes during Step 4.
|
|
32
|
-
Self-identified at implementation time.
|
|
33
|
-
|
|
34
|
-
- `missing-context` — The plan didn't account for the timing difference between the old synchronous `record.outputFile` assignment (immediately after `spawn()`) and the new asynchronous availability (after `SessionManager.create()` runs inside `runAgent()`).
|
|
35
|
-
This required adding `session.sessionManager.getSessionFile()` in the `onSessionCreated` callback — a design decision made during implementation.
|
|
36
|
-
Impact: minor within-step rework, no extra commit needed.
|
|
37
|
-
|
|
38
|
-
#### What caused friction (user side)
|
|
39
|
-
|
|
40
|
-
- The dependency update to 0.75.4 was a reasonable pre-plan request, but it added ~10 minutes of tangential work (diagnosing `pnpm update` resolution behavior, normalizing version specifiers).
|
|
41
|
-
This could have been a separate commit/session, though batching it was pragmatic since it gave the plan access to the latest SDK types.
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 66
|
|
3
|
-
issue_title: "refactor: replace `as any` casts in extracted tool/menu factories with proper SDK types"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #66 — replace `as any` casts with proper SDK types
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-20T18:50:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Replaced all 14 `as any` casts in `src/index.ts` by typing 5 factory dep interfaces with proper SDK types (`ExtensionContext`, `AgentSession`, `ExtensionAPI`, `ModelRegistry`) and the newly-exported `SpawnOptions`.
|
|
13
|
-
Released as `pi-subagents-v5.8.1` with zero behavioral change across 520 tests.
|
|
14
|
-
The plan, implementation, and shipping were completed in a single session with 6 implementation commits.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- Thorough context-gathering during planning paid off: reading all 5 dep interfaces, the SDK `.d.ts` files, test mock helpers, and the `ExtensionUIContext` shape before writing the plan meant most steps landed on first `pnpm run check`.
|
|
21
|
-
- The plan's risk table anticipated the cascading `as any` issue on `createAgentTool` and prepared a mitigation ("add explicit `satisfies ToolDefinition<…>` if needed"), which was close to the actual fix needed.
|
|
22
|
-
- Steps 4 and 5 (`GetResultDeps`, `SteerToolDeps`) were trivially clean — single-type-import changes that compiled immediately.
|
|
23
|
-
|
|
24
|
-
#### What caused friction (agent side)
|
|
25
|
-
|
|
26
|
-
- `missing-context` — The plan assumed `NotificationDeps.sendMessage.display` could be optional (`display?: boolean`) but the SDK's `CustomMessage.display` is required `boolean`.
|
|
27
|
-
First `pnpm run check` after step 2 failed; required one extra edit-verify cycle.
|
|
28
|
-
Impact: added friction but no rework (fixed in the same commit).
|
|
29
|
-
|
|
30
|
-
- `missing-context` — The plan did not check the `execute` function's full signature in `agent-tool.ts`.
|
|
31
|
-
Removing the outer `as any` on `createAgentTool({...})` exposed three additional type mismatches: `onUpdate` parameter type (`unknown` vs `AgentToolResult<any>`), `signal` optionality (`AbortSignal` vs `AbortSignal | undefined`), and `params.description` (`unknown` vs `string`).
|
|
32
|
-
The plan flagged cascading risk but assumed only the return type would be affected.
|
|
33
|
-
Impact: step 3 required three extra edits and two extra `pnpm run check` cycles, noted as a deviation in the commit body.
|
|
34
|
-
|
|
35
|
-
- `missing-context` — Steps 6 and 7 had to be folded into one commit.
|
|
36
|
-
The plan listed them as independent steps but typing `AgentMenuManager.spawnAndWait(ctx: ExtensionContext)` immediately made `MenuContext` incompatible — `showGenerateWizard` passes `ctx: MenuContext` to the dep callback that now expects `ExtensionContext`.
|
|
37
|
-
The testing skill already warns: "when a TDD plan lists separate steps that share a type definition, changing that type in step N breaks steps N+1…N+k."
|
|
38
|
-
The planner failed to recognize that `MenuContext` and `AgentMenuManager.spawnAndWait` share a type dependency through `ctx`.
|
|
39
|
-
Impact: no rework — the steps were folded successfully — but the plan's step count was inaccurate.
|
|
40
|
-
|
|
41
|
-
#### What caused friction (user side)
|
|
42
|
-
|
|
43
|
-
- No user-side friction observed.
|
|
44
|
-
The user ran three sequential prompts (`/plan-issue 66`, `/tdd-plan`, `/ship-issue`) with no corrections or redirects needed.
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 69
|
|
3
|
-
issue_title: "refactor: eliminate module-scope mutable state in pi-subagents — create SubagentRuntime"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #69 — create SubagentRuntime
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-19T16:47:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Planned, implemented, and shipped `SubagentRuntime` — a composition-root object that replaces module-scope mutable state in `agent-runner.ts` and closure-scoped state in `index.ts`.
|
|
13
|
-
Six TDD steps completed with one deviation: `agent-tool.ts` and `agent-menu.ts` also imported the removed getter/setter exports, requiring unplanned fixes.
|
|
14
|
-
Released as `pi-subagents-v5.2.0`.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- The lift-and-shift strategy (introduce `RunOptions` fields alongside module-scope fallback, wire consumers, then remove old path) kept the 460-test suite green through every intermediate commit.
|
|
21
|
-
No step broke existing tests.
|
|
22
|
-
- `pnpm run check` caught the two missing downstream files (`agent-tool.ts`, `agent-menu.ts`) immediately after the removal step.
|
|
23
|
-
The typecheck-after-removal safety net worked exactly as intended.
|
|
24
|
-
- The `pi-permission-system` prior art (`ExtensionRuntime` in #43) provided a clear structural template, reducing design decisions to near zero.
|
|
25
|
-
|
|
26
|
-
#### What caused friction (agent side)
|
|
27
|
-
|
|
28
|
-
- `missing-context` — The plan's Module-Level Changes listed `agent-runner.ts`, `agent-manager.ts`, and `index.ts` but missed `src/tools/agent-tool.ts` and `src/ui/agent-menu.ts`, both of which imported `getDefaultMaxTurns`/`setDefaultMaxTurns`/`getGraceTurns`/`setGraceTurns` from `agent-runner.ts`.
|
|
29
|
-
A grep for all importers of the removed symbols during planning would have caught this.
|
|
30
|
-
Impact: 4 extra files touched in step 5 (the two source files + their test helpers); no rework of earlier steps, but the commit scope was wider than planned. (self-identified at `pnpm run check` time)
|
|
31
|
-
|
|
32
|
-
- `missing-context` — In step 3 (`agent-manager.test.ts`), checked `vi.mocked(runAgent).mock.calls[0]` without clearing the mock first.
|
|
33
|
-
The module-level `vi.mock("../src/agent-runner.js")` is shared across all describe blocks, so `calls[0]` picked up a stale invocation from an earlier test.
|
|
34
|
-
Impact: one debug cycle adding `vi.mocked(runAgent).mockClear()` after `resolvedRun()`. (self-identified)
|
|
35
|
-
|
|
36
|
-
#### What caused friction (user side)
|
|
37
|
-
|
|
38
|
-
- Nothing notable.
|
|
39
|
-
The plan was unambiguous, and the session ran without user intervention beyond the initial prompts.
|
|
40
|
-
|
|
41
|
-
### Changes made
|
|
42
|
-
|
|
43
|
-
1. `.pi/prompts/plan-issue.md` — added grep-importers rule to the Module-Level Changes bullet: when a step removes or renames an export, grep all `src/` and `test/` files for every removed symbol before finalizing the file list.
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 70
|
|
3
|
-
issue_title: "refactor: extract event handlers from pi-subagents index.ts into src/handlers/"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #70 — extract event handlers from index.ts
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-20T19:30:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Planned and implemented #70 — extracting four inline event handler lambdas from `src/index.ts` into `src/handlers/lifecycle.ts` (`SessionLifecycleHandler` class) and `src/handlers/tool-start.ts` (`ToolStartHandler` class).
|
|
13
|
-
During planning, the user identified that the initial plain-function design missed shared collaborators and structural smells, prompting a redesign to class-based handlers and a predecessor issue (#87) to evolve `SubagentRuntime` from a data bag to an object with methods.
|
|
14
|
-
Released as `pi-subagents-v5.8.0` with 8 new handler tests (520 total).
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- The user's progressive questioning during planning ("Are you confident?", "Keep digging", Kent Beck quote) surfaced two concrete structural smells — output arguments on `runtime.currentCtx` writes and 8 LoD violations via `runtime.widget!` reach-throughs — that the initial design would have just relocated rather than fixed.
|
|
21
|
-
- Filing predecessor #87 was the right sequencing call.
|
|
22
|
-
By the time #70 executed, the runtime had proper methods and the handler extraction was purely mechanical.
|
|
23
|
-
- The 3-step TDD cycle executed cleanly with zero rework or deviations from the plan.
|
|
24
|
-
The only issue was a `tsc` type error (`vi.fn()` return type not assignable to `() => void`) caught during the post-TDD type check and fixed in-place before the final commit.
|
|
25
|
-
|
|
26
|
-
#### What caused friction (agent side)
|
|
27
|
-
|
|
28
|
-
- `premature-convergence` — The initial plan used plain functions with per-call `LifecycleDeps`/`ToolStartDeps` interfaces, the first viable approach, without analyzing whether handlers shared collaborators.
|
|
29
|
-
The user had to prompt three times before I switched to class-based handlers with constructor-injected shared deps.
|
|
30
|
-
Impact: three rounds of plan revision before the design was correct; no rework commits, but significant planning churn.
|
|
31
|
-
|
|
32
|
-
- `instruction-violation` (user-caught) — The `/plan-issue` prompt says "load the `design-review` skill and run its checklist on the affected modules."
|
|
33
|
-
I loaded the skill but did not actually run the checklist (grep for access patterns, check LoD, check output arguments) until the user explicitly told me to "keep digging."
|
|
34
|
-
Had I run the checklist proactively, the output-argument and LoD findings would have surfaced on the first pass, and the predecessor issue (#87) would have been identified without user escalation.
|
|
35
|
-
Impact: user had to escalate three times; planning took ~3× longer than necessary.
|
|
36
|
-
|
|
37
|
-
- `wrong-abstraction` — I initially reasoned at the mechanical level ("handlers are small, 1–5 lines, so plain functions are fine") instead of the structural level ("do these handlers share collaborators that a class captures naturally?").
|
|
38
|
-
The code-style skill explicitly says "Do not pass a shared dependency bag to functions that only use a subset" — but I applied it backwards (splitting into per-function deps) rather than recognizing the shared deps as a class cohesion signal.
|
|
39
|
-
Impact: same as premature-convergence above; folded into the same rework cycle.
|
|
40
|
-
|
|
41
|
-
#### What caused friction (user side)
|
|
42
|
-
|
|
43
|
-
- The progressive escalation approach (question → directive → quote) was effective pedagogically but required three turns of user attention on what a proactive design-review checklist run would have caught automatically.
|
|
44
|
-
Earlier intervention with a specific redirect (e.g., "Run the design-review checklist before writing the plan") could have resolved it in one turn.
|
|
45
|
-
|
|
46
|
-
### Changes made
|
|
47
|
-
|
|
48
|
-
1. Retro file created at `packages/pi-subagents/docs/retro/0070-extract-event-handlers.md`.
|
|
49
|
-
2. Updated `packages/pi-subagents/docs/architecture/architecture.md` — marked #87 and #70 as done (✓), updated Phase 2 status to complete, updated next-issue pointer to #66.
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 71
|
|
3
|
-
issue_title: "refactor: extract pure agent-session assembler from agent-runner.ts"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #71 - extract session-config assembler
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-19T22:15:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Planned, implemented, and shipped `assembleSessionConfig()` - a pure configuration assembler extracted from `runAgent()` in `agent-runner.ts`.
|
|
13
|
-
Eight TDD steps completed across three phases (plan, implement, ship), adding 33 new tests in `test/session-config.test.ts` and reducing `runAgent()` from ~390 lines to ~198.
|
|
14
|
-
Released as `pi-subagents-v5.3.0`.
|
|
15
|
-
Filed follow-up #80 (consolidate `getConfig`/`getAgentConfig`) and updated the architecture roadmap.
|
|
16
|
-
|
|
17
|
-
### Observations
|
|
18
|
-
|
|
19
|
-
#### What went well
|
|
20
|
-
|
|
21
|
-
- The user's redirecting question ("Do we need more decomposition?
|
|
22
|
-
Are there any seams we can exploit?") at the `as any` fix point was perfectly timed.
|
|
23
|
-
It shifted the approach from mechanical casting (8 `as any` casts) to a structural fix: `unknown` for opaque model handles, `Array<{ provider: string; id: string }>` for the availability check.
|
|
24
|
-
The final design removed the `@earendil-works/pi-ai` import from `session-config.ts` entirely - cleaner than the plan's original specification of `Model<any>`.
|
|
25
|
-
- The prior art from `pi-permission-system` (`evaluate()` extraction) provided a clear template for the pure-core-from-IO-shell pattern.
|
|
26
|
-
Design decisions were minimal.
|
|
27
|
-
- All 451 existing tests stayed green through every intermediate commit.
|
|
28
|
-
The mock-at-module-boundary strategy (`vi.mock("../src/agent-types.js")` etc.) meant existing `agent-runner.test.ts` mocks continued to intercept the same module paths even after the assembler delegated to them.
|
|
29
|
-
|
|
30
|
-
#### What caused friction (agent side)
|
|
31
|
-
|
|
32
|
-
- `premature-convergence` - When `pnpm run check` surfaced 10 type errors from `Model<any>` in `SessionConfig`, the first fix attempt was adding `as any` casts to the `vi.fn` factory return values and all test model objects (8 casts total).
|
|
33
|
-
This partially addressed the symptom but created new `never[]` inference errors and left a fundamentally wrong interface.
|
|
34
|
-
The user's first pushback ("Can we find a real type?") prompted a proper analysis of `Model<TApi>`'s ~10 required fields, leading to the `unknown` solution.
|
|
35
|
-
Impact: ~20 minutes of rework across 3 attempts (the `as any` factory cast, diagnosing the residual `never[]` errors, and the final `unknown` rewrite). (user-caught)
|
|
36
|
-
|
|
37
|
-
- `missing-context` - The plan omitted `agentMaxTurns` from the `SessionConfig` return type.
|
|
38
|
-
`runAgent()`'s turn-limit resolution reads `agentConfig?.maxTurns`, which is no longer available after the assembly delegation.
|
|
39
|
-
Caught during step 7 (wiring) when the code wouldn't compile without it.
|
|
40
|
-
Impact: added one field to `SessionConfig` and `assembleSessionConfig`; no rework of earlier steps, but the commit body noted the deviation. (self-identified at implementation time)
|
|
41
|
-
|
|
42
|
-
- `missing-context` - The `vi.fn(() => [])` → `never[]` TypeScript inference issue wasn't anticipated.
|
|
43
|
-
Five mock factories (`mockGetMemoryToolNames`, `mockGetReadOnlyMemoryToolNames`, `mockPreloadSkills`, `mockRegistry.find`, `mockRegistry.getAvailable`) needed explicit return-type annotations.
|
|
44
|
-
Impact: one debug cycle to diagnose, then a second to fix with `import type` annotations. (self-identified during `pnpm run check`)
|
|
45
|
-
|
|
46
|
-
#### What caused friction (user side)
|
|
47
|
-
|
|
48
|
-
- The user's second pushback ("Do we need more decomposition?") was the highest-leverage intervention in the session.
|
|
49
|
-
Without it, the `as any` approach would have landed and the `pi-ai` import would have stayed in `session-config.ts` - defeating the goal of a SDK-free business-logic module.
|
|
50
|
-
The pattern of catching design-level issues through "is there a better seam?"
|
|
51
|
-
questions is worth preserving.
|
|
52
|
-
|
|
53
|
-
#### Design observations (not actionable as rules)
|
|
54
|
-
|
|
55
|
-
- The `cfg.model as Model<any> | undefined` cast in `agent-runner.ts` is a legitimate interim cost — it's one line at the SDK boundary and will be resolved when #66 (replace `as any` casts with proper SDK types) and #72 (AgentManager DI) refine the interface contracts.
|
|
56
|
-
Codifying “use `unknown` + boundary cast” as a general pattern would normalize something that should feel uncomfortable and motivate further interface refinement.
|
|
57
|
-
|
|
58
|
-
### Changes made
|
|
59
|
-
|
|
60
|
-
1. `.pi/skills/testing/SKILL.md` — added `vi.fn()` return-type annotation rule under “Vitest mock patterns”: annotate factories that return empty arrays or narrow literals to prevent `never[]` inference.
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 72
|
|
3
|
-
issue_title: "refactor: dependency-inject AgentManager's collaborators"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #72 — dependency-inject AgentManager's collaborators
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-20T17:50:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Defined `AgentRunner` and `WorktreeManager` interfaces, converted `AgentManager`'s 6-positional-parameter constructor to an options bag with injected collaborators, migrated all 19 test sites from `vi.mock()` to `vi.fn()` stubs, and added 7 new DI-enabled tests.
|
|
13
|
-
The planning phase required significant user redirection to arrive at the right abstractions; the TDD execution phase was clean with zero rework.
|
|
14
|
-
Released as `pi-subagents-v5.6.0`.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- The `ask_user` interactions during planning surfaced genuine design decisions (options bag vs positional constructor, lifecycle callback grouping) that the issue body left open.
|
|
21
|
-
The user's responses were substantive and redirecting.
|
|
22
|
-
- The user's "make the change that makes the change easy" framing identified #84 (`GitWorktreeManager` extraction) as a prerequisite, which made #72's implementation clean — zero type-shuffling needed.
|
|
23
|
-
- The lift-and-shift test migration (Phase B → Phase C) worked exactly as planned: introduce `createManager()` helper under the old constructor, then switch it to the options bag atomically.
|
|
24
|
-
All 19 test sites migrated with no logic changes.
|
|
25
|
-
- `Promise.withResolvers` (ES2024) in the new queueing test made controlled async coordination clean — no manual resolve/reject wiring.
|
|
26
|
-
|
|
27
|
-
#### What caused friction (agent side)
|
|
28
|
-
|
|
29
|
-
- `wrong-abstraction` — Spent ~4 analysis cycles on "how to move types between files" (`ToolActivity`, `RunOptions`, `WorktreeInfo` → `types.ts`) when the real question was "what objects want to exist?"
|
|
30
|
-
The user had to redirect three times: "are there real objects with state?", "what state IS in AgentRunner?", and "we haven't pulled all the threads."
|
|
31
|
-
Impact: added ~10 minutes of back-and-forth during planning, but ultimately produced a better design (stateful `WorktreeManager` vs stateless `AgentRunner` seam, plus #84 as prep).
|
|
32
|
-
The dependency-graph analysis itself was sound — it confirmed no circular deps — but it answered a question nobody was asking.
|
|
33
|
-
|
|
34
|
-
- `premature-convergence` — First draft of the plan included `WorktreeManager` extraction as "Phase A step 1" inside #72.
|
|
35
|
-
The user asked "did we create another issue that we need to tackle first?"
|
|
36
|
-
— pointing out that the prep work should be its own issue.
|
|
37
|
-
Impact: minor rework to update the plan and file #84; no code rework since it was caught during planning. (User-caught.)
|
|
38
|
-
|
|
39
|
-
#### What caused friction (user side)
|
|
40
|
-
|
|
41
|
-
- The user's early redirect ("take a step back — does the AgentManager really need six params?") could have been even more direct — e.g., "before we discuss constructor shape, what higher-level abstractions are missing?"
|
|
42
|
-
That said, the Socratic approach ultimately led to a better shared understanding of why `WorktreeManager` is a real object and `AgentRunner` is a seam.
|
|
43
|
-
|
|
44
|
-
### Changes made
|
|
45
|
-
|
|
46
|
-
1. Retro file created at `packages/pi-subagents/docs/retro/0072-inject-agent-manager-collaborators.md`.
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 76
|
|
3
|
-
issue_title: "refactor: inject cwd into AgentManager constructor instead of reading process.cwd() in dispose()"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #76 — inject cwd into AgentManager constructor
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-19T21:00:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Planned, implemented, and shipped a single-step refactoring that injects `cwd: string` into the `AgentManager` constructor, replacing the `process.cwd()` call in `dispose()` with `this.cwd`.
|
|
13
|
-
Released as `pi-subagents-v5.4.1`.
|
|
14
|
-
The entire cycle (plan → TDD → ship → release) completed in one session with one minor friction point.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- Clean single-commit implementation: one `refactor:` commit touched 3 files, updated 18 test constructor calls plus one production call site, and added one new assertion — all green on first run.
|
|
21
|
-
- TDD Red phase worked well despite the plan calling this a "single-step refactoring."
|
|
22
|
-
Writing a new test (`"calls pruneWorktrees with the cwd passed to the constructor"`) gave a clear Red signal before the implementation change, even though the constructor signature change had to be applied atomically.
|
|
23
|
-
|
|
24
|
-
#### What caused friction (agent side)
|
|
25
|
-
|
|
26
|
-
- `wrong-abstraction` — The plan's "Test Impact Analysis" stated "No new unit tests are needed" and framed existing tests as sufficient.
|
|
27
|
-
In practice, the existing tests only called `dispose()` in `afterEach` hooks without assertions on `pruneWorktrees` arguments, so a new test was needed for a proper Red phase.
|
|
28
|
-
The user noticed the discrepancy before TDD began ("We will at least alter some tests, right?").
|
|
29
|
-
Impact: one clarifying exchange, no rework.
|
|
30
|
-
User-caught.
|
|
31
|
-
|
|
32
|
-
#### What caused friction (user side)
|
|
33
|
-
|
|
34
|
-
- None observed.
|
|
35
|
-
The user's question about test changes was a useful early catch that would have surfaced during TDD anyway.
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 77
|
|
3
|
-
issue_title: "refactor: add projectAgentsDir to AgentMenuDeps instead of reading process.cwd() inline"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #77 — inject projectAgentsDir into AgentMenuDeps
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-20T16:15:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Planned, implemented, and shipped a refactoring that adds `projectAgentsDir: string` to `AgentMenuDeps`, replacing the inline `process.cwd()` lambda in `createAgentsMenuHandler`.
|
|
13
|
-
The change mirrors the existing `personalAgentsDir` injection pattern.
|
|
14
|
-
Released as `pi-subagents-v5.8.2`.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- Clean end-to-end execution: plan → TDD → ship with zero corrections or rework.
|
|
21
|
-
- The Red test was well-targeted: exercised `findAgentFile` through the menu navigation path and naturally failed because `process.cwd()` produced a different path than the injected `/test-project/.pi/agents`.
|
|
22
|
-
- Correctly identified at execution time that the plan's two-step TDD split was impractical (interface change is atomic) and combined into a single `refactor:` commit.
|
|
23
|
-
|
|
24
|
-
#### What caused friction (agent side)
|
|
25
|
-
|
|
26
|
-
- `instruction-violation` — The plan listed two TDD commits (step 1: `test:`, step 2: `refactor:`) but adding a required field to `AgentMenuDeps` is an atomic change — the test references the new field, so both must land together.
|
|
27
|
-
The testing skill's shared-type-definition rule ("changing that type in step N breaks steps N+1…N+k — fold them into one step") should have been applied during planning.
|
|
28
|
-
Impact: added friction but no rework — the deviation was self-identified at execution time and the steps were combined.
|
|
29
|
-
Self-identified.
|
|
30
|
-
|
|
31
|
-
#### What caused friction (user side)
|
|
32
|
-
|
|
33
|
-
- None observed.
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 80
|
|
3
|
-
issue_title: "refactor: consolidate getConfig / getAgentConfig into a single resolution path"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #80 — consolidate getConfig / getAgentConfig
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-20T00:35:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Consolidated two overlapping agent config lookup functions (`getConfig` and `getAgentConfig`) into a single `resolveAgentConfig(type): AgentConfig` with a guaranteed-non-null return and internal fallback chain.
|
|
13
|
-
Migrated all 6 source callers and 5 test files across 6 TDD commits, then shipped as `pi-subagents-v5.4.0`.
|
|
14
|
-
|
|
15
|
-
### Observations
|
|
16
|
-
|
|
17
|
-
#### What went well
|
|
18
|
-
|
|
19
|
-
- The lift-and-shift migration strategy (add new function → migrate callers incrementally → remove old functions) kept every commit green.
|
|
20
|
-
No intermediate step broke the test suite.
|
|
21
|
-
- The planning phase correctly identified an under-documented scope question (callers beyond the two mentioned in the issue) and used `ask-user` to resolve it before writing the plan.
|
|
22
|
-
- The `test/prompts.test.ts` caller, missed by the plan, was caught cleanly during the final grep sweep in step 6 — no rework needed, just an additional edit in the same commit.
|
|
23
|
-
|
|
24
|
-
#### What caused friction (agent side)
|
|
25
|
-
|
|
26
|
-
- `missing-context` — The plan specified that `resolveAgentConfig` should fall back for disabled types (matching `getConfig`'s semantics), but didn't trace what `agent-menu.ts` actually reads from disabled configs.
|
|
27
|
-
`agent-menu.ts` iterates `getAllTypes()` (including disabled agents) and needs the real config to render `✕` indicators, source badges, and `(disabled)` descriptions.
|
|
28
|
-
With fallback-for-disabled semantics, disabled agents would silently display as general-purpose.
|
|
29
|
-
Caught during step 4 while editing `agent-menu.ts`, before any wrong test assertions ran.
|
|
30
|
-
Impact: required changing `resolveAgentConfig` semantics (only fall back for unknown types, not disabled) and updating the step 1 test — a ~5 minute fix folded into the step 4 commit.
|
|
31
|
-
|
|
32
|
-
#### What caused friction (user side)
|
|
33
|
-
|
|
34
|
-
- Nothing notable.
|
|
35
|
-
The user's `ask-user` response during planning ("remove both, migrate all callers") was clear and included a useful directional note about computing values earlier.
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 84
|
|
3
|
-
issue_title: "refactor: extract GitWorktreeManager class from worktree.ts free functions"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #84 — extract GitWorktreeManager class from worktree.ts free functions
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-20T13:31:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Extracted a `WorktreeManager` interface and `GitWorktreeManager` class from the three free functions in `worktree.ts`.
|
|
13
|
-
The two-step TDD cycle (add tests → add implementation) executed cleanly with no rework or deviations from the plan.
|
|
14
|
-
Released as `pi-subagents-v5.5.0`.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- The issue body included an exact "Proposed Interface" section with TypeScript code, which made the plan nearly mechanical and eliminated all design ambiguity.
|
|
21
|
-
The `ask-user` step was correctly skipped.
|
|
22
|
-
- The two-step TDD cycle was appropriately minimal for a thin delegation extraction — no over-engineering of the test or commit structure.
|
|
23
|
-
- The full pipeline (plan → TDD → ship → release) completed in a single pass with zero corrections.
|
|
24
|
-
|
|
25
|
-
#### What caused friction (agent side)
|
|
26
|
-
|
|
27
|
-
No friction observed.
|
|
28
|
-
The issue was well-scoped and the existing pipeline instructions handled every step.
|
|
29
|
-
|
|
30
|
-
#### What caused friction (user side)
|
|
31
|
-
|
|
32
|
-
No friction observed.
|
|
33
|
-
The pipeline was driven cleanly with `/plan-issue` → `/tdd-plan` → `/ship-issue`.
|
|
34
|
-
|
|
35
|
-
### Changes made
|
|
36
|
-
|
|
37
|
-
1. Retro file created at `packages/pi-subagents/docs/retro/0084-extract-git-worktree-manager.md`.
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 87
|
|
3
|
-
issue_title: "refactor: evolve SubagentRuntime from data bag to object with methods"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #87 — evolve SubagentRuntime from data bag to object with methods
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-20T18:00:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Planned, implemented, and shipped #87 — converting `SubagentRuntime` from a plain interface + factory into a class with session-context methods (`setSessionContext`, `clearSessionContext`) and widget delegation methods (`setUICtx`, `onTurnStart`, `markFinished`, `updateWidget`, `ensureTimer`).
|
|
13
|
-
All 10 call sites in `index.ts` were migrated, eliminating raw `currentCtx` field writes and `runtime.widget!` reach-throughs.
|
|
14
|
-
Released as `pi-subagents-v5.7.0`.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- The 3-step TDD cycle executed cleanly with zero rework or deviations from the plan.
|
|
21
|
-
Test count went from 5 → 16 in `runtime.test.ts`; all 512 package tests stayed green throughout.
|
|
22
|
-
- The user identified a missing architecture update and a pre-existing hallucination (`@earendil-works/pi-subagents` → `@gotgenes/pi-subagents`) after the plan commit.
|
|
23
|
-
The fix was a single well-scoped commit (`ddee1a0`) that corrected 10 scope references, updated the dependency graph to include #87 as a precursor to #70, and fixed list numbering per phase heading.
|
|
24
|
-
- The plan's "Call sites to migrate" tables with exact line numbers and before/after code made step 3 (the refactoring commit) purely mechanical — no design decisions at implementation time.
|
|
25
|
-
|
|
26
|
-
#### What caused friction (agent side)
|
|
27
|
-
|
|
28
|
-
- `missing-context` — In TDD step 2, the new `describe` block used `vi.fn()` but the test file's import was `{ describe, expect, it }` without `vi`.
|
|
29
|
-
The first red run surfaced this immediately (`ReferenceError: vi is not defined`) and it was fixed before the green step.
|
|
30
|
-
Impact: one extra test run, no rework commits.
|
|
31
|
-
- `scope-drift` — The `/plan-issue` prompt does not instruct updating `architecture.md`, but the user noticed #87 was missing from the roadmap's dependency graph.
|
|
32
|
-
The agent hadn't checked `architecture.md` during planning even though #87 is explicitly listed as a precursor to #70 in the #70 plan.
|
|
33
|
-
Impact: user-caught; required a follow-up edit pass after the plan commit.
|
|
34
|
-
|
|
35
|
-
#### What caused friction (user side)
|
|
36
|
-
|
|
37
|
-
No friction observed.
|
|
38
|
-
The user's correction about `architecture.md` was well-targeted and caught a real gap.
|
|
39
|
-
|
|
40
|
-
### Changes made
|
|
41
|
-
|
|
42
|
-
1. Retro file created at `packages/pi-subagents/docs/retro/0087-evolve-subagent-runtime-methods.md`.
|