@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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cr1ms0n/pi-subagent",
3
- "version": "0.8.8",
4
- "description": "Community fork of Luke Parke's pi-subagent with explicit model policy and model visibility for Pi",
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",
@@ -1,121 +1,142 @@
1
- ---
2
- name: subagent
3
- description: Delegate work to isolated child agents with the subagent tool model and thinking policy, explore/review/general profiles, parallel fanout with synthesis, worktree isolation and the diff/apply/discard loop, background runs, steering, output_schema, context fork, and backend tradeoffs (pi/codex/claude). 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
- // Examples use placeholders only. Replace these with the exact model selected
24
- // from the current modelPolicy route; they do not configure a real model.
25
- const routeModel = "<exact model from current modelPolicy route>";
26
-
27
- // Single foreground task (default profile: general)
28
- { task: "Find call sites of parseConfig", description: "Map parseConfig", model: routeModel }
29
-
30
- // Parallel read-only explorers (default profile for tasks[]: explore)
31
- {
32
- tasks: [
33
- { task: "Map auth middleware", description: "Auth flow", model: routeModel },
34
- { task: "List env vars in server/", description: "Env inventory", model: routeModel }
35
- ],
36
- synthesis: "Merge into one prioritized brief"
37
- }
38
-
39
- // Background notified on completion; wait/status still work
40
- { task: "Audit dependency licenses", model: routeModel, 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", model: routeModel, 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 is a dry-run, but every task still needs the policy-routed model.
55
- { action: "plan", tasks: [{ task: "…", model: routeModel, isolation: "worktree" }] }
56
- ```
57
-
58
- ## Profiles
59
-
60
- | Profile | Tools | Writes |
61
- | --------- | --------------------------------------------------------- | ------------------------------------------- |
62
- | `explore` | read/search/ls (+safe) + allowlisted context tools | no project-file writes |
63
- | `review` | same as explore | no project-file writes |
64
- | `general` | inherited active tools + allowlisted context tools | yes if tools include bash/edit/write |
65
-
66
- For Pi children, `new_context`, `get_context_remaining`, `history`, and
67
- `notes` are control-plane tools. They are kept in the child allowlist only when
68
- the target model exactly matches a `compaction.gatewayContextModels` entry in
69
- the Remote Context toolkit config
70
- (`$PI_CODING_AGENT_DIR/extensions/pi-openai-toolkit/config.json`, default:
71
- `~/.pi/agent/extensions/pi-openai-toolkit/config.json`, with
72
- `contextManagement: "remote"`), and only when the parent exposes them. For an
73
- eligible target they stay even if a narrower tool list was requested; for any
74
- other Pi target they are dropped from inherited tools, never passed to
75
- `--tools`, and an explicit request for one is rejected as unavailable. Fallback
76
- attempts are filtered per attempt. Missing/unreadable/invalid/disabled toolkit
77
- configuration means no context tools at all. They may update context
78
- notes/window state, but never grant `bash`, `edit`, or `write` access.
79
-
80
- Parallel write-capable tasks sharing one checkout are rejected unless each uses
81
- `isolation: "worktree"`, a distinct `cwd`, or `allow_shared_writes: true`.
82
-
83
- ## Backends
84
-
85
- `backend: "pi" | "codex" | "claude"` (default `pi`). Unsupported combinations are
86
- **refused**, not silently degraded:
87
-
88
- | | pi | codex | claude |
89
- | ------------------------ | -------------- | ---------------------- | -------------- |
90
- | `max_cost` | yes | refused (tokens only) | yes |
91
- | read-only profile | tool allowlist | OS sandbox | tool allowlist |
92
- | steering / grace wrap-up | yes | no | no |
93
- | `context: "fork"` | yes | refused | yes |
94
- | `thinking` | yes | no | no |
95
- | `output_schema` | yes | yes | yes |
96
-
97
- ## Budgets and safety
98
-
99
- - Prefer `max_turns`, `max_cost`, and/or `timeout_ms` on long or write-capable runs.
100
- - `output_schema` asks the child for a fenced `json:result` block (one repair round).
101
- - `context: "fork"` continues from a fork of the parent session (pi/claude).
102
- - Do not poll `status` in a tight loop — use `wait` / `subagent_wait`, or let the
103
- completion notification arrive for `async: true` runs.
104
- - Point the user at `/subagents` for the live inspector and `/subagent-cost` for
105
- the root / subagent / combined ledger.
106
-
107
- ## Model policy
108
-
109
- Every new task must pass a `model` that exactly matches the current
110
- `modelPolicy` mapping in `~/.pi/subagent.json`; agent frontmatter,
111
- `taskDefaults.model`, and parent-session model inheritance are ignored. An
112
- agent route replaces the default route, and configured fallback order is
113
- immutable. Omit `fallback_models` to use the route; if supplied, it must match
114
- exactly. An optional route `thinking` value is an opaque Pi thinking-level
115
- string; common values include `off`, `minimal`, `low`, `medium`, `high`, `xhigh`,
116
- and `max`, but model-specific values are passed through unchanged. It is a
117
- default; explicit task, agent, and profile `taskDefaults.thinking` values
118
- override it. Management actions do not require model. The extension re-reads
119
- this policy on each dispatch and injects it into
120
- the parent prompt. If the policy is missing or invalid, management remains
121
- available but new spawns and synthesis are rejected.
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.