pi-herdr-agents 0.1.3 → 1.0.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.
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 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.
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.
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
 
@@ -93,6 +93,8 @@ Run LSP diagnostics on every changed TypeScript file; lint and tests do not catc
93
93
 
94
94
  For Herdr or lifecycle changes, run the deterministic suite from inside Herdr. Run only one integration suite at a time on a Herdr instance; concurrent suites compete for terminal focus and process capacity and can cause false timeouts or leaked test resources.
95
95
 
96
+ When a test reports that a `pi-integ-*` worktree path already exists, first check whether the same test already created that worktree and the deterministic provider dispatched the tool twice after asynchronous completion. Deterministic providers must make each requested tool call one-shot after its started result appears. Remove only verified test-owned residue after confirming that no workspace or process owns it.
97
+
96
98
  ```bash
97
99
  npm run test:integration
98
100
  ```
package/CONTEXT.md CHANGED
@@ -17,24 +17,16 @@ The JSON block at the start of a workflow script that the runner parses and vali
17
17
  _Avoid_: Evaluated metadata, inferred policy
18
18
 
19
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. The first workflow supports Pi-backed agents only; existing public Claude subagents remain unchanged.
21
- _Avoid_: Runtime tiers, silent fallback, inherited runtime, v1 Claude workflow adapter
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
22
 
23
- **External CLI runtime adapter**:
24
- A runtime-specific module selected by a known local role `cli` value. The MVP dispatches `cli: claude` to the built-in Claude adapter; a future registry needs a proven second CLI.
25
- _Avoid_: Raw flag template, plugin system before a second CLI
23
+ **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.
25
+ _Avoid_: Runtime dispatch, adapter registry, split launch ownership
26
26
 
27
- **Adapter permission policy**:
28
- The runtime adapter owns its fixed vendor flags for the MVP. A local role selects the CLI, not raw flags or a policy profile.
29
- _Avoid_: Implied permission bypass, raw flag values
30
-
31
- **Adapter seam**:
32
- `index.ts` retains pane, worktree, lifecycle, and delivery ownership. The Claude adapter owns Claude command construction, completion/result extraction, transcript copying, and workspace cleanup.
33
- _Avoid_: Vendor behavior in the shared lifecycle
34
-
35
- **Runtime dispatch**:
36
- The core validates a role's `cli` value before pane creation and dispatches each known value to its internal adapter. The MVP recognizes `claude` only; unknown values fail closed.
37
- _Avoid_: Silent Pi fallback, speculative runtime registry
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
38
30
 
39
31
  **Run journal**:
40
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.
package/README.md CHANGED
@@ -65,7 +65,7 @@ Use `pi install -l npm:pi-herdr-agents` for a project-local installation, or try
65
65
  pi -e npm:pi-herdr-agents
