pi-herdr-agents 1.5.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/AGENTS.md +10 -10
  2. package/CHANGELOG.md +54 -1
  3. package/CONTEXT.md +87 -175
  4. package/README.md +136 -97
  5. package/RELEASING.md +1 -1
  6. package/agents/adversarial-reviewer.md +2 -4
  7. package/config.json.example +10 -2
  8. package/docs/README.md +41 -36
  9. package/docs/adr/0002-agent-workflow-skill-runtime-taxonomy.md +2 -0
  10. package/docs/adr/0004-require-active-user-approval-for-workflow-execution.md +2 -0
  11. package/docs/adr/0005-parent-owns-workflow-script-authority.md +2 -0
  12. package/docs/adr/0006-limit-v1-execution-effects-to-isolated-worktrees.md +2 -0
  13. package/docs/adr/0007-require-fresh-review-for-workflow-scripts.md +2 -0
  14. package/docs/adr/0009-remove-workflow-subsystem.md +30 -0
  15. package/docs/adr/0010-persistent-specialists-as-session-generations.md +29 -0
  16. package/docs/orchestrated-review-workflow-plan.md +5 -1
  17. package/docs/worktree-subagents.md +6 -4
  18. package/package.json +3 -3
  19. package/pi-extension/subagents/completion.ts +37 -14
  20. package/pi-extension/subagents/herdr.ts +247 -39
  21. package/pi-extension/subagents/index.ts +876 -1050
  22. package/pi-extension/subagents/launch.ts +56 -5
  23. package/pi-extension/subagents/lifecycle.ts +3 -1
  24. package/pi-extension/subagents/pane-config.ts +43 -10
  25. package/pi-extension/subagents/persistent-config.ts +114 -0
  26. package/pi-extension/subagents/session.ts +499 -19
  27. package/pi-extension/subagents/subagent-done.ts +145 -0
  28. package/pi-extension/subagents/supervision-config.ts +100 -0
  29. package/pi-extension/subagents/supervision.ts +258 -0
  30. package/pi-extension/subagents/terminal.ts +24 -3
  31. package/pi-extension/subagents/type-guards.ts +4 -0
  32. package/pi-extension/subagents/wake.ts +102 -0
  33. package/skills/orchestrate/SKILL.md +65 -210
  34. package/skills/orchestrate/adversarial-review-example.js +58 -211
  35. package/skills/orchestrate/adversarial-review.md +69 -246
  36. package/pi-extension/subagents/workflow-worker.js +0 -73
  37. package/pi-extension/subagents/workflow.ts +0 -1228
package/AGENTS.md CHANGED
@@ -4,7 +4,7 @@ These instructions apply to humans and coding agents changing `pi-herdr-agents`.
4
4
 
5
5
  ## What this package is
6
6
 
7
- `pi-herdr-agents` (Pi Herdr Agents) is a Pi extension that launches asynchronous Pi child agents and approved read-only review workflows exclusively in Herdr. Ordinary runs use dedicated Herdr panes/tabs. Writing tasks may opt into one isolated Herdr-managed Git worktree per branch. Legacy role definitions that request an external CLI fail before Herdr creates resources.
7
+ `pi-herdr-agents` (Pi Herdr Agents) is a Pi extension that launches asynchronous Pi child agents exclusively in Herdr. Ordinary runs group child panes in extension-owned `Agents` tabs by default. Writing tasks may opt into one isolated Herdr-managed Git worktree per branch. Legacy role definitions that request an external CLI fail before Herdr creates resources.
8
8
 
9
9
  The extension is fire-and-forget: `subagent` returns an acknowledgement, and completion is delivered to the parent automatically. Never add polling guidance that tells callers to sleep, tail sessions, or repeatedly check status.
10
10
 
@@ -12,28 +12,29 @@ The extension is fire-and-forget: `subagent` returns an acknowledgement, and com
12
12
 
13
13
  - [`README.md`](./README.md) — canonical installation, API, configuration, lifecycle, and agent-authoring reference
14
14
  - [`docs/README.md`](docs/README.md) — map of shipped contracts, active design, ADRs, and background research
15
- - [`CONTEXT.md`](CONTEXT.md) — workflow domain language and prototype evidence; read it before changing workflow design
15
+ - [`CONTEXT.md`](CONTEXT.md) — workflow-domain glossary; read it before changing orchestration design
16
16
  - [`docs/adr/0003-installable-role-packs.md`](docs/adr/0003-installable-role-packs.md) — installable role-pack discovery, precedence, and collision contract
17
17
  - [`docs/worktree-subagents.md`](docs/worktree-subagents.md) — canonical worktree operating, review, recovery, and cleanup guide
18
18
  - [`RELEASING.md`](RELEASING.md) — release checks and publishing procedure
19
19
 
20
- Bundled role prompts live in [`agents/`](agents/). The native `/skill:orchestrate` workflow authoring skill lives at [`skills/orchestrate/SKILL.md`](skills/orchestrate/SKILL.md). The `/plan` orchestration prompt lives at [`pi-extension/subagents/plan-skill.md`](pi-extension/subagents/plan-skill.md).
20
+ Bundled role prompts live in [`agents/`](agents/). The native `/skill:orchestrate` public-review fan-out skill lives at [`skills/orchestrate/SKILL.md`](skills/orchestrate/SKILL.md). The `/plan` orchestration prompt lives at [`pi-extension/subagents/plan-skill.md`](pi-extension/subagents/plan-skill.md).
21
21
 
