@d3ara1n/pi-subagent 1.3.0 → 1.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/spawn.ts +27 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d3ara1n/pi-subagent",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "description": "Role-based subagent orchestration for pi — delegates tasks to specialized pi child processes with configurable model roles",
6
6
  "main": "src/index.ts",
package/src/spawn.ts CHANGED
@@ -231,6 +231,33 @@ export async function spawnSubagent(
231
231
  "--append-system-prompt",
232
232
  `<subagent_env>\nPI_SUBAGENT_TMPDIR=${tmpDir}\nAvailable as $PI_SUBAGENT_TMPDIR in bash. Use for git clone and scratch files.\n</subagent_env>`,
233
233
  );
234
+ // Shared behavioral policy for EVERY subagent run — built-in roles and
235
+ // agentOverrides customs alike. Role prompts (roles.ts) shape WHAT a role
236
+ // does; this shapes HOW any subagent behaves when the task exceeds its
237
+ // actual capabilities: report the gap and stop instead of improvising
238
+ // workarounds until timeout.
239
+ args.push(
240
+ "--append-system-prompt",
241
+ [
242
+ "<subagent_policy>",
243
+ "Before attempting the task, check it against your actual capabilities in this",
244
+ "session — the tool list here is definitive.",
245
+ "- If the task needs a capability you do not have (web access, bash, file",
246
+ " writes, ...) or material that is not present locally or in the provided",
247
+ " context/files, it is out of scope for you. Do NOT improvise workarounds.",
248
+ '- "Cannot complete" means a capability or material gap — not "difficult" or',
249
+ ' "uncertain". If it is merely hard, keep working within your tools.',
250
+ "- When you hit a genuine gap, stop early and return:",
251
+ " ## Cannot complete",
252
+ " - Missing: the capability or material that is absent",
253
+ " - Needed: what would complete the task",
254
+ " - Found: partial findings so far (optional)",
255
+ "",
256
+ 'An early "cannot complete" report is a successful outcome; grinding on',
257
+ "impossible workarounds until timeout is the failure.",
258
+ "</subagent_policy>",
259
+ ].join("\n"),
260
+ );
234
261
 
235
262
  // ── Context channel: independent size gate ──
236
263
  // Large context spills to @ctx.md (pi auto-wraps in <file>); small context