66
66
  ```
67
67
 
68
- Pi packages execute with your user account's full system access. Review the package source before installation. A locally installed Claude CLI adapter launches with `--dangerously-skip-permissions`, so those runs skip Claude's interactive permission prompts.
68
+ Pi packages execute with your user account's full system access. Review the package source before installation.
69
69
 
70
70
  After the one-time first-package bootstrap, changing the `package.json` version on `main` automatically publishes to npm and creates the matching Git tag and GitHub Release. For bootstrap authentication, versioning, verification, and troubleshooting, see [RELEASING.md](RELEASING.md).
71
71
 
@@ -136,9 +136,8 @@ This package uses five distinct concepts:
136
136
  artifacts, and runtime policy.
137
137
  - A **skill** is a Pi-native procedure loaded into the current agent. Skills are
138
138
  dependencies of roles or workflows, not subagent definitions.
139
- - A **runtime** is how an invocation executes: Pi or an external CLI, plus its
140
- model and thinking policy.
141
- - An **adapter** is a hidden runtime-specific definition supplied locally or optionally used by a workflow.
139
+ - A **runtime** is the authenticated Pi provider/model and thinking policy used
140
+ for one invocation.
142
141
 
143
142
  See [ADR-0002](docs/adr/0002-agent-workflow-skill-runtime-taxonomy.md) for the
144
143
  accepted decision, rationale, migration boundaries, and evidence.
@@ -165,13 +164,10 @@ The current workflow inventory is:
165
164
  | **poteto** | Coordinator agent role | Config, then parent | Autonomously investigates, edits minimally, delegates independent work, and verifies. |
166
165
  | **adversarial-reviewer** | Transitional workflow implementation | Three distinct authenticated Pi model IDs, preferring provider diversity | Runs evidence-backed Optimizer and Skeptic review passes through generic `reviewer` children. |
167
166
 
168
- Bundled definitions are portable Pi roles. Vendor-specific external CLI adapters
169
- are local or optional definitions, not bundled roles. The existing external CLI
170
- path supports a local hidden Claude adapter (`cli: claude`) and always adds
171
- `--dangerously-skip-permissions`; it does not provide an adapter registry or
172
- Cursor/OpenCode support. Put an adapter in
173
- `$PI_CODING_AGENT_DIR/agents/` or `.pi/agents/` with
174
- `disable-model-invocation: true` when direct exact-name invocation needs it.
167
+ All subagents execute through Pi. Claude models remain available through normal
168
+ Pi provider/model routing. Legacy role definitions that contain `cli` fail before
169
+ Herdr creates a pane or worktree; remove `cli` and `cli-model`, then select an
170
+ authenticated Pi `provider/model-id`.
175
171
 
176
172
  Optional prerequisites fail closed and are not bundled:
177
173
 
@@ -223,7 +219,7 @@ Multiple subagents run concurrently — each steers its result back independentl
223
219
  ╰─────────────────────────────────────────────────────────╯
224
220
  ```
225
221
 
226
- Completion messages render with a colored background and are expandable with `Ctrl+O`. Results larger than 16,000 characters are abbreviated in the parent context while preserving their beginning, conclusion, and session path; the complete result remains in the child session. The extension includes that bounded result directly in the user message that wakes Pi, avoiding empty turns caused by a separate context-free follow-up. Completed rows are removed from the widget as soon as their result is delivered or suppressed.
222
+ Completion messages render with a colored background and are expandable with `Ctrl+O`. Results larger than 16,000 characters are abbreviated in the parent context while preserving their beginning, conclusion, and session path; the complete result remains in the child session. The extension includes that bounded result and a continuation instruction directly in the single custom `subagent_result` message that triggers or steers Pi, avoiding empty turns caused by a separate context-free wake-up. The renderer uses the unadorned bounded result from structured details. Completed rows are removed from the widget as soon as their result is delivered or suppressed.
227
223
 
228
224
  ### In-progress status updates
229
225
 
