@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,49 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 123
|
|
3
|
-
issue_title: "refactor(pi-subagents): remove vi.fn() cast smell from test helpers"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #123 — remove vi.fn() cast smell from test helpers
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-22T00:00:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Planned and implemented removal of all 9 `as ReturnType<typeof vi.fn>` casts and 5 `vi.mocked()` calls across 3 test files, replacing them with named typed mock variables.
|
|
13
|
-
Released as `pi-subagents-v6.8.1`.
|
|
14
|
-
Pure test hygiene — no production code changes, no behavioral changes, 652 tests unchanged.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- **Three-file scope executed cleanly once the plan was right.**
|
|
21
|
-
Each file was an independent commit with no cross-file dependencies.
|
|
22
|
-
The named-variable pattern (`const mockGetRecord = vi.fn<AgentManagerLike["getRecord"]>()`) worked identically across all three test files despite different mock construction styles (factory function vs `beforeEach` assignment).
|
|
23
|
-
|
|
24
|
-
#### What caused friction (agent side)
|
|
25
|
-
|
|
26
|
-
- `scope-drift` — The initial plan scoped the fix to `service-adapter.test.ts` only, listing `lifecycle.test.ts` and `tool-start.test.ts` as explicit Non-Goals — despite the planning-phase grep showing all 9 cast sites across 3 files.
|
|
27
|
-
The user redirected with "let's eliminate this pattern of behavior."
|
|
28
|
-
Updated the GitHub issue body, rewrote the plan, and amended the commit.
|
|
29
|
-
Impact: plan rewrite (~2 minutes), no implementation rework.
|
|
30
|
-
User-caught.
|
|
31
|
-
- `missing-context` — Imported `MockInstance` from `vitest` during step 1 (`service-adapter.test.ts`) but actually used `ReturnType<typeof vi.fn<...>>` — matching the pattern used in the other two files.
|
|
32
|
-
The unused import was caught by `pnpm run lint` at the post-implementation check, not proactively.
|
|
33
|
-
Impact: one extra edit + amend cycle.
|
|
34
|
-
Self-identified (via lint).
|
|
35
|
-
- `other` — Ran `git commit --amend` to fix the unused import but HEAD was step 3's commit (`tool-start`), not step 1's (`service-adapter`).
|
|
36
|
-
The amend landed the `service-adapter.test.ts` change into the wrong commit with the wrong message.
|
|
37
|
-
Required `git reset --soft` back to the plan commit and recommitting all 3 files.
|
|
38
|
-
Impact: ~1 minute of git surgery, clean result.
|
|
39
|
-
Self-identified.
|
|
40
|
-
|
|
41
|
-
#### What caused friction (user side)
|
|
42
|
-
|
|
43
|
-
- The issue body scoped the fix to `service-adapter.test.ts` only, which the agent followed literally.
|
|
44
|
-
The broader intent ("eliminate this pattern") was implicit.
|
|
45
|
-
Flagging the desired scope as "all files with this pattern" in the issue body would have avoided the plan rewrite.
|
|
46
|
-
|
|
47
|
-
### Changes made
|
|
48
|
-
|
|
49
|
-
1. Wrote retro file at `packages/pi-subagents/docs/retro/0123-remove-vi-fn-cast-smell.md`.
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 131
|
|
3
|
-
issue_title: Consolidate shared test fixtures
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #131 — Consolidate shared test fixtures
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-22T11:30:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Planned and implemented the consolidation of six duplicated test factories into two shared helpers (`createMockSession` in `test/helpers/mock-session.ts`, `createToolDeps` in `test/helpers/make-deps.ts`).
|
|
13
|
-
All 715 tests pass, released as `pi-subagents-v6.9.4`.
|
|
14
|
-
The implementation was a pure test refactor with no production code changes.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- The lift-and-shift approach worked cleanly: create factory → migrate one consumer at a time → verify green after each step.
|
|
21
|
-
Each migration commit was small and isolated, making failures easy to diagnose.
|
|
22
|
-
- Structural typing as a strategy proved out — `createToolDeps()` returns `AgentToolDeps` (the superset), and `spawnBackground(deps, ...)` and `runForeground(deps, ...)` accept their narrow `BackgroundDeps`/`ForegroundDeps` interfaces without any casting.
|
|
23
|
-
|
|
24
|
-
#### What caused friction (agent side)
|
|
25
|
-
|
|
26
|
-
- `missing-context` — Plan used `registry.resolve("general-purpose", "/dir")` in the `make-deps.test.ts` test, but `AgentTypeRegistry` has no `resolve` method — the correct method is `resolveAgentConfig()`.
|
|
27
|
-
Impact: one test failure during step 5 red→green, fixed immediately with no rework.
|
|
28
|
-
|
|
29
|
-
- `missing-context` — Default values differed between the old narrow factories and the new shared factory: `"bg-1"` vs `"agent-1"` for spawn IDs (`background-spawner.test.ts`), `"Task done."` vs `"All done."` for result text (`foreground-runner.test.ts`).
|
|
30
|
-
Impact: two test failures in step 7, one in step 8, each requiring assertion updates before the migration step could pass.
|
|
31
|
-
|
|
32
|
-
- `missing-context` — `MockSession` interface used `ReturnType<typeof vi.fn>` which expands to `Mock<Procedure | Constructable>` in Vitest v4 — a union type TypeScript cannot call.
|
|
33
|
-
Impact: `pnpm run check` failed after all TDD steps were done, requiring a separate `style:` commit to switch to explicitly parameterized `Mock<() => void>` etc.
|
|
34
|
-
|
|
35
|
-
- `missing-context` — Removed the `AgentToolDeps` import from `agent-tool.test.ts` without checking that the `execute()` helper still referenced it.
|
|
36
|
-
Impact: caught in the same `pnpm run check` pass, fixed in the same `style:` commit.
|
|
37
|
-
|
|
38
|
-
#### What caused friction (user side)
|
|
39
|
-
|
|
40
|
-
- No user-side friction observed.
|
|
41
|
-
The plan was unambiguous, and the session ran autonomously through all 8 TDD steps plus post-checks without intervention.
|
|
42
|
-
|
|
43
|
-
### Changes made
|
|
44
|
-
|
|
45
|
-
1. `.pi/skills/testing/SKILL.md` — added TDD planning rule for diffing default values when consolidating duplicate test factories.
|
|
46
|
-
2. `.pi/skills/testing/SKILL.md` — added Vitest mock pattern rule for typing mock fields with `Mock<specific-signature>` instead of `ReturnType<typeof vi.fn>`.
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 132
|
|
3
|
-
issue_title: "Inject IO collaborators into `assembleSessionConfig`"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #132 — Inject IO collaborators into `assembleSessionConfig`
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-22T12:25:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Defined an `AssemblerIO` interface bundling four IO/prompt collaborators, injected it into `assembleSessionConfig`, and updated `agent-runner.ts` to pass real implementations.
|
|
13
|
-
Eliminated all 4 `vi.mock()` calls in `session-config.test.ts`, flattened the `vi.hoisted()` block into plain `vi.fn()` declarations, and shifted assertions from mock-call verification to output-property checks.
|
|
14
|
-
Released as `pi-subagents-v6.10.0`.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- Perl two-pass replacement (multi-line then single-line) handled 40+ `assembleSessionConfig` call-site updates in one command with zero manual errors.
|
|
21
|
-
- Flattening `vi.hoisted()` into regular `vi.fn()` declarations in step 3 was a clean simplification — hoisting was only needed when the mocks were referenced inside `vi.mock()` factories.
|
|
22
|
-
- Real `getMemoryToolNames` / `getReadOnlyMemoryToolNames` worked as drop-in replacements with no test rework needed — the pure functions' behavior matched what the mocks were configured to return for all existing test scenarios.
|
|
23
|
-
|
|
24
|
-
#### What caused friction (agent side)
|
|
25
|
-
|
|
26
|
-
- `missing-context` — `mockBuildAgentPrompt` was declared as `vi.fn(() => "assembled system prompt")` which inferred `Mock<() => string>`.
|
|
27
|
-
When step 4 used `mockImplementationOnce` with a parameterized function, TypeScript rejected it.
|
|
28
|
-
The testing skill already documents `Mock<specific-signature>` for this exact case.
|
|
29
|
-
Impact: one type-check failure, fixed by adding `Mock<AssemblerIO["buildAgentPrompt"]>` annotation; added friction but no rework.
|
|
30
|
-
|
|
31
|
-
#### What caused friction (user side)
|
|
32
|
-
|
|
33
|
-
- Nothing notable — standard prompt-template workflow with no corrections needed.
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 133
|
|
3
|
-
issue_title: "Inject SDK boundary into `agent-runner`"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #133 — Inject SDK boundary into agent-runner
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-22T13:15:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Injected all SDK and IO dependencies into `runAgent()` via a `RunnerIO` interface and `createAgentRunner(io)` factory.
|
|
13
|
-
Eliminated all 14 `vi.mock()` calls across `agent-runner.test.ts` (7) and `agent-runner-extension-tools.test.ts` (7).
|
|
14
|
-
Released as `pi-subagents-v6.11.0`.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- The `createAgentRunner(io)` factory pattern was a clean design choice that kept the `AgentRunner` interface and `AgentManager` completely unchanged — zero downstream impact.
|
|
21
|
-
- Folding plan steps 1 and 2 into a single commit was the right call given `tsconfig.json` includes `test/` — recognized the constraint before attempting a broken intermediate commit.
|
|
22
|
-
|
|
23
|
-
#### What caused friction (agent side)
|
|
24
|
-
|
|
25
|
-
1. `wrong-abstraction` — Annotated `createRunnerIO(): RunnerIO` in the test helper, which erased the `Mock<...>` type information from `vi.fn()` stubs.
|
|
26
|
-
TypeScript then rejected `.mockResolvedValue()` on `io.createSession` across 18 call sites.
|
|
27
|
-
Required removing the annotation plus a follow-up edit to remove the now-unused `type RunnerIO` import flagged by Biome.
|
|
28
|
-
Impact: two extra edit rounds and a type-check cycle before the fix landed.
|
|
29
|
-
|
|
30
|
-
2. `missing-context` — Added `SettingsManager` to the SDK import block in `index.ts` without checking that the name was already imported from `./settings.js`.
|
|
31
|
-
Biome caught the redeclaration and the `noRedeclare` lint error required an alias fix (`SettingsManager as SdkSettingsManager`).
|
|
32
|
-
Impact: one extra edit round triggered by the autoformat failure.
|
|
33
|
-
|
|
34
|
-
3. `premature-convergence` — Spent excessive reasoning time deliberating commit-boundary strategy (whether to combine steps 1+2, how to handle broken intermediate states, whether step 4 would have remaining work).
|
|
35
|
-
The answer was straightforward once the `tsconfig` `include` was checked, but the check came late in the deliberation.
|
|
36
|
-
Impact: added friction but no rework — the final decision was correct.
|
|
37
|
-
|
|
38
|
-
#### What caused friction (user side)
|
|
39
|
-
|
|
40
|
-
- None identified.
|
|
41
|
-
The plan and issue were well-specified, and the user's only intervention was "Please, continue" after a message boundary, which was appropriate.
|
|
42
|
-
|
|
43
|
-
### Changes made
|
|
44
|
-
|
|
45
|
-
1. `.pi/skills/testing/SKILL.md` — added rule: do not annotate test factory return types with production interface types (erases `Mock<...>` methods).
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 134
|
|
3
|
-
issue_title: "Reduce `as any` casts in test suite"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #134 — Reduce as-any casts in test suite
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-22T17:00:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Reduced `as any` casts from 93 to 15 across the pi-subagents package.
|
|
13
|
-
Production changes added type guards (`getToolCallName`, `isBashExecution`), narrowed `SubagentRuntime.widget` to `WidgetLike`, typed `CreateSessionOptions.settingsManager` as `SettingsManager`, and fixed `ResourceLoaderOptions.appendSystemPromptOverride` to match the SDK.
|
|
14
|
-
Test improvements introduced `toAgentSession()`, `STUB_CTX`, and `makeRegistry()` helpers to centralise unavoidable bridge casts.
|
|
15
|
-
Also fixed 3 pre-existing lint issues.
|
|
16
|
-
|
|
17
|
-
This session also included #133 (plan + implement + ship) which preceded the #134 work.
|
|
18
|
-
|
|
19
|
-
### Observations
|
|
20
|
-
|
|
21
|
-
#### What went well
|
|
22
|
-
|
|
23
|
-
- The user's Kent Beck prompt ("make the change that makes the change easy") redirected the plan from test-only fixes to targeted production changes, yielding cleaner results — `WidgetLike`, type guards, and SDK-typed options eliminated casts that would have been impossible to remove from tests alone.
|
|
24
|
-
- The user's TDA observation on the `MenuCtx` step caught a deep architectural issue (context threaded 4 layers just to relay to `buildParentSnapshot`).
|
|
25
|
-
Skipping step 4 was the right call — attempting it would have added a production cast or cascaded changes through 6+ files.
|
|
26
|
-
|
|
27
|
-
#### What caused friction (agent side)
|
|
28
|
-
|
|
29
|
-
1. `rabbit-hole` — Step 1 planning involved extensive analysis of whether `CreateSessionOptions` could use full SDK types.
|
|
30
|
-
Spent significant reasoning tracing `ModelRegistry` / `SessionManager` private fields, structural compatibility, `ParentSnapshot` constructibility, and `ResourceLoader` interface width before concluding that only `settingsManager` and the callback signature could be fixed.
|
|
31
|
-
The plan's claim "widen to SDK types" was optimistic about class-with-private-fields constraints.
|
|
32
|
-
Impact: added friction but no rework — the conclusion was correct, just slow to reach.
|
|
33
|
-
|
|
34
|
-
2. `wrong-abstraction` — Step 4 (`MenuCtx`) attempted to mechanically narrow the handler parameter without questioning why `ctx` was threaded 4 layers deep.
|
|
35
|
-
Partially implemented the `MenuCtx` interface before the user's "What am I misunderstanding?"
|
|
36
|
-
prompt exposed the real issue: a TDA violation where intermediate functions carry `ExtensionContext` only to relay it.
|
|
37
|
-
Impact: partial implementation reverted via `git checkout src/ui/agent-menu.ts`; ~10 minutes of wasted edits.
|
|
38
|
-
|
|
39
|
-
3. `instruction-violation` (user-caught) — Used `pnpm exec biome check --write --unsafe` instead of `pnpm run lint:fix` to fix pre-existing lint issues.
|
|
40
|
-
The `/tdd-plan` prompt explicitly says "run `pnpm run lint:fix`."
|
|
41
|
-
Impact: no functional difference (same result), but violated the established convention and used an unnecessary `--unsafe` flag.
|
|
42
|
-
|
|
43
|
-
4. `instruction-violation` (user-caught) — Dismissed pre-existing lint issues as "not from our changes" without fixing them.
|
|
44
|
-
The user asked "Why do we have pre-existing lint issues?"
|
|
45
|
-
— the correct action was to fix them immediately rather than noting and ignoring them.
|
|
46
|
-
Impact: required an extra commit (`style: fix pre-existing lint issues`) that should have been folded into an earlier step.
|
|
47
|
-
|
|
48
|
-
#### What caused friction (user side)
|
|
49
|
-
|
|
50
|
-
- The user's interventions on the `MenuCtx` step and lint issues were both valuable redirections that improved the outcome.
|
|
51
|
-
No mechanical overhead identified — each intervention was strategic judgment that the agent couldn't have reached alone.
|
|
52
|
-
|
|
53
|
-
### Changes made
|
|
54
|
-
|
|
55
|
-
1. `.pi/prompts/tdd-plan.md` — added "Verify green baseline" section (check + lint + test before starting TDD); added "Fix all failures — including pre-existing ones" to the end-of-cycle lint step.
|
|
56
|
-
2. `.pi/prompts/build-plan.md` — same baseline check and fix-all rule for non-TDD plans.
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 135
|
|
3
|
-
issue_title: "Extract display helpers from `agent-widget.ts`"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #135 — Extract display helpers from agent-widget.ts
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-22T19:00:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Extracted 11 helper functions, 3 constants, and 2 types from `agent-widget.ts` into a new `ui/display.ts` module.
|
|
13
|
-
Updated 10 source consumers and 2 test consumers.
|
|
14
|
-
Pure code-motion refactoring — no behavior change, no test-count delta (714 tests throughout).
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- Plan accurately identified all 10 source and 2 test import sites with no misses — the consumer import table in the plan mapped 1:1 to actual changes.
|
|
21
|
-
- TDD execution was mechanical and smooth: create module → update source imports → rename test file → verify.
|
|
22
|
-
Zero surprises or deviations from the plan.
|
|
23
|
-
|
|
24
|
-
#### What caused friction (agent side)
|
|
25
|
-
|
|
26
|
-
- `rabbit-hole` — During `/ship-issue`, wasted ~6 tool calls investigating whether `pi-subagents-v6.12.0` was at HEAD.
|
|
27
|
-
Ran `git log --oneline HEAD --not --remotes=origin/main` which dumped the entire repo history (50KB truncation), then misread `git describe --tags --abbrev=0` (nearest ancestor tag) as confirming the tag was at HEAD.
|
|
28
|
-
`git tag --points-at HEAD` returned empty, disproving the assumption, but I still spent cycles reasoning about CI release-please behavior.
|
|
29
|
-
Impact: added friction but no rework — the close comment and release-please merge were correct.
|
|
30
|
-
|
|
31
|
-
#### What caused friction (user side)
|
|
32
|
-
|
|
33
|
-
- None observed.
|
|
34
|
-
The issue was unambiguous, the architecture doc prescribed the exact extraction set, and no user intervention was needed during implementation.
|
|
35
|
-
|
|
36
|
-
### Changes made
|
|
37
|
-
|
|
38
|
-
1. Created `packages/pi-subagents/docs/retro/0135-extract-display-helpers.md` (this file).
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 136
|
|
3
|
-
issue_title: "Decompose `agent-menu.ts`"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #136 — Decompose `agent-menu.ts`
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-22T20:10:00-04:00)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Decomposed `agent-menu.ts` (668 lines) into four focused modules: `agent-file-ops.ts`, `agent-config-editor.ts`, `agent-creation-wizard.ts`, and a slimmed-down `agent-menu.ts` (296 lines).
|
|
13
|
-
Three TDD cycles shipped cleanly, adding 47 tests (714 → 761) and eliminating `vi.mock("node:fs")` from the menu test file.
|
|
14
|
-
Released as `pi-subagents-v6.13.0`.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- The three-cycle TDD plan (file-ops → config-editor → creation-wizard) produced clean incremental commits with no rework.
|
|
21
|
-
Each cycle left the repo green for both tests and type-check.
|
|
22
|
-
- The creation wizard naturally produced narrower interfaces (`WizardManager`, `WizardRegistry`) than the plan specified — a positive deviation from the plan's `AgentTypeRegistry` concrete type, following ISP more strictly.
|
|
23
|
-
- The large edit removing ~170 lines of extracted functions from `agent-menu.ts` in Cycle 2 landed correctly on the first attempt, thanks to using exact `oldText` matching with the full function bodies.
|
|
24
|
-
|
|
25
|
-
#### What caused friction (agent side)
|
|
26
|
-
|
|
27
|
-
- `missing-context` — The config-editor test factory used `Partial<AgentConfigEditorDeps>` for the overrides parameter.
|
|
28
|
-
The `...overrides` spread created a union type that erased `Mock<...>` methods from `fileOps`, producing 28 `TS2339` errors on `pnpm run check`.
|
|
29
|
-
The testing skill warns about return-type annotations but not about `Partial<Interface>` in overrides — the same erasure mechanism applies through a different path.
|
|
30
|
-
Impact: one extra edit-check cycle to remove the `Partial<>` annotation and overrides parameter.
|
|
31
|
-
Self-identified (caught on `pnpm run check` before commit).
|
|
32
|
-
|
|
33
|
-
- `missing-context` — The config-editor test had an unused `ctx` variable from an earlier draft of the "disable-only file" test, caught only by the linter after the Cycle 3 commit.
|
|
34
|
-
Impact: required amending the Cycle 3 commit; added friction but no rework.
|
|
35
|
-
Self-identified (caught by `pnpm run lint`).
|
|
36
|
-
|
|
37
|
-
#### What caused friction (user side)
|
|
38
|
-
|
|
39
|
-
- None observed — the user's plan was unambiguous and the prerequisite (#135) was already implemented.
|
|
40
|
-
|
|
41
|
-
### Changes made
|
|
42
|
-
|
|
43
|
-
1. Added a `Partial<Interface>` type-erasure bullet to `.pi/skills/testing/SKILL.md`.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 144
|
|
3
|
-
issue_title: "Consolidate observation model (Phase 9, Step L)"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #144 — Consolidate observation model
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-23)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Planned and implemented the Phase 9 Step L observation model consolidation.
|
|
13
|
-
Removed dual `_toolUses`/`_lifetimeUsage` counting from `AgentActivityTracker`, added `session`/`outputFile` convenience getters to `AgentRecord`, migrated 14 callsites, and dissolved `NotificationDeps` into plain constructor parameters.
|
|
14
|
-
Released as `pi-subagents-v6.16.0`.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- The plan correctly anticipated that TDD steps 4 (remove tracker stats) and 5 (migrate UI consumers) would be type-coupled and need merging.
|
|
21
|
-
This played out exactly as predicted — no surprise rework.
|
|
22
|
-
- Step 2's grep sweep during `execution?.` migration found two callsites (`agent-tool.ts:315`, `agent-manager.ts:353`) that the plan's file list missed.
|
|
23
|
-
Systematic grep at migration time caught them before commit.
|
|
24
|
-
|
|
25
|
-
#### What caused friction (agent side)
|
|
26
|
-
|
|
27
|
-
- `instruction-violation` — Did not load the `colgrep` skill during the planning phase despite two explicit instructions: AGENTS.md ("Use `colgrep` for intent-based codebase exploration") and the `/plan-issue` prompt ("load the `code-design` skill and the `colgrep` skill for convention discovery").
|
|
28
|
-
Loaded 4 other skills but skipped colgrep.
|
|
29
|
-
User-caught ("I noticed you didn't load or use `colgrep`").
|
|
30
|
-
Impact: one extra round-trip with the user; no rework since the plan hadn't been committed yet.
|
|
31
|
-
The colgrep searches proved useful once run — highest-scoring hit for "dependency bag converted to plain constructor parameters" was `notification.ts`, directly confirming the target.
|
|
32
|
-
- `wrong-abstraction` — When editing `src/ui/ui-observer.ts` to remove the `message_end` accumulation block, the replacement text closed the `session.subscribe(...)` callback but also added the function's closing brace, producing a duplicate `}`.
|
|
33
|
-
Autoformat caught the parse error immediately.
|
|
34
|
-
Impact: one follow-up edit, no downstream rework.
|
|
35
|
-
|
|
36
|
-
#### What caused friction (user side)
|
|
37
|
-
|
|
38
|
-
- None observed.
|
|
39
|
-
The user's intervention on colgrep was timely — caught before plan commit, not after.
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 145
|
|
3
|
-
issue_title: "Decompose execute and push ExtensionContext to the boundary (Phase 9, Step M)"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #145 — Decompose execute and push ExtensionContext to the boundary
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-23)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Extracted config resolution into a pure `resolveSpawnConfig` function, injected three collaborators (`buildSnapshot`, `getModelInfo`, `getSessionInfo`) into `createAgentTool` to eliminate `ctx` reads from `execute`, pushed `ParentSnapshot` to `AgentManager`'s public API, and dissolved three small dependency bags (`ForegroundDeps`, `BackgroundDeps`, `AdapterDeps`) into plain parameters.
|
|
13
|
-
Released as `pi-subagents-v6.15.0`.
|
|
14
|
-
|
|
15
|
-
### Observations
|
|
16
|
-
|
|
17
|
-
#### What went well
|
|
18
|
-
|
|
19
|
-
- User's two escalating questions ("Are there any other missing collaborators?"
|
|
20
|
-
→ "Hiding dependencies in an object bag still counts as dependencies!") caught a `premature-convergence` before it landed as committed code.
|
|
21
|
-
The reverted partial step 3 attempt was ~4 files of changes that would have needed rework.
|
|
22
|
-
The resulting design (injected collaborators) is meaningfully better than the original plan's mechanical relocation.
|
|
23
|
-
- Folding tightly-coupled TDD steps (ctx elimination + params shrinking + deps dissolution) into fewer commits avoided intermediate states with broken types.
|
|
24
|
-
The plan's 12-step sequence would have required lift-and-shift gymnastics; the actual 7-commit sequence was cleaner.
|
|
25
|
-
|
|
26
|
-
#### What caused friction (agent side)
|
|
27
|
-
|
|
28
|
-
- `premature-convergence` — the original plan relocated `buildParentSnapshot` calls to `execute` without questioning whether `execute` should read `ctx` at all.
|
|
29
|
-
The existing `code-design` skill has DIP and parameter-relay rules that should have flagged this.
|
|
30
|
-
The `service-adapter.ts` module already demonstrated the getter-injection pattern (`getCtx`, `getModelRegistry`), but I didn't search for it during plan writing.
|
|
31
|
-
Impact: one plan rewrite commit (76bb57b), one reverted partial implementation (~15 minutes of rework).
|
|
32
|
-
User-caught.
|
|
33
|
-
|
|
34
|
-
- `missing-context` — didn't use `colgrep` during initial plan writing to discover the established getter-injection convention in `service-adapter.ts`.
|
|
35
|
-
Used `grep` exclusively for exact symbol matching.
|
|
36
|
-
When prompted by the user to use `colgrep`, the results were confirmatory rather than revelatory because I'd already read the relevant files by that point.
|
|
37
|
-
The miss was not using it *earlier* for intent-based exploration ("how do existing modules inject session-scoped state?").
|
|
38
|
-
Impact: added friction but no rework — the user's questions surfaced the pattern before code was committed.
|
|
39
|
-
User-caught.
|
|
40
|
-
|
|
41
|
-
- `instruction-violation` — wrote an inline `import()` type assertion (`session.ctx as import("@earendil-works/pi-coding-agent").ExtensionContext`) in `service-adapter.ts`.
|
|
42
|
-
AGENTS.md says "Use standard top-level imports only."
|
|
43
|
-
Impact: one extra edit round, caught before committing.
|
|
44
|
-
User-caught.
|
|
45
|
-
|
|
46
|
-
#### What caused friction (user side)
|
|
47
|
-
|
|
48
|
-
- The user's redirecting questions were well-timed and effective.
|
|
49
|
-
The escalation from "Are there any other missing collaborators?"
|
|
50
|
-
to the more pointed "Hiding dependencies in an object bag still counts as dependencies!"
|
|
51
|
-
was the right amount of pressure.
|
|
52
|
-
No friction observed on the user side.
|
|
53
|
-
|
|
54
|
-
### Changes made
|
|
55
|
-
|
|
56
|
-
1. `.pi/prompts/plan-issue.md` — added `colgrep` skill loading to the "Load skills" section for code-change plans, so convention discovery happens during exploration rather than after committing to a design.
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 146
|
|
3
|
-
issue_title: "Narrow UI context for menu handlers (Phase 9, Step N)"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #146 — Narrow UI context for menu handlers
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-23T10:00:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Introduced a `MenuUI` interface in `agent-menu.ts` capturing the 6 `ctx.ui` methods used by menu handlers.
|
|
13
|
-
Replaced `ExtensionContext` with `MenuUI` (plus explicit `ModelRegistry` and `ParentSnapshot`) in all inner functions across `agent-menu.ts`, `agent-config-editor.ts`, and `agent-creation-wizard.ts`.
|
|
14
|
-
Dissolved three ≤4-field dependency bags (`AgentConfigEditorDeps`, `GetResultDeps`, `SteerToolDeps`) into plain parameters; destructured `AgentMenuDeps` and `AgentCreationWizardDeps` in their factory signatures.
|
|
15
|
-
Eliminated 42 `ctx as any` casts across 5 test files.
|
|
16
|
-
Released as `pi-subagents-v6.16.2`.
|
|
17
|
-
|
|
18
|
-
### Observations
|
|
19
|
-
|
|
20
|
-
#### What went well
|
|
21
|
-
|
|
22
|
-
- **User-initiated plan review caught three ordering bugs before implementation.**
|
|
23
|
-
The user asked the agent to "review the plan and judge its quality and clarity" after the initial commit.
|
|
24
|
-
The review identified three execution-blocking problems in the TDD order: `MenuUI` not defined before consumers, `ParentSnapshot` not threaded through the handler return type, and `index.ts` call sites not updated alongside their factories.
|
|
25
|
-
All three were fixed before TDD execution began, saving significant implementation friction.
|
|
26
|
-
- The plan's TDD order (after fixes) worked well for a pure-refactoring change — all 806 tests stayed green throughout every step.
|
|
27
|
-
- The type checker served as an effective safety net: every call-site mismatch was caught immediately by `pnpm run check`, preventing runtime surprises.
|
|
28
|
-
|
|
29
|
-
#### What caused friction (agent side)
|
|
30
|
-
|
|
31
|
-
##### Planning session
|
|
32
|
-
|
|
33
|
-
- `missing-context` — The initial plan had three TDD ordering bugs: (1) `MenuUI` used before defined, (2) `ParentSnapshot` not threaded through handler return type, (3) `index.ts` call sites not updated alongside factory signature changes.
|
|
34
|
-
These were caught by a user-prompted plan review, not by the planning agent itself.
|
|
35
|
-
Impact: would have caused type-check failures during TDD execution; fixed before implementation started.
|
|
36
|
-
|
|
37
|
-
- `wrong-abstraction` — After fixing the plan, the agent ran `git commit --amend --no-edit` to update the plan commit, but it landed on the wrong commit (a stacked prompt-changes commit from a different session).
|
|
38
|
-
This caused divergent history with origin.
|
|
39
|
-
Recovery required `git reset --hard origin/main` and re-applying the plan fixes as a new commit (`3d5b591`).
|
|
40
|
-
Impact: ~5 minutes of git recovery and re-application of edits.
|
|
41
|
-
|
|
42
|
-
##### Implementation session
|
|
43
|
-
|
|
44
|
-
- `missing-context` — In Step 3, the plan listed the `WizardManager.spawnAndWait` signature change (to accept `ParentSnapshot`) and the `AgentMenuManager.spawnAndWait` change as separate steps (3 and 4).
|
|
45
|
-
But `agent-menu.ts` passes `deps.manager` (typed as `AgentMenuManager`) to `createAgentCreationWizard`, which expects `WizardManager`.
|
|
46
|
-
Changing `WizardManager` without also changing `AgentMenuManager` broke the type checker.
|
|
47
|
-
I had to pull the `AgentMenuManager` change forward from Step 4 into Step 3.
|
|
48
|
-
Impact: minor — a few minutes of diagnosis and one extra edit, no rework.
|
|
49
|
-
|
|
50
|
-
- `missing-context` — In Step 2, after dissolving `AgentConfigEditorDeps` and changing `showAgentDetail(ctx)` to `showAgentDetail(ui: MenuUI)`, I forgot to update the call site in `agent-menu.ts` from `editor.showAgentDetail(ctx, agentName)` to `editor.showAgentDetail(ctx.ui, agentName)`.
|
|
51
|
-
The type checker caught it immediately.
|
|
52
|
-
Impact: added friction but no rework — one extra `pnpm run check` cycle.
|
|
53
|
-
|
|
54
|
-
- `missing-context` — In Step 4, the `makeUI()` test helper used `modelRegistry: {}` which didn't satisfy the `ModelRegistry` interface (requires `find` and `getAll`).
|
|
55
|
-
Impact: one extra `pnpm run check` cycle and a one-line fix.
|
|
56
|
-
|
|
57
|
-
- `missing-context` — In Step 5, two tests called `createGetResultTool(makeDeps())` directly (not via the `execute()` helper).
|
|
58
|
-
After dissolving deps, the factory signature changed but I only updated `execute()`.
|
|
59
|
-
The type checker caught the two direct calls.
|
|
60
|
-
Impact: one extra `pnpm run check` cycle.
|
|
61
|
-
|
|
62
|
-
#### What caused friction (user side)
|
|
63
|
-
|
|
64
|
-
- None observed — the session ran autonomously with no user corrections needed.
|
|
65
|
-
|
|
66
|
-
#### What caused friction (user side — planning)
|
|
67
|
-
|
|
68
|
-
- The user had to explicitly ask for a plan review (“I'd like you to review the plan and judge its quality and clarity”) to surface three ordering bugs.
|
|
69
|
-
The planning agent should have caught these during plan authoring — the testing skill already contains rules about TDD step ordering and shared interface changes.
|
|
70
|
-
The user's intervention prevented significant implementation friction.
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 147
|
|
3
|
-
issue_title: "Inject text wrapping into ConversationViewer (Phase 9, Step O)"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #147 — Inject text wrapping into ConversationViewer (Phase 9, Step O)
|
|
7
|
-
|
|
8
|
-
## Stage: Planning (2026-05-23T00:00:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Read the issue, loaded package-pi-subagents, code-design, testing, and markdown-conventions skills.
|
|
13
|
-
Explored `src/ui/conversation-viewer.ts`, `src/ui/agent-menu.ts`, `test/conversation-viewer.test.ts`, and the Phase 9 architecture roadmap.
|
|
14
|
-
Wrote and committed the plan at `packages/pi-subagents/docs/plans/0147-inject-wrap-text-into-conversation-viewer.md`.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
- The change is tightly scoped: two source files (`conversation-viewer.ts`, `agent-menu.ts`) and one test file.
|
|
19
|
-
- `wrapTextWithAnsi` is called in exactly four places inside `buildContentLines` — all in the same private method, making the replacement straightforward.
|
|
20
|
-
- The only production call site for `new ConversationViewer({…})` is `viewAgentConversation` in `agent-menu.ts`.
|
|
21
|
-
`wrapTextWithAnsi` is added as a static import there and passed as `wrapText` — no threading through `AgentMenuDeps` needed.
|
|
22
|
-
- All `new ConversationViewer({…})` calls in the test file are inline (no shared factory helper), so every call site needs the new `wrapText` field added.
|
|
23
|
-
Grep confirms the count: 11+ calls, all in `test/conversation-viewer.test.ts`.
|
|
24
|
-
- The plan uses 2 TDD cycles: Cycle 1 adds the field and updates all call sites (with the `vi.mock` still present for safety); Cycle 2 removes the mock and converts dynamic `await import()` to static imports.
|
|
25
|
-
This ordering avoids a large simultaneous change and gives the suite a stable intermediate state.
|
|
26
|
-
- The "mock is intercepting wrapTextWithAnsi" test is deleted in Cycle 1 (it verified the mock mechanism, not production behavior).
|
|
27
|
-
- No exported API symbols are removed; `wrapText` is a new required field on `ConversationViewerOptions`, which is a breaking change only for external constructors of `ConversationViewer` — confirmed none exist outside this package.
|
|
28
|
-
|
|
29
|
-
## Stage: Implementation — TDD (2026-05-23T11:36:00Z)
|
|
30
|
-
|
|
31
|
-
### Session summary
|
|
32
|
-
|
|
33
|
-
Completed both TDD cycles from the plan.
|
|
34
|
-
Cycle 1 added `wrapText` to `ConversationViewerOptions`, destructured options in the constructor, replaced all four `wrapTextWithAnsi` calls with `this.wrapText`, updated `agent-menu.ts` to import and pass `wrapTextWithAnsi`, and updated all 16 test constructor call sites (11 render-width-safety + 5 safety-net) while keeping the `vi.mock` shim in place.
|
|
35
|
-
Cycle 2 removed the `vi.mock` block, `wrapOverride`, and `beforeEach` reset, then converted the dynamic `await import()` calls to ordinary static imports.
|
|
36
|
-
Test count: 806 → 805 (deleted the mock-mechanism sentinel test).
|
|
37
|
-
Full suite 50 files, 805 tests, all green.
|
|
38
|
-
|
|
39
|
-
### Observations
|
|
40
|
-
|
|
41
|
-
- The plan said the render-width-safety constructor calls numbered "11+" — the actual count was 16 total (11 render-width-safety + 5 safety-net), all in `test/conversation-viewer.test.ts`.
|
|
42
|
-
No external call sites existed.
|
|
43
|
-
- `wrapTextWithAnsi` needed to be added to the dynamic import in Cycle 1 (`const { visibleWidth, wrapTextWithAnsi } = await import(...)`) because the render-width-safety tests reference it by name.
|
|
44
|
-
The plan didn't call this out explicitly — minor omission.
|
|
45
|
-
- Used a Python script (inline via bash) to make the 17 constructor-call edits rather than 17 separate Edit-tool calls.
|
|
46
|
-
The safety-net tests each had a different stub character (`X`, `Y`, `Z`, `B`, `W`) which required a regex capture group to preserve.
|
|
47
|
-
The script worked on the first attempt.
|
|
48
|
-
- Cycle 2 was a single Edit call replacing the entire mock block + the two dynamic imports + `beforeEach`.
|
|
49
|
-
The autoformatter then cleaned up import ordering automatically.
|
|
50
|
-
- Architecture doc updated: smells table row struck-through and Step O marked ✓.
|
|
51
|
-
|
|
52
|
-
## Stage: Final Retrospective (2026-05-23T11:45:00Z)
|
|
53
|
-
|
|
54
|
-
### Session summary
|
|
55
|
-
|
|
56
|
-
Planned, implemented, shipped, and released issue #147 across a single session chain.
|
|
57
|
-
Two TDD cycles completed cleanly; CI passed; issue closed; `pi-subagents-v6.17.0` released.
|
|
58
|
-
Test count: 806 → 805 (deleted mock-mechanism sentinel test).
|
|
59
|
-
|
|
60
|
-
### Observations
|
|
61
|
-
|
|
62
|
-
#### What went well
|
|
63
|
-
|
|
64
|
-
- Python script for bulk constructor edits worked first-try on 17 call sites with per-test regex capture groups.
|
|
65
|
-
This is now a proven pattern — #116 and #147 both used it successfully for `ConversationViewer` constructor changes.
|
|
66
|
-
- Two-cycle TDD approach (Cycle 1: add DI with mock still present; Cycle 2: remove mock) gave a stable intermediate state and caught the missing `wrapTextWithAnsi` import before proceeding.
|
|
67
|
-
- Scope was tight: 3 files changed, 2 commits of substance, no rework on the production code.
|
|
68
|
-
|
|
69
|
-
#### What caused friction (agent side)
|
|
70
|
-
|
|
71
|
-
1. `instruction-violation` — Failed to load the `colgrep` skill during planning.
|
|
72
|
-
Constructed the path by pattern (`.pi/skills/colgrep/SKILL.md`) instead of using the `<location>` listed in the `<available_skills>` block (`packages/pi-colgrep/skills/colgrep/SKILL.md`).
|
|
73
|
-
Got ENOENT and silently moved on.
|
|
74
|
-
Impact: user-caught; required a follow-up exchange to load the skill and re-review the plan.
|
|
75
|
-
No rework needed — the plan was already correct.
|
|
76
|
-
2. `wrong-abstraction` — Cycle 2 Edit replaced the entire `vi.mock` block + dynamic imports as one chunk, leaving the `ConversationViewer` static import stranded after `const testRegistry` instead of at the top with other imports.
|
|
77
|
-
Impact: user-caught ("Wait, we have a dynamic import?"); required a follow-up edit and amend into the retro commit.
|
|
78
|
-
3. `missing-context` — Plan stated "11+" constructor call sites; actual count was 16 (11 render-width-safety + 5 safety-net).
|
|
79
|
-
The grep output during planning showed all 16 but the count wasn't verified.
|
|
80
|
-
Impact: no rework — the Python script handled all 17 (16 test + 1 production) regardless.
|
|
81
|
-
|
|
82
|
-
#### What caused friction (user side)
|
|
83
|
-
|
|
84
|
-
- No friction identified — user interventions were timely and precise.
|
|
85
|
-
|
|
86
|
-
### Changes made
|
|
87
|
-
|
|
88
|
-
1. Appended this final retrospective entry to `packages/pi-subagents/docs/retro/0147-inject-wrap-text-into-conversation-viewer.md`.
|
|
89
|
-
2. Separated `colgrep` skill loading into its own bullet in `.pi/prompts/plan-issue.md` to reduce pattern-matching shortcuts.
|
|
90
|
-
3. Replaced deterministic step in `.pi/prompts/retro.md` with a "Sync with remote" section matching the other prompts.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 148
|
|
3
|
-
issue_title: "Split AgentWidget rendering from lifecycle (Phase 9, Step P)"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #148 — Split AgentWidget rendering from lifecycle
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-23T06:20:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Extracted pure rendering functions (`renderWidgetLines`, `renderFinishedLine`, `renderRunningLines`) from `AgentWidget` into `ui/widget-renderer.ts`.
|
|
13
|
-
The widget shrank from 374 to 198 lines — now a thin lifecycle wrapper. 23 new unit tests cover all status variants, overflow, tree connectors, and empty states.
|
|
14
|
-
Released as `pi-subagents-v6.16.1`.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- TDD cycles were fast and clean: 9 commits, all tests green on first or second try, zero test regressions across the full 806-test suite.
|
|
21
|
-
- The `WidgetAgent` / `WidgetActivity` interfaces worked well as structural subsets — `AgentRecord` and `AgentActivityTracker` satisfy them without mapping code.
|
|
22
|
-
- The stub `Theme` pattern from `test/renderer.test.ts` (`fg: (c, t) => \`[\${c}:\${t}]\``) transferred cleanly to the new test file, keeping assertions readable.
|
|
23
|
-
|
|
24
|
-
#### What caused friction (agent side)
|
|
25
|
-
|
|
26
|
-
- `missing-context` — The plan's `renderWidgetLines` API spec omitted `theme` from its parameters, even though the heading, tree connectors, and per-agent render calls all require it.
|
|
27
|
-
Caught immediately at step 4 (first `renderWidgetLines` test) and fixed by adding `theme` to the params.
|
|
28
|
-
Impact: deviation note in commit body; no rework.
|
|
29
|
-
|
|
30
|
-
- `missing-context` — Step 3 (`renderRunningLines` implementation) initially missed importing `SPINNER` from `display.ts`.
|
|
31
|
-
The test caught it as a runtime `ReferenceError`, fixed in the same Red→Green cycle.
|
|
32
|
-
Impact: added friction but no rework.
|
|
33
|
-
|
|
34
|
-
- `wrong-abstraction` — Step 8 ("Extract into `widget-renderer.ts`") was a no-op because the module was created incrementally during steps 1–7 (tests must import from the new module to run).
|
|
35
|
-
Impact: step skipped; noted in summary.
|
|
36
|
-
|
|
37
|
-
#### What caused friction (user side)
|
|
38
|
-
|
|
39
|
-
- None observed — the session ran autonomously from plan through ship with no user corrections needed.
|