@gotgenes/pi-subagents 18.0.0 → 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 +14 -0
- package/README.md +22 -31
- 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/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/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 -45
- package/docs/retro/0442-dissolve-agents-conversation-viewer.md +0 -108
- 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/src/observation/notification-state.ts +0 -27
- package/vitest.config.ts +0 -14
|
@@ -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.
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 152
|
|
3
|
-
issue_title: "Add promptSnippet to pi-subagents tools"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #152 — Add `promptSnippet` to pi-subagents tools
|
|
7
|
-
|
|
8
|
-
## Final Retrospective (2026-05-22)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Added `promptSnippet` to the `Agent`, `get_subagent_result`, and `steer_subagent` tool registrations in pi-subagents, matching the convention used by pi-github-tools and pi-colgrep.
|
|
13
|
-
The full plan→TDD→ship pipeline completed in one session with zero rework.
|
|
14
|
-
Released as `pi-subagents-v6.14.0`.
|
|
15
|
-
|
|
16
|
-
### Observations
|
|
17
|
-
|
|
18
|
-
#### What went well
|
|
19
|
-
|
|
20
|
-
- Clean single-cycle execution: the issue was unambiguous, the plan correctly scoped it as one TDD step, and the implementation matched the plan exactly.
|
|
21
|
-
- Cross-package convention check (grepping sibling packages for `promptSnippet` usage) confirmed the `"tool_name: One-liner."` format before writing the plan, avoiding any wording rework.
|
|
22
|
-
|
|
23
|
-
#### What caused friction (agent side)
|
|
24
|
-
|
|
25
|
-
No friction points identified.
|
|
26
|
-
The issue was a straightforward property addition with no design decisions, no interface changes, and no downstream breakage.
|
|
27
|
-
|
|
28
|
-
#### What caused friction (user side)
|
|
29
|
-
|
|
30
|
-
No friction points identified.
|
|
31
|
-
|
|
32
|
-
### Changes made
|
|
33
|
-
|
|
34
|
-
1. Created `packages/pi-subagents/docs/retro/0152-add-prompt-snippet.md` (this file).
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 164
|
|
3
|
-
issue_title: "refactor(pi-subagents): reorganize source into domain directories"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #164 — refactor(pi-subagents): reorganize source into domain directories
|
|
7
|
-
|
|
8
|
-
## Stage: Planning (2026-05-23T00:00:00Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Read issue #164, confirmed #157 (import normalization) was a prerequisite and had been completed.
|
|
13
|
-
Explored the full `src/` and `test/` structure, mapped every relative import in the 26 files to be moved, and produced a four-commit plan that moves files domain-by-domain in dependency order.
|
|
14
|
-
|
|
15
|
-
### Observations
|
|
16
|
-
|
|
17
|
-
- Issue #157 removed `.js` suffixes and introduced `#src/*` aliases in `test/` files.
|
|
18
|
-
This makes the reorganization cleaner: test imports are flat `#src/agent-manager` → `#src/lifecycle/agent-manager` with no depth variation.
|
|
19
|
-
- `lifecycle/` and `observation/` have a circular dependency (`agent-manager` ↔ `record-observer`), so they must be moved in a single commit (Step 3).
|
|
20
|
-
All other domains can be committed independently.
|
|
21
|
-
- `vitest.config.ts` uses `"test/**/*.test.ts"` — test files in new subdirectories are
|
|
22
|
-
auto-discovered without config changes.
|
|
23
|
-
- Three UI test files (`conversation-viewer.test.ts`, `display.test.ts`,
|
|
24
|
-
`widget-renderer.test.ts`) are misplaced at `test/` root; left out of scope for this issue.
|
|
25
|
-
- No `default-agents.test.ts`, `context.test.ts`, or `execution-state.test.ts` exist —
|
|
26
|
-
those src modules have no dedicated test files.
|
|
27
|
-
- The import tables in the plan enumerate every path change; `pnpm run check` will catch
|
|
28
|
-
any missed update before each commit.
|
|
29
|
-
|
|
30
|
-
## Stage: Implementation — TDD (2026-05-23T16:55:00Z)
|
|
31
|
-
|
|
32
|
-
### Session summary
|
|
33
|
-
|
|
34
|
-
Executed all four plan steps (config, session, lifecycle+observation, service) plus a fifth unplanned step converting all `src/` internal imports to `#src/` aliases.
|
|
35
|
-
All 50 test files and 805 tests pass throughout.
|
|
36
|
-
Updated `docs/architecture/architecture.md` to reflect the completed restructuring.
|
|
37
|
-
|
|
38
|
-
### Observations
|
|
39
|
-
|
|
40
|
-
- The plan's consumer tables were mostly complete but missed a few files: `src/ui/widget-renderer.ts` and `src/session-config.ts` (still at root during step 1) both imported `agent-types`; `src/service-adapter.ts` imported `model-resolver`; `test/parent-snapshot.test.ts` had a `vi.mock("#src/context")` path.
|
|
41
|
-
All caught immediately by `pnpm run check` or a failing test.
|
|
42
|
-
- `src/service-adapter.ts` and `src/service.ts` (still at root during step 3) imported `parent-snapshot` and `usage` which moved in that step, so they had to be fixed as part of step 3's commit rather than step 4's.
|
|
43
|
-
- The `#src/` alias conversion (fifth commit) was added after the user correctly observed that `src/` files should use the same alias style as `test/` files.
|
|
44
|
-
This eliminates all `../` relative cross-directory imports from `src/`.
|
|
45
|
-
Future file moves in `src/` now only require updating the `#src/domain/name` string — no relative depth arithmetic.
|
|
46
|
-
- Biome auto-fixed 14 files (import sorting / trailing whitespace) during the `#src/` conversion step; committed via `git add -A` after the pre-commit hook run.
|
|
47
|
-
|
|
48
|
-
## Stage: Final Retrospective (2026-05-23T17:10:00Z)
|
|
49
|
-
|
|
50
|
-
### Session summary
|
|
51
|
-
|
|
52
|
-
Shipped #164 (6 commits, `pi-subagents-v6.17.2`), filed #174 (ESLint for type-aware rules + import path enforcement), and reviewed the full issue lifecycle across planning, implementation, and shipping sessions.
|
|
53
|
-
|
|
54
|
-
### Observations
|
|
55
|
-
|
|
56
|
-
#### What went well
|
|
57
|
-
|
|
58
|
-
- The user's mid-implementation redirect to use `#src/` aliases in `src/` files was the highest-impact intervention across the entire issue.
|
|
59
|
-
It eliminated the `../` depth-arithmetic problem, simplified the final commit to a one-liner `sed` command across 40 files, and directly motivated #174.
|
|
60
|
-
- `pnpm run check` (`tsc --noEmit`) caught every missed consumer immediately — no broken commit ever landed.
|
|
61
|
-
- The four-step dependency ordering (config → session → lifecycle+observation → service) kept every commit green despite the circular dependency between `lifecycle` and `observation`.
|
|
62
|
-
|
|
63
|
-
#### What caused friction (agent side)
|
|
64
|
-
|
|
65
|
-
- `wrong-abstraction` — Used ~60 individual `Edit` tool calls across steps 1–4 for what was a mechanical find-and-replace.
|
|
66
|
-
The fifth commit proved `sed` handles bulk import rewrites across 40 files in a single command.
|
|
67
|
-
Impact: hundreds of unnecessary tool calls and significant token waste across four commits.
|
|
68
|
-
- `missing-context` — The plan's consumer tables missed 4 files (`src/ui/widget-renderer.ts`, `src/session-config.ts`, `src/service-adapter.ts`, `test/parent-snapshot.test.ts` `vi.mock` path).
|
|
69
|
-
The plan manually traced imports instead of using `grep` to enumerate all consumers of each moving module.
|
|
70
|
-
Impact: mid-step rework in steps 1, 2, and 3 to fix un-updated imports caught by `tsc`.
|
|
71
|
-
- `missing-context` — Did not recognize that `src/` files should use `#src/` aliases (same as `test/` files) even though #157 set up the aliases for exactly this purpose.
|
|
72
|
-
Impact: all four domain-move commits used relative `../` imports, requiring a fifth unplanned commit to convert them.
|
|
73
|
-
User-caught.
|
|
74
|
-
- `wrong-abstraction` — The agent lacks access to LSP-level refactoring tools ("Move to file", "Rename symbol") that a human developer would use for this kind of reorganization.
|
|
75
|
-
A human with an LSP would have completed the entire issue in minutes with zero missed consumers.
|
|
76
|
-
This is a fundamental capability gap — the agent compensated with low-level text manipulation, which is error-prone and token-expensive.
|
|
77
|
-
|
|
78
|
-
#### What caused friction (user side)
|
|
79
|
-
|
|
80
|
-
- The `#src/` alias convention was established in #157 but the user didn't flag it during the planning session.
|
|
81
|
-
Had this been raised during planning, all four domain-move commits would have used `#src/` from the start.
|
|
82
|
-
The user did catch it during implementation, which was still early enough to save the final result.
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 165
|
|
3
|
-
issue_title: "refactor(pi-subagents): decompose ResolvedSpawnConfig (15 fields)"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Retro: #165 — decompose ResolvedSpawnConfig (15 fields)
|
|
7
|
-
|
|
8
|
-
## Stage: Planning (2026-05-24T13:41:41Z)
|
|
9
|
-
|
|
10
|
-
### Session summary
|
|
11
|
-
|
|
12
|
-
Produced a 5-step TDD plan to decompose the 15-field `ResolvedSpawnConfig` into three nested sub-interfaces (`SpawnIdentity`, `SpawnExecution`, `SpawnPresentation`).
|
|
13
|
-
Also improved skill descriptions for `colgrep` and `markdown-conventions` to signal decision-relevant content rather than tool reference material.
|
|
14
|
-
|
|
15
|
-
### Observations
|
|
16
|
-
|
|
17
|
-
- The proposed decomposition in the issue aligns well with actual field usage patterns — no adjustments needed.
|
|
18
|
-
- `modelName` and `agentTags` are never accessed by external consumers; they're intermediate computation exposed on the return type.
|
|
19
|
-
Keeping them on `SpawnPresentation` is harmless and aids debuggability.
|
|
20
|
-
- Step 1 (interface change + return restructure) will break type checking for all consumers simultaneously.
|
|
21
|
-
The plan addresses this by landing steps 1–4 in rapid succession on the same branch.
|
|
22
|
-
- Both test files have `makeConfig()` factories that must be updated in lock-step with their respective source files.
|
|
23
|
-
- Issue #164 (directory reorganization) is closed, so import paths are already in their final `#src/<domain>/` form.
|
|
24
|
-
|
|
25
|
-
## Stage: Implementation — TDD (2026-05-24T14:32:58Z)
|
|
26
|
-
|
|
27
|
-
### Session summary
|
|
28
|
-
|
|
29
|
-
Completed all 4 TDD cycles plus full-suite verification in one session.
|
|
30
|
-
The decomposition touched 7 files (4 source, 3 test) and kept the test count flat at 805 — no new tests needed for a pure structural refactor.
|
|
31
|
-
|
|
32
|
-
### Observations
|
|
33
|
-
|
|
34
|
-
- The `Partial<ResolvedSpawnConfig>` spread pattern in `makeConfig` factories doesn't deep-merge into nested sub-objects.
|
|
35
|
-
Two tests (`foreground-runner.test.ts` and `background-spawner.test.ts`) used flat field overrides (`{ fellBack: true }`, `{ description: "my task" }`) that silently stopped working after nesting.
|
|
36
|
-
Fixed by writing out the full nested sub-object at the override call site.
|
|
37
|
-
Future factories for nested config types should either deep-merge or avoid the `Partial<T>` spread pattern — see the `testing` skill's warning about this.
|
|
38
|
-
- Step 1 breaking all consumers simultaneously was handled smoothly by completing all steps before pushing, as planned.
|
|
39
|
-
No transitional alias was needed.
|
|
40
|
-
- The `background-spawner.test.ts` description-override test was the only unexpected friction point — the flat spread issue wasn't caught by the plan.
|
|
41
|
-
|
|
42
|
-
## Stage: Final Retrospective (2026-05-24T15:00:14Z)
|
|
43
|
-
|
|
44
|
-
### Session summary
|
|
45
|
-
|
|
46
|
-
Shipped issue #165 (CI green, released as `pi-subagents-v6.18.1`) and ran the final retrospective.
|
|
47
|
-
The most impactful outcome across all three sessions was the skill description improvements (commit `51f52ef`), which addressed a recurring `instruction-violation` pattern.
|
|
48
|
-
|
|
49
|
-
### Observations
|
|
50
|
-
|
|
51
|
-
#### What went well
|
|
52
|
-
|
|
53
|
-
- The user's probing question ("This is consistent, though.
|
|
54
|
-
Why?") turned a simple skill-loading skip into a generalizable improvement to three skill descriptions and two prompt instructions.
|
|
55
|
-
This is a good example of the user investing a redirecting question instead of a correction.
|
|
56
|
-
- TDD execution was clean — 4 cycles, no rework, no type errors at the end.
|
|
57
|
-
The plan's risk mitigation ("land steps 1–4 on the same branch") worked as intended.
|
|
58
|
-
- Ship stage had zero friction: push, CI, close, release-please merge, tag — all first-try.
|
|
59
|
-
|
|
60
|
-
#### What caused friction (agent side)
|
|
61
|
-
|
|
62
|
-
- `instruction-violation` — Skipped loading the `colgrep` skill during planning despite explicit instructions.
|
|
63
|
-
Root cause: skill descriptions that read like tool reference manuals get deprioritized because the agent perceives them as redundant with the tool schema already in context.
|
|
64
|
-
Impact: no rework on the plan itself, but triggered a productive detour to improve skill descriptions.
|
|
65
|
-
User-caught.
|
|
66
|
-
- `missing-context` — The plan didn't anticipate that `Partial<ResolvedSpawnConfig>` spread in test factories would silently break after nesting.
|
|
67
|
-
The `testing` skill already warns about spread-related pitfalls, but not this specific variant (flat keys ignored by top-level spread on a nested structure).
|
|
68
|
-
Impact: one test failure during step 4 that required a verbose inline fix (writing out the full `execution` sub-object).
|
|
69
|
-
Self-identified during implementation.
|
|
70
|
-
|
|
71
|
-
#### What caused friction (user side)
|
|
72
|
-
|
|
73
|
-
- None observed.
|
|
74
|
-
The user's intervention on the `colgrep` skill was well-timed and produced a higher-value outcome than skipping it would have.
|
|
75
|
-
|
|
76
|
-
### Changes made
|
|
77
|
-
|
|
78
|
-
1. Added a TDD planning rule to `.pi/skills/testing/SKILL.md` warning about `Partial<T>` spread not deep-merging into nested interfaces after a flat-to-nested refactor.
|