@dreki-gg/pi-subagent 0.8.0 → 0.8.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.
@@ -1,199 +0,0 @@
1
- ---
2
- name: "Parallel recon, single-writer docs refresh"
3
- overview: "Document `@dreki-gg/pi-subagent` as an opinionated orchestration tool for parallel reconnaissance, planning, and review around a single writer. This slice updates the package docs and skill guidance without introducing new runtime behavior."
4
- todo:
5
- - id: "docs-refresh-1"
6
- task: "Add a package-local orchestration principles doc that explains when to use single, parallel, and chain modes—and when not to"
7
- status: done
8
- - id: "docs-refresh-2"
9
- task: "Update the package README so one-writer guidance appears near the top instead of being implied"
10
- status: done
11
- - id: "docs-refresh-3"
12
- task: "Tighten the spawn-subagents skill and bundled prompt descriptions so they consistently recommend parallel recon, not parallel conflicting edits"
13
- status: done
14
- ---
15
-
16
- # Goal
17
-
18
- Make the package documentation explicitly teach the operating model we want users and orchestrating agents to follow: parallelize discovery and verification, keep writes coherent, and use fresh-context reviewers instead of swarms of editors.
19
-
20
- # Context
21
-
22
- - Parent rationale: the current package direction is already mostly right; the docs should make that philosophy unmistakable.
23
- - Module root: `packages/subagent`
24
- - This is a docs-and-guidance slice. It should not depend on runtime changes landing first.
25
- - Prefer package-local docs because the repo already stores package-specific plans under package-local `docs/` trees (for example `packages/browser-tools/docs/plans/`).
26
-
27
- ## What exists
28
-
29
- Current relevant file tree on disk:
30
-
31
- - `packages/subagent/README.md`
32
- - `packages/subagent/skills/spawn-subagents/SKILL.md`
33
- - `packages/subagent/prompts/implement.md`
34
- - `packages/subagent/prompts/scout-and-plan.md`
35
- - `packages/subagent/prompts/implement-and-review.md`
36
- - `packages/subagent/prompts/scout.md`
37
- - `packages/subagent/prompts/planner.md`
38
- - `packages/subagent/prompts/reviewer.md`
39
- - `packages/subagent/prompts/worker.md`
40
- - `packages/subagent/package.json`
41
- - `packages/subagent/CHANGELOG.md`
42
-
43
- Actual current state on disk:
44
-
45
- - `packages/subagent/README.md` explains the three tool modes and the bundled agents, but it does not prominently state a philosophy like “parallel readers, single writer” or “use review loops over swarms.” The first sections are mode descriptions and examples (`README.md:11-45`).
46
- - The README does list examples that already imply sensible usage—scout, planner, worker, reviewer—but it stops short of explicitly warning against conflicting parallel edits (`README.md:21-45`).
47
- - The `spawn-subagents` skill is already the clearest articulation of current best practice:
48
- - `Single specialist` (`SKILL.md:23-29`)
49
- - `Parallel recon` (`SKILL.md:31-35`)
50
- - `Plan then implement` (`SKILL.md:37-42`)
51
- - `Review loop` (`SKILL.md:44-47`)
52
- - execution rules that say “Parallelize reconnaissance, not conflicting edits” and “Prefer one worker unless file ownership is clearly partitioned” (`SKILL.md:49-53`)
53
- - The prompt templates are short and functional, but their descriptions do not advertise the package’s opinionated orchestration stance:
54
- - `/implement` is “Full implementation workflow” (`packages/subagent/prompts/implement.md:1-10`)
55
- - `/scout-and-plan` is “Scout gathers context, planner creates implementation plan” (`packages/subagent/prompts/scout-and-plan.md:1-9`)
56
- - `/implement-and-review` is “Worker implements, reviewer reviews, worker applies feedback” (`packages/subagent/prompts/implement-and-review.md:1-10`)
57
- - There is currently no `packages/subagent/docs/` directory other than the plans we are now adding.
58
-
59
- # API inventory
60
-
61
- ## User-facing package surface documented today
62
-
63
- From `packages/subagent/README.md`:
64
-
65
- ```md
66
- ## Subagent Tool
67
-
68
- The `subagent` tool supports three modes:
69
-
70
- | Mode | Description |
71
- | Single | `{ agent, task }` — one agent, one task |
72
- | Parallel | `{ tasks: [...] }` — multiple agents concurrently |
73
- | Chain | `{ chain: [...] }` — sequential with `{previous}` placeholder |
74
- ```
75
-
76
- ```md
77
- ### Bundled Agents
78
- - `scout` — fast codebase recon
79
- - `docs-scout` — Context7-first documentation lookup
80
- - `planner` — implementation planning
81
- - `worker` — general-purpose implementation (`sessionStrategy: fork-at` by default)
82
- - `reviewer` — code review (`sessionStrategy: fork-at` by default)
83
- - `ux-designer` — frontend UI design
84
- ```
85
-
86
- ## Current skill guidance to preserve and elevate
87
-
88
- From `packages/subagent/skills/spawn-subagents/SKILL.md`:
89
-
90
- ```md
91
- ## 2. Parallel recon
92
- - Run `scout` + `docs-scout` in parallel when both code and docs matter.
93
- - Keep parallel tasks non-overlapping.
94
- - Return a compact synthesis to the main thread.
95
-
96
- Execution rules:
97
- - Parallelize reconnaissance, not conflicting edits.
98
- - Prefer one `worker` unless file ownership is clearly partitioned.
99
- - Use `docs-scout` when external library/framework details matter.
100
- - Pass previous outputs verbatim or as a tight structured summary.
101
- ```
102
-
103
- These lines are the core behavioral contract the docs refresh should reinforce.
104
-
105
- # Tasks
106
-
107
- ## 1. Add a package-local orchestration principles doc
108
-
109
- ### Files
110
- - Create `packages/subagent/docs/orchestration-principles.md`
111
-
112
- ### What to add
113
- Create a short, high-signal doc that explains the intended operating model of `@dreki-gg/pi-subagent`.
114
-
115
- ### Required sections
116
- - `## Default philosophy`
117
- - single writer, many thinkers
118
- - parallel recon yes / conflicting edits no
119
- - `## When to use each mode`
120
- - `single`
121
- - `parallel`
122
- - `chain`
123
- - `## Recommended workflows`
124
- - scout → planner → worker
125
- - worker → reviewer → worker
126
- - scout + docs-scout in parallel
127
- - `## Non-goals`
128
- - arbitrary swarms
129
- - multi-writer editing without clear ownership
130
- - using subagents as a substitute for coherent architecture decisions
131
- - `## Examples`
132
- - concise examples mirroring current prompt templates and skill guidance
133
-
134
- ### Notes
135
- - Keep it grounded in features that exist today.
136
- - Do not document manager/advisor agents here unless they actually ship before this slice lands.
137
-
138
- ## 2. Update the package README so one-writer guidance appears near the top
139
-
140
- ### Files
141
- - Modify `packages/subagent/README.md`
142
-
143
- ### What to change
144
- - Add an “Opinionated defaults” or “How to think about this package” section immediately after the mode table.
145
- - Make these points explicit:
146
- - `parallel` is best for scouts and other read-only discovery agents
147
- - `chain` is best when a single writer needs planned, sequential help
148
- - `reviewer` is a verifier, not a second writer
149
- - default safe pattern is one writer unless file ownership is clearly partitioned
150
- - Keep existing install/use examples, but rewrite at least one example block to show the philosophy in practice.
151
-
152
- ### Suggested wording targets
153
- - “Use parallel mode for discovery, not competing edits.”
154
- - “Prefer one worker and surround it with scouts, planners, and reviewers.”
155
- - “Use review loops to inject fresh context before a human or main agent reads the result.”
156
-
157
- ## 3. Tighten the `spawn-subagents` skill and prompt descriptions
158
-
159
- ### Files
160
- - Modify `packages/subagent/skills/spawn-subagents/SKILL.md`
161
- - Modify `packages/subagent/prompts/implement.md`
162
- - Modify `packages/subagent/prompts/scout-and-plan.md`
163
- - Modify `packages/subagent/prompts/implement-and-review.md`
164
-
165
- ### What to change
166
- - Keep the skill concise, but move the “parallel recon, not conflicting edits” principle earlier or phrase it more strongly.
167
- - Make the prompt descriptions more self-explanatory:
168
- - `/implement` should read as a safe sequential workflow around one implementing agent.
169
- - `/scout-and-plan` should read as a recon + planning workflow, not a half-implemented swarm.
170
- - `/implement-and-review` should read as a generator-verifier loop.
171
- - If any prompt template still implies that `{previous}` is just an unbounded transcript, rewrite the wording to say “handoff” / “summary” instead.
172
-
173
- # Files to create
174
-
175
- - `packages/subagent/docs/orchestration-principles.md`
176
-
177
- # Files to modify
178
-
179
- - `packages/subagent/README.md` — make package philosophy explicit near the top
180
- - `packages/subagent/skills/spawn-subagents/SKILL.md` — strengthen the opinionated orchestration guidance
181
- - `packages/subagent/prompts/implement.md` — clarify this is a sequential one-writer workflow
182
- - `packages/subagent/prompts/scout-and-plan.md` — clarify this is recon + planning, not implementation
183
- - `packages/subagent/prompts/implement-and-review.md` — describe the workflow as a generator-verifier loop
184
-
185
- # Testing notes
186
-
187
- - This slice is markdown-only unless you also tweak package metadata, so there is no TypeScript typecheck requirement.
188
- - Manually read the final README and skill files in one pass to make sure they do not contradict each other.
189
- - Keep examples aligned with currently shipped agents and prompts.
190
- - If a later feature slice adds manager/advisor agents before this one lands, update the new principles doc in the same branch rather than documenting speculative agents now.
191
-
192
- # Patterns to follow
193
-
194
- - `packages/subagent/skills/spawn-subagents/SKILL.md:21-58` — current best articulation of package operating rules
195
- - `packages/subagent/README.md:11-45` — current package intro to improve, not replace wholesale
196
- - `packages/subagent/prompts/implement.md:1-10` — terse prompt-template style to preserve
197
- - `packages/subagent/prompts/scout-and-plan.md:1-9` — terse prompt-template style to preserve
198
- - `packages/subagent/prompts/implement-and-review.md:1-10` — terse prompt-template style to preserve
199
- - `packages/browser-tools/docs/plans/*.plan.md` — package-local docs/plans organization pattern already used elsewhere in the repo
@@ -1,248 +0,0 @@
1
- ---
2
- name: "Manager workflow for multi-slice delegation"
3
- overview: "Add a bundled `manager` role and a reusable manager workflow so `@dreki-gg/pi-subagent` can coordinate larger, multi-slice tasks without turning into an unstructured swarm. The manager should split work, delegate bounded child tasks, synthesize discoveries, and keep writes coherent."
4
- todo:
5
- - id: "manager-workflow-1"
6
- task: "Add a bundled `manager` agent with a narrow orchestration role, explicit child-report contract, and no multi-writer default"
7
- status: pending
8
- - id: "manager-workflow-2"
9
- task: "Add a bundled prompt template that invokes the manager for larger features or migrations"
10
- status: pending
11
- - id: "manager-workflow-3"
12
- task: "Expose the new manager role in package docs and examples without overpromising unstructured swarm behavior"
13
- status: pending
14
- ---
15
-
16
- # Goal
17
-
18
- Introduce a first-class manager workflow that can decompose larger tasks into bounded child-agent workstreams, synthesize the results, and keep decision-making coherent.
19
-
20
- # Context
21
-
22
- - Parent rationale: the package already has strong primitives (`single`, `parallel`, `chain`), but not a clear higher-level delegation pattern for “a feature spanning several slices” or “a migration with multiple child tasks.”
23
- - Module root: `packages/subagent`
24
- - This slice should stay opinionated: map / reduce / manage, not arbitrary peer-to-peer swarms.
25
- - The manager should be useful even if no new runtime code is added. Prefer prompt + workflow packaging first.
26
-
27
- ## What exists
28
-
29
- Current relevant file tree on disk:
30
-
31
- - `packages/subagent/prompts/scout.md`
32
- - `packages/subagent/prompts/docs-scout.md`
33
- - `packages/subagent/prompts/planner.md`
34
- - `packages/subagent/prompts/worker.md`
35
- - `packages/subagent/prompts/reviewer.md`
36
- - `packages/subagent/prompts/implement.md`
37
- - `packages/subagent/prompts/scout-and-plan.md`
38
- - `packages/subagent/prompts/implement-and-review.md`
39
- - `packages/subagent/README.md`
40
- - `packages/subagent/extensions/subagent/index.ts`
41
- - `packages/subagent/extensions/subagent/agent-runner.ts`
42
- - `packages/subagent/extensions/subagent/agents.ts`
43
- - `packages/subagent/skills/spawn-subagents/SKILL.md`
44
- - `packages/subagent/skills/write-an-agent/SKILL.md`
45
-
46
- Actual current state on disk:
47
-
48
- - The package ships six bundled agents today: `scout`, `docs-scout`, `planner`, `worker`, `reviewer`, and `ux-designer` (`packages/subagent/README.md:88-105`). There is no `manager` agent.
49
- - The package ships three prompt templates today: `/implement`, `/scout-and-plan`, and `/implement-and-review` (`README.md:121-124`). There is no manager-oriented workflow prompt.
50
- - The `subagent` tool supports only three orchestration modes:
51
- - single
52
- - parallel
53
- - chain
54
- (`packages/subagent/extensions/subagent/index.ts:584-595` and `README.md:13-20`)
55
- - Parallel mode is already bounded and intentionally limited:
56
- - max 8 tasks (`index.ts:50`, `:728-738`)
57
- - max concurrency 4 (`index.ts:51`, `:780-805`)
58
- - The `spawn-subagents` skill already encodes the package’s desired shape:
59
- - parallel recon
60
- - plan then implement
61
- - review loop
62
- - “Parallelize reconnaissance, not conflicting edits” (`SKILL.md:31-58`)
63
- But there is no equivalent section for higher-level “manager delegates to children, then synthesizes.”
64
- - The current agent runner logic is already compatible with a manager-style agent:
65
- - `runSingleAgent()` in `index.ts:325-328` only passes `--tools` when the agent frontmatter declares a tool list.
66
- - `runAgent()` in `agent-runner.ts:73-76` behaves the same way.
67
- - This means a new `manager` agent can omit `tools:` in frontmatter if it needs access to the full tool set, including the `subagent` tool itself.
68
- - There is no project-local `.pi/prompts/*.md` manager override in this repo right now; `.pi/prompts/` exists but is empty.
69
-
70
- # API inventory
71
-
72
- ## Existing agent frontmatter model
73
-
74
- From `packages/subagent/extensions/subagent/agents.ts`:
75
-
76
- ```ts
77
- export interface AgentConfig {
78
- name: string;
79
- description: string;
80
- tools?: string[];
81
- model?: string;
82
- thinking?: string;
83
- sessionStrategy?: 'inline' | 'fork-at';
84
- systemPrompt: string;
85
- source: 'bundled' | 'user' | 'project' | 'package';
86
- filePath: string;
87
- }
88
- ```
89
-
90
- From `packages/subagent/README.md`:
91
-
92
- ```md
93
- ---
94
- name: my-agent
95
- description: What this agent does
96
- tools: read, grep, find, ls
97
- model: anthropic/claude-haiku-4-5
98
- sessionStrategy: fork-at
99
- ---
100
- ```
101
-
102
- ## Existing subagent tool modes the manager will likely use
103
-
104
- From `packages/subagent/README.md` and `packages/subagent/extensions/subagent/index.ts`:
105
-
106
- ```ts
107
- // Single
108
- { agent, task }
109
-
110
- // Parallel
111
- { tasks: [{ agent, task }, ...] }
112
-
113
- // Chain
114
- { chain: [{ agent, task }, ...] }
115
- ```
116
-
117
- ## Existing agent roles the manager should compose, not replace
118
-
119
- - `scout` — repo reconnaissance
120
- - `docs-scout` — docs lookup
121
- - `planner` — implementation planning
122
- - `worker` — implementation
123
- - `reviewer` — verification
124
-
125
- The manager should orchestrate these roles, not absorb them.
126
-
127
- ## Proposed manager output contract
128
-
129
- Create a prompt contract that is directly usable by the main agent or a human:
130
-
131
- ```md
132
- ## Goal
133
- - one-sentence statement of the parent task
134
-
135
- ## Workstreams
136
- 1. Workstream name — owner agent, scope, expected output
137
- 2. ...
138
-
139
- ## Shared Decisions
140
- - constraints all children must follow
141
-
142
- ## Child Reports
143
- ### <workstream>
144
- - what was learned / produced
145
- - files implicated
146
- - blockers or open questions
147
-
148
- ## Recommended Next Action
149
- - whether to run worker, reviewer, or ask the human
150
- ```
151
-
152
- # Tasks
153
-
154
- ## 1. Add a bundled `manager` agent with a narrow orchestration role
155
-
156
- ### Files
157
- - Create `packages/subagent/prompts/manager.md`
158
-
159
- ### What to add
160
- Author a concise bundled agent prompt that:
161
- - decomposes a larger task into bounded child workstreams
162
- - delegates to child agents via the `subagent` tool when beneficial
163
- - prefers read-only discovery or planning in parallel
164
- - keeps implementation coherent by limiting writing to one `worker` at a time unless file ownership is truly partitioned
165
- - synthesizes child output into a structured manager report
166
-
167
- ### Frontmatter guidance
168
- - Omit `tools:` in the first implementation unless you confirm that explicitly listing `subagent` is supported end-to-end in spawned agent tool selection.
169
- - Use an existing strong model already present in the package (for example `openai/gpt-5.4`) rather than introducing a new provider requirement in this slice.
170
- - Keep the file under ~100 lines, following `packages/subagent/skills/write-an-agent/SKILL.md`.
171
-
172
- ### Required prompt rules
173
- 1. Split work by scope, not by arbitrary agent count.
174
- 2. Prefer `scout` / `docs-scout` / `planner` in parallel for discovery.
175
- 3. Prefer a single `worker` for edits unless file ownership is obviously isolated.
176
- 4. Synthesize child findings before asking for more work.
177
- 5. Escalate open product or architecture decisions back to the main agent / user instead of hallucinating consensus.
178
-
179
- ## 2. Add a bundled prompt template that invokes the manager for larger tasks
180
-
181
- ### Files
182
- - Create `packages/subagent/prompts/manage.md`
183
-
184
- ### What to add
185
- Add a prompt template for larger tasks such as migrations, multi-package refactors, or features that need several child investigations.
186
-
187
- ### Suggested prompt shape
188
-
189
- ```md
190
- Use the subagent tool to run the `manager` agent on: $@
191
-
192
- The manager should:
193
- 1. break the work into bounded child workstreams
194
- 2. use parallel scouts/planners where helpful
195
- 3. keep implementation single-writer by default
196
- 4. return a synthesized report with recommended next steps
197
- ```
198
-
199
- ### Notes
200
- - Do not build an unbounded recursive swarm prompt.
201
- - The manager prompt should feel like a higher-level entry point, not a new runtime mode.
202
-
203
- ## 3. Expose the new manager role in docs and examples
204
-
205
- ### Files
206
- - Modify `packages/subagent/README.md`
207
- - Modify `packages/subagent/skills/spawn-subagents/SKILL.md`
208
-
209
- ### What to change
210
- - Add `manager` to the bundled agent list in the README.
211
- - Add one example showing when to use it, such as a multi-package migration or a feature spanning several child tasks.
212
- - Extend the `spawn-subagents` skill with a new “Manager pattern” section that explains:
213
- - when to use a manager
214
- - how it should delegate
215
- - why this is different from a generic swarm
216
-
217
- ### Suggested skill wording targets
218
- - “Use `manager` when the task is too large for one prompt but still needs coherent decisions.”
219
- - “Managers split work, children investigate or implement bounded slices, the manager synthesizes.”
220
- - “Do not create arbitrary peer-to-peer negotiation loops.”
221
-
222
- # Files to create
223
-
224
- - `packages/subagent/prompts/manager.md`
225
- - `packages/subagent/prompts/manage.md`
226
-
227
- # Files to modify
228
-
229
- - `packages/subagent/README.md` — add manager to bundled agents and prompt templates, plus one usage example
230
- - `packages/subagent/skills/spawn-subagents/SKILL.md` — add manager orchestration guidance
231
-
232
- # Testing notes
233
-
234
- - If the manager prompt remains markdown-only, there is no package typecheck requirement.
235
- - Manually run a small `/run-agent manager ...` or equivalent `subagent` call and confirm the manager:
236
- - breaks work into bounded tasks
237
- - uses parallel recon rather than parallel conflicting edits
238
- - returns a synthesized report instead of dumping raw child logs
239
- - If you decide to add any helper TS module to support manager summaries, run `bun run --filter '@dreki-gg/pi-subagent' typecheck`.
240
- - Keep the manager role useful without assuming any future advisor/handoff feature exists.
241
-
242
- # Patterns to follow
243
-
244
- - `packages/subagent/skills/spawn-subagents/SKILL.md:31-58` — existing orchestration philosophy to extend upward
245
- - `packages/subagent/skills/write-an-agent/SKILL.md:15-20` and `:46-67` — agent-authoring constraints for concise, high-signal prompts
246
- - `packages/subagent/prompts/planner.md:9-38` — good example of a narrow role with a clear output contract
247
- - `packages/subagent/prompts/worker.md:9-26` — example of a task-focused executor the manager should call, not replace
248
- - `packages/subagent/README.md:88-124` — bundled-agent and bundled-prompt sections to update