22
22
  ## Code map
23
23
 
24
24
  - `pi-extension/subagents/index.ts` — public tools/commands, agent discovery, launch/watch lifecycle, completion delivery, worktree manifests and handoffs
25
- - `pi-extension/subagents/herdr.ts` — Herdr CLI argument construction and response parsing
25
+ - `pi-extension/subagents/herdr.ts` — Herdr CLI calls, response parsing, and ID-based Agents tab placement and capacity
26
26
  - `pi-extension/subagents/terminal.ts` — terminal adapter used by the lifecycle
27
27
  - `pi-extension/subagents/lifecycle.ts`, `status.ts`, `activity.ts` — process/turn state and widget projection
28
+ - `pi-extension/subagents/wake.ts`, `supervision.ts`, `supervision-config.ts` — file wake-ups, shared pane reconciliation, polling fallback, and supervision configuration
29
+ - `pi-extension/subagents/persistent-config.ts` — strict persistent-specialist cap configuration
28
30
  - `pi-extension/subagents/completion.ts`, `session.ts`, `subagent-done.ts` — child completion, transcript handling, `caller_ping`, and `subagent_done`
29
- - `pi-extension/subagents/workflow.ts`, `workflow-worker.js`workflow preparation, ownership, journal, lifecycle, and Worker execution
30
- - `CONTEXT.md` — domain glossary and validated prototype evidence for active design
31
+ - `CONTEXT.md` — orchestration-domain glossary
31
32
  - `docs/adr/` — hard-to-reverse architectural decisions
32
33
  - `docs/research/` — evidence and alternatives, never the shipped contract
33
34
  - `test/test.ts` — unit tests for public subagent extension seams
34
- - `test/workflow.test.ts` — unit tests for workflow preparation, execution, and cancellation
35
35
  - `test/package-skill.test.js` — bundled skill and package manifest contract test
36
36
  - `test/integration/` — real Herdr and Pi lifecycle tests using the deterministic provider by default
37
+ - `test/bench/supervision-bench.mjs` — manual isolated-Herdr supervision transport benchmark; raw samples stay in `/tmp/issue29-bench/`
37
38
 
38
39
  ## Worktree contract
39
40
 
@@ -72,8 +73,7 @@ When behavior changes, update every affected surface in the same commit:
72
73
  - `/plan` orchestration policy → `pi-extension/subagents/plan-skill.md`
73
74
  - contributor/release verification → this file, `.pi/skills/run-integration-tests/SKILL.md`, or `RELEASING.md`
74
75
  - domain terminology → `CONTEXT.md`
75
- - hard-to-reverse workflow trade-offs → the relevant ADR; do not create an ADR for every design question
76
- - active orchestrated-review design → `docs/orchestrated-review-workflow-plan.md`
76
+ - hard-to-reverse orchestration trade-offs → the relevant ADR; do not create an ADR for every design question
77
77
  - architectural evidence and alternatives only → research docs, clearly marked when later decisions supersede them
78
78
 
79
79
  Do not copy the full worktree guide into every role prompt. Keep canonical detail in the guide and add only the role-specific rule an agent needs while running.
