@maxiaochao/pi-toolkit 0.9.6 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +1 -2
- package/package.json +5 -5
- package/packages/herdr-subagents/CHANGELOG.md +50 -0
- package/packages/herdr-subagents/README.md +283 -0
- package/packages/herdr-subagents/TESTING.md +25 -0
- package/packages/herdr-subagents/agents/explorer.md +8 -0
- package/packages/herdr-subagents/agents/reviewer.md +8 -0
- package/packages/{tiny-subagent → herdr-subagents}/agents/worker.md +1 -0
- package/packages/herdr-subagents/docs/demo.webm +0 -0
- package/packages/herdr-subagents/docs/screenshot.png +0 -0
- package/packages/herdr-subagents/extensions/herdr-subagents.ts +258 -0
- package/packages/herdr-subagents/extensions/subagent-report.ts +65 -0
- package/packages/{tiny-subagent → herdr-subagents}/package.json +7 -6
- package/packages/herdr-subagents/src/batch-runner.ts +219 -0
- package/packages/herdr-subagents/src/blocking.ts +175 -0
- package/packages/herdr-subagents/src/config.ts +129 -0
- package/packages/herdr-subagents/src/continue-run.ts +87 -0
- package/packages/herdr-subagents/src/dispatcher.ts +73 -0
- package/packages/herdr-subagents/src/errors.ts +3 -0
- package/packages/herdr-subagents/src/fleet-controller.ts +82 -0
- package/packages/herdr-subagents/src/fleet.ts +56 -0
- package/packages/herdr-subagents/src/herdr.ts +224 -0
- package/packages/herdr-subagents/src/history.ts +210 -0
- package/packages/herdr-subagents/src/live-agent.ts +87 -0
- package/packages/herdr-subagents/src/monitor.ts +18 -0
- package/packages/herdr-subagents/src/ownership.ts +17 -0
- package/packages/herdr-subagents/src/parameters.ts +21 -0
- package/packages/{tiny-subagent → herdr-subagents}/src/personas.ts +13 -2
- package/packages/herdr-subagents/src/protocol.ts +23 -0
- package/packages/herdr-subagents/src/queued-runs.ts +70 -0
- package/packages/herdr-subagents/src/reconcile.ts +167 -0
- package/packages/herdr-subagents/src/records.ts +213 -0
- package/packages/herdr-subagents/src/result-path.ts +7 -0
- package/packages/herdr-subagents/src/run-locator.ts +19 -0
- package/packages/herdr-subagents/src/run-pane-allocator.ts +78 -0
- package/packages/herdr-subagents/src/run-status.ts +23 -0
- package/packages/herdr-subagents/src/runner.ts +250 -0
- package/packages/herdr-subagents/src/state.ts +11 -0
- package/packages/herdr-subagents/src/tab-cleanup.ts +68 -0
- package/packages/herdr-subagents/src/tool.ts +217 -0
- package/packages/herdr-subagents/src/validation.ts +38 -0
- package/packages/herdr-subagents/tests/extension-contract.ts +225 -0
- package/packages/herdr-subagents/tests/run-tests.mjs +895 -0
- package/packages/todo/extensions/todo.ts +1 -1
- package/packages/tiny-subagent/CHANGELOG.md +0 -12
- package/packages/tiny-subagent/README.md +0 -128
- package/packages/tiny-subagent/TESTING.md +0 -20
- package/packages/tiny-subagent/docs/demo.gif +0 -0
- package/packages/tiny-subagent/docs/screenshot.png +0 -0
- package/packages/tiny-subagent/extensions/tiny-subagent.ts +0 -228
- package/packages/tiny-subagent/src/runner.ts +0 -319
- package/packages/tiny-subagent/tests/run-tests.mjs +0 -111
- package/skills/calldiff/LICENSE +0 -21
- package/skills/calldiff/NOTICE +0 -19
- package/skills/calldiff/SKILL.md +0 -121
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## 2026-10-08 - v0.10.1
|
|
2
|
+
|
|
3
|
+
- bundle herdr-subagents v0.2.1: add default thinking configuration and inline Herdr workflow video
|
|
4
|
+
- remove the bundled `calldiff` skill
|
|
5
|
+
- add merged global/project `defaultThinking` for Herdr Subagents, below persona-specific thinking and above parent-session fallback
|
|
6
|
+
- embed the Herdr workflow video directly in the GitHub README, retain the reproducible WebM source, and remove the GIF preview
|
|
7
|
+
- document every Herdr Subagents settings and persona option, accepted values, defaults, configuration paths, examples, and exact precedence
|
|
8
|
+
- add a full real-time Herdr Subagents WebM recording that focuses every child Agent pane before returning to the parent summary
|
|
9
|
+
|
|
10
|
+
- replace the rendered Herdr transcript demo with a real UI recording of a parent Pi conversation opening and completing three concurrent interactive Agent panes
|
|
11
|
+
|
|
12
|
+
## 2026-10-08 - v0.10.0
|
|
13
|
+
|
|
14
|
+
- bundle herdr-subagents v0.2.0: replace Tiny Subagent with visible interactive Herdr agents and durable batch workflows
|
|
15
|
+
- replace Tiny Subagent's hidden print/shell execution with Herdr Subagents: visible interactive Pi Agents, one exclusive on-demand pane per task, Fleet keyboard navigation, durable blocked/history continuation, parent-session cancellation, and focus-safe batch tab cleanup
|
|
16
|
+
- fix Herdr Subagents Fleet state after blocked responses, preserve the active task widget while later background runs queue, and share ownership, pane-allocation, and status-reduction logic across recovery paths
|
|
17
|
+
|
|
1
18
|
## 2026-10-08 - v0.9.6
|
|
2
19
|
|
|
3
20
|
- bundle codex-edit v0.1.9: install the pinned Pi runtime for clean-runner publication tests
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ The root package embeds the child-package source snapshots listed below. Install
|
|
|
25
25
|
| [pi-todo](packages/todo/README.md) | Session plans, automatic task advancement, `/todos` | `pi install npm:@maxiaochao/pi-todo` | `pi update npm:@maxiaochao/pi-todo` |
|
|
26
26
|
| [pi-cache-export](packages/cache-export/README.md) | Tau-aligned interactive cache dashboard for Pi sessions | `pi install npm:@maxiaochao/pi-cache-export` | `pi update npm:@maxiaochao/pi-cache-export` |
|
|
27
27
|
| [pi-codex-edit](packages/codex-edit/README.md) | Codex-harness `apply_patch` routing for selected GPT models | `pi install npm:@maxiaochao/pi-codex-edit` | `pi update npm:@maxiaochao/pi-codex-edit` |
|
|
28
|
-
| [pi-
|
|
28
|
+
| [pi-herdr-subagents](packages/herdr-subagents/README.md) | Interactive Herdr Pi Agents with bounded concurrency, direct navigation, and recovery | `pi install npm:@maxiaochao/pi-herdr-subagents` | `pi update npm:@maxiaochao/pi-herdr-subagents` |
|
|
29
29
|
| [pi-worktree](packages/worktree/README.md) | Worktree CLI, completion, installer, and agent skill | `pi install npm:@maxiaochao/pi-worktree` | `pi update npm:@maxiaochao/pi-worktree` |
|
|
30
30
|
|
|
31
31
|
Each child README owns its feature description, motivation or upstream alignment, examples, screenshots/demos, configuration, and test documentation.
|
|
@@ -66,7 +66,6 @@ bash scripts/install.sh
|
|
|
66
66
|
| `herdr` | Control Herdr workspaces, tabs, panes, and agents |
|
|
67
67
|
| `agent-team` | Run cross-vendor adversarial review through Herdr |
|
|
68
68
|
| `tapd` | Use the TAPD CLI for requirements, defects, tasks, and wikis |
|
|
69
|
-
| `calldiff` | Diff call stacks across commits |
|
|
70
69
|
|
|
71
70
|
Package-specific skills, such as `pi-worktree`, are documented by their child package.
|
|
72
71
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maxiaochao/pi-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Personal pi coding agent toolkit: /todos, /btw, /cache_export and apply_patch extensions, browser automation, and bundled theme/skills.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"packages/todo",
|
|
16
16
|
"packages/cache-export",
|
|
17
17
|
"packages/codex-edit",
|
|
18
|
-
"packages/
|
|
18
|
+
"packages/herdr-subagents",
|
|
19
19
|
"packages/worktree",
|
|
20
20
|
"themes",
|
|
21
21
|
"README.md",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"./packages/cache-export/extensions/cache-export.ts",
|
|
35
35
|
"./extensions/btw/index.ts",
|
|
36
36
|
"./packages/codex-edit/extensions/codex-edit.ts",
|
|
37
|
-
"./packages/
|
|
37
|
+
"./packages/herdr-subagents/extensions/herdr-subagents.ts"
|
|
38
38
|
],
|
|
39
39
|
"skills": [
|
|
40
40
|
"./skills",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"ws": "^8.19.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
|
-
"test": "node tests/package-layout.mjs && npm --prefix packages/todo test && npm --prefix packages/cache-export test && npm --prefix packages/codex-edit test && npm --prefix packages/
|
|
61
|
-
"load-test": "pi -ne -e ./packages/todo/extensions/todo.ts && pi -ne -e ./packages/cache-export/extensions/cache-export.ts && pi -ne -e ./extensions/btw/index.ts && pi -ne -e ./packages/codex-edit/extensions/codex-edit.ts && pi -ne -e ./packages/
|
|
60
|
+
"test": "node tests/package-layout.mjs && npm --prefix packages/todo test && npm --prefix packages/cache-export test && npm --prefix packages/codex-edit test && npm --prefix packages/herdr-subagents test && npm --prefix packages/worktree test && node --experimental-strip-types extensions/btw/tests/history.mjs",
|
|
61
|
+
"load-test": "pi -ne -e ./packages/todo/extensions/todo.ts && pi -ne -e ./packages/cache-export/extensions/cache-export.ts && pi -ne -e ./extensions/btw/index.ts && pi -ne -e ./packages/codex-edit/extensions/codex-edit.ts && pi -ne -e ./packages/herdr-subagents/extensions/herdr-subagents.ts",
|
|
62
62
|
"eval:agents": "node evaluations/agents-md/run.mjs",
|
|
63
63
|
"eval:agents:test": "node evaluations/agents-md/tests/run-tests.mjs",
|
|
64
64
|
"postinstall": "node scripts/install-agents.mjs"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
## 2026-10-08 - v0.2.1
|
|
2
|
+
|
|
3
|
+
- add default thinking configuration and inline Herdr workflow video
|
|
4
|
+
- Add merged global/project `defaultThinking`, below persona-specific thinking and above parent-session fallback, with effective source reporting.
|
|
5
|
+
- Embed the workflow video directly in the GitHub README, retain the reproducible WebM source, and remove the GIF preview.
|
|
6
|
+
- Expand the README with every settings and persona option, accepted values, defaults, paths, examples, and exact model, thinking, skills, and definition precedence.
|
|
7
|
+
- Add a full WebM recording that focuses all three live child Agent panes before returning to the parent summary.
|
|
8
|
+
- Replace the rendered transcript media with a real Herdr UI recording that follows a parent Pi conversation through a three-Agent batch and final compact response.
|
|
9
|
+
|
|
10
|
+
## 2026-10-08 - v0.2.0
|
|
11
|
+
|
|
12
|
+
- replace Tiny Subagent with visible interactive Herdr agents and durable batch workflows
|
|
13
|
+
- Skip tool and command registration outside a Herdr workspace so unavailable Subagent capabilities do not enter the model context.
|
|
14
|
+
- Preserve newly allocated panes when blocked runs resume, stop blindly retrying Herdr resource-creating commands after uncertain failures, and prevent concurrent historical resumes from writing the same Pi session.
|
|
15
|
+
- Isolate malformed queue/history entries so healthy active runs and durable history remain recoverable, and share durable attempt settlement plus task projection contracts across execution modes.
|
|
16
|
+
- Retain blocked Fleet and dispatcher ownership after stateless response errors, and include public test entrypoints in the published package.
|
|
17
|
+
- Preserve every pending stale-tab cleanup across repeated pane migrations, retry all of them during startup reconciliation, and surface allocator cleanup failures through batch updates.
|
|
18
|
+
- Keep persisted reports authoritative even when Herdr transport fails after submission, persist failure reports for historical follow-ups, reject resume attempts against active or cleanup-pending runs, recover terminal deferred cleanup on startup, preserve cancelled ownership on shutdown, keep recovered Agent attempts aligned with durable turns, archive malformed turns, remove rejected background queue entries, support Pi enhanced keyboard sequences and authoritative status rendering, centralize lifecycle metadata, surface control-plane and cleanup failures, merge deferred cleanup against current durable state, and force-close focused tabs when parent shutdown is already active.
|
|
19
|
+
- Share strict report parsing across live and recovered paths, validate durable task ordering, surface unreadable queue/history records, reconcile prior sessions even within one Pi process, keep settled Fleet rows navigable, preserve surviving sibling panes during dead-pane recovery, and retain cleanup diagnostics.
|
|
20
|
+
- Keep queued and blocked siblings alive when one blocked response fails, centralize authoritative run-status transitions, and bind focus-deferred tab cleanup to parent-session shutdown.
|
|
21
|
+
- Retain dispatcher and Fleet ownership while a batch is blocked, centralize task/turn transitions, surface transient pane lookup failures, and notify deferred single-task cleanup failures.
|
|
22
|
+
- Fail reconciliation when task records are unreadable, archive malformed child reports before replacing them with valid failure records, and keep durable history and saved-session follow-up usable.
|
|
23
|
+
- Keep startup reconciliation moving past truncated child reports, resume dispatch after recovery errors, clear stale blocked fields after authoritative follow-ups, and surface deferred cleanup failures.
|
|
24
|
+
- Stream Fleet row and pane updates while a blocked answer resumes work and releases queued siblings.
|
|
25
|
+
- Keep the active Fleet widget stable when another background run is queued, refresh rows and pane navigation after blocked responses, and cover the public extension UI/input wiring with injectable dependencies.
|
|
26
|
+
- Centralize parent ownership, run-status aggregation, and serialized pane allocation across initial, continued, recovered, and historical runs.
|
|
27
|
+
- Run every initial task, blocked response, recovered task, and historical follow-up as a visible interactive Pi Agent through Herdr Agent start/prompt; remove print mode, pane shell injection, completion markers, and marker polling.
|
|
28
|
+
- Give every started task a new on-demand pane, retain completed panes until the batch settles, and then close the whole tab with focus-safe cleanup.
|
|
29
|
+
- Add a flat fully described tool schema with runtime mode validation and a Fleet-style task list with direct keyboard pane navigation.
|
|
30
|
+
- Continue historical sessions as durable turns of the same logical task, and cancel/archive unfinished work when the parent Pi session closes.
|
|
31
|
+
- Persist and reconcile queued/running work across parent shutdown, avoid retrying uncertain startup operations, preserve post-submit failures, warn without timing out stalled children, and atomically replace state snapshots.
|
|
32
|
+
- Add compact project-local history, saved-session follow-ups in new Herdr tabs, explicit per-run cleanup, unlimited retention, and generated-state Git exclusion.
|
|
33
|
+
- Support structured `needs-input` reports, preserve blocked panes and sessions, and resume the original child with `action: respond`.
|
|
34
|
+
- Queue background batches behind one active run, return stable IDs immediately, keep progress visible, and send one compact run-level parent notification.
|
|
35
|
+
- Show active run counts in a persistent widget, expose compact `/herdr-subagents active` and pane focus navigation, update progress labels, and defer cleanup while a completed tab is focused.
|
|
36
|
+
- Execute ordered read-only batches with FIFO bounded concurrency, stable result order, and sibling failure isolation; force write-capable runs to serial execution.
|
|
37
|
+
- Add built-in worker, explorer, and reviewer personas with project/global/package discovery precedence.
|
|
38
|
+
- Add merged global and project model, thinking, skill, and concurrency settings plus `/herdr-subagents` discovery commands.
|
|
39
|
+
- Run one synchronous subagent in a dedicated, unfocused Herdr tab and close it after completion.
|
|
40
|
+
- Require a structured child report and return only its summary and document paths to the parent.
|
|
41
|
+
- Persist run/task metadata, the full result, and the child Pi session under `.pi/herdr-subagents/runs`.
|
|
42
|
+
|
|
43
|
+
## 2026-09-30 - v0.1.1
|
|
44
|
+
|
|
45
|
+
- Add standalone testing documentation and production-runner screenshot/demo media.
|
|
46
|
+
- Align the package manifest and root bundle with the shared workspace source.
|
|
47
|
+
|
|
48
|
+
## 2026-09-01 - v0.1.0
|
|
49
|
+
|
|
50
|
+
- initial release
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# @maxiaochao/pi-herdr-subagents
|
|
2
|
+
|
|
3
|
+
A Pi extension that runs focused foreground or background work as normal interactive Pi Agents in visible Herdr panes. Full answers and sessions stay in project-local records while the parent receives only concise summaries and document paths.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Demo
|
|
8
|
+
|
|
9
|
+
The recording shows a real Pi conversation invoking a three-task read-only batch, Herdr opening one interactive Agent pane per task, and the compact results returning to the parent.
|
|
10
|
+
|
|
11
|
+
https://github.com/user-attachments/assets/8ddf3ae6-a11a-492b-9cae-d9496ba65b67
|
|
12
|
+
|
|
13
|
+
The video starts a three-agent batch, focuses each live child pane in turn, then returns
|
|
14
|
+
to the parent summary. The reproducible source recording is retained as [`docs/demo.webm`](docs/demo.webm).
|
|
15
|
+
|
|
16
|
+
## Requirements and install
|
|
17
|
+
|
|
18
|
+
Run Pi inside Herdr, then install the package:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pi install npm:@maxiaochao/pi-herdr-subagents
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Update an existing standalone installation with:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pi update npm:@maxiaochao/pi-herdr-subagents
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The full `@maxiaochao/pi-toolkit` package also bundles this extension. Install the full toolkit or this standalone child package, not both.
|
|
31
|
+
|
|
32
|
+
Inside a Herdr workspace, the package registers `herdr_subagents` and `/herdr-subagents`. Outside Herdr (or without a workspace ID), the extension registers neither, so the tool is absent from the model context. Start Pi inside Herdr or reload the extension there to enable them.
|
|
33
|
+
|
|
34
|
+
The design replaces hidden print-mode subprocesses with ordinary interactive Pi Agents managed through Herdr, so delegated work stays visible, inspectable, resumable, and durably recorded.
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
Discover the effective personas first:
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
herdr_subagents({ action: "list" })
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then run one self-contained task:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
herdr_subagents({
|
|
48
|
+
agent: "worker",
|
|
49
|
+
label: "auth-review",
|
|
50
|
+
prompt: "Inspect the authentication flow and summarize the risks"
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Or submit an ordered foreground batch:
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
herdr_subagents({
|
|
58
|
+
label: "security-review",
|
|
59
|
+
concurrency: 3,
|
|
60
|
+
tasks: [
|
|
61
|
+
{ name: "auth", agent: "reviewer", prompt: "Review authentication" },
|
|
62
|
+
{ name: "sessions", agent: "explorer", prompt: "Trace session storage" }
|
|
63
|
+
]
|
|
64
|
+
})
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Set `background: true` to return a stable run ID immediately while the queue continues. One run is dispatched at a time by an extension instance; later runs remain queued and start FIFO. Each background run sends one compact parent notification only when the whole run completes, partially fails, fails, or blocks. Individual successful tasks do not wake the parent model.
|
|
68
|
+
|
|
69
|
+
A child missing required information reports `needs-input` with an exact question. The run becomes blocked, keeps its Herdr tab, pane, partial report, and Pi session, and returns control to the parent. Answer through the same tool to continue the original session:
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
herdr_subagents({ action: "respond", runId: "<run-id>", answer: "Use the main branch." })
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
While a batch is active, its task rows stay below the editor. With an empty editor, press `↓` to enter the list, `↑`/`↓` to choose a task, `Enter` to focus its exact pane, and `Esc` to return. `/herdr-subagents focus <task-number>` remains available as a fallback.
|
|
76
|
+
|
|
77
|
+
## History
|
|
78
|
+
|
|
79
|
+
Run `/herdr-subagents history` or `herdr_subagents({ action: "history" })` to list compact project-local run and task reports after Herdr tabs close. Full results, described documents, artifacts, and persistent Pi sessions remain separate on disk and are not loaded into parent context.
|
|
80
|
+
|
|
81
|
+
Continue a saved conversation in a new Herdr tab with `herdr_subagents({ action: "resume", runId: "<run-id>", task: 1, prompt: "Follow up..." })`. Remove only a selected archive with `herdr_subagents({ action: "cleanup", runId: "<run-id>" })`. History has no automatic count-based eviction. The extension adds the runtime path to local Git excludes when available (and otherwise uses `.pi/.gitignore`) without overwriting unrelated rules.
|
|
82
|
+
|
|
83
|
+
Read-only tasks start FIFO up to the configured concurrency limit. A pane is created only when its task starts, belongs exclusively to that task, and is never reused. Completed panes remain inspectable while another task in the batch is unsettled. Results remain in input order, and one failed task does not cancel its siblings. Any batch containing a write-capable persona is forced to concurrency one.
|
|
84
|
+
|
|
85
|
+
The widget shows one row per queued, running, blocked, failed, or completed task. Answering a blocked task refreshes rows and pane IDs as that task resumes and queued siblings start. Completed rows remain selectable until the whole batch settles. `/herdr-subagents active` shows the same compact state. Native labels stay short: `SA · <batch>` for the tab and `<order> · <task>` for each pane. When all tasks settle, the tab closes immediately if unfocused or after the user leaves it; a deferred close failure is persisted and shown as a warning.
|
|
86
|
+
|
|
87
|
+
Foreground calls block until all children report completion, failure, or a request for input. Every child is started with Herdr's Agent lifecycle as a normal Pi TUI and prompted with wait semantics; no print-mode command or completion marker is injected into the pane.
|
|
88
|
+
|
|
89
|
+
## Reports and records
|
|
90
|
+
|
|
91
|
+
The child must finish through the package's structured `subagent_report` tool. The parent receives only:
|
|
92
|
+
|
|
93
|
+
- completion or failure status
|
|
94
|
+
- a concise summary
|
|
95
|
+
- paths to useful documents
|
|
96
|
+
- the task-record location
|
|
97
|
+
|
|
98
|
+
The complete result is not copied into the parent model context. Each run is retained under:
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
.pi/herdr-subagents/runs/<run>/tasks/<task>/
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The task directory contains the full result, structured report, task metadata, system prompt, and persistent Pi session. Run-level metadata is stored in the parent run directory.
|
|
105
|
+
|
|
106
|
+
## Configuration and personas
|
|
107
|
+
|
|
108
|
+
Herdr Subagents loads settings and persona definitions from separate files:
|
|
109
|
+
|
|
110
|
+
| Scope | Settings | Persona definitions |
|
|
111
|
+
| --- | --- | --- |
|
|
112
|
+
| Project | `.pi/herdr-subagents.json` | `.pi/herdr-subagents/agents/*.md` |
|
|
113
|
+
| Global | `~/.pi/agent/herdr-subagents.json` | `~/.pi/agent/herdr-subagents/agents/*.md` |
|
|
114
|
+
| Package | built-in defaults | installed package `agents/*.md` |
|
|
115
|
+
|
|
116
|
+
Project JSON values recursively override global JSON values. The built-in setting defaults are `defaultConcurrency: 1`, `maxConcurrency: 4`, and `stalledWarningSeconds: 300`. `defaultModel` and `defaultThinking` are unset, so the parent Pi model and its thinking level are inherited unless another setting wins.
|
|
117
|
+
|
|
118
|
+
### Settings file option reference
|
|
119
|
+
|
|
120
|
+
These are all supported top-level fields in `herdr-subagents.json`:
|
|
121
|
+
|
|
122
|
+
| Option | Accepted value | Default | Effect |
|
|
123
|
+
| --- | --- | --- | --- |
|
|
124
|
+
| `defaultConcurrency` | Positive integer | `1` | Number of read-only tasks allowed to run together when a batch call omits `concurrency`. It is capped to `maxConcurrency`. |
|
|
125
|
+
| `maxConcurrency` | Positive integer | `4` | Hard ceiling for requested/default batch concurrency. A batch containing any write-capable persona still runs serially. |
|
|
126
|
+
| `stalledWarningSeconds` | Positive integer | `300` | Seconds before a still-running child emits a warning. This is not a timeout and does not stop the child. |
|
|
127
|
+
| `defaultModel` | Non-empty Pi model string, normally `provider/model` | Unset | Model used when neither JSON persona settings nor persona Markdown select one. If unset, the parent model is inherited. Use `/herdr-subagents models` to list authenticated models. |
|
|
128
|
+
| `defaultThinking` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max` | Unset | Thinking level below persona-specific settings. Provider/model support can vary. If unset, parent thinking is inherited only when the parent model is also inherited. |
|
|
129
|
+
| `personas` | Object keyed by an existing persona name | `{}` | Per-persona JSON overrides described below. This does not create a persona; a matching Markdown definition must exist. |
|
|
130
|
+
|
|
131
|
+
Known fields with an invalid JSON type, an empty required string, or a non-positive integer are ignored with a diagnostic shown by `/herdr-subagents settings`. Model IDs, thinking-level compatibility, and skill availability are ultimately validated by Pi when the child starts. When `defaultConcurrency` exceeds `maxConcurrency`, the effective default is reduced to the maximum.
|
|
132
|
+
|
|
133
|
+
Each `personas.<name>` object supports exactly these overrides:
|
|
134
|
+
|
|
135
|
+
| Option | Accepted value | Effect |
|
|
136
|
+
| --- | --- | --- |
|
|
137
|
+
| `model` | Non-empty Pi model string | Overrides the model from the effective persona Markdown and `defaultModel`. |
|
|
138
|
+
| `thinking` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max` | Overrides persona Markdown and `defaultThinking`. The value is passed to Pi's `--thinking` option. |
|
|
139
|
+
| `skills` | Array of non-empty strings | Replaces the entire lower-precedence skill list. Use `[]` to clear inherited skills. Each item is passed to child Pi as `--skill`. |
|
|
140
|
+
|
|
141
|
+
JSON persona overrides cannot change `name`, `description`, `access`, `tools`, or the system prompt; define those in persona Markdown.
|
|
142
|
+
|
|
143
|
+
A global configuration can establish shared defaults:
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"defaultConcurrency": 2,
|
|
148
|
+
"maxConcurrency": 4,
|
|
149
|
+
"stalledWarningSeconds": 300,
|
|
150
|
+
"defaultModel": "anthropic/claude-sonnet-4-5",
|
|
151
|
+
"defaultThinking": "medium",
|
|
152
|
+
"personas": {
|
|
153
|
+
"explorer": {
|
|
154
|
+
"model": "anthropic/claude-haiku-4-5",
|
|
155
|
+
"thinking": "medium",
|
|
156
|
+
"skills": ["code-search"]
|
|
157
|
+
},
|
|
158
|
+
"reviewer": {
|
|
159
|
+
"thinking": "high",
|
|
160
|
+
"skills": ["code-review"]
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The project file can override only the fields that differ. Persona fields are merged by persona name:
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"defaultConcurrency": 3,
|
|
171
|
+
"stalledWarningSeconds": 600,
|
|
172
|
+
"defaultThinking": "high",
|
|
173
|
+
"personas": {
|
|
174
|
+
"explorer": {
|
|
175
|
+
"model": "openai/gpt-5.2"
|
|
176
|
+
},
|
|
177
|
+
"reviewer": {
|
|
178
|
+
"skills": ["security-review", "code-review"]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The package includes these personas:
|
|
185
|
+
|
|
186
|
+
| Persona | Access | Built-in tools | Intended use |
|
|
187
|
+
| --- | --- | --- | --- |
|
|
188
|
+
| `worker` | write | `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls` | Focused implementation work |
|
|
189
|
+
| `explorer` | read | `read`, `bash`, `grep`, `find`, `ls` | Fast codebase investigation |
|
|
190
|
+
| `reviewer` | read | `read`, `bash`, `grep`, `find`, `ls` | Correctness and maintainability review |
|
|
191
|
+
|
|
192
|
+
Persona definitions use Markdown frontmatter followed by the child system prompt. For example, save this as `.pi/herdr-subagents/agents/security-reviewer.md`:
|
|
193
|
+
|
|
194
|
+
```md
|
|
195
|
+
---
|
|
196
|
+
name: security-reviewer
|
|
197
|
+
description: Read-only reviewer for security risks
|
|
198
|
+
access: read
|
|
199
|
+
model: anthropic/claude-sonnet-4-5
|
|
200
|
+
thinking: high
|
|
201
|
+
tools: read, bash, grep, find, ls
|
|
202
|
+
skills: security-review, code-review
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
Review the assigned scope without modifying files. Report concrete risks and evidence.
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Persona Markdown supports these frontmatter fields:
|
|
209
|
+
|
|
210
|
+
| Field | Accepted value | Required/default | Effect |
|
|
211
|
+
| --- | --- | --- | --- |
|
|
212
|
+
| `name` | Non-empty string | Required | Persona identifier used by `agent`. Names must be unique within one persona directory. |
|
|
213
|
+
| `description` | Non-empty string | Required | Description shown to the parent when agents are listed. |
|
|
214
|
+
| `access` | `read` or `write` | `write` | Scheduling declaration. Any batch containing `write` is forced to concurrency one. `read` permits parallel scheduling but does not itself remove tools. |
|
|
215
|
+
| `model` | Non-empty Pi model string | Unset | Persona model default. |
|
|
216
|
+
| `thinking` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max` | Unset | Persona thinking default passed to Pi's `--thinking` option. |
|
|
217
|
+
| `tools` | Non-empty comma-separated list, optionally bracketed | Child Pi defaults | Restricts built-in tools. Supported names are `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`, and `powershell`. `subagent_report` is always added. |
|
|
218
|
+
| `skills` | Comma-separated list, optionally bracketed | None | Skills loaded explicitly into child Pi; automatic skill discovery is disabled. |
|
|
219
|
+
|
|
220
|
+
The Markdown body after the frontmatter is the child system prompt and may be empty. To make a custom persona operationally read-only, set `access: read` **and** choose an appropriate `tools` allowlist; `access` alone is not a tool sandbox. Model names and skill values are passed to Pi, so they must be available in the installed Pi environment.
|
|
221
|
+
|
|
222
|
+
Persona Markdown definitions use replacement precedence, not field merging. A same-name project definition replaces the entire global or package definition:
|
|
223
|
+
|
|
224
|
+
1. project `.pi/herdr-subagents/agents/*.md`
|
|
225
|
+
2. global `~/.pi/agent/herdr-subagents/agents/*.md`
|
|
226
|
+
3. package built-ins
|
|
227
|
+
|
|
228
|
+
### Model and persona-option precedence
|
|
229
|
+
|
|
230
|
+
The child model is selected in this exact order:
|
|
231
|
+
|
|
232
|
+
1. `model` on the task or call
|
|
233
|
+
2. project `personas.<name>.model` JSON setting
|
|
234
|
+
3. global `personas.<name>.model` JSON setting
|
|
235
|
+
4. `model` in the effective persona Markdown frontmatter
|
|
236
|
+
5. effective `defaultModel` JSON setting (project overrides global)
|
|
237
|
+
6. parent Pi model
|
|
238
|
+
|
|
239
|
+
The child thinking level is selected in this order:
|
|
240
|
+
|
|
241
|
+
1. project `personas.<name>.thinking` JSON setting
|
|
242
|
+
2. global `personas.<name>.thinking` JSON setting
|
|
243
|
+
3. `thinking` in the effective persona Markdown frontmatter
|
|
244
|
+
4. effective `defaultThinking` JSON setting (project overrides global)
|
|
245
|
+
5. parent Pi thinking level when the child also inherits the parent model
|
|
246
|
+
|
|
247
|
+
Thinking has no call-level override. `skills` uses the first three persona-level steps and has no global default; a project `skills` array replaces, rather than appends to, the global or Markdown list.
|
|
248
|
+
|
|
249
|
+
Override the model for one task:
|
|
250
|
+
|
|
251
|
+
```text
|
|
252
|
+
herdr_subagents({
|
|
253
|
+
agent: "reviewer",
|
|
254
|
+
model: "anthropic/claude-opus-4-1:high",
|
|
255
|
+
prompt: "Review the authorization boundary"
|
|
256
|
+
})
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Each task in a batch can select its own model:
|
|
260
|
+
|
|
261
|
+
```text
|
|
262
|
+
herdr_subagents({
|
|
263
|
+
concurrency: 2,
|
|
264
|
+
tasks: [
|
|
265
|
+
{ name: "map", agent: "explorer", model: "anthropic/claude-haiku-4-5", prompt: "Map the request flow" },
|
|
266
|
+
{ name: "review", agent: "reviewer", model: "anthropic/claude-sonnet-4-5", prompt: "Review input validation" }
|
|
267
|
+
]
|
|
268
|
+
})
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Run `/herdr-subagents agents`, `/herdr-subagents models`, or `/herdr-subagents settings` to inspect effective values and their sources.
|
|
272
|
+
|
|
273
|
+
## Recovery and failures
|
|
274
|
+
|
|
275
|
+
Queued background submissions are persisted before dispatch. Closing the parent Pi session cancels queued, running, and blocked work, records `cancelled`, and closes the owned run tab. On the next Pi start, stale active records and queued submissions from a prior parent session are reconciled to a terminal state, including when Pi reused the same process, and leaked tabs are cleaned up when possible. Missing, truncated, or structurally invalid child reports become explicit failures or cancellation diagnostics; recovery errors are reported without leaving new submissions paused.
|
|
276
|
+
|
|
277
|
+
Tab, pane, and child startup commands are not automatically retried: an error may arrive after Herdr already created the resource. A failure after prompt submission is preserved and never automatically rerun. Historical follow-ups exclude concurrent resumes of the same run with an atomic `.resume.lock` directory; if Pi crashes without releasing it, confirm no Agent is still using that run before removing the lock manually. `stalledWarningSeconds` emits a warning without killing long-running work. Run/task/report snapshots use atomic replacement so interruption cannot expose half-written JSON.
|
|
278
|
+
|
|
279
|
+
The child does not inherit parent extensions, parent conversation, or unconfigured skills, but normal project context files still apply. It uses the same Pi installation, provider configuration, model catalog, and credentials as the parent.
|
|
280
|
+
|
|
281
|
+
## Development and tests
|
|
282
|
+
|
|
283
|
+
See [TESTING.md](TESTING.md) for deterministic tests, extension loading, packaging, and real Herdr smoke requirements.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Herdr Subagents test strategy
|
|
2
|
+
|
|
3
|
+
## Flow
|
|
4
|
+
|
|
5
|
+
1. `npm --prefix packages/herdr-subagents test` runs deterministic scheduler, recovery, and persona tests.
|
|
6
|
+
2. `pi -ne -ns --no-session -e ./packages/herdr-subagents/extensions/herdr-subagents.ts` verifies extension loading.
|
|
7
|
+
3. From a visible X11 Herdr client with the GStreamer X11 and VP8 plugins installed, run `HERDR_MEDIA_WINDOW_ID=<window-id> node scripts/capture-package-media.mjs`. The Herdr capture must show a parent Pi conversation, a three-task run tab, each of the three real interactive Agent panes receiving focus in turn, and the final compact parent response.
|
|
8
|
+
4. `npm pack ./packages/herdr-subagents --dry-run` verifies package contents.
|
|
9
|
+
5. Verify the README renders the GitHub attachment video directly and live Herdr UI media `docs/screenshot.png` and `docs/demo.webm` are present in the tarball; `docs/demo.gif` must be absent. Inspect the WebM metadata and play it through once to confirm the parent → three focused children → parent sequence.
|
|
10
|
+
|
|
11
|
+
## Cases
|
|
12
|
+
|
|
13
|
+
- Resolve package, global, and project personas and validate frontmatter/configuration.
|
|
14
|
+
- Run foreground tasks and FIFO bounded-concurrency batches through an injectable Herdr boundary.
|
|
15
|
+
- Verify all paths use interactive Agent start/prompt without print mode, shell injection, markers, or pane reuse.
|
|
16
|
+
- Force write-capable batches to serial execution while allowing bounded read-only parallelism.
|
|
17
|
+
- Preserve compact reports, full results, Pi sessions, blocked questions, and historical follow-ups.
|
|
18
|
+
- Recover queued/running work after interruption without retrying post-prompt side effects, including truncated reports and recovery errors.
|
|
19
|
+
- Verify the flat public contract and injectable extension wiring, including conditional registration only inside Herdr, Fleet rendering, editor focus ownership, terminal-input passthrough, exact-pane navigation, and stable display while another background run queues.
|
|
20
|
+
- Verify blocked-response live Fleet updates, authoritative stale-field replacement, parent-shutdown cancellation, cleanup notifications, atomic state replacement, non-retried uncertain startup operations, and stalled warnings.
|
|
21
|
+
- Verify resumed batches retain newly allocated pane IDs and historical follow-ups exclude simultaneous session writers.
|
|
22
|
+
|
|
23
|
+
## Latest baseline
|
|
24
|
+
|
|
25
|
+
All 136 deterministic scheduler, recovery, process-boundary, schema-validation, navigation, and persona cases must pass. Release validation also requires extension loading and a real Herdr read-only batch smoke with distinct task panes and final tab cleanup. The latest smoke completed two concurrent tasks, retained its focused run tab through settlement, and closed it automatically after focus moved away.
|
|
Binary file
|
|
Binary file
|