@xynogen/pix-skills 0.4.15 → 0.4.17

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/skills/subagent.md +114 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-skills",
3
- "version": "0.4.15",
3
+ "version": "0.4.17",
4
4
  "description": "Pi extension — agent skill loader (skill tool + skills bundle)",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -8,8 +8,16 @@ description: Plan a task, break it into small independent units, and fan them ou
8
8
  Plan first, decompose into small independent units, then fan those units out to
9
9
  **cheaper** subagent models running **in parallel**. A capable orchestrator (you)
10
10
  keeps the plan, the decisions, and the final integration. Cheap workers do the
11
- bulk grunt work concurrently. Net effect: faster wall-clock, lower cost, less of
12
- the expensive model's tokens spent on mechanical work.
11
+ bulk grunt work concurrently.
12
+
13
+ **The real trade is not intelligence for speed — it is spending *less of* the
14
+ orchestrator's intelligence.** The strong model's context window and attention
15
+ are the scarce resource. Every mechanical unit it does itself burns that finite
16
+ budget on work that does not need it. Offloading those units to cheap workers
17
+ keeps the smart model's context clean and reserved for the hard 10% — the plan,
18
+ the seams, the integration. Faster wall-clock and lower cost are byproducts; the
19
+ point is preserving the expensive model's intelligence for where it actually
20
+ matters.
13
21
 
14
22
  This skill is for the **parent orchestrator only**. Children receive concrete,
15
23
  self-contained tasks — they do not plan, do not decompose further, and do not
@@ -52,11 +60,11 @@ exact file paths, the shared contracts (types, function signatures, interfaces),
52
60
  the naming, and the acceptance criteria **before** splitting. The whole point is
53
61
  that workers inherit decisions instead of inventing them.
54
62
 
55
- For large/complex tasks, delegate planning to the builtin `planner` first, get
63
+ For large/complex tasks, delegate planning to the builtin `Plan` agent first, get
56
64
  the plan, then decompose it:
57
65
 
58
66
  ```typescript
59
- subagent({ agent: "planner", task: "Plan: <task>. Emphasize independent, parallelizable units." })
67
+ subagent({ subagent_type: "Plan", prompt: "Plan: <task>. Emphasize independent, parallelizable units." })
60
68
  ```
61
69
 
62
70
  ### 2. Decompose
@@ -73,12 +81,50 @@ Split the plan into units that satisfy the independence test:
73
81
  If a unit fails the test, either merge it back, sequence it (chain), or keep it
74
82
  on the orchestrator.
75
83
 
84
+ > **Delegating ≠ branching.** A foreground/blocking subagent call where the
85
+ > parent waits for the result before launching the next is *serial delegation* —
86
+ > it only buys context isolation, **zero wall-clock gain**. The whole point of
87
+ > this skill is branching: all independent units must be launched **together in
88
+ > one fan-out** (`tasks:[...]` with `async: true`, or N background launches in a
89
+ > single turn) so they run concurrently. If you spawn one, wait, spawn the next,
90
+ > you are not using the power of subagents — you are just relaying work serially.
91
+ > Splitting a *dependency chain* into separate agents wins nothing either: they
92
+ > serialize on each other's data. Branch only truly-independent units.
93
+
76
94
  ### 3. Fan out to cheap models
77
95
 
78
96
  Use top-level parallel tasks with a per-task `model` override pointing at a
79
97
  cheaper/smaller model.
80
98
 
81
- **Resolve the cheap model at call time — never hardcode it.** The active model is
99
+ > **Delegating ≠ branching — serial fan-out is pure loss.** A foreground/blocking
100
+ > subagent call where the parent waits for one result before launching the next
101
+ > is *serial delegation*, and it is **strictly worse than doing the work
102
+ > yourself**. The orchestrator stays tied up relaying the unit — so its scarce
103
+ > context/attention was spent anyway — *and* the unit ran on a weaker model. You
104
+ > traded the strong model's intelligence away and got nothing back, not even less
105
+ > of it spent. The only thing serial delegation buys is context isolation, which
106
+ > rarely justifies the quality hit.
107
+ >
108
+ > The entire value of this skill is **branching**: launch every independent unit
109
+ > **together in one fan-out** (`tasks:[...]` with `async: true`, or N background
110
+ > launches in a single turn) so they run concurrently. Concurrency is what makes
111
+ > the trade pay — N units of mechanical work leave the orchestrator's context at
112
+ > once, freeing its budget for the hard parts. Remove the parallelism and you
113
+ > keep none of that upside, only the downside.
114
+ >
115
+ > Corollary: splitting a *dependency chain* into separate agents wins nothing
116
+ > either — the units serialize on each other's data, collapsing back to serial.
117
+ > Branch **only** truly-independent units; if you cannot fan them out
118
+ > concurrently, keep the work on the orchestrator instead of delegating it.
119
+
120
+ **Type and model are orthogonal — set both, every time.** `subagent_type` (the
121
+ agent type) picks the tool allowlist and persona: `Explore` for read-only search,
122
+ `Plan` for read-only architecture, `general-purpose` for full-toolset work. It
123
+ does **not** pick the model. The model is always yours to choose per call via
124
+ `model:`. A read-only `Explore` worker is not automatically cheap — you make it
125
+ cheap by passing a cheap-tier model.
126
+
127
+ Resolve that model at call time — never hardcode it. The active model is
82
128
  dynamic: the user can switch it mid-chat, and the orchestrator's own model is