@@ -105,7 +105,7 @@ Use `PI_TEST_MODEL="openai-codex/gpt-5.6-luna" PI_TEST_TIMEOUT=180000 npm run te
105
105
  Before committing:
106
106
 
107
107
  - inspect `git status` and the final diff;
108
- - confirm the package preview includes `CHANGELOG.md`, `skills/orchestrate/SKILL.md`, `skills/orchestrate/adversarial-review.md`, `skills/orchestrate/adversarial-review-example.js`, and `pi-extension/subagents/workflow-worker.js`, while excluding plans, journals, sessions, prototypes, generated evidence, and local config;
108
+ - confirm the package preview includes `CHANGELOG.md`, `skills/orchestrate/SKILL.md`, `skills/orchestrate/adversarial-review.md`, and `skills/orchestrate/adversarial-review-example.js`, while excluding `pi-extension/subagents/workflow-worker.js`, plans, journals, sessions, prototypes, generated evidence, and local config;
109
109
  - run `npm pack --dry-run` when package contents or documentation paths changed;
110
110
  - confirm that no generated plans, journals, sessions, provider configuration, test scripts, or review artifacts are staged; and
111
111
  - confirm that no accidental empty directory exists at the repository root:
package/CHANGELOG.md CHANGED
@@ -7,7 +7,59 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
9
9
 
10
- ## [v1.5.1](https://github.com/giuseppecrj/pi-herdr-agents/compare/v1.5.0...v1.5.1)
10
+ ## [v1.7.0](https://github.com/giuseppecrj/pi-herdr-agents/compare/v1.6.0...v1.7.0)
11
+
12
+ ### Merged
13
+
14
+ - feat(subagents): checkout-aware Agents tabs and safe cleanup (#33) [`#43`](https://github.com/giuseppecrj/pi-herdr-agents/pull/43)
15
+ - feat: no-progress advisories for active subagents (#40) [`#41`](https://github.com/giuseppecrj/pi-herdr-agents/pull/41)
16
+ - fix(subagents): measure recovered hang duration and track outstanding tool calls [`#40`](https://github.com/giuseppecrj/pi-herdr-agents/pull/40)
17
+
18
+ ### Commits
19
+
20
+ - feat(subagents): group agents by checkout with safe pane cleanup (#33) [`59a1075`](https://github.com/giuseppecrj/pi-herdr-agents/commit/59a10756722e7cce3b2ded07db6e1adb04abb0ab)
21
+ - fix(subagents): preserve delivery cleanup and live caller identity (#33) [`26987c5`](https://github.com/giuseppecrj/pi-herdr-agents/commit/26987c58a2c882f31a0d935d7e97ce9dd8c4cce8)
22
+ - feat(subagents): no-progress hang advisories for active children (#40) [`1ebf356`](https://github.com/giuseppecrj/pi-herdr-agents/commit/1ebf356521dd46dd6ee035fe3ebba0262992f399)
23
+ - fix(subagents): keep no-progress recovery guidance evidence-based (#40) [`9cbf155`](https://github.com/giuseppecrj/pi-herdr-agents/commit/9cbf155e291c063f70ef86800ef3bfe3c742c6c6)
24
+ - test(integration): hang advisory coverage (#40) [`075f4fe`](https://github.com/giuseppecrj/pi-herdr-agents/commit/075f4feb17938df28a92fa00851d606e5a83b258)
25
+ - fix(subagents): preserve boundary-aligned records in bounded session tails (#40) [`f096fdb`](https://github.com/giuseppecrj/pi-herdr-agents/commit/f096fdb681921e9ab460610d53e456758802725f)
26
+
27
+ ## [v1.6.0](https://github.com/giuseppecrj/pi-herdr-agents/compare/v1.5.1...v1.6.0) - 2026-09-08
28
+
29
+ ### Merged
30
+
31
+ - feat: event-driven supervision with file wake-ups and batched reconciliation (#29) [`#39`](https://github.com/giuseppecrj/pi-herdr-agents/pull/39)
32
+ - fix(subagents): never downgrade a queued reconciliation to a wake [`#29`](https://github.com/giuseppecrj/pi-herdr-agents/pull/29)
33
+ - feat: persistent subagents with turn-based task delivery (#32) [`#37`](https://github.com/giuseppecrj/pi-herdr-agents/pull/37)
34
+ - fix(subagents): fail closed after an unconfirmed persistent stop [`#32`](https://github.com/giuseppecrj/pi-herdr-agents/pull/32)
35
+ - fix(subagents): close persistent delivery and stop-retry edge cases [`#32`](https://github.com/giuseppecrj/pi-herdr-agents/pull/32)
36
+ - refactor!: remove the workflow subsystem (#31) [`#36`](https://github.com/giuseppecrj/pi-herdr-agents/pull/36)
37
+ - refactor!: remove the workflow subsystem [`#31`](https://github.com/giuseppecrj/pi-herdr-agents/pull/31)
38
+
39
+ ### Commits
40
+
41
+ - feat(subagents): turn-based task delivery for persistent specialists (#32) [`820a7dc`](https://github.com/giuseppecrj/pi-herdr-agents/commit/820a7dcebf5cf1b2d36435c39388702d238410f1)
42
+ - feat(subagents): file wake-ups and batched supervision reconciliation (#29) [`cbd42ed`](https://github.com/giuseppecrj/pi-herdr-agents/commit/cbd42ed0df09276d0859436e53657c6af9ba848d)
43
+ - feat(subagents): subagent_stop, specialist cap, and crash notices (#32) [`73267af`](https://github.com/giuseppecrj/pi-herdr-agents/commit/73267afbd279f8796dd8b13b92a16de6aba65562)
44
+ - feat(subagents): subagent_send and specialist visibility (#32) [`5542341`](https://github.com/giuseppecrj/pi-herdr-agents/commit/554234161a25c5868b1b6744a05914d816a61823)
45
+ - fix(subagents): retain persistent task and stop evidence (#32) [`154bc1f`](https://github.com/giuseppecrj/pi-herdr-agents/commit/154bc1f202e3e90e0a42ef5687964c69bbbbc68e)
46
+ - test(integration): persistent specialist lifecycle coverage (#32) [`526ae46`](https://github.com/giuseppecrj/pi-herdr-agents/commit/526ae46ffe56205919d8eb6f1ba94020c2e4d378)
47
+ - feat(subagents): supervision benchmark and docs (#29) [`97fb7a3`](https://github.com/giuseppecrj/pi-herdr-agents/commit/97fb7a3b6b2445faa452fce7d72008cf8173adc5)
48
+ - test(integration): event-driven supervision fault coverage (#29) [`f9d2603`](https://github.com/giuseppecrj/pi-herdr-agents/commit/f9d260388c8e494da6d70bb524341f1ba2edd637)
49
+ - fix(subagents): keep legacy polling honest and close supervision handles (#29) [`256a32c`](https://github.com/giuseppecrj/pi-herdr-agents/commit/256a32c572e8c7349e8faa820d8c9cc9f5f11395)
50
+ - fix(subagents): enforce single-task busy state for persistent specialists (#32) [`c2fa33f`](https://github.com/giuseppecrj/pi-herdr-agents/commit/c2fa33f5a367ca7b79ab9635ef9d41f1ea165c31)
51
+ - fix(subagents): scope pane snapshots to registered owners and confirm absence (#29) [`c73a132`](https://github.com/giuseppecrj/pi-herdr-agents/commit/c73a13211f743dc881c506226f457c6a5045e41b)
52
+ - feat(subagents): persistent specialist docs, glossary, and integration coverage (#32) [`e0f052d`](https://github.com/giuseppecrj/pi-herdr-agents/commit/e0f052da7b717a9c4c21ae1d83172acb1a27452c)
53
+ - fix(subagents): guard terminal evidence against racing semantic records (#29) [`f2e41f7`](https://github.com/giuseppecrj/pi-herdr-agents/commit/f2e41f74f185c13a89b49301e226e04948d4c088)
54
+ - chore: release v1.6.0 [`8a18189`](https://github.com/giuseppecrj/pi-herdr-agents/commit/8a181890479f46d5955d4f1bac3be759a2d39010)
55
+ - fix(subagents): type-safe validation for persistent sidecar, ledger, and config parsing [`fe81be5`](https://github.com/giuseppecrj/pi-herdr-agents/commit/fe81be5ca76eba504ff59fcf46ba3e9499753a70)
56
+ - fix(orchestrate): parse review reports out of wrapped public delivery [`9f11918`](https://github.com/giuseppecrj/pi-herdr-agents/commit/9f11918a407be39388999feeee16970e9d888105)
57
+ - fix(subagents): close stopped persistent specialist panes (#32) [`8d0b6e7`](https://github.com/giuseppecrj/pi-herdr-agents/commit/8d0b6e7e9703fd7416e8ddc0ffb97dc26d48ab6b)
58
+ - docs(context): define child wake-up signal and result delivery terms [`a3c159e`](https://github.com/giuseppecrj/pi-herdr-agents/commit/a3c159e2056d13be5697494a13bcb84bdcf92bab)
59
+ - docs(subagents): clarify persistent help requests (#32) [`16e9363`](https://github.com/giuseppecrj/pi-herdr-agents/commit/16e9363180cf49b5e03003f5ea1e57b38ac8adbd)
60
+ - docs(release): require workflow-worker.js absence in the pack preview (#31) [`9d40cc0`](https://github.com/giuseppecrj/pi-herdr-agents/commit/9d40cc0f3aa08ce203a720947bf097a4b66c9357)
61
+
62
+ ## [v1.5.1](https://github.com/giuseppecrj/pi-herdr-agents/compare/v1.5.0...v1.5.1) - 2026-09-05
11
63
 
12
64
  ### Merged
13
65
 
@@ -20,6 +72,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
20
72
  - fix(roles): reject malformed capability declarations (#27) [`0d263b8`](https://github.com/giuseppecrj/pi-herdr-agents/commit/0d263b8867e1708288302e0f9a5c9b806c810345)
21
73
  - fix(workflows): join child cleanup before terminal delivery (#25) [`e928817`](https://github.com/giuseppecrj/pi-herdr-agents/commit/e9288172b8037b39ed04107ad0729292ea596a8f)
22
74
  - test(integration): assert cwd and session delivery structurally (#28) [`ec277ff`](https://github.com/giuseppecrj/pi-herdr-agents/commit/ec277ff9ddf4b309edb1f12942acac68ee295eb2)
75
+ - chore: release v1.5.1 [`ebef265`](https://github.com/giuseppecrj/pi-herdr-agents/commit/ebef2657b0b21177373868d83d66965fdf77febd)
23
76
 
24
77
  ## [v1.5.0](https://github.com/giuseppecrj/pi-herdr-agents/compare/v1.4.2...v1.5.0) - 2026-09-05
25
78
 
package/CONTEXT.md CHANGED
@@ -1,189 +1,101 @@
1
- # Feature Delivery
2
-
3
- This context defines language for the shipped first-flow workflow runtime and deferred follow-up. [`README.md`](./README.md) is authoritative for shipped behavior; [`docs/orchestrated-review-workflow-plan.md`](./docs/orchestrated-review-workflow-plan.md) records the shipped implementation and deferred work. The workflow coordinates existing subagent roles without becoming a general-purpose workflow engine.
1
+ # Orchestration glossary
4
2
 
5
3
  ## Language
6
4
 
7
- **Feature-delivery workflow**:
8
- A bounded, user-approved plan that coordinates work needed to deliver one feature and ends in reviewable evidence.
9
- _Avoid_: General task graph, orchestrator agent
10
-
11
- **Workflow script**:
12
- The per-run `workflow.js` containing a runner-validated JSON metadata block and the user-approved executable strategy.
13
- _Avoid_: Execution plan, generic script, inferred policy
14
-
15
- **Workflow metadata**:
16
- The JSON block at the start of a workflow script that the runner parses and validates before loading any executable JavaScript.
17
- _Avoid_: Evaluated metadata, inferred policy
18
-
19
- **Approved runtime**:
20
- A mandatory exact `provider/model` reference and thinking level declared in workflow metadata; every execution node must resolve to one of these approved runtimes. Missing values fail preparation rather than inheriting parent or role defaults. All subagent and workflow execution is Pi-backed.
21
- _Avoid_: Runtime tiers, external CLI adapter, silent fallback, inherited runtime
22
-
23
5
  **Pi subagent runtime**:
24
- The single execution path for fresh and resumed children. `launchPiSubagent()` owns the complete Pi and Herdr launch transaction; completion uses Pi sidecar evidence first and the terminal exit marker as fallback.
6
+ The single execution path for fresh and resumed children. `launchPiSubagent()`
7
+ owns the complete Pi and Herdr launch transaction; completion uses Pi sidecar
8
+ evidence first and the terminal exit marker as fallback.
25
9
  _Avoid_: Runtime dispatch, adapter registry, split launch ownership
26
10
 
27
- **Legacy external CLI role**:
28
- An old role definition that contains `cli`. Discovery reports a migration diagnostic, and launch fails before Herdr creates a pane or worktree. Remove `cli` and `cli-model`, then select the model through Pi provider/model routing.
29
- _Avoid_: Silent Pi reinterpretation, compatibility adapter
30
-
31
- **Run journal**:
32
- The runner-owned append-only `run.jsonl` that starts with approval binding the workflow-script hash, canonical repository identity, and committed base, then records observed node calls and results. Exactly one terminal event contains the bounded runtime envelope; a following delivery event references it without duplicating the task result.
33
- _Avoid_: User-authored plan, mutable audit log, duplicated result
34
-
35
- **Terminal lifecycle**:
36
- Every workflow terminal path stops queued work and accounts for active read and review panes before checkout disposal and final delivery. Completed panes close after result capture while child session files and run evidence remain. Unconfirmed child exit retains the checkout and ends failed with `cancel_termination_failed`. Writer-worktree retention belongs to a deferred writer workflow.
37
- _Avoid_: Retaining every clean pane, deleting review evidence
38
-
39
- **Restart boundary**:
40
- Workflow ownership survives Pi lifecycle transitions handled inside the same process, including `/reload`. A full process restart performs interruption reconciliation only: it marks a stale run interrupted, retains sessions, journals, branches, and worktrees as evidence, and requires a newly approved run. There is no replay, restart of children, cleanup, or history surface.
41
- _Avoid_: Automatic replay, durable workflow manager, lost-artifact claim
42
-
43
- **Execution artifact directory**:
44
- The project-local `.pi/plans/<run>/` directory that keeps its workflow script and run journal together.
45
- _Avoid_: Session-only state, runner-global artifacts
46
-
47
- **Execution run**:
48
- One immutable orchestration attempt with its own unique artifact directory; a retry or revised plan creates a new run that can reference its predecessor. Approval binds the canonical repository root, Git common directory, and committed base SHA. Read-only execution nodes share a run-owned checkout pinned to that identity.
49
- _Avoid_: Overwritten feature directory, mutable run history, parent-checkout reads, SHA-only repository ambiguity
50
-
51
- **Execution source**:
52
- A user-selected PRD, ticket set, URL, or combination that the orchestration skill reads before preparation. Local paths must resolve inside the approved repository; remote or tracker content is materialized into the exact approved script or prompt evidence rather than fetched by workflow children. Metadata source strings are provenance, not runtime read authority.
53
- _Avoid_: Required ticket conversion, fixed ticket graph, runtime refetch, path escape
54
-
55
- **Orchestration skill**:
56
- The user-facing native Pi skill bundled with this package that accepts an execution source, derives a workflow script, and invokes the runner only after approval. Its adversarial branch is a disclosed procedure in the same skill, not another engine or role.
57
- _Avoid_: Extension command, separate skill package, raw runner API, child-authored workflow
58
-
59
- **Adversarial review procedure**:
60
- The preferred `orchestrate` branch for exact approved review: two routine or three distinct-lens high-risk discovery reviewers, candidate-dependent cross-family verification, then fresh synthesis. It uses the existing runner and SDK.
61
- _Avoid_: Fixed `3 + 3 + 1`, confidence vote, new workflow engine
62
-
63
- **Compatibility review coordinator**:
64
- The transitional `adversarial-reviewer` role for public asynchronous child launches. It stays open across automatic result steers, counts terminal child envelopes by name, and calls `subagent_done` only after synthesis. Its Bash-enabled inspection contract is behavioral rather than an enforced read-only capability boundary.
65
- _Avoid_: Preferred hardened path, enforced read-only runner, auto-exit coordinator
66
-
67
- **Source resolution**:
68
- The orchestration skill reads an execution source through capabilities already available to the parent; the extension has no built-in tracker client and stops when the source is inaccessible.
69
- _Avoid_: Required tracker integration, silent fallback
11
+ **Child wake-up signal**:
12
+ An internal indication that prompts fresh inspection of an owned child. It does
13
+ not itself establish completion, failure, or a help request.
14
+ _Avoid_: Completion result, user alert
70
15
 
71
- **Execution node**:
72
- A bounded planned subagent run that may cover one, part of one, or several source tickets while retaining source traceability. The shipped first flow accepts only `kind: "review"`; `read` and `write` remain deferred kinds for later workflows.
73
- _Avoid_: Ticket, untracked child run, inferred effect, first-flow read/write node
16
+ **Child result delivery**:
17
+ The parent-facing handoff of a child run's observed outcome and available
18
+ evidence. Receiving it does not establish that the work is correct or accepted.
19
+ _Avoid_: Wake-up signal, acceptance
74
20
 
75
- **Review node**:
76
- A declared workflow execution identity that pins one role, exact runtime, and
77
- thinking level. Node IDs are unique within a workflow; several nodes can use
78
- the same role.
79
- _Avoid_: Role identity, implicit runtime, duplicate-role prohibition
21
+ **No-progress advisory**:
22
+ An internal warning that an active child shows no durable progress in its session
23
+ JSONL or activity snapshot. It is advisory only and never changes the child's
24
+ outcome or triggers recovery.
25
+ _Avoid_: Hang verdict, automatic recovery, stall replacement
80
26
 
81
- **Writer lane (deferred)**:
82
- A possible later single write node and retained worktree; it is not part of the first review-only workflow and requires separate evidence and approval.
83
- _Avoid_: First-flow writer, parallel writers, shared-checkout writer
84
-
85
- **Read-only fan-out**:
86
- The shipped first flow runs bounded parallel review nodes, then one fresh synthesis node. A later writer workflow may define separate pre-write and post-write review stages.
87
- _Avoid_: Unbounded fan-out, first-flow writer, reviewing through a writer
88
-
89
- **Code-oriented orchestration**:
90
- The parent writes JavaScript against a narrow capability API so intermediate subagent results stay in code and only the final useful result returns to the parent context, similar in shape to Cloudflare Code Mode.
91
- _Avoid_: Direct parent turn per child result, broad generated tool API, security-equivalence claim
92
-
93
- **Workflow SDK**:
94
- The extension-private JavaScript API that workflow scripts use to launch and await policy-checked execution nodes through the existing subagent lifecycle. V1 exposes only `agent()` and `log()`; scripts use ordinary JavaScript control flow and `Promise.all`.
95
- _Avoid_: Public `subagent()` tool, third-party package API, speculative helper framework
96
-
97
- **Tool derivation**:
98
- The runner computes each node's effective tools from its resolved role, the hard maximum for its declared kind, and extension deny rules; `agent()` has no script-controlled `tools` option. Workflow children receive the exact derived list without public child-control tools such as `caller_ping`.
99
- _Avoid_: Script-granted capability, duplicated tool policy, public child-control tool
100
-
101
- **Agent result**:
102
- The explicit success-or-failure value returned by `agent()`, preserving output, retryability, session reference, and any Git handoff without collapsing operational failure to `null`.
103
- _Avoid_: Nullable result, prose-only failure
104
-
105
- **Runtime envelope**:
106
- The runner-owned final wrapper containing only operational facts such as run ID, terminal runtime state, returned task result, and a runtime error when present.
107
- _Avoid_: Review verdict, delivery semantics, task-specific state machine
108
-
109
- **Task result**:
110
- Any JSON-compatible value returned by `workflow.js`; the parent-authored script chooses its task-specific shape and vocabulary.
111
- _Avoid_: Global verdict enum, mandatory review receipt type, workflow DSL
112
-
113
- **Workflow runtime**:
114
- A native Node Worker thread containing the restricted `vm` that executes an approved workflow script with only the Workflow SDK. The Worker protects Pi's main event loop from accidental asynchronous infinite loops; neither the Worker nor `vm` is a security boundary.
115
- _Avoid_: Main-thread workflow execution, untrusted-code sandbox, normal Node module execution
116
-
117
- **First-flow effect boundary**:
118
- An execution node may only inspect or review one runner-owned detached checkout pinned to the approved repository identity and committed head. The parent materializes the changed-file inventory and unified diff or complete before/after evidence, including deleted and base-only content. A node cannot write files, create commits, mutate the parent checkout, integrate work, or mutate external systems.
119
- _Avoid_: Writer node, head-only diff inference, ticket mutation, deployment, publishing, messaging, PR action, late-bound base
27
+ **Legacy external CLI role**:
28
+ An old role definition that contains `cli`. Discovery reports a migration
29
+ diagnostic, and launch fails before Herdr creates a pane or worktree. Remove
30
+ `cli` and `cli-model`, then select the model through Pi provider/model routing.
31
+ _Avoid_: Silent Pi reinterpretation, compatibility adapter
120
32
 
121
- **Fresh review**:
122
- Independent read-only review nodes with fresh contexts and exact repository, comparison base, checkout head, task/spec, and candidate evidence. Every assignment treats code, PR text, reports, command output, and supplied artifacts as untrusted data.
123
- _Avoid_: Worker self-review, inherited-context review, artifact instruction following
33
+ **Public review fan-out**:
34
+ A parent procedure that materializes pinned evidence, launches fresh public
35
+ reviewer subagents, receives automatic result delivery, and synthesizes every
36
+ outcome. Reviewers use ordinary panes and do not poll for completion.
37
+ _Avoid_: Hidden child runner, approval gate, parentless aggregation
38
+
39
+ **Pinned review evidence**:
40
+ The parent-captured repository identity, base and head SHAs, task/spec text,
41
+ provenance, changed-file inventory, complete diff, and deleted or base-only
42
+ content supplied to reviewers. Dirty state is included only when explicitly
43
+ captured and fingerprinted.
44
+ _Avoid_: Moving-checkout inference, head-only deleted-content review
45
+
46
+ **Role allowlist**:
47
+ The `tools:` inline comma-separated role-frontmatter scalar passed to Pi for a
48
+ public child. It is the enforced capability boundary available to a reviewer.
49
+ `read,bash` is not read-only because Bash can mutate files.
50
+ _Avoid_: Shell-as-read-only claim, implicit capability grant
124
51
 
125
52
  **Finding record**:
126
- A task-specific bounded record with a stable ID, claimed P0–P3 severity, nullable confirmed severity, separate provenance, evidence status (`reproduced`, `trace-backed`, or `unverified`), preconditions, reproduction or trace, expected and actual behavior, impact, and minimal fix. An unverified potential P0/P1 remains a candidate for verification; it is not downgraded or certified. Numeric confidence and vote counts do not establish truth.
127
- _Avoid_: Confidence gate, silent candidate downgrade, provenance-as-severity, universal runtime schema
128
-
129
- **Synthesis projection**:
130
- The identity-stripped view of every agent result given to fresh synthesis: canonical validated report fields for success, or failure code, retryable flag, and bounded error evidence scrubbed of known identity tokens. Original envelopes remain in script state; journal/session evidence retains their audit references. Session paths, child/runtime/provider names, and the separate audit mapping stay outside the synthesis prompt. Anonymization is presentation hygiene, not a sandbox or proof against bias.
131
- _Avoid_: Filtered result, raw identity-bearing envelope, security claim
132
-
133
- **Review-policy boundary**:
134
- The bundled skill authors review fan-out and synthesis, and exact-script approval binds that task strategy; the runner enforces operational capabilities and evidence without a fixed review receipt or data-flow state machine.
135
- _Avoid_: Hidden task semantics, runner-certified review completeness
136
-
137
- **Review workflow**:
138
- The first product flow: an approved JavaScript run fans out to fresh read-only reviewers, retains every explicit result, then sends every outcome through a synthesis projection to one fresh reviewer.
139
- _Avoid_: Parent-scheduled review nodes, filtered result, prose-only aggregation
140
-
141
- **Review synthesis**:
142
- The final fresh read-only review node that receives exact materialized source evidence and identity-stripped projections for every discovery and verification outcome, preserves finding provenance, resolves claims from evidence, and returns one task-specific result. Reviewer aliases and a predetermined report order reduce identity/order cues while the approval packet and journal retain auditable runtime provenance.
143
- _Avoid_: Filtered failures, raw identity metadata, mechanical worst-verdict rule, confidence voting, parent-side synthesis
144
-
145
- **Parent-guided recovery**:
146
- Current runtime child failures are explicit non-retryable evidence. The parent can approve a new smaller workflow for missing coverage. The bundled skill also contains one dormant same-node replacement branch, used only when a required failure explicitly has `retryable: true`; it never infers retryability from prose or runtime error text.
147
- _Avoid_: Error-text retry classification, silent model fallback, unbounded retries
53
+ A bounded review record with a stable ID, claimed P0–P3 severity, nullable
54
+ confirmed severity, separate provenance, evidence status (`reproduced`,
55
+ `trace-backed`, or `unverified`), preconditions, reproduction or trace, expected
56
+ and actual behavior, impact, and minimal fix. An unverified potential P0/P1 is
57
+ a candidate for verification, not a certified finding.
58
+ _Avoid_: Confidence gate, provenance-as-severity, vote count
148
59
 
149
60
  **Incomplete review**:
150
- A review-workflow task-result state chosen by the script when drift, failure, missing or truncated evidence, malformed task output, a child-reported coverage gap, or unresolved material verification leaves coverage unknown. Valid discovery, verification, or synthesis output with `status: INCOMPLETE` propagates even through `ok: true`. It is not a runner-owned terminal state.
151
- _Avoid_: Hidden missing coverage, runtime-wide review semantics, invented or certified-uncertain findings
152
-
153
- **Ready for integration (deferred)**:
154
- A possible later writer-workflow result containing retained commits, verification, and review evidence. It is not a first-flow result and cannot claim automatic acceptance.
155
- _Avoid_: First-flow handoff, ship verdict, automatic integration
156
-
157
- **Run assembly (deferred)**:
158
- A possible later post-writing step that combines writer commits on a run-owned branch without modifying the parent checkout; adoption requires a separate end-to-end prototype.
159
- _Avoid_: First-flow assembly, parent integration, automatic conflict repair
160
-
161
- **Delivery verdict (deferred)**:
162
- A possible later delivery workflow's task-specific recommendation, assembled in JavaScript from review evidence and accepted or rejected by the parent; its vocabulary would remain outside the runtime contract.
163
- _Avoid_: First-flow verdict requirement, runtime-wide verdict enum, automatic acceptance, worker self-acceptance
164
-
165
- **Workflow-script authority**:
166
- The parent is the only actor that may author or revise a workflow script; children can only return findings or recommendations.
167
- _Avoid_: Child-authored workflow script, self-modifying workflow
168
-
169
- **Execution approval**:
170
- An explicit `APPROVE <8-character SHA-256 prefix>` authorization entered by the user after preparation in the same active parent session to execute one exact workflow-script revision once. Preparation also binds resolved role behavior and tools; any change requires preparation and approval again. Parent-guided recovery creates a new run.
171
- _Avoid_: Pre-prepare approval, cross-session approval, friendly-ID mapping, reusable approval, implicit approval
172
-
173
- **Preflight discovery**:
174
- A parent-directed, read-only investigation after an orchestration request and before execution approval; it is not workflow execution.
175
- _Avoid_: Unapproved node, workflow execution
176
-
177
- ## Prototype evidence
178
-
179
- ### JavaScript review workflow validated
180
-
181
- - **Question:** Can JavaScript await real Pi-backed Herdr children internally, fan review out, synthesize every final result, and return one value without public subagent steers?
182
- - **Primary source:** branch `prototype/js-review-workflow`, commit `4622e08731d31ccda1c33eb01cff5610d86d0166`
183
- - **Run:** `npm run prototype:review-workflow`
184
- - **Observed:** three parallel Luna reviewers and one Luna synthesizer completed; the prototype's synthetic replacement is historical evidence only and is not part of the shipped flow; every real child used only read-only tools; no child result entered the parent session; completed panes closed; the exact-base shared checkout was disposed; sessions and a 15-event journal remained.
185
- - **VM result:** `agent.constructor(...)` reached the host `process`, confirming that Node `vm` is not a security boundary.
186
- - **Event-loop result:** a separate Node 26.3 probe showed that the VM timeout stops a synchronous infinite loop but not one started after `await`; production workflow code must run in a terminable Worker thread rather than Pi's main event loop.
187
- - **Self-hosting result:** child `pi -ne -e subagent-done.ts` avoided duplicate loading of the repository and globally installed subagent extensions.
188
- - **Answered later:** cancel-all is shipped as `herdr_workflow cancel` under a process-global terminal gate: active panes capture Herdr process identities before close, checkout dispose requires confirmed exit, and unconfirmed termination retains the checkout and ends `failed` with `cancel_termination_failed`.
189
- - **Not answered:** writer review visibility; typed retryability remains deferred, while real launch-failure classification is covered by the shipped workflow failure envelope and same-process `/reload` ownership is covered by the process-global workflow owner.
61
+ A review outcome for drift, failure, missing or truncated evidence, malformed
62
+ output, coverage gaps, or unresolved serious candidates. A child-reported
63
+ `INCOMPLETE` propagates to the parent result.
64
+ _Avoid_: Hidden missing coverage, certified uncertainty
65
+
66
+ **Persistent specialist**:
67
+ A logical subagent that retains one policy-bound Pi session between sequential
68
+ tasks until it is stopped or crashes.
69
+ _Avoid_: Immortal process, reusable pane
70
+
71
+ **Session generation**:
72
+ One concrete Pi session serving a persistent specialist's logical identity.
73
+ _Avoid_: Logical specialist, revived session
74
+
75
+ **Task outcome**:
76
+ The recorded terminal result for one persistent-specialist task, including
77
+ `delivered`, `rejected-busy`, or a stop-pending task's eventual terminal state.
78
+ _Avoid_: Assumed completion, replay candidate
79
+
80
+ **Delivery ledger**:
81
+ The append-only evidence record of persistent task dispatch and terminal
82
+ outcomes for one session generation.
83
+ _Avoid_: Work queue, mutable task list
84
+
85
+ **Agents tab**:
86
+ An extension-owned Herdr tab grouping delegated child panes in an existing
87
+ checkout workspace. Ownership comes from returned IDs, not its display label.
88
+ The pane cap includes every live pane; overflow creates another tab, not a
89
+ workspace. Separate parent processes own separate groups.
90
+ _Avoid_: Agent workspace, label-based ownership, automatic rearrangement
91
+
92
+ **Retained checkout shell**:
93
+ The interactive shell in a managed worktree's root pane, preserved after the
94
+ child Pi process exits. Temporary review panes can close without deleting this
95
+ surface or its checkout.
96
+ _Avoid_: Completed agent process, disposable pane, automatic worktree cleanup
97
+
98
+ **Worktree lease**:
99
+ The lifetime-exclusive binding between a persistent specialist generation and
100
+ one managed worktree, when that specialist writes in a worktree.
101
+ _Avoid_: Rebindable checkout, shared worktree ownership