pi-herdr-agents 0.1.4 → 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 +3 -1
- package/CONTEXT.md +8 -16
- package/README.md +14 -23
- package/agents/scout.md +0 -1
- package/agents/worker.md +0 -1
- package/docs/README.md +2 -1
- package/docs/adr/0002-agent-workflow-skill-runtime-taxonomy.md +29 -39
- package/docs/adr/0008-adopt-pi-only-subagent-execution.md +22 -0
- package/docs/orchestrated-review-workflow-plan.md +1 -1
- package/package.json +2 -2
- package/pi-extension/subagents/completion.ts +1 -11
- package/pi-extension/subagents/index.ts +142 -843
- package/pi-extension/subagents/launch.ts +816 -0
- package/pi-extension/subagents/status.ts +3 -35
- package/pi-extension/subagents/workflow.ts +1 -3
- package/pi-extension/subagents/claude.ts +0 -164
- package/pi-extension/subagents/plugin/.claude-plugin/plugin.json +0 -5
- package/pi-extension/subagents/plugin/hooks/hooks.json +0 -15
- package/pi-extension/subagents/plugin/hooks/on-stop.sh +0 -68
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.
|
|
21
|
-
_Avoid_: Runtime tiers, silent fallback, inherited 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
22
|
|
|
23
|
-
**
|
|
24
|
-
|
|
25
|
-
_Avoid_:
|
|
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
|
-
**
|
|
28
|
-
|
|
29
|
-
_Avoid_:
|
|
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.
|
|
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
|
|
140
|
-
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
|
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;
|
|
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;
|
|
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)) |
|
|
@@ -396,8 +391,6 @@ This sends Escape to the child pane, cancelling the in-progress model turn. The
|
|
|
396
391
|
|
|
397
392
|
This is a turn-level interrupt, not a method for forcibly terminating a subagent session.
|
|
398
393
|
|
|
399
|
-
> **Note:** Only Pi-backed subagents are supported. Claude-backed runs will return an error.
|
|
400
|
-
|
|
401
394
|
---
|
|
402
395
|
|
|
403
396
|
## Workflow control (`herdr_workflow`)
|
|
@@ -687,10 +680,8 @@ and verify them with `/subagent list` plus a smoke launch.
|
|
|
687
680
|
| `name` | string | Optional explicit agent name used in `agent: "my-agent"`; defaults to the filename stem and must match it in role packs |
|
|
688
681
|
| `description` | string | Shown in `subagents_list` output |
|
|
689
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 |
|
|
690
|
-
| `
|
|
691
|
-
| `
|
|
692
|
-
| `thinking` | string | Optional Pi thinking default (`off` through `max`); omit to inherit the parent. Thinking overrides are not supported for Claude CLI agents |
|
|
693
|
-
| `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 |
|
|
694
685
|
| `tools` | string | Comma-separated Pi `--tools` allowlist; may contain any registered built-in, extension, or custom tool name |
|
|
695
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. |
|
|
696
687
|
| `session-mode` | string | Default child-session mode: `standalone`, `lineage-only`, or `fork` |
|
|
@@ -699,7 +690,7 @@ and verify them with `/subagent list` plus a smoke launch.
|
|
|
699
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). |
|
|
700
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. |
|
|
701
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 |
|
|
702
|
-
| `disable-model-invocation` | boolean | Hide
|
|
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", ... })`. |
|
|
703
694
|
|
|
704
695
|
---
|
|
705
696
|
|
|
@@ -867,7 +858,7 @@ herdr
|
|
|
867
858
|
pi
|
|
868
859
|
```
|
|
869
860
|
|
|
870
|
-
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.
|
|
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.
|
|
871
862
|
|
|
872
863
|
---
|
|
873
864
|
|
package/agents/scout.md
CHANGED
package/agents/worker.md
CHANGED
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** —
|
|
26
|
-
|
|
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`).
|
|
43
|
-
|
|
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
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
global configuration, then the parent model.
|
|
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
|
|
142
|
+
3. Leave bundled role `model` unset unless a particular model is a functional
|
|
146
143
|
prerequisite.
|
|
147
|
-
4.
|
|
148
|
-
|
|
149
|
-
5.
|
|
150
|
-
|
|
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.
|
|
154
|
+
### 5. Subagent execution is Pi-only
|
|
158
155
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
`
|
|
187
|
-
|
|
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` —
|
|
203
|
-
Claude
|
|
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`;
|
|
232
|
-
|
|
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
|
-
-
|
|
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
|
|
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,
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-herdr-agents",
|
|
3
|
-
"version": "0.
|
|
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
|
-
|
|
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 };
|