83
129
  whatever is current. So before fanning out:
84
130
 
@@ -89,9 +135,10 @@ whatever is current. So before fanning out:
89
135
  rather than guessing — the wrong pick wastes the run.
90
136
 
91
137
  The per-task `model` override is the right mechanism precisely because the main
92
- model can change: the override pins each worker to the chosen cheap model
93
- regardless of what the orchestrator is running at that moment. Examples below use
94
- `<cheap-model>` as a placeholder — substitute the resolved model.
138
+ model can change: the override pins each worker to the chosen model regardless
139
+ of what the orchestrator is running at that moment. Examples below use
140
+ `<cheap-model>` as a placeholder — substitute the resolved model. Omit `model:`
141
+ only when you deliberately want the worker to inherit the parent's model.
95
142
 
96
143
  ```typescript
97
144
  subagent({
@@ -185,6 +232,65 @@ Task: "Add the same new field + validation to 6 independent API handlers."
185
232
  across all 6, dedupes if they each inlined it.
186
233
  5. **Verify** — full test suite; fix any handler that drifted from the contract.
187
234
 
235
+ ## Common pitfalls
236
+
237
+ Five failure modes that look like optimizations but cost you. The meta-pattern
238
+ across all of them: **mechanical wins (faster, cheaper, parallel) only pay when
239
+ the underlying semantic is right.** Optimize the form and you lose the meaning.
240
+
241
+ ### 1. Serial delegation
242
+
243
+ Spawn one subagent, wait for the result, then spawn the next. The parent stays
244
+ tied up relaying the unit the whole time, so its scarce context/attention was
245
+ spent anyway — *and* the unit ran on a weaker model. You traded the strong
246
+ model's intelligence away and got nothing back, not even less of it spent. The
247
+ only thing serial delegation buys is context isolation, which rarely justifies
248
+ the quality hit. **When it's actually OK:** the unit is genuinely heavy (huge
249
+ file dump, web crawl, massive tool loop) and you need the context back before
250
+ the next step can even be planned. Rare. Otherwise: branch, don't relay.
251
+
252
+ ### 2. Dependency chains
253
+
254
+ B needs A's output, so you spawn A, wait, spawn B. The units serialize on each
255
+ other's data, collapsing back to serial. Two spawns' wall-clock with two
256
+ spawns' quality cost, no parallelism was ever possible. **Fix:** chain them
257
+ *inside one* subagent (let it do B after A) or do A→B yourself on the
258
+ orchestrator. Don't fan out a chain.
259
+
260
+ ### 3. Vague prompts
261
+
262
+ "Look at the auth flow and tell me what's wrong." The child has no memory of
263
+ your conversation. It doesn't know which auth flow, what you already tried,
264
+ what "wrong" means in your context, or what shape of answer you want. It
265
+ guesses, and you pay twice — once to spawn, once to re-spawn with a better
266
+ spec. **Fix:** write prompts like you're briefing a smart colleague who just
267
+ walked in cold. Include file paths, line numbers, the shared contract, the
268
+ expected output shape, how to validate locally. The cheap-worker prompt
269
+ contract above (goal / contract / constraints / validation / output) is the
270
+ minimum — more spec, not less, when the model is smaller.
271
+
272
+ ### 4. Trusting the summary blindly
273
+
274
+ The child returns "done, I fixed the bug." You mark the task done. The
275
+ child's summary describes what it *intended*, not what it *did*. For read-only
276
+ lookups that's fine. For write operations — edits, file creates, command runs
277
+ — the only verification is reading the actual diff. **Fix:** for any subagent
278
+ that wrote or edited, check the diff before reporting work as complete. A
279
+ subagent's "done" is a claim, not a fact.
280
+
281
+ ### 5. Type/model coupling
282
+
283
+ The agent *type* (Explore, Plan, general-purpose) implies a *model* — usually
284
+ baked into the type's default config. A caller's explicit `model:` gets
285
+ silently discarded because the type's default wins. The parent LLM was told
286
+ "pick a cheap model per call" but the code says "no you can't." The
287
+ principle — **type and model are orthogonal, the caller owns the model** —
288
+ is violated by the implementation, not just unenforced. **Fix:** types set
289
+ tool allowlist + persona only. Model is always caller-decided via `model:`.
290
+ A read-only `Explore` worker is not automatically cheap — you make it cheap
291
+ by passing a cheap-tier model. If you find yourself unable to override a
292
+ type's model, that's a bug in the precedence, not a feature of the type.
293
+
188
294
  ## Cost / efficiency notes
189
295
 
190
296
  - The win is **decomposition quality**, not raw parallelism. Bad splits create