@henryqw/pi-subagent 27.2.1 → 27.3.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/CONTEXT.md +63 -95
- package/README.md +231 -57
- package/dist/herdr-runtime.d.ts +2 -0
- package/dist/herdr-runtime.js +35 -19
- package/dist/integration-git.d.ts +2 -0
- package/dist/integration-git.js +19 -8
- package/dist/runner.d.ts +7 -0
- package/dist/runner.js +151 -56
- package/dist/schema.js +2 -2
- package/docs/orchestration.md +2 -2
- package/extensions/isolated.ts +2 -2
- package/package.json +1 -1
package/CONTEXT.md
CHANGED
|
@@ -1,95 +1,63 @@
|
|
|
1
|
-
# Pi Subagent
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- Failures, ambiguity, interruption, review findings, conflicts, drift, unproved termination, or cleanup failure enter `needs_attention` and preserve evidence.
|
|
65
|
-
- `subagent_status` is read-only, callable from `codemode` scripts, and returns the bounded public projection as structured content, never raw run state. `delegate_task`, `subagent_resume`, `subagent_stage`, `subagent_integrate`, and `subagent_abort` are model-only. `subagent_resume` accepts only strict `retry`, `verify`, or `finalize` continuations; only a correcting `retry` takes Main's optional instruction. `subagent_abort` terminates only exact owned workers.
|
|
66
|
-
- The extension never pushes, opens a pull request, publishes, deploys, stashes, resets, force-cleans, or deletes unproved recoverable work.
|
|
67
|
-
|
|
68
|
-
### Resource and launch policy
|
|
69
|
-
|
|
70
|
-
- Ambient child extensions and Skills stay disabled. Only Role/caller resources plus required internal adapters load.
|
|
71
|
-
- Every Role requires `tools`, `extensions`, and `skills` arrays; unknown frontmatter keys are rejected per file, and an invalid file blocks only the name it claims. `roleDefaults` in config merge into every Role first, deduplicated. `extensions` may name Pi built-in extensions as `builtin:<name>`. A Role activates `codemode` only by naming it in `tools` with `builtin:codemode` loaded; MCP configuration never activates it, and Pi's codemode settings apply unchanged. `mcps` names servers from the global `~/.pi/agent/mcp.json`; their tools keep their configured exposure in a codemode Role and are forced to direct exposure otherwise. Omitted or empty `mcps` denies MCP access. Direct `pi-mcp-adapter` loading is rejected because it bypasses the allowlist.
|
|
72
|
-
- The Role tool policy declares the Role's `tools` and the extension tools Pi would declare on registration; extension tools with `codemode` or `deferred` exposure stay callable from scripts without being declared.
|
|
73
|
-
- Selected extensions are trusted executable bundles, not a sandbox. All tools and lifecycle behavior they register load together.
|
|
74
|
-
- Role Skill names resolve through Main's effective Pi registry. Missing Roles, Skills, tools, MCP servers, routes, models, or thinking levels fail before the first productive turn.
|
|
75
|
-
- Route precedence is call model class, then Role default, then registered Model Task assignment/default. A direct model replaces only the route model and must support its thinking level.
|
|
76
|
-
- Main-only delegation/recovery tools and `ask_question` are excluded from children. Recursive delegation is unavailable.
|
|
77
|
-
- Package built-ins are `implementer`, `reviewer`, and `scout`; a same-named user Role overrides a built-in.
|
|
78
|
-
- `git_read` is an internal read-only child tool loaded only for Roles declaring it; the built-in reviewer opts in. Fixed structured Git operations provide bounded local evidence without Bash, network, external filters, or mutations. Named-ref context supplements but never replaces the authoritative exact isolated review patch.
|
|
79
|
-
|
|
80
|
-
### Executor boundaries
|
|
81
|
-
|
|
82
|
-
- A terminal response at the turn boundary succeeds; attempted continuation fails with typed `turn_limit` and bounded retained output.
|
|
83
|
-
- Token accounting sums completed assistant responses once. A terminal crossing succeeds. A continuing crossing completes tools and receives one response-only handoff; further continuation fails.
|
|
84
|
-
- Recognized Pi JSON events renew idle timeout; raw bytes do not. Child maximum runtime always terminates ephemeral children.
|
|
85
|
-
- Output, stderr, protocol events, callback draining, and inherited descendant streams are bounded.
|
|
86
|
-
- Low-level worktree finalization returns explicit `pruned`, `retained`, or `recovery` evidence and never force-deletes uncertain work.
|
|
87
|
-
- Exact review helpers produce bounded private evidence; callers must preserve identity guards and verdict validation.
|
|
88
|
-
|
|
89
|
-
## Owned storage
|
|
90
|
-
|
|
91
|
-
- User config and Role Markdown: `<agent-dir>/config/pi-subagent/`
|
|
92
|
-
- Durable state: `<agent-dir>/config/pi-subagent/state/<repository-hash>/`
|
|
93
|
-
- Shared model routes: `<agent-dir>/config/pi-task-models/config.json`
|
|
94
|
-
|
|
95
|
-
State version 5 is strict. Older or malformed files are rejected rather than rewritten or migrated silently.
|
|
1
|
+
# Pi Subagent
|
|
2
|
+
|
|
3
|
+
Pi Subagent delegates bounded work to Role-configured Pi workers. Direct tasks share Main's checkout; isolated requests produce checked candidates for explicit integration.
|
|
4
|
+
|
|
5
|
+
## Language
|
|
6
|
+
|
|
7
|
+
### Delegation
|
|
8
|
+
|
|
9
|
+
**Main**:
|
|
10
|
+
The Pi session and checkout that coordinate delegated work.
|
|
11
|
+
|
|
12
|
+
**Role**:
|
|
13
|
+
A named capability definition with instructions, tools, trusted extension sources, Skills, optional MCP servers, and an optional Model Class default. A Role does not select isolation.
|
|
14
|
+
|
|
15
|
+
**Model Class**:
|
|
16
|
+
A `fast`, `balanced`, `frontier`, or `fav` choice resolved through Pi Task Models.
|
|
17
|
+
|
|
18
|
+
**Direct task**:
|
|
19
|
+
A bounded task in Main's shared checkout with declared `read` or `write` access. Authorized writes take effect immediately, without rollback or checked integration.
|
|
20
|
+
|
|
21
|
+
**Direct reference**:
|
|
22
|
+
A display and continuation reference for one recorded direct worker, such as `D7.1`. It does not grant ownership of that worker.
|
|
23
|
+
|
|
24
|
+
**Continued worker**:
|
|
25
|
+
A new direct worker that resumes a finished worker's saved Pi conversation in a new tab with a new Direct reference.
|
|
26
|
+
|
|
27
|
+
**Checkout admission**:
|
|
28
|
+
The exclusive permission held by a direct write request that prevents Main and other direct writers from writing to the shared checkout. It remains held until worker termination is proven; read classification is not a sandbox.
|
|
29
|
+
|
|
30
|
+
**Isolated request**:
|
|
31
|
+
A durable goal and dependency graph of text and changeset tasks, with checked results and recovery state.
|
|
32
|
+
|
|
33
|
+
**Text task**:
|
|
34
|
+
An isolated-graph task whose result is bounded text rather than a changeset. Completed text can supply context to later tasks.
|
|
35
|
+
|
|
36
|
+
**Changeset task**:
|
|
37
|
+
An isolated-graph task that produces a committed change in its own worker worktree.
|
|
38
|
+
|
|
39
|
+
### Checked integration
|
|
40
|
+
|
|
41
|
+
**Candidate**:
|
|
42
|
+
The exact clean committed identity of a changeset worker's proposed change.
|
|
43
|
+
|
|
44
|
+
**Readiness**:
|
|
45
|
+
Saved proof that an exact candidate passed preliminary checks and is sealed for Main's explicit selection. It is not a separate user approval.
|
|
46
|
+
|
|
47
|
+
**Integration generation**:
|
|
48
|
+
Main's ordered assembly of selected candidates in a separate checkout. A replaced assembly remains available as a superseded generation.
|
|
49
|
+
|
|
50
|
+
**Judgment**:
|
|
51
|
+
A review decision bound to an exact candidate or combined integration generation, separate from automated validation.
|
|
52
|
+
|
|
53
|
+
**Promotion**:
|
|
54
|
+
The guarded transfer of a validated integration generation into unchanged, clean Main. Readiness alone does not permit promotion.
|
|
55
|
+
|
|
56
|
+
**Release**:
|
|
57
|
+
Main's explicit cleanup of an exact rejected worker or superseded generation after proving that it is no longer selected. Release does not discard dirty, conflicted, or uncertain work.
|
|
58
|
+
|
|
59
|
+
**Productive lease**:
|
|
60
|
+
Repository-scoped ownership that excludes concurrent execution or resumption while permitting status inspection and abort.
|
|
61
|
+
|
|
62
|
+
**Safety budget**:
|
|
63
|
+
A finite limit for child execution or a safety operation, not a deadline for the whole isolated request.
|