pi-agent-replicate 1.4.0 → 1.4.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 +5 -0
- package/README.md +25 -196
- package/RELEASING.md +2 -0
- package/assets/banner.png +0 -0
- package/docs/README.md +3 -0
- package/docs/configuration.md +14 -0
- package/docs/development.md +27 -0
- package/docs/retained-roles.md +71 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
Earlier entries were generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
## [v1.4.1](https://github.com/alexshpunt/pi-agent-replicate/compare/v1.4.0...v1.4.1) - 2026-11-01
|
|
12
|
+
|
|
13
|
+
- Rewrote the README to explain replication, inherited context, installation, and directory modes.
|
|
14
|
+
- Updated the package image so the full artwork fits in the Pi Packages preview.
|
|
15
|
+
|
|
11
16
|
## v1.4.0 - 2026-11-01
|
|
12
17
|
|
|
13
18
|
First npm release of Pi Agent Replicate under its own package name.
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="assets/banner.png" alt="
|
|
2
|
+
<img src="assets/banner.png" alt="Pi Agent Replicate: one agent branches into two copies" width="100%">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h1 align="center">Pi Agent Replicate</h1>
|
|
@@ -9,232 +9,61 @@
|
|
|
9
9
|
<div align="center">
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/pi-agent-replicate)
|
|
12
|
-
[](https://www.npmjs.com/package/pi-agent-replicate)
|
|
13
12
|
[](./LICENSE)
|
|
14
13
|
|
|
15
14
|
</div>
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
Give your [Pi](https://github.com/earendil-works/pi) agent the ability to work in parallel in [Herdr](https://herdr.dev). It creates copies of itself for independent parts of a task, keeps working, and receives their results automatically.
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Copies work in separate Git worktrees by default. For projects that need the same directory, such as Unity projects, you can choose a shared directory instead.
|
|
18
|
+
Each copy starts with the current conversation, system prompt, model, thinking level and active tools. It has the context it needs to continue the work, rather than starting from scratch.
|
|
22
19
|
|
|
23
20
|
## Install
|
|
24
21
|
|
|
25
|
-
Install from npm:
|
|
26
|
-
|
|
27
22
|
```bash
|
|
28
23
|
pi install npm:pi-agent-replicate
|
|
29
24
|
```
|
|
30
25
|
|
|
31
26
|
Start Pi inside Herdr, then restart Pi or run `/reload`.
|
|
32
27
|
|
|
33
|
-
##
|
|
34
|
-
|
|
35
|
-
The extension registers exactly one model-facing tool:
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
replicate({ name: "check-auth-risks", task: "Check authentication risks while I implement the settings change. Return concrete findings with file references." });
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Use it only from a task-ready state: the agent is already in the intended working location, understands its task, and has identified independent parts that can run in parallel. Before calling, it must know the copy's assignment, the expected result, and the separate work it will continue itself.
|
|
42
|
-
|
|
43
|
-
This is parallel work by one agent, not a tool for handing off a task. Do not replicate while still deciding the task, its scope, or where to work. If the next step would be waiting for the copy, do the work yourself. After finishing real parallel work, the original may end its turn and wait for automatic delivery. Do not poll.
|
|
44
|
-
|
|
45
|
-
The schema always requires only `name` and `task`. Each call starts a fresh copy with the caller's current context. After a result, continue in the original session or create another copy. Routine replies omit host paths and checkpoint details. A work problem is explained when it occurs.
|
|
46
|
-
|
|
47
|
-
The caller must choose a task-specific `name` in lowercase kebab-case, such as `check-auth-risks`. The runtime adds the origin: `check-auth-risks ← Settings`. The origin comes from the parent's session name, then its current Herdr pane name, then the project directory name. The same combined title appears in the copy's session, Herdr workspace and pane, active status, and result. There is no automatic numbering. Internal IDs remain separate.
|
|
48
|
-
|
|
49
|
-
Git branches use `replica/<origin>/<name>`, for example `replica/settings/check-auth-risks`. The origin is lowercased and made safe for a path; Cyrillic is transliterated (`Настройки` becomes `nastroiki`). Herdr uses the branch to name the checkout directory, such as `replica-nastroiki-check-auth-risks`. Repeated or simultaneous launches reserve separate branches with `-2`, `-3`, and so on, without changing the displayed session title. These suffixes also avoid different origin/task pairs that would produce the same checkout directory. Existing branches and worktrees are not renamed.
|
|
50
|
-
|
|
51
|
-
## Project directory mode
|
|
52
|
-
|
|
53
|
-
Run `/replica-directory` to choose a mode, or use `/replica-directory shared` or `/replica-directory worktree`. The choice is saved in `.pi/replicate.json` in the current project directory and applies to new copies. The default is `worktree`.
|
|
54
|
-
|
|
55
|
-
In `shared` mode, copies use their parent's current directory, including ignored files and dependencies. They do not create a Git worktree or branch, and there is no snapshot or automatic join. Changes are visible immediately and remain even if the copy fails. Coordinate assignments: simultaneous edits to the same files can overwrite each other, and there is no automatic rollback or conflict isolation. This mode can be useful when copies need the same Unity project directory. Changing the mode does not move already-running copies.
|
|
56
|
-
|
|
57
|
-
## Replication runtime
|
|
58
|
-
|
|
59
|
-
The following details describe the implementation, not instructions added to the agent's prompt.
|
|
60
|
-
|
|
61
|
-
Each call copies the current active conversation, including the current user turn. It inherits the model, thinking level, full system prompt and active tools. Explicit CLI extensions follow the copy too. The bounded assignment and summary requirement are sent as a normal task message, without changing the system prompt.
|
|
62
|
-
|
|
63
|
-
A fresh call requires `name` and `task`. There are no model-facing role, model, cwd, worktree or batch choices. In the default worktree mode, each copy gets tracked working files and nonignored untracked files from the moment of launch. The snapshot does not change the parent's HEAD or staging. Ignored files, dependencies and builds are not copied. Worktrees isolate source files, not shared processes, ports or databases.
|
|
64
|
-
|
|
65
|
-
There are no model-facing continuation, resume or fork choices. Saved sessions and source checkpoints remain recovery evidence; the tool always creates a fresh copy.
|
|
66
|
-
|
|
67
|
-
A copy can call `replicate` for an independent part of its assignment. It must wait for its own copies and return a nonempty final summary. The runtime delivers that summary and closes its pane and empty Herdr workspace after descendants drain and the process exits. Failed and conflicted copies close too; their files and saved sessions stay available for recovery. Copies do not get `caller_ping` or `subagent_done`.
|
|
68
|
-
|
|
69
|
-
The old subagent tools and child completion/help tools are removed. The internal launcher and package-root API remain available without registering model-facing controls. The package ships no workflows, skills or built-in roles.
|
|
70
|
-
|
|
71
|
-
## Retained runtime policy
|
|
72
|
-
|
|
73
|
-
Model and thinking are resolved independently:
|
|
74
|
-
|
|
75
|
-
1. Use the value from the selected role's frontmatter.
|
|
76
|
-
2. If the role omits it, inherit the value from the parent session.
|
|
77
|
-
|
|
78
|
-
This role policy applies only to the retained internal launcher and package-root API. `replicate` uses the parent runtime without resolving a role. Bare spawns remain supported by those retained paths. They inherit both values. Role models must be one exact authenticated `provider/model-id`. Model fallback lists and `config.json` model routing are not supported.
|
|
79
|
-
|
|
80
|
-
## Custom roles for the retained API
|
|
81
|
-
|
|
82
|
-
The package has no built-in roles. Add roles in one of these places:
|
|
83
|
-
|
|
84
|
-
| Source | Path |
|
|
85
|
-
| --- | --- |
|
|
86
|
-
| Project | `.pi/agents/<name>.md` |
|
|
87
|
-
| Global | `$PI_CODING_AGENT_DIR/agents/<name>.md` (normally `~/.pi/agent/agents/<name>.md`) |
|
|
88
|
-
| Role pack | An installed Pi package registered through the role discovery event |
|
|
89
|
-
|
|
90
|
-
Priority is project, then global, then role pack. Duplicate role-pack names are rejected.
|
|
91
|
-
|
|
92
|
-
Example:
|
|
93
|
-
|
|
94
|
-
```markdown
|
|
95
|
-
---
|
|
96
|
-
name: security-reviewer
|
|
97
|
-
description: Reviews a bounded change for security problems
|
|
98
|
-
model: provider/exact-model-id
|
|
99
|
-
thinking: high
|
|
100
|
-
tools: read, bash
|
|
101
|
-
spawning: false
|
|
102
|
-
auto-exit: true
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
Review only the requested change. Report concrete findings with file references.
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Useful frontmatter fields:
|
|
109
|
-
|
|
110
|
-
- `name`, `description`
|
|
111
|
-
- `model`, `thinking`
|
|
112
|
-
- `tools`, `skills`, `deny-tools`
|
|
113
|
-
- `spawning`, `allow-self-spawn`
|
|
114
|
-
- `auto-exit`, `interactive`
|
|
115
|
-
- `session-mode`: `standalone`, `lineage-only`, or `fork`
|
|
116
|
-
- `cwd`
|
|
117
|
-
- `system-prompt`: `append` or `replace`
|
|
118
|
-
- `disable-model-invocation`
|
|
28
|
+
## How it works
|
|
119
29
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
Definitions that request an external `cli` fail before Herdr creates resources.
|
|
123
|
-
|
|
124
|
-
### Role packs
|
|
125
|
-
|
|
126
|
-
A Pi package can register one absolute Markdown file or a directory of direct `.md` children through this event:
|
|
30
|
+
The extension adds one tool, `replicate`. The agent calls it with a task-specific name and a bounded assignment:
|
|
127
31
|
|
|
128
32
|
```typescript
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
);
|
|
33
|
+
replicate({
|
|
34
|
+
name: "check-auth-risks",
|
|
35
|
+
task: "Check authentication risks while I implement the settings change. Return concrete findings with file references.",
|
|
36
|
+
});
|
|
135
37
|
```
|
|
136
38
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
## Lifecycle
|
|
140
|
-
|
|
141
|
-
`replicate` is fire-and-forget. Do not poll, sleep, tail session files or check panes to wait for it. Continue independent work or end your turn until automatic delivery starts the next turn.
|
|
142
|
-
|
|
143
|
-
Delayed result and help cards keep the launch call that owns that attempt. In Stereo fullscreen they appear beside that call in Activity, not as a second Conversation card. Nested calls link to their actual visible outer call. Saved ownership follows delivery through reload, receiver recovery and Teleport. Older or API-launched work without a recorded tool owner stays unlinked. This changes presentation only: the parent still receives the complete result, and saved history stays chronological.
|
|
144
|
-
|
|
145
|
-
Host metadata retains the saved session and immutable Markdown result-file paths. Routine model-visible results carry the copy's summary, without saved-copy choices or internal references. Terminal model failures report error facts; host metadata also retains a separate file containing every post-fork textual assistant answer in order. That file excludes the original's answers, tool calls, tool results and hidden reasoning. Answers are not truncated. An empty required summary is a failure, not success.
|
|
146
|
-
|
|
147
|
-
Every fully stopped replica reports and closes, including after user input or Escape. An interrupted copy reports interruption; an unsaved close or process loss reports failure with preserved answers, not success or an automatic restart. The parent continues with the returned information or creates a fresh copy.
|
|
148
|
-
|
|
149
|
-
If Pi fails while loading extensions or before its session initializes, the parent uses its saved launch ownership to close the failed attempt pane and reports the available startup error. It does not wait for completion hooks that never started. The failed checkout stays available. A warning alone or a terminal marker printed while Pi is still running does not count as process failure.
|
|
150
|
-
|
|
151
|
-
Missing or damaged answer history does not block a failure report or pane cleanup. The result explains why history is unavailable without exporting answers of unknown origin. If the session itself cannot be checkpointed, source work is still saved where possible and retained, and no changes are applied automatically.
|
|
152
|
-
|
|
153
|
-
Automatic closure waits for active tools, pending background terminal completions, background request receipts, reported Linux child PIDs and their observed descendants, and owned replicas. Completion messages wake the copy so it can process the result before returning. New input or work cancels a stale shutdown decision. This ownership state follows the exact session through reload.
|
|
154
|
-
|
|
155
|
-
The process guard uses reported descendant PIDs, not every process in the terminal or every runtime helper. It cannot discover unreported daemonized jobs or remote CI jobs without a background receipt/completion message. A running open-ended job keeps its copy open until stopped.
|
|
156
|
-
|
|
157
|
-
Once session work is finished, settlement reports without an extra model confirmation. A ten-second safety net retries a missed handoff only while Pi is truly idle, with no queued work, movement or undrained descendants. Active tools, requests, retries and compaction are not subject to that deadline. Durable ownership restores pending results, join plans and cleanup after restart. The retained non-replica API keeps its existing recovery and interactive policies.
|
|
158
|
-
|
|
159
|
-
The binding is saved inside the Pi session and follows its stable session ID through Teleport. A new file, cwd, process, or pane does not change the receiver. A fork with a new session ID does not inherit pending answers. Children restore their own lifecycle and follow their moved immediate parent, including nested launches. A move suspends source-side delivery and completion while the replacement binds; an abandoned child handoff has a bounded recovery gate.
|
|
160
|
-
|
|
161
|
-
Ownership and current locations are indexed under `$PI_CODING_AGENT_DIR/subagent-sessions` (default: `~/.pi/agent/subagent-sessions`). The session carries this store path through moves. Answers stay in durable lineage inboxes until their exact result entry is saved in the parent session. When the parent is closed, nothing opens it automatically: reopening that session restores observers, replays pending answers, and wakes its agent. A Herdr restart does not erase the store. An interrupted active child uses bounded recovery or reports failure; unfinished computation is not a saved answer.
|
|
162
|
-
|
|
163
|
-
Keep the binding store, session artifacts, and saved sessions together when backing up or moving to another machine. Pane IDs alone are never permission to close a pane after a restart.
|
|
164
|
-
|
|
165
|
-
No child receives a model-facing completion or help tool.
|
|
166
|
-
|
|
167
|
-
## Managed worktrees
|
|
39
|
+
The name uses lowercase kebab-case. The copy works in its own Pi session and can create copies of its own. When its work and any child work finish, the result returns to the original agent automatically. The original can continue independent work or end its turn while it waits; it does not need to poll.
|
|
168
40
|
|
|
169
|
-
|
|
41
|
+
Use replication when there are genuinely independent tasks to do in parallel, not simply to hand off a task and wait. Copies inherit the conversation and tools, but their subsequent conversations are separate.
|
|
170
42
|
|
|
171
|
-
|
|
43
|
+
## Where copies work
|
|
172
44
|
|
|
173
|
-
|
|
45
|
+
By default, each copy works in a separate Git worktree. It starts with a snapshot of the parent's tracked changes and non-ignored new files. Ignored files, dependencies and build outputs are not copied. On success, the host attempts to apply the copy's changes to the parent without changing its HEAD or staging. A conflict or failure leaves the copy's work available for review rather than applying partial changes. A clean join does not guarantee the combined code is correct.
|
|
174
46
|
|
|
175
|
-
|
|
47
|
+
Worktree mode requires a non-bare Git checkout with a commit. Snapshots do not support unresolved index conflicts, sparse or assume-unchanged index entries, submodules or nested Git repositories. Worktrees isolate files, not shared processes, ports or databases.
|
|
176
48
|
|
|
177
|
-
|
|
49
|
+
When copies need the same directory, switch to shared mode:
|
|
178
50
|
|
|
179
|
-
|
|
180
|
-
-
|
|
181
|
-
- Parent uncommitted and untracked files are not copied.
|
|
182
|
-
- Ownership is recorded before Herdr resources are created.
|
|
183
|
-
- Success, failure, and help requests retain the workspace.
|
|
184
|
-
- Completion reports branch, commits, changed files, and clean/conflicted state.
|
|
185
|
-
- Unknown Git inspection results remain unknown; they are never guessed clean.
|
|
186
|
-
|
|
187
|
-
See [Worktree subagents](docs/worktree-subagents.md) for review and cleanup commands.
|
|
188
|
-
|
|
189
|
-
## Package-root API
|
|
190
|
-
|
|
191
|
-
Other Pi extensions can import the side-effect-free package root:
|
|
192
|
-
|
|
193
|
-
```typescript
|
|
194
|
-
import { createSubagentTree, attachSubagentTree } from "pi-agent-replicate";
|
|
51
|
+
```text
|
|
52
|
+
/replica-directory shared
|
|
195
53
|
```
|
|
196
54
|
|
|
197
|
-
|
|
55
|
+
Shared copies work in the parent's current directory, including ignored files and dependencies. They do not create a worktree or branch, and there is no snapshot or automatic join. Changes are visible immediately and can remain even if a copy fails. Coordinate assignments: parallel edits to the same files can overwrite each other, and there is no automatic rollback.
|
|
198
56
|
|
|
199
|
-
|
|
57
|
+
Use `/replica-directory worktree` to switch back, or `/replica-directory` to choose interactively. The setting is saved in `.pi/replicate.json` in the current project directory and applies to new copies only.
|
|
200
58
|
|
|
201
|
-
|
|
59
|
+
## When a copy stops
|
|
202
60
|
|
|
203
|
-
|
|
204
|
-
{
|
|
205
|
-
"status": {
|
|
206
|
-
"enabled": true,
|
|
207
|
-
"quietThresholdMs": 120000
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
`PI_SUBAGENT_QUIET_THRESHOLD_MS` overrides the quiet threshold for the current process. It must be a positive integer.
|
|
61
|
+
A completed copy returns its summary automatically. If it fails, is interrupted or loses its process, the parent receives a failure and any available answer information. Copies do not restart automatically; the parent can create a fresh copy if needed. In worktree mode, failed or conflicted work remains available for recovery; in shared mode, changes may already be in the shared directory.
|
|
213
62
|
|
|
214
|
-
##
|
|
63
|
+
## More information
|
|
215
64
|
|
|
216
|
-
|
|
217
|
-
npm test
|
|
218
|
-
npm run lint
|
|
219
|
-
npm pack --dry-run
|
|
220
|
-
npx tsc --noEmit index.ts
|
|
221
|
-
node --check index.js
|
|
222
|
-
git diff --check
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
Run selected isolated real-Pi and Herdr cases from inside Herdr:
|
|
226
|
-
|
|
227
|
-
```bash
|
|
228
|
-
npm run test:integration -- test/integration/replication.test.ts
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
For a manual TUI check with a deterministic provider, set `PI_INTEGRATION_TUI_DIR` to a fresh ignored directory and `PI_INTEGRATION_IDE_ENTRY` to the current IDE source entry. Run only this case with the intended Pi binary on `PATH`:
|
|
232
|
-
|
|
233
|
-
```bash
|
|
234
|
-
node --experimental-strip-types test/integration/run-isolated.ts \
|
|
235
|
-
--test-name-pattern='renders an active isolated replica' test/integration/replication.test.ts
|
|
236
|
-
```
|
|
65
|
+
See the [documentation](docs/README.md) for technical contracts and [development instructions](docs/development.md).
|
|
237
66
|
|
|
238
|
-
|
|
67
|
+
## License
|
|
239
68
|
|
|
240
|
-
|
|
69
|
+
[MIT](LICENSE)
|
package/RELEASING.md
CHANGED
|
@@ -59,6 +59,8 @@ After the package exists on npm, steady-state releases use npm trusted publishin
|
|
|
59
59
|
|
|
60
60
|
When the repository secret `NPM_TOKEN` is absent, the publish step unsets `NODE_AUTH_TOKEN` and relies on OIDC. Once the package exists, the workflow fails if `NPM_TOKEN` is still configured, so steady-state releases cannot silently keep using the bootstrap credential. Manual dispatch runs only from `main`; other refs are rejected.
|
|
61
61
|
|
|
62
|
+
A new trusted publisher expires 48 hours after creation unless it completes a successful publish. Create or recreate it shortly before the next release; an expired configuration cannot authorize publishing. The first successful trusted publish validates the configuration.
|
|
63
|
+
|
|
62
64
|
### Bootstrap history
|
|
63
65
|
|
|
64
66
|
The upstream `0.0.1` publication and documented trusted publisher for `giuseppecrj/pi-herdr-agents` do not establish the renamed npm package or authorize its releases.
|
package/assets/banner.png
CHANGED
|
Binary file
|
package/docs/README.md
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
- [Worktree subagents](worktree-subagents.md) — isolation, retained state, review, and cleanup.
|
|
6
6
|
- [Public subagent tree API](public-subagent-tree-api.md) — package-root API and ownership contract.
|
|
7
7
|
- [Settled lifecycle contract](settled-lifecycle-contract.md) — completion and delivery semantics.
|
|
8
|
+
- [Retained role launcher](retained-roles.md) — role definitions and discovery for the package-root API.
|
|
9
|
+
- [Status configuration](configuration.md) — status display settings.
|
|
10
|
+
- [Development](development.md) — checks and isolated integration testing.
|
|
8
11
|
|
|
9
12
|
## Architecture decisions
|
|
10
13
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Status configuration
|
|
2
|
+
|
|
3
|
+
Status settings are read from `config.json` at the installed package root. If that file is absent, `config.json.example` supplies the defaults:
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"status": {
|
|
8
|
+
"enabled": true,
|
|
9
|
+
"quietThresholdMs": 120000
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`PI_SUBAGENT_QUIET_THRESHOLD_MS` overrides the quiet threshold for the current process. It must be a positive integer. Package updates may replace changes made inside the installed package directory.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Development
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
npm test
|
|
5
|
+
npm run lint
|
|
6
|
+
npm pack --dry-run
|
|
7
|
+
npx tsc --noEmit index.ts
|
|
8
|
+
node --check index.js
|
|
9
|
+
git diff --check
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Run selected isolated real-Pi and Herdr cases from inside Herdr:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm run test:integration -- test/integration/replication.test.ts
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
For a manual TUI check with a deterministic provider, set `PI_INTEGRATION_TUI_DIR` to a fresh ignored directory and `PI_INTEGRATION_IDE_ENTRY` to the current IDE source entry. Run only this case with the intended Pi binary on `PATH`:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
node --experimental-strip-types test/integration/run-isolated.ts \
|
|
22
|
+
--test-name-pattern='renders an active isolated replica' test/integration/replication.test.ts
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The case reloads Pi and records the loaded IDE in `runtime.json`. The applied and failed cases each write to their own subdirectory. Use its `pane.json` to attach a read-only observer to the private Herdr endpoint. Capture the active pane, then create `release-child` in the inspection directory. Capture the delivered result, then create `finish` so the runner can clean up. Both observation gates time out after five minutes. Do not use the user's persistent Herdr server.
|
|
26
|
+
|
|
27
|
+
See [RELEASING.md](../RELEASING.md) for release checks.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Retained role launcher
|
|
2
|
+
|
|
3
|
+
This reference applies to the package-root API and retained internal launcher, not the model-facing `replicate` tool.
|
|
4
|
+
|
|
5
|
+
## Retained runtime policy
|
|
6
|
+
|
|
7
|
+
Model and thinking are resolved independently:
|
|
8
|
+
|
|
9
|
+
1. Use the value from the selected role's frontmatter.
|
|
10
|
+
2. If the role omits it, inherit the value from the parent session.
|
|
11
|
+
|
|
12
|
+
This role policy applies only to the retained internal launcher and package-root API. `replicate` uses the parent runtime without resolving a role. Bare spawns remain supported by those retained paths. They inherit both values. Role models must be one exact authenticated `provider/model-id`. Model fallback lists and `config.json` model routing are not supported.
|
|
13
|
+
|
|
14
|
+
## Custom roles for the retained API
|
|
15
|
+
|
|
16
|
+
The package has no built-in roles. Add roles in one of these places:
|
|
17
|
+
|
|
18
|
+
| Source | Path |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| Project | `.pi/agents/<name>.md` |
|
|
21
|
+
| Global | `$PI_CODING_AGENT_DIR/agents/<name>.md` (normally `~/.pi/agent/agents/<name>.md`) |
|
|
22
|
+
| Role pack | An installed Pi package registered through the role discovery event |
|
|
23
|
+
|
|
24
|
+
Priority is project, then global, then role pack. Duplicate role-pack names are rejected.
|
|
25
|
+
|
|
26
|
+
Example:
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
---
|
|
30
|
+
name: security-reviewer
|
|
31
|
+
description: Reviews a bounded change for security problems
|
|
32
|
+
model: provider/exact-model-id
|
|
33
|
+
thinking: high
|
|
34
|
+
tools: read, bash
|
|
35
|
+
spawning: false
|
|
36
|
+
auto-exit: true
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
Review only the requested change. Report concrete findings with file references.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Useful frontmatter fields:
|
|
43
|
+
|
|
44
|
+
- `name`, `description`
|
|
45
|
+
- `model`, `thinking`
|
|
46
|
+
- `tools`, `skills`, `deny-tools`
|
|
47
|
+
- `spawning`, `allow-self-spawn`
|
|
48
|
+
- `auto-exit`, `interactive`
|
|
49
|
+
- `session-mode`: `standalone`, `lineage-only`, or `fork`
|
|
50
|
+
- `cwd`
|
|
51
|
+
- `system-prompt`: `append` or `replace`
|
|
52
|
+
- `disable-model-invocation`
|
|
53
|
+
|
|
54
|
+
Requested skills are saved in the child's conversation once. Reloading or resuming that conversation reuses the saved skills instead of adding another initialization message.
|
|
55
|
+
|
|
56
|
+
Definitions that request an external `cli` fail before Herdr creates resources.
|
|
57
|
+
|
|
58
|
+
### Role packs
|
|
59
|
+
|
|
60
|
+
A Pi package can register one absolute Markdown file or a directory of direct `.md` children through this event:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
pi.events.on(
|
|
64
|
+
"pi-herdr-subagents:roles:discover:v1",
|
|
65
|
+
(request: { apiVersion: number; register(path: string): void }) => {
|
|
66
|
+
if (request.apiVersion === 1) request.register(absoluteRolesDirectory);
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
A role-pack extension must remove its listener on `session_shutdown`.
|