@leo-alvarenga/pi-mini-subagents 0.3.0 → 0.4.2

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 +2 -2
  2. package/src/config.ts +30 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leo-alvarenga/pi-mini-subagents",
3
- "version": "0.3.0",
3
+ "version": "0.4.2",
4
4
  "description": "Transient subagents for Pi: mini_subagent tool (single + parallel), /subagents command, and a live TUI panel",
5
5
  "license": "MIT",
6
6
  "repository": "github.com/leo-alvarenga/pi-mono",
@@ -27,7 +27,7 @@
27
27
  "typebox": "*"
28
28
  },
29
29
  "dependencies": {
30
- "@leo-alvarenga/pi-ext-core": "0.5.3"
30
+ "@leo-alvarenga/pi-ext-core": "0.6.1"
31
31
  },
32
32
  "pi": {
33
33
  "extensions": [
package/src/config.ts CHANGED
@@ -39,15 +39,26 @@ function getStyledSubagent(r: SubagentRecord, th: Theme): string {
39
39
  return line;
40
40
  }
41
41
 
42
+ const SUBAGENTS_TOOL: SubagentSpec["tool"] = {
43
+ name: "mini_subagents",
44
+ label: "Mini Subagents",
45
+ description:
46
+ "Delegate a task to a transient headless subagent (a separate pi process) and get its findings back. " +
47
+ "Modes: single (task) or parallel (tasks array, max 8). Subagents are read-only by default; set allowWrite to let one edit files. " +
48
+ "If a subagent reports it needs input (NEEDS_INPUT), answer the questions and call again with `answers`.",
49
+ };
50
+
51
+ const SUBAGENTS_LIMITS: SubagentSpec["limits"] = {
52
+ maxPanelRows: MAX_PANEL_ROWS,
53
+ maxConcurrency: MAX_CONCURRENCY,
54
+ maxStoredOutput: MAX_STORED_OUTPUT,
55
+ maxParallelTasks: MAX_PARALLEL_TASKS,
56
+ perTaskOutputCap: PER_TASK_OUTPUT_CAP,
57
+ maxWritesPerSubagent: MAX_WRITES_PER_SUBAGENT,
58
+ };
59
+
42
60
  export const SUBAGENTS_SPEC: SubagentSpec = {
43
- tool: {
44
- name: "mini_subagents",
45
- label: "Mini Subagents",
46
- description:
47
- "Delegate a task to a transient headless subagent (a separate pi process) and get its findings back. " +
48
- "Modes: single (task) or parallel (tasks array, max 8). Subagents are read-only by default; set allowWrite to let one edit files. " +
49
- "If a subagent reports it needs input (NEEDS_INPUT), answer the questions and call again with `answers`.",
50
- },
61
+ tool: SUBAGENTS_TOOL,
51
62
 
52
63
  spawn: {
53
64
  flagEnv: "PI_SUBAGENT",
@@ -60,6 +71,16 @@ export const SUBAGENTS_SPEC: SubagentSpec = {
60
71
  "Subagents are read-only unless you set allowWrite: true.",
61
72
  "If a result asks for input, answer the questions (ask the user if needed) and re-call with `answers` — do not guess.",
62
73
  "For any task requiring parallel execution or medium to large data gathering: delegate to a subagent, instruct it to use those tools, and get only the report back — never let batch/multi-output tools run directly in your session.",
74
+
75
+ "## Orchestrator Rules of Engagement",
76
+ "You are an orchestrator of subagents. Spawning subagents is almost always the right and laziest move.",
77
+ "Your go to move should be to delegate work to subagents, unless you have a compelling reason not to OR you are not sure the current work would benefit from parellelization.",
78
+ `Additionally, if the prompt includes keywords like "plan", "refactor", "explore", "review", "scout", or "audit", you should always delegate work to subagents.`,
79
+ `CODEBASE EXPLORATION: Default to spawning read-only subagents via ${SUBAGENTS_TOOL.name} for searches, greps, and multi-file analysis to prevent context window pollution.`,
80
+ "\tThis also includes scenarios where you want to understand the codebase, even if you don't need/want to read it to its full extent",
81
+ "WRITE PLANNING: When making changes across 4 or more files, write a concise execution plan first.",
82
+ `PARALLEL DELEGATION: Delegate file modifications evenly to write-enabled subagents (allowWrite: true). Limit each subagent to a maximum of ${SUBAGENTS_LIMITS.maxWritesPerSubagent} target files per invocation.`,
83
+ `TOOL HIERARCHY: ${SUBAGENTS_TOOL.name} supersedes any tool that produces large output, runs commands in parallel, or aggregates data from multiple sources. Those tools flood raw output directly into context; a subagent isolates it entirely and returns only findings. The rule: whenever you would reach for a parallel, batch, or multi-output tool — delegate via ${SUBAGENTS_TOOL.name} instead, instructing the subagent to use that tool inside its own session. You receive the report; the noise stays in the subagent. This applies regardless of what tools or extensions are active in this session.`,
63
84
  ],
64
85
  instructions: {
65
86
  always: "You are a transient subagent. Complete the task, then stop",
@@ -76,22 +97,11 @@ export const SUBAGENTS_SPEC: SubagentSpec = {
76
97
  },
77
98
  },
78
99
 
79
- endorsement: {
80
- enabled: true,
81
- },
82
-
83
100
  orchestratorMode: {
84
101
  enabled: true,
85
102
  },
86
103
 
87
- limits: {
88
- maxPanelRows: MAX_PANEL_ROWS,
89
- maxConcurrency: MAX_CONCURRENCY,
90
- maxStoredOutput: MAX_STORED_OUTPUT,
91
- maxParallelTasks: MAX_PARALLEL_TASKS,
92
- perTaskOutputCap: PER_TASK_OUTPUT_CAP,
93
- maxWritesPerSubagent: MAX_WRITES_PER_SUBAGENT,
94
- },
104
+ limits: SUBAGENTS_LIMITS,
95
105
 
96
106
  entries: {
97
107
  state: STATE_ENTRY,