@@ -357,10 +353,9 @@ subagent({
357
353
  | `agent` | string | — | Load defaults from agent definition |
358
354
  | `fork` | boolean | `false` | Force the full-context fork mode for this spawn, overriding any agent `session-mode` frontmatter |
359
355
  | `interactive` | boolean | derived | Mark this spawn as interactive (don't wake the parent on stall/recovery). Defaults to the agent's `interactive` frontmatter, otherwise the inverse of `auto-exit`. |
360
- | `model` | string | configured or parent | Exact authenticated `provider/model-id`, or an ordered comma-separated Pi fallback list; unavailable for Claude CLI and worktree spawns. Resolution is tool argument → agent frontmatter → per-agent config → global config → parent |
356
+ | `model` | string | configured or parent | Exact authenticated `provider/model-id`, or an ordered comma-separated Pi fallback list; fallback lists are unavailable for worktree spawns. Resolution is tool argument → agent frontmatter → per-agent config → global config → parent |
361
357
  | `thinking` | string | parent level | Pi thinking level (`off` through `max`); omit to inherit the parent |
362
- | `systemPrompt` | string | — | Role/system-prompt text for a bare spawn; overrides the body for Claude CLI agents, while named Pi agents keep their definition body |
363
- | `resumeSessionId` | string | — | Claude CLI session ID to resume; separate from the Pi `subagent_resume` tool |
358
+ | `systemPrompt` | string | — | Role/system-prompt text for a bare spawn; named agents keep their definition body |
364
359
  | `skills` | string | — | Comma-separated skill names |
365
360
  | `tools` | string | — | Comma-separated tool names |
366
361
  | `cwd` | string | — | Working directory, or source repository when `worktree` is set (see [Role Folders](#role-folders)) |
@@ -370,6 +365,8 @@ subagent({
370
365
 
371
366
  Use one worktree per independent writing task; keep read-only agents in ordinary panes. `cwd` selects the source Git repository, `branch` must be unique, and `base` is resolved to an exact commit before creation. If `base` is omitted, the source checkout's committed `HEAD` is used. Parent-checkout changes that have not been committed are not copied.
372
367
 
368
+ A launch with `worktree` and an effective bundled `scout`, `reviewer`, or `adversarial-reviewer` returns a non-blocking warning. Scouts and reviewers normally need an ordinary pane; the adversarial reviewer is a coordinator that normally uses an ordinary pane for its review artifacts and child reviewers. To inspect or review an existing worker result, start an ordinary child in that retained worktree path. Project or global role overrides do not receive these bundled-role warnings.
369
+
373
370
  The child starts at the returned worktree root. Tell writing agents to test and commit when you want a commit-based handoff, and tell them not to push, merge, switch branches, or remove the worktree. The parent owns review and integration.
374
371
 
375
372
  Successful, failed, and help-requesting runs retain their workspace. Completion includes the worktree path, Herdr workspace, branch, base/head SHAs, commits ahead, changed and untracked files, and clean/dirty/conflicted state. Here, `clean` means no uncommitted files; the branch may still contain commits. If Git inspection fails, state is reported as unknown rather than guessed.
@@ -394,8 +391,6 @@ This sends Escape to the child pane, cancelling the in-progress model turn. The
394
391
 
395
392
  This is a turn-level interrupt, not a method for forcibly terminating a subagent session.
396
393
 
397
- > **Note:** Only Pi-backed subagents are supported. Claude-backed runs will return an error.
398
-
399
394
  ---
400
395
 
401
396
  ## Workflow control (`herdr_workflow`)
@@ -685,10 +680,8 @@ and verify them with `/subagent list` plus a smoke launch.
685
680
  | `name` | string | Optional explicit agent name used in `agent: "my-agent"`; defaults to the filename stem and must match it in role packs |
686
681
  | `description` | string | Shown in `subagents_list` output |
687
682
  | `model` | string | Optional exact authenticated Pi model default or ordered comma-separated fallback list; omit to use per-agent config, global config, then the parent |
688
- | `cli` | string | Set to `claude` to launch the Claude CLI instead of Pi |
689
- | `cli-model` | string | Optional model name passed to a Claude CLI agent; separate from Pi model routing |
690
- | `thinking` | string | Optional Pi thinking default (`off` through `max`); omit to inherit the parent. Thinking overrides are not supported for Claude CLI agents |
691
- | `system-prompt` | string | `append` passes the agent body through Pi's appended system prompt; `replace` replaces Pi's default system prompt. Without this field, the body is included in the task wrapper. Claude CLI agents always append their body/override |
683
+ | `thinking` | string | Optional Pi thinking default (`off` through `max`); omit to inherit the parent |
684
+ | `system-prompt` | string | `append` passes the agent body through Pi's appended system prompt; `replace` replaces Pi's default system prompt. Without this field, the body is included in the task wrapper |
692
685
  | `tools` | string | Comma-separated Pi `--tools` allowlist; may contain any registered built-in, extension, or custom tool name |
693
686
  | `skills` | string | Comma-separated installed skill names to auto-load. Use this plural form for new definitions; legacy project/global definitions using singular `skill` remain compatible. |
694
687
  | `session-mode` | string | Default child-session mode: `standalone`, `lineage-only`, or `fork` |
@@ -697,7 +690,7 @@ and verify them with `/subagent list` plus a smoke launch.
697
690
  | `auto-exit` | boolean | Auto-shutdown when the agent finishes its turn — no `subagent_done` call needed. If the user sends any input, auto-exit is permanently disabled and the user takes over the session. Recommended for autonomous agents (scout, worker); not for interactive ones (planner). Also determines the default value of `interactive` (see below). |
698
691
  | `interactive` | boolean | Override whether stall/recovery transitions wake the parent session. Defaults to the inverse of `auto-exit`: autonomous agents (`auto-exit: true`) are non-interactive and get stall pings; agents without `auto-exit` are interactive and stay quiet. Explicit values take precedence. |
699
692
  | `cwd` | string | Default working directory. Absolute paths are unambiguous; relative agent-frontmatter paths resolve from Pi's agent config directory (`PI_CODING_AGENT_DIR` or `~/.pi/agent`), not the project root |
700
- | `disable-model-invocation` | boolean | Hide an internal adapter from discovery surfaces like `subagents_list`. The definition remains directly invocable by exact name via `subagent({ agent: "name", ... })`. |
693
+ | `disable-model-invocation` | boolean | Hide a role from discovery surfaces like `subagents_list`. The definition remains directly invocable by exact name via `subagent({ agent: "name", ... })`. |
701
694
 
702
695
  ---
703
696
 
@@ -865,7 +858,7 @@ herdr
865
858
  pi
866
859
  ```
867
860
 
868
- Other multiplexers and terminal backends are not supported. Worktrees provide Git checkout isolation only, not process or security isolation; child agents and installed Pi packages run with your user's filesystem and command permissions. Locally configured Claude CLI adapters always launch with `--dangerously-skip-permissions` and therefore skip Claude's interactive permission prompts.
861
+ Other multiplexers and terminal backends are not supported. Worktrees provide Git checkout isolation only, not process or security isolation; child agents and installed Pi packages run with your user's filesystem and command permissions.
869
862
 
870
863
  ---
871
864
 
package/agents/scout.md CHANGED
@@ -2,7 +2,6 @@
2
2
  name: scout
3
3
  description: Fast codebase reconnaissance - maps existing code, conventions, and patterns for a task
4
4
  tools: read, bash
5
- deny-tools: claude
6
5
  spawning: false
7
6
  auto-exit: true
8
7
  system-prompt: append
package/agents/worker.md CHANGED
@@ -2,7 +2,6 @@
2
2
  name: worker
3
3
  description: Implements a complete task or plan section - writes code, runs tests, commits only when asked
4
4
  tools: read, bash, write, edit
5
- deny-tools: claude
6
5
  spawning: false
7
6
  auto-exit: true
8
7
  system-prompt: append
package/docs/README.md CHANGED
@@ -26,12 +26,13 @@ Workflow preparation, exact approval, Worker execution, isolated read-only child
26
26
  | ADR | Status | Decision |
27
27
  | --- | --- | --- |
28
28
  | [`0001`](adr/0001-btw-ephemeral-side-questions.md) | Accepted | Add `/btw` as an ephemeral side-question child. |
29
- | [`0002`](adr/0002-agent-workflow-skill-runtime-taxonomy.md) | Accepted | Keep agent execution, workflows, skills, and runtimes distinct. |
29
+ | [`0002`](adr/0002-agent-workflow-skill-runtime-taxonomy.md) | Accepted in part; external CLI provisions superseded | Keep agent execution, workflows, skills, and Pi runtimes distinct. |
30
30
  | [`0003`](adr/0003-installable-role-packs.md) | Accepted | Discover installable role packs through Pi's event bus. |
31
31
  | [`0004`](adr/0004-require-active-user-approval-for-workflow-execution.md) | Accepted | Require active approval for exact workflow-script execution. |
32
32
  | [`0005`](adr/0005-parent-owns-workflow-script-authority.md) | Accepted | Keep workflow-script authority with the parent. |
33
33
  | [`0006`](adr/0006-limit-v1-execution-effects-to-isolated-worktrees.md) | Accepted | Limit the first workflow to read-only effects. |
34
34
  | [`0007`](adr/0007-require-fresh-review-for-workflow-scripts.md) | Accepted | Require fresh review in skill-authored review workflows. |
35
+ | [`0008`](adr/0008-adopt-pi-only-subagent-execution.md) | Accepted; implemented | Remove the external CLI adapter and make subagent execution Pi-only. |
35
36
 
36
37
  ## Research
37
38
 
@@ -1,10 +1,11 @@
1
1
  # ADR-0002: Adopt the agent, workflow, skill, and runtime taxonomy
2
2
 
3
- - **Status:** Accepted
3
+ - **Status:** Accepted in part; external CLI provisions superseded
4
4
  - **Date:** 2026-08-02
5
5
  - **Decision owners:** `acrnm`
6
6
  - **Scope:** `giuseppecrj/pi-herdr-agents`
7
7
  - **Historical tracking:** legacy issues #4 and #5 (not carried into the clean repository)
8
+ - **Superseded in part by:** ADR-0008 removes the external CLI runtime adapter
8
9
 
9
10
  ## Decision
10
11
 
@@ -22,10 +23,8 @@ Use these terms consistently:
22
23
  - **Skill** — A Pi-native instruction set that teaches the current agent a
23
24
  reusable procedure. It may invoke workflows or roles. Owned by Pi or the
24
25
  skill author and user-facing.
25
- - **Runtime** — How a role executes: Pi or an external CLI, plus model and
26
- thinking selection. Owned by invocation/configuration and not user-facing.
27
- - **Adapter** — A local or optional runtime-specific role for direct invocation.
28
- Owned by the caller or local configuration and not user-facing.
26
+ - **Runtime** — The authenticated Pi provider/model and thinking selection for
27
+ one invocation. Owned by invocation/configuration and not user-facing.
29
28
 
30
29
  An agent role is **not** a workflow merely because it can spawn other agents.
31
30
  A coordinator role is allowed when it owns an interactive or multi-stage child
@@ -39,8 +38,8 @@ surface:
39
38
  - Agent definitions are discovered from package, global, and project folders,
40
39
  with project definitions overriding global and bundled definitions.
41
40
  - The bundled list includes reusable roles (`scout`, `worker`, `reviewer`) and
42
- a multi-stage orchestration (`adversarial-reviewer`). Runtime-specific
43
- implementations are local optional adapters, not bundled definitions.
41
+ a multi-stage orchestration (`adversarial-reviewer`). Every definition runs
42
+ through Pi.
44
43
  - The extension can request Pi skills, select model defaults, and start
45
44
  sessions, but it has no first-class workflow definition or agent-definition
46
45
  schema validation.
@@ -130,42 +129,34 @@ the package's `/plan` workflow, not as a second kind of subagent definition.
130
129
 
131
130
  ### 4. Runtimes are selected by policy, not role identity
132
131
 
133
- A role describes the work; a runtime describes how one invocation performs it.
134
- For Pi-backed agents, the current model-resolution chain is the correct
135
- foundation: explicit invocation choice, agent default, per-agent configuration,
136
- global configuration, then the parent model. A local Claude CLI adapter instead
137
- uses `cli` and `cli-model`; do not set a Pi `model` on an adapter expecting it
138
- to select the CLI model.
132
+ A role describes the work; a runtime describes which authenticated Pi
133
+ provider/model and thinking level one invocation uses. The model-resolution
134
+ chain is explicit invocation choice, agent default, per-agent configuration,
135
+ global configuration, then the parent model.
139
136
 
140
137
  Apply these rules:
141
138
 
142
139
  1. Prefer per-invocation `model` and `thinking` for a workflow's deliberate
143
140
  diversity or cost/quality policy.
144
141
  2. Use ignored local `config.json` for a person's durable role preferences.
145
- 3. Leave bundled Pi-role `model` unset unless a particular model is a functional
142
+ 3. Leave bundled role `model` unset unless a particular model is a functional
146
143
  prerequisite.
147
- 4. Treat `cli` and `cli-model` as a runtime adapter concern, not a review or
148
- planning policy.
149
- 5. State runtime prerequisites before launch and fail closed when a required
150
- runtime is unavailable.
144
+ 4. State runtime prerequisites before launch and fail closed when a required
145
+ Pi runtime is unavailable.
146
+ 5. Reject legacy role definitions that contain `cli` before Herdr resource
147
+ creation; do not reinterpret them as Pi roles.
151
148
 
152
149
  This preserves the useful multi-model review behavior without baking a
153
150
  particular vendor choice into the generic `reviewer` role. Adversarial review
154
151
  selects three distinct exact authenticated Pi model IDs at runtime, preferring
155
152
  provider diversity, and launches generic `reviewer` children.
156
153
 
157
- ### 5. Local adapters are hidden from task discovery
154
+ ### 5. Subagent execution is Pi-only
158
155
 
159
- An adapter exists to satisfy a workflow's runtime contract, not to ask a user
160
- what they want to do. It is a local or optional definition, must use
161
- `disable-model-invocation: true`, and should have a name that makes its internal
162
- nature clear. Hidden adapters remain explicitly invokable by exact name.
163
-
164
- The package preserves its existing external CLI launch path for local adapters;
165
- it does not bundle vendor-specific adapters, provide an adapter registry, or add
166
- Cursor/OpenCode support. Move callers that invoke `claude-reviewer` by exact
167
- name to `$PI_CODING_AGENT_DIR/agents/claude-reviewer.md` or
168
- `.pi/agents/claude-reviewer.md` with the same hidden frontmatter.
156
+ Every visible or hidden role executes through Pi. Claude models remain available
157
+ through normal Pi provider/model routing. A legacy role that contains `cli`
158
+ receives a migration diagnostic and cannot create a Herdr pane or worktree.
159
+ There is no runtime adapter registry or compatibility path.
169
160
 
170
161
  ### 6. Agent frontmatter is a constrained contract
171
162
 
@@ -182,10 +173,9 @@ validation that does not exist yet.
182
173
  For a future validation pass, require at least `name` and `description`, reject
183
174
  unknown package-owned fields, validate tool/skill list syntax, and report the
184
175
  source path in errors. The authoring template must cover the complete existing
185
- README frontmatter reference (`tools`, `deny-tools`, `thinking`, `system-prompt`,
186
- `spawning`, `auto-exit`, `interactive`, `session-mode`, `cwd`, `cli`,
187
- `cli-model`, and `disable-model-invocation`) rather than introduce a partial
188
- second schema. Keep extension fields separate from arbitrary prompt metadata so
176
+ README frontmatter reference (`tools`, `deny-tools`, `thinking`, `system-prompt`, `spawning`, `auto-exit`,
177
+ `interactive`, `session-mode`, `cwd`, and `disable-model-invocation`) rather
178
+ than introduce a partial second schema. Keep extension fields separate from arbitrary prompt metadata so
189
179
  project authors can still add their own namespaced fields.
190
180
 
191
181
  ## Current mapping
@@ -199,8 +189,8 @@ project authors can still add their own namespaced fields.
199
189
  engineering responsibility remains intentional.
200
190
  - `visual-tester` — Leaf agent role with skill prerequisite. Keep its
201
191
  `chrome-cdp` dependency declared through canonical `skills` metadata.
202
- - `claude-reviewer` — No longer bundled. Callers that need this exact local
203
- Claude CLI adapter must provide it in a global or project agent directory.
192
+ - `claude-reviewer` — Removed. Use the generic `reviewer` role with an
193
+ authenticated Claude model through Pi provider/model routing.
204
194
  - `adversarial-reviewer` — Workflow implementation pending a workflow surface.
205
195
  It selects three distinct exact authenticated Pi model IDs at runtime,
206
196
  preferring provider diversity, and launches generic `reviewer` children. Do
@@ -228,8 +218,8 @@ not a general workflow registry.
228
218
  policy in one place. Adversarial review selects three distinct exact
229
219
  authenticated Pi model IDs at runtime, prefers provider diversity, and uses
230
220
  generic `reviewer` children.
231
- 5. Remove bundled `claude-reviewer`; exact-name callers supply the hidden local
232
- adapter from their global or project agent directory.
221
+ 5. Remove bundled `claude-reviewer`; callers use the generic `reviewer` role
222
+ with Pi provider/model routing.
233
223
 
234
224
  ### Phase 2 — improve discovery without a new framework
235
225
 
@@ -251,7 +241,7 @@ language before that repeated need exists.
251
241
 
252
242
  - A user can distinguish a workflow from a directly runnable role before
253
243
  launching either.
254
- - `subagents_list` does not advertise internal runtime adapters as peer tasks.
244
+ - Legacy external CLI roles fail with a migration diagnostic before launch.
255
245
  - A role author can create and smoke-test a valid definition from one documented
256
246
  template; schema-level frontmatter errors remain a deferred validation pass.
257
247
  - A workflow can select different authenticated runtimes per child without
@@ -271,4 +261,4 @@ This decision is based on the current implementation:
271
261
  defaults; launch-time arguments remain the appropriate workflow override.
272
262
  - `README.md` documents `/plan`, `/iterate`, `/btw`, agent discovery,
273
263
  frontmatter, and runtime precedence.
274
- - `agents/` contains the mixed role/coordinator/adapter set mapped above.
264
+ - `agents/` contains the role/coordinator set mapped above.
@@ -0,0 +1,22 @@
1
+ # ADR-0008: Adopt Pi-only subagent execution
2
+
3
+ - **Status:** Accepted (implemented)
4
+ - **Date:** 2026-08-10
5
+ - **Scope:** `giuseppecrj/pi-herdr-agents`
6
+ - **Supersedes:** The external CLI runtime-adapter provisions of ADR-0002
7
+
8
+ ## Decision
9
+
10
+ Make every public subagent run Pi-backed. Remove the Claude terminal adapter and its `cli`, `cli-model`, and `resumeSessionId` interface fields. Existing role files that request an external CLI must fail with a clear error instead of silently running through Pi.
11
+
12
+ A single deep launch module will own the complete launch transaction behind one small interface. Pi and Herdr remain implementation details of that module; do not add a runtime adapter seam without a second real execution path.
13
+
14
+ Completion delivery will use one custom message whose content contains the bounded result and triggers the parent turn. Completion detection will keep the Pi sidecar as primary evidence and the terminal exit marker as its best-effort fallback.
15
+
16
+ ## Why
17
+
18
+ The Claude terminal path duplicates launch, completion, transcript, cleanup, status, resume, and interruption behavior. It also requires `--dangerously-skip-permissions`, has no bundled role, and reduces locality and test leverage. Pi already provides Claude models through normal provider/model routing.
19
+
20
+ ## Consequences
21
+
22
+ This is an immediate pre-1.0 breaking change; no deprecation adapter remains. The agent/workflow/skill/runtime taxonomy in ADR-0002 remains accepted, but its external CLI adapter rules no longer apply. Shipped-behavior documentation and `CONTEXT.md` now describe the Pi-only contract.
@@ -417,7 +417,7 @@ All slices are sequential because they touch the same runtime and lifecycle seam
417
417
 
418
418
  - Metadata header must be first, valid JSON, version 1, strict, and within hard caps.
419
419
  - Paths outside `.pi/plans/<run>/workflow.js`, symlinks, reused journals, and missing files fail.
420
- - Unknown, duplicate, Claude-backed, unauthenticated, or non-review roles fail.
420
+ - Unknown, duplicate, legacy external-CLI, unauthenticated, or non-review roles fail.
421
421
  - Script syntax failure does not evaluate code.
422
422
  - Prepare records exact bytes, full hash, base SHA, session identity/leaf, role-policy fingerprints, runtimes, and effective tools in pending memory without creating the journal.
423
423
  - A matching later user message in the same session starts; assistant text, pre-prepare or other-session user text, malformed text, uppercase/short/long prefixes, and surrounding whitespace fail.
@@ -121,7 +121,27 @@ The parent receives the normal child summary plus:
121
121
 
122
122
  `clean` means there are no staged, unstaged, or untracked files. It does **not** mean the branch has no commits or diff relative to its base.
123
123
 
124
- If Git inspection fails, SHA/count/state/file fields are reported as unknown rather than guessed, and the warning is included in the handoff. Inspect the retained workspace directly before integrating or deleting it.
124
+ If Git inspection fails, SHA/count/state/file fields are reported as unknown rather than guessed, and the warning is included in the handoff. Inspect the retained workspace directly before integrating or deleting it. Every retained handoff also includes the exact `herdr worktree remove --workspace <workspace-id>` command, but run it only after useful state is preserved.
125
+
126
+ ## Parallel pull-request review without new worktrees
127
+
128
+ For parallel read-only review, prepare one stable existing checkout of the pull request or retained worker result. Do not create one managed worktree per reviewer.
129
+
130
+ 1. The parent records the exact base and head SHAs and makes sure no writer changes the checkout while review runs.
131
+ 2. Start each read-only child in an ordinary pane with `cwd` set to that checkout. Omit `worktree`.
132
+ 3. Give every reviewer the same exact base and head SHAs. Require it to report `git rev-parse HEAD` before its review result.
133
+ 4. Before the parent reports or publishes the review, recheck the checkout SHA. If it changed, treat the prior reviews as stale and review the new commit again.
134
+
135
+ ```typescript
136
+ subagent({
137
+ name: "PR reviewer",
138
+ agent: "reviewer",
139
+ cwd: "/path/to/pr-checkout",
140
+ task: "Review base <base-sha> through head <head-sha>. First report git rev-parse HEAD. Do not modify files.",
141
+ });
142
+ ```
143
+
144
+ A retained worker worktree can be this checkout. The parent owns any final report, PR action, integration, and cleanup.
125
145
 
126
146
  ## Review and integration
127
147
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-herdr-agents",
3
- "version": "0.1.3",
3
+ "version": "1.0.0",
4
4
  "description": "Asynchronous Pi subagents and approved review workflows in Herdr, with optional isolated Git worktrees",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -30,7 +30,7 @@
30
30
  "type": "module",
31
31
  "scripts": {
32
32
  "lint": "oxlint pi-extension test",
33
- "test": "node --experimental-strip-types --test test/test.ts test/runtime-routing.test.ts test/release-workflow.test.ts test/workflow.test.ts test/package-skill.test.js",
33
+ "test": "node --experimental-strip-types --test test/test.ts test/launch.test.ts test/runtime-routing.test.ts test/release-workflow.test.ts test/workflow.test.ts test/package-skill.test.js",
34
34
  "test:integration": "node --experimental-strip-types --test --test-concurrency=1 test/integration/*.test.ts",
35
35
  "test:integration:live": "PI_TEST_LIVE=1 node --experimental-strip-types --test --test-concurrency=1 test/integration/*.test.ts"
36
36
  },
@@ -21,7 +21,6 @@ export interface CompletionOptions {
21
21
  observedAt: number,
22
22
  ) => void;
23
23
  sessionFile?: string;
24
- sentinelFile?: string;
25
24
  onTick?: (elapsedSeconds: number) => void;
26
25
  }
27
26
 
@@ -83,12 +82,7 @@ function terminalExitCode(screen: string): number | null {
83
82
  }
84
83
 
85
84
  function completionArtifact(options: CompletionOptions): CompletionResult | null {
86
- const sidecar = consumeExitSidecar(options.sessionFile);
87
- if (sidecar) return sidecar;
88
- if (options.sentinelFile && existsSync(options.sentinelFile)) {
89
- return { reason: "sentinel", exitCode: 0 };
90
- }
91
- return null;
85
+ return consumeExitSidecar(options.sessionFile);
92
86
  }
93
87
 
94
88
  async function waitForDisappearanceArtifacts(
@@ -137,10 +131,6 @@ export async function waitForCompletion(
137
131
  const sidecarResult = consumeExitSidecar(options.sessionFile);
138
132
  if (sidecarResult) return sidecarResult;
139
133
 
140
- if (options.sentinelFile && existsSync(options.sentinelFile)) {
141
- return { reason: "sentinel", exitCode: 0 };
142
- }
143
-
144
134
  try {
145
135
  const exitCode = terminalExitCode(await options.readTerminalTail());
146
136
  if (exitCode !== null) return { reason: "sentinel", exitCode };