@cr1ms0n/pi-subagent 0.8.8 → 0.9.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/CHANGELOG.md +14 -6
- package/README.md +218 -128
- package/docs/ARCHITECTURE.md +168 -132
- package/docs/COST-ACCOUNTING.md +116 -66
- package/docs/RELEASING.md +32 -32
- package/docs/SECURITY.md +125 -97
- package/docs/UX.md +158 -141
- package/package.json +2 -2
- package/skills/subagent/SKILL.md +142 -121
- package/src/agents.ts +282 -288
- package/src/backends/pi.ts +164 -94
- package/src/child-preflight.ts +166 -0
- package/src/config.ts +254 -252
- package/src/dispatch-preflight.ts +87 -0
- package/src/dispatch-routing.ts +56 -0
- package/src/extension.ts +368 -187
- package/src/format.ts +436 -365
- package/src/jev-router.ts +1036 -0
- package/src/orchestrator.ts +303 -312
- package/src/persistence.ts +643 -335
- package/src/policy.ts +562 -561
- package/src/process-lock.ts +730 -687
- package/src/protocol.ts +320 -290
- package/src/registry.ts +730 -632
- package/src/routing-policy.ts +268 -0
- package/src/routing-types.ts +217 -0
- package/src/runner.ts +1299 -850
- package/src/schema.ts +189 -189
- package/src/startup-check.ts +481 -0
- package/src/types.ts +208 -198
- package/src/usage.ts +316 -274
- package/src/context-policy.ts +0 -169
- package/src/model-policy.ts +0 -169
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cr1ms0n/pi-subagent",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Community fork of Luke Parke's pi-subagent with
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "Community fork of Luke Parke's pi-subagent with Jev model/tool routing and verified Pi child capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Luke Parke",
|
package/skills/subagent/SKILL.md
CHANGED
|
@@ -1,121 +1,142 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: subagent
|
|
3
|
-
description: Delegate work to isolated child agents with the subagent tool
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Subagent
|
|
7
|
-
|
|
8
|
-
Delegate research, parallel exploration, and clean-context implementation to child
|
|
9
|
-
agents. Prefer `subagent` over long in-thread digressions when the work benefits
|
|
10
|
-
from isolation, parallelism, or a fresh context.
|
|
11
|
-
|
|
12
|
-
## When to use
|
|
13
|
-
|
|
14
|
-
- Map a codebase area without bloating the parent context (`profile: "explore"`).
|
|
15
|
-
- Review a diff read-only (`profile: "review"`).
|
|
16
|
-
- Implement behind a worktree and land via apply (`profile: "general"`, `isolation: "worktree"`).
|
|
17
|
-
- Fan out independent questions, optionally with `synthesis` to fold results.
|
|
18
|
-
- Background long work (`async: true`) and collect later with `wait` / `subagent_wait`.
|
|
19
|
-
|
|
20
|
-
## Core calls
|
|
21
|
-
|
|
22
|
-
```ts
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// Single foreground task (default profile: general)
|
|
28
|
-
{ task: "Find call sites of parseConfig", description: "Map parseConfig"
|
|
29
|
-
|
|
30
|
-
// Parallel read-only explorers (default profile for tasks[]: explore)
|
|
31
|
-
{
|
|
32
|
-
tasks: [
|
|
33
|
-
{ task: "Map auth middleware", description: "Auth flow"
|
|
34
|
-
{ task: "List env vars in server/", description: "Env inventory"
|
|
35
|
-
],
|
|
36
|
-
synthesis: "Merge into one prioritized brief"
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Background
|
|
40
|
-
{ task: "Audit dependency licenses",
|
|
41
|
-
{ action: "status", id: "abc123" }
|
|
42
|
-
{ action: "wait", id: "abc123" } // interruptible; does not cancel
|
|
43
|
-
{ action: "cancel", id: "abc123" }
|
|
44
|
-
// Same wait semantics as a dedicated tool:
|
|
45
|
-
// subagent_wait { id: "abc123", timeout_ms?: number }
|
|
46
|
-
|
|
47
|
-
// Worktree loop
|
|
48
|
-
{ task: "Implement feature A",
|
|
49
|
-
{ action: "diff", id: "abc123", index: 1 }
|
|
50
|
-
{ action: "apply", id: "abc123", index: 1 }
|
|
51
|
-
{ action: "discard", id: "abc123", index: 1 }
|
|
52
|
-
|
|
53
|
-
// Dry-run validation + resolved plan (no spawn)
|
|
54
|
-
// plan
|
|
55
|
-
{ action: "plan", tasks: [{ task: "…",
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Profiles
|
|
59
|
-
|
|
60
|
-
| Profile | Tools | Writes |
|
|
61
|
-
| --------- | --------------------------------------------------------- | ------------------------------------------- |
|
|
62
|
-
| `explore` | read
|
|
63
|
-
| `review` | same as explore | no project-file writes |
|
|
64
|
-
| `general` |
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
the
|
|
69
|
-
the
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
##
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
`
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
1
|
+
---
|
|
2
|
+
name: subagent
|
|
3
|
+
description: Delegate work to isolated child agents with the subagent tool. Jev routes each new dispatch to an execution model and individual tools from the user's configured candidate list; covers explore/review/general profiles, parallel fanout with best-effort synthesis, worktree isolation and the diff/apply/discard loop, background runs, steering, output_schema, context fork, and the Pi-only new-dispatch rule. Use when delegating exploration or implementation, running tasks in parallel, or when a subagent run needs inspecting, steering, or landing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Subagent
|
|
7
|
+
|
|
8
|
+
Delegate research, parallel exploration, and clean-context implementation to child
|
|
9
|
+
agents. Prefer `subagent` over long in-thread digressions when the work benefits
|
|
10
|
+
from isolation, parallelism, or a fresh context.
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
|
|
14
|
+
- Map a codebase area without bloating the parent context (`profile: "explore"`).
|
|
15
|
+
- Review a diff read-only (`profile: "review"`).
|
|
16
|
+
- Implement behind a worktree and land via apply (`profile: "general"`, `isolation: "worktree"`).
|
|
17
|
+
- Fan out independent questions, optionally with `synthesis` to fold results.
|
|
18
|
+
- Background long work (`async: true`) and collect later with `wait` / `subagent_wait`.
|
|
19
|
+
|
|
20
|
+
## Core calls
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
// Omit model and fallback_models. Jev selects the execution model from the
|
|
24
|
+
// user's configured candidate list and the individual tools from the locally
|
|
25
|
+
// permitted catalog. An explicit model/fallback is rejected on new work.
|
|
26
|
+
|
|
27
|
+
// Single foreground task (default profile: general)
|
|
28
|
+
{ task: "Find call sites of parseConfig", description: "Map parseConfig" }
|
|
29
|
+
|
|
30
|
+
// Parallel read-only explorers (default profile for tasks[]: explore)
|
|
31
|
+
{
|
|
32
|
+
tasks: [
|
|
33
|
+
{ task: "Map auth middleware", description: "Auth flow" },
|
|
34
|
+
{ task: "List env vars in server/", description: "Env inventory" }
|
|
35
|
+
],
|
|
36
|
+
synthesis: "Merge into one prioritized brief"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Background: notified on completion; wait/status still work
|
|
40
|
+
{ task: "Audit dependency licenses", async: true }
|
|
41
|
+
{ action: "status", id: "abc123" }
|
|
42
|
+
{ action: "wait", id: "abc123" } // interruptible; does not cancel
|
|
43
|
+
{ action: "cancel", id: "abc123" }
|
|
44
|
+
// Same wait semantics as a dedicated tool:
|
|
45
|
+
// subagent_wait { id: "abc123", timeout_ms?: number }
|
|
46
|
+
|
|
47
|
+
// Worktree loop
|
|
48
|
+
{ task: "Implement feature A", profile: "general", isolation: "worktree" }
|
|
49
|
+
{ action: "diff", id: "abc123", index: 1 }
|
|
50
|
+
{ action: "apply", id: "abc123", index: 1 }
|
|
51
|
+
{ action: "discard", id: "abc123", index: 1 }
|
|
52
|
+
|
|
53
|
+
// Dry-run validation + resolved plan (no spawn).
|
|
54
|
+
// plan calls Jev and incurs selector fees, then a later dispatch selects again.
|
|
55
|
+
{ action: "plan", tasks: [{ task: "…", isolation: "worktree" }] }
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Profiles
|
|
59
|
+
|
|
60
|
+
| Profile | Tools | Writes |
|
|
61
|
+
| --------- | --------------------------------------------------------- | ------------------------------------------- |
|
|
62
|
+
| `explore` | locally permitted read-only tools + Pi context tools | no project-file writes |
|
|
63
|
+
| `review` | same as explore | no project-file writes |
|
|
64
|
+
| `general` | Jev chooses from the full available locally permitted catalog + Pi context tools | yes if the selected tools include bash/edit/write |
|
|
65
|
+
|
|
66
|
+
Jev picks individual tool names, not a capability bundle. Candidates come from
|
|
67
|
+
the full available locally permitted catalog, not from agent `tools` defaults and
|
|
68
|
+
not from only the parent's active tools. An explicit `tools` list is a ceiling,
|
|
69
|
+
explore/review stay read-only regardless of the answer, and an empty selection
|
|
70
|
+
never means "all tools".
|
|
71
|
+
|
|
72
|
+
For Pi children, `new_context`, `get_context_remaining`, `history`, and
|
|
73
|
+
`notes` are added locally when the parent exposes them, so the selector never
|
|
74
|
+
asks about them. They are control-plane tools: they may update context
|
|
75
|
+
notes/window state, but never grant `bash`, `edit`, or `write` access. Route
|
|
76
|
+
metadata reports them as local additions.
|
|
77
|
+
|
|
78
|
+
The finalized tool subset is passed to the child as Pi's `--tools` allowlist
|
|
79
|
+
(`--no-tools` for a true empty set). Pi 0.86.0 is the verified baseline for
|
|
80
|
+
built-in, extension and late-registered tool enforcement; an unsupported host is
|
|
81
|
+
refused rather than silently weakened.
|
|
82
|
+
|
|
83
|
+
Parallel write-capable tasks sharing one checkout are rejected unless each uses
|
|
84
|
+
`isolation: "worktree"`, a distinct `cwd`, or `allow_shared_writes: true`.
|
|
85
|
+
|
|
86
|
+
## Backends
|
|
87
|
+
|
|
88
|
+
New dispatch is Pi-only. `backend: "codex"` or `backend: "claude"` on new work
|
|
89
|
+
is **refused** before any selector or provider work, including a backend
|
|
90
|
+
inherited from agent frontmatter, and is never silently switched to Pi. Existing
|
|
91
|
+
Codex/Claude runs remain manageable through `status`/`wait`/`cancel`/`steer`/
|
|
92
|
+
`diff`/`apply`/`discard`.
|
|
93
|
+
|
|
94
|
+
Another provider's execution model is still eligible through Pi when the user
|
|
95
|
+
lists it in their candidate configuration. Unsupported combinations inside the
|
|
96
|
+
Pi path are **refused**, not silently degraded:
|
|
97
|
+
|
|
98
|
+
| | pi |
|
|
99
|
+
| ------------------------ | -------------- |
|
|
100
|
+
| `max_cost` | yes (provider-reported execution only; not selector currency) |
|
|
101
|
+
| read-only profile | tool allowlist |
|
|
102
|
+
| steering / grace wrap-up | yes |
|
|
103
|
+
| `context: "fork"` | yes |
|
|
104
|
+
| `thinking` | yes |
|
|
105
|
+
| `output_schema` | yes |
|
|
106
|
+
|
|
107
|
+
## Budgets and safety
|
|
108
|
+
|
|
109
|
+
- Prefer `max_turns`, `max_cost`, and/or `timeout_ms` on long or write-capable runs.
|
|
110
|
+
`timeout_ms` is absolute: local preflight, Jev selection, setup, queue and
|
|
111
|
+
runtime all count against it.
|
|
112
|
+
- `output_schema` asks the child for a fenced `json:result` block (one repair round).
|
|
113
|
+
- `context: "fork"` continues from a fork of the parent session.
|
|
114
|
+
- Do not poll `status` in a tight loop. Use `wait` / `subagent_wait`, or let the
|
|
115
|
+
completion notification arrive for `async: true` runs.
|
|
116
|
+
- Point the user at `/subagents` for the live inspector and `/subagent-cost` for
|
|
117
|
+
the root / subagent / routing / combined ledger. Routing cost is reported as
|
|
118
|
+
unreported (tokens only, no currency).
|
|
119
|
+
|
|
120
|
+
## Routing
|
|
121
|
+
|
|
122
|
+
Omit `model` and `fallback_models` on every new call: both are legacy fields,
|
|
123
|
+
and an explicit value is rejected rather than bypassing selection. Jev chooses
|
|
124
|
+
one execution model from the user's dedicated candidate list plus an individual
|
|
125
|
+
include/exclude decision per eligible tool. The local policy then re-validates
|
|
126
|
+
the answer: unknown or unsafe tools cannot launch, explore/review stay read-only,
|
|
127
|
+
and management actions need no routing config or credential.
|
|
128
|
+
|
|
129
|
+
There are no emergency or fallback models, and low confidence is accepted rather
|
|
130
|
+
than treated as a threshold. A Jev timeout or API failure stops the affected new
|
|
131
|
+
dispatch with an actionable error; existing runs stay queryable and cancellable.
|
|
132
|
+
Transient child failures retry the already selected model and tool set within the
|
|
133
|
+
original deadline, up to `max_retries`; a quality failure never reselects.
|
|
134
|
+
|
|
135
|
+
An optional candidate `thinking` value is an opaque Pi thinking-level string;
|
|
136
|
+
common values include `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, and
|
|
137
|
+
`max`, but model-specific values are passed through unchanged. It is a default:
|
|
138
|
+
explicit task, agent, and profile `taskDefaults.thinking` values override it.
|
|
139
|
+
The extension re-reads `jevRouting` on each dispatch and injects the current
|
|
140
|
+
routing guidance into the parent prompt. If `jevRouting` is missing or invalid,
|
|
141
|
+
or the credential environment variable is unset, management remains available but
|
|
142
|
+
new spawns, `/btw`, plan, resume, fork and synthesis are rejected.
|