# Nested supervisor validation
2026-09-05T19:31:55+08:00

$ npm test

> @wassname2/pi-goals@0.2.2 test
> vitest run


 RUN  v4.1.9 /home/code/.pi/agent/git/github.com/wassname/pi-goals


 Test Files  9 passed (9)
      Tests  43 passed (43)
   Start at  19:31:56
   Duration  1.60s (transform 709ms, setup 0ms, import 1.64s, tests 1.76s, environment 1ms)


$ npm run typecheck

> @wassname2/pi-goals@0.2.2 typecheck
> tsc --noEmit


$ npm run lint

> @wassname2/pi-goals@0.2.2 lint
> biome check src/ test/

Checked 15 files in 29ms. No fixes applied.

$ git diff --check
(no output)

$ npm pack --dry-run
npm notice
npm notice 📦  @wassname2/pi-goals@0.2.2
npm notice Tarball Contents
npm notice 5.8kB README.md
npm notice 1.1kB agents/goal-worker.md
npm notice 1.5kB package.json
npm notice 4.0kB src/approval.ts
npm notice 34.6kB src/index.ts
npm notice 13.6kB src/prompts.ts
npm notice 5.9kB src/supervisor-runtime.ts
npm notice 7.3kB src/worker.ts
npm notice Tarball Details
npm notice name: @wassname2/pi-goals
npm notice version: 0.2.2
npm notice filename: wassname2-pi-goals-0.2.2.tgz
npm notice package size: 23.1 kB
npm notice unpacked size: 73.7 kB
npm notice shasum: 579debe3de67b56116e51da6cac46c14511bdd07
npm notice integrity: sha512-f5S39K2J3kjIX[...]cuwx2WFIeBBAQ==
npm notice total files: 8
npm notice
wassname2-pi-goals-0.2.2.tgz

$ git diff --stat 2852432
 README.md                                          |  13 +-
 agents/goal-worker.md                              |   2 +-
 .../20260905_nested-supervisor-validation.txt      |  70 ++++------
 src/approval.ts                                    |  27 +++-
 src/index.ts                                       | 153 +++++++++++++++------
 src/prompts.ts                                     |   9 +-
 src/supervisor-runtime.ts                          |  81 ++++++++---
 src/worker.ts                                      |  36 +++--
 test/goals-flow.test.ts                            |  54 +++++++-
 test/prompts.test.ts                               |   2 +-
 test/supervisor-runtime.test.ts                    |  32 ++++-
 test/worker.test.ts                                |  18 ++-
 12 files changed, 354 insertions(+), 143 deletions(-)

## Dogfood run

The model-backed run produced commit `0a33ff2` and independently verified 47 text-file word counts with zero set, count, or order mismatches. Approval then deadlocked:

> Cannot approve while the retained worker is pending.

The worker process was terminal, but its model result was `Request was aborted`; the completion event did not clear retained state. A supervisor resume also failed because `subagent_supervisor` was unavailable in its strict tool list.

Usage from the run status files:

| agent | turns | new tokens | cached reads | reported cost |
| --- | ---: | ---: | ---: | ---: |
| supervisor, including recovery | 42 | 169,288 | 2,670,336 | $2.35 |
| worker | 17 | 67,803 | 812,544 | $0.90 |

The corrective patch keeps the supervisor fork, compacts its planning history before the first turn when Ready (compact) is selected, removes global/project/skill prompt inheritance, replaces raw status polling with a concise worker-state tool, removes the unavailable tool, and treats process-terminal as terminal worker state. Unit tests pass; a second model-backed run is still required.

-- PI[gpt-5.6-sol]
