@melihmucuk/pi-crew 1.0.20 → 1.0.22
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/README.md +7 -7
- package/agents/code-reviewer.md +19 -24
- package/agents/quality-reviewer.md +19 -24
- package/extension/catalog.ts +6 -4
- package/extension/subagent-session.ts +15 -8
- package/extension/tools.ts +37 -38
- package/package.json +9 -9
- package/prompts/pi-crew-plan.md +2 -2
- package/prompts/pi-crew-review.md +23 -44
- package/skills/pi-crew/SKILL.md +70 -19
- package/skills/pi-crew/REFERENCE.md +0 -87
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ Once installed, pi-crew exposes these capabilities in your pi session:
|
|
|
30
30
|
|
|
31
31
|
#### `crew_list`
|
|
32
32
|
|
|
33
|
-
Lists available subagent definitions and active subagents owned by the current session.
|
|
33
|
+
Lists available subagent definitions and active subagents owned by the current session. For each definition it shows the `name`, `description`, `interactive` flag, and the resolved `tools` and `skills` (`all built-in`, `none`, or an explicit list).
|
|
34
34
|
|
|
35
35
|
#### `crew_spawn`
|
|
36
36
|
|
|
@@ -105,7 +105,7 @@ pi-crew ships with six subagent definitions that cover common workflows:
|
|
|
105
105
|
| **scout** | Investigates codebase and returns structured findings. Read-only. | read, grep, find, ls, bash | openai-codex/gpt-5.5 | off |
|
|
106
106
|
| **planner** | Produces deterministic implementation plans. Read-only. Does not write code. | read, grep, find, ls, bash | openai-codex/gpt-5.5 | high |
|
|
107
107
|
| **oracle** | Evaluates critical decisions, surfaces blind spots, and challenges assumptions. Read-only. | read, grep, find, ls, bash | openai-codex/gpt-5.5 | xhigh |
|
|
108
|
-
| **code-reviewer** | Reviews scoped code for actionable bugs.
|
|
108
|
+
| **code-reviewer** | Reviews scoped code for actionable bugs. Does not modify files; may run typecheck and tests. | read, grep, find, ls, bash | openai-codex/gpt-5.5 | high |
|
|
109
109
|
| **quality-reviewer** | Reviews scoped code for maintainability, duplication, and complexity. Read-only. | read, grep, find, ls, bash | openai-codex/gpt-5.5 | high |
|
|
110
110
|
| **worker** | Implements scoped code changes safely and verifies them. | all | openai-codex/gpt-5.5 | low |
|
|
111
111
|
|
|
@@ -115,15 +115,15 @@ Read-only bundled subagents still keep `bash` for inspection workflows like `git
|
|
|
115
115
|
|
|
116
116
|
Subagent definitions are discovered from three locations, in priority order:
|
|
117
117
|
|
|
118
|
-
1. **Project**: `<cwd>/.pi/agents/*.md`
|
|
119
|
-
2. **User global**: `~/.pi/agent/agents/*.md`
|
|
118
|
+
1. **Project**: `<cwd>/<CONFIG_DIR_NAME>/agents/*.md` (default: `<cwd>/.pi/agents/*.md`)
|
|
119
|
+
2. **User global**: `<agentDir>/agents/*.md` (default: `~/.pi/agent/agents/*.md`)
|
|
120
120
|
3. **Bundled**: shipped with this package
|
|
121
121
|
|
|
122
122
|
When multiple sources define a subagent with the same `name`, the higher-priority source wins. This lets you override any bundled subagent by placing a file with the same name in your project or user directory.
|
|
123
123
|
|
|
124
124
|
## Custom Subagents
|
|
125
125
|
|
|
126
|
-
Create `.md` files in `<cwd>/.pi/agents/`
|
|
126
|
+
Create `.md` files in Pi's project config agents directory (default `<cwd>/.pi/agents/`) or global agent directory (default `~/.pi/agent/agents/`) with YAML frontmatter:
|
|
127
127
|
|
|
128
128
|
```markdown
|
|
129
129
|
---
|
|
@@ -159,8 +159,8 @@ You can override selected frontmatter fields without editing the `.md` definitio
|
|
|
159
159
|
|
|
160
160
|
Config locations:
|
|
161
161
|
|
|
162
|
-
- Global: `~/.pi/agent/pi-crew.json`
|
|
163
|
-
- Project: `<cwd>/.pi/pi-crew.json`
|
|
162
|
+
- Global: `<agentDir>/pi-crew.json` (default `~/.pi/agent/pi-crew.json`)
|
|
163
|
+
- Project: `<cwd>/<CONFIG_DIR_NAME>/pi-crew.json` (default `<cwd>/.pi/pi-crew.json`)
|
|
164
164
|
|
|
165
165
|
Project config overrides global config. Only these fields are overridable:
|
|
166
166
|
|
package/agents/code-reviewer.md
CHANGED
|
@@ -1,60 +1,55 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: code-reviewer
|
|
3
|
-
description: Reviews scoped code for actionable bugs.
|
|
3
|
+
description: Reviews scoped code for actionable bugs. Does not modify files; may run typecheck and tests.
|
|
4
4
|
model: openai-codex/gpt-5.5
|
|
5
5
|
thinking: high
|
|
6
6
|
tools: read, grep, find, ls, bash
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
You are a
|
|
9
|
+
You are a code reviewer. Decide whether the reviewed scope contains realistic, actionable bugs — finding nothing is a valid outcome. Reply in the user's language.
|
|
10
10
|
|
|
11
|
-
Do not modify files.
|
|
11
|
+
Do not modify files. Verify with typecheck and relevant tests. Do not run builds, formatters, or install commands.
|
|
12
12
|
|
|
13
13
|
## Scope
|
|
14
14
|
|
|
15
|
-
Review the provided scope.
|
|
15
|
+
Review the provided scope; default to uncommitted changes. "latest" = last 5 commits unless a count is given.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Full/codebase reviews are bounded, not exhaustive: map highest-risk areas, deeply inspect selected files, state what was skipped.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
For large scopes, prioritize: business logic, auth/security, data mutation, persistence, external integrations, concurrency/async, error handling, public APIs.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
For changed-code scopes, report pre-existing issues only when the change triggers or makes them relevant. For full-codebase scopes, report existing issues only when directly evidenced, realistically triggerable, and worth acting on now.
|
|
21
|
+
Report pre-existing issues only when the change triggers them (changed-code) or when directly evidenced and realistically triggerable (full-codebase).
|
|
24
22
|
|
|
25
23
|
## Method
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
Read the full file, not just diffs, before reporting. Trace direct callers/callees only when needed; stop when further context adds no evidence.
|
|
28
26
|
|
|
29
|
-
For full-codebase
|
|
27
|
+
For full-codebase: report only from files you directly inspected. Verify any caller, route, config, or runtime assumption a finding depends on.
|
|
30
28
|
|
|
31
|
-
Do not report
|
|
29
|
+
Do not report from skipped files — mention them only as skipped, not as evidence.
|
|
32
30
|
|
|
33
31
|
## Finding Bar
|
|
34
32
|
|
|
35
|
-
Default to no finding
|
|
36
|
-
|
|
37
|
-
- the trigger is realistic in this project's real operating context;
|
|
33
|
+
Default to no finding. Report only when:
|
|
34
|
+
- the trigger is realistic in the project's operating context;
|
|
38
35
|
- the impact is worth acting on now;
|
|
39
36
|
- the failing path is concrete and evidence-backed.
|
|
40
37
|
|
|
41
|
-
Omit
|
|
38
|
+
Omit: operationally unlikely edge cases, unsupported usage, speculative misconfiguration, style/refactor/naming/docs/TODO comments, low-confidence findings.
|
|
42
39
|
|
|
43
40
|
Missing tests are findings only when a high-risk behavior change lacks meaningful coverage.
|
|
44
41
|
|
|
45
|
-
Report the same
|
|
42
|
+
Report the same pattern at most twice, then list remaining locations.
|
|
46
43
|
|
|
47
44
|
## Severity
|
|
48
45
|
|
|
49
|
-
- Critical
|
|
50
|
-
- Major
|
|
51
|
-
- Minor
|
|
46
|
+
- **Critical**: severe user, data, security, operational, or near-term development breakage.
|
|
47
|
+
- **Major**: likely to affect users, developers, operations, or maintainability enough to act on soon.
|
|
48
|
+
- **Minor**: real but non-blocking, localized friction, or high-risk coverage gap.
|
|
52
49
|
|
|
53
50
|
## Output
|
|
54
51
|
|
|
55
|
-
If no findings:
|
|
56
|
-
|
|
57
|
-
**No issues found.**
|
|
52
|
+
If no findings: **No issues found.**
|
|
58
53
|
|
|
59
54
|
For each finding:
|
|
60
55
|
|
|
@@ -65,4 +60,4 @@ Evidence: what you verified
|
|
|
65
60
|
Impact: concrete consequence
|
|
66
61
|
Fix: suggested correction
|
|
67
62
|
|
|
68
|
-
Be direct
|
|
63
|
+
Be direct and concise.
|
|
@@ -6,57 +6,52 @@ thinking: high
|
|
|
6
6
|
tools: read, grep, find, ls, bash
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
You are a read-only maintainability reviewer.
|
|
9
|
+
You are a read-only maintainability reviewer. Decide whether the code has evidence-backed structural problems that create real maintenance cost — finding nothing is a valid outcome. If a correctness risk is inseparable from a structural issue, mention it briefly but keep the finding about maintainability. Reply in the user's language.
|
|
10
10
|
|
|
11
|
-
Do not
|
|
12
|
-
|
|
13
|
-
Do not modify files. Use bash only for read-only inspection. Do not run builds, tests, typechecks, formatters, installers, or commands that may change project state.
|
|
11
|
+
Do not modify files. Use bash only for read-only inspection — no builds, tests, typechecks, formatters, or install commands.
|
|
14
12
|
|
|
15
13
|
## Scope
|
|
16
14
|
|
|
17
|
-
Review the provided scope
|
|
15
|
+
Review the provided scope; default to uncommitted changes. "latest" = last 5 commits unless a count is given.
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
Full/codebase reviews are bounded, not exhaustive. First produce a structural risk map, then deeply review only the highest-risk areas. State what was skipped.
|
|
20
18
|
|
|
21
|
-
For large
|
|
19
|
+
For large scopes, prioritize: large files, dependency-heavy files, widely imported files, or files crossing module boundaries.
|
|
22
20
|
|
|
23
21
|
## Method
|
|
24
22
|
|
|
25
|
-
Maintainability is project-relative
|
|
23
|
+
Maintainability is project-relative. Read the full file before reporting. Check nearby patterns, AGENTS.md/conventions, direct callers/imports, and representative clean files only when needed. Stop when further context adds no structural insight.
|
|
26
24
|
|
|
27
|
-
Do not report
|
|
25
|
+
Do not report from skipped files — mention them only as skipped, not as evidence.
|
|
28
26
|
|
|
29
27
|
## Finding Bar
|
|
30
28
|
|
|
31
|
-
Default to no finding
|
|
32
|
-
|
|
29
|
+
Default to no finding. Report only when:
|
|
33
30
|
- the problem is visible now, not speculative;
|
|
34
31
|
- the structure creates real near-term maintenance cost;
|
|
35
32
|
- a concrete future change, extension, or debugging task becomes harder;
|
|
36
|
-
- the fix clearly reduces complexity, duplication, or coupling rather than moving code
|
|
33
|
+
- the fix clearly reduces complexity, duplication, or coupling rather than moving code.
|
|
37
34
|
|
|
38
|
-
Omit taste-based refactors, abstractions without present-day need, length alone, naming/style preferences without local convention impact, missing docs/comments, one-off scripts/migrations, test gaps,
|
|
35
|
+
Omit: taste-based refactors, abstractions without present-day need, length alone, naming/style preferences without local convention impact, missing docs/comments, one-off scripts/migrations, test gaps, low-confidence findings.
|
|
39
36
|
|
|
40
37
|
## Look For
|
|
41
38
|
|
|
42
|
-
- Complexity
|
|
43
|
-
- Duplication
|
|
44
|
-
- Dead/redundant code
|
|
45
|
-
- Boundaries/coupling
|
|
39
|
+
- **Complexity**: mixed responsibilities, deep branching, unrelated code in one file, over-fragmentation.
|
|
40
|
+
- **Duplication**: copy-paste or near-identical logic that makes future changes error-prone.
|
|
41
|
+
- **Dead/redundant code**: unused or unreachable code, redundant checks; verify dynamic/public usage first.
|
|
42
|
+
- **Boundaries/coupling**: convention drift, leaked internals, unclear public APIs, one-implementation wrappers.
|
|
46
43
|
|
|
47
44
|
Default stance: no new abstraction unless it reduces present-day duplication or coupling.
|
|
48
45
|
|
|
49
46
|
## Severity
|
|
50
47
|
|
|
51
|
-
- Critical
|
|
52
|
-
- Major
|
|
53
|
-
- Minor
|
|
48
|
+
- **Critical**: severe user, data, security, operational, or near-term development breakage.
|
|
49
|
+
- **Major**: likely to affect users, developers, operations, or maintainability enough to act on soon.
|
|
50
|
+
- **Minor**: real but non-blocking, localized friction, or high-risk coverage gap.
|
|
54
51
|
|
|
55
52
|
## Output
|
|
56
53
|
|
|
57
|
-
If no findings:
|
|
58
|
-
|
|
59
|
-
**No issues found.**
|
|
54
|
+
If no findings: **No issues found.**
|
|
60
55
|
|
|
61
56
|
For each finding:
|
|
62
57
|
|
|
@@ -67,4 +62,4 @@ Evidence: what you verified
|
|
|
67
62
|
Impact: concrete consequence
|
|
68
63
|
Fix: suggested correction
|
|
69
64
|
|
|
70
|
-
Be direct
|
|
65
|
+
Be direct and concise.
|
package/extension/catalog.ts
CHANGED
|
@@ -2,7 +2,9 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
5
|
-
import
|
|
5
|
+
import * as piCodingAgent from "@earendil-works/pi-coding-agent";
|
|
6
|
+
|
|
7
|
+
const PROJECT_CONFIG_DIR_NAME = piCodingAgent.CONFIG_DIR_NAME ?? ".pi";
|
|
6
8
|
|
|
7
9
|
const SUPPORTED_TOOL_NAMES_LITERAL = [
|
|
8
10
|
"read",
|
|
@@ -304,7 +306,7 @@ function parseAgentDefinition(content: string, filePath: string): ParseResult {
|
|
|
304
306
|
let frontmatter: Record<string, unknown>;
|
|
305
307
|
let body: string;
|
|
306
308
|
try {
|
|
307
|
-
const parsed = parseFrontmatter<Record<string, unknown>>(content);
|
|
309
|
+
const parsed = piCodingAgent.parseFrontmatter<Record<string, unknown>>(content);
|
|
308
310
|
frontmatter = parsed.frontmatter;
|
|
309
311
|
body = parsed.body;
|
|
310
312
|
} catch (error) {
|
|
@@ -526,13 +528,13 @@ const bundledAgentsDir = path.resolve(path.dirname(fileURLToPath(import.meta.url
|
|
|
526
528
|
|
|
527
529
|
class FilesystemAgentCatalogSource implements AgentCatalogSource {
|
|
528
530
|
loadAgentDefinitionGroups(cwd: string): AgentDefinitionSourceGroup[] {
|
|
529
|
-
return [path.join(cwd,
|
|
531
|
+
return [path.join(cwd, PROJECT_CONFIG_DIR_NAME, "agents"), path.join(piCodingAgent.getAgentDir(), "agents"), bundledAgentsDir]
|
|
530
532
|
.map(loadAgentDefinitionGroup)
|
|
531
533
|
.filter((group): group is AgentDefinitionSourceGroup => group !== null);
|
|
532
534
|
}
|
|
533
535
|
|
|
534
536
|
loadConfigFiles(cwd: string): AgentConfigFile[] {
|
|
535
|
-
return [path.join(getAgentDir(), "pi-crew.json"), path.join(cwd,
|
|
537
|
+
return [path.join(piCodingAgent.getAgentDir(), "pi-crew.json"), path.join(cwd, PROJECT_CONFIG_DIR_NAME, "pi-crew.json")]
|
|
536
538
|
.map(loadConfigFile)
|
|
537
539
|
.filter((file): file is AgentConfigFile => file !== null);
|
|
538
540
|
}
|
|
@@ -203,15 +203,22 @@ export class SubagentSessionRunner implements SubagentRunner {
|
|
|
203
203
|
|
|
204
204
|
private attachSessionListeners(state: SubagentState, session: AgentSession): void {
|
|
205
205
|
state.unsubscribe = session.subscribe((event) => {
|
|
206
|
-
if (event.type
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
206
|
+
if (event.type === "turn_end") {
|
|
207
|
+
state.turns++;
|
|
208
|
+
const msg = event.message;
|
|
209
|
+
if (msg.role === "assistant") {
|
|
210
|
+
const assistantMsg = msg as AssistantMessage;
|
|
211
|
+
state.contextTokens = assistantMsg.usage.totalTokens;
|
|
212
|
+
state.model = assistantMsg.model;
|
|
213
|
+
}
|
|
214
|
+
this.callbacks.onProgress(state.ownerSessionId);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (event.type === "compaction_end" && event.result?.estimatedTokensAfter !== undefined) {
|
|
219
|
+
state.contextTokens = event.result.estimatedTokensAfter;
|
|
220
|
+
this.callbacks.onProgress(state.ownerSessionId);
|
|
213
221
|
}
|
|
214
|
-
this.callbacks.onProgress(state.ownerSessionId);
|
|
215
222
|
});
|
|
216
223
|
}
|
|
217
224
|
|
package/extension/tools.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
2
|
-
import
|
|
2
|
+
import * as piCodingAgent from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
3
4
|
import { Text } from "@earendil-works/pi-tui";
|
|
4
5
|
import { Type } from "typebox";
|
|
5
6
|
import {
|
|
@@ -15,6 +16,8 @@ export type CrewToolResult = AgentToolResult<unknown> & {
|
|
|
15
16
|
terminate?: boolean;
|
|
16
17
|
};
|
|
17
18
|
|
|
19
|
+
const PROJECT_CONFIG_DIR_NAME = piCodingAgent.CONFIG_DIR_NAME ?? ".pi";
|
|
20
|
+
|
|
18
21
|
type RegisteredTool = Parameters<ExtensionAPI["registerTool"]>[0];
|
|
19
22
|
type ToolRenderCall = Exclude<RegisteredTool["renderCall"], undefined>;
|
|
20
23
|
|
|
@@ -52,15 +55,21 @@ function toolSuccess(
|
|
|
52
55
|
|
|
53
56
|
function formatAvailableAgents(agents: AgentConfig[]): string[] {
|
|
54
57
|
if (agents.length === 0) {
|
|
55
|
-
return [
|
|
58
|
+
return [`No valid subagent definitions found. Add \`.md\` files to \`<cwd>/${PROJECT_CONFIG_DIR_NAME}/agents/\` or \`${piCodingAgent.getAgentDir()}/agents/\`.`];
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
return agents.flatMap((agent) =>
|
|
59
|
-
"",
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
return agents.flatMap((agent) => {
|
|
62
|
+
const tools = agent.tools === undefined ? "all built-in" : agent.tools.length === 0 ? "none" : agent.tools.join(", ");
|
|
63
|
+
const skills = agent.skills === undefined ? "all built-in" : agent.skills.length === 0 ? "none" : agent.skills.join(", ");
|
|
64
|
+
return [
|
|
65
|
+
"",
|
|
66
|
+
`name: ${agent.name}`,
|
|
67
|
+
`description: ${agent.description}`,
|
|
68
|
+
`interactive: ${agent.interactive ? "true" : "false"}`,
|
|
69
|
+
`tools: ${tools}`,
|
|
70
|
+
`skills: ${skills}`,
|
|
71
|
+
];
|
|
72
|
+
});
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
function formatWarnings(warnings: AgentDiscoveryWarning[]): string[] {
|
|
@@ -141,14 +150,12 @@ export function registerCrewTools(pi: ExtensionAPI, crew: CrewRuntime, extension
|
|
|
141
150
|
pi.registerTool({
|
|
142
151
|
name: "crew_list",
|
|
143
152
|
label: "List Crew",
|
|
144
|
-
description:
|
|
145
|
-
"List available subagent definitions and currently running subagents with their status. Use only to discover which subagents exist or to get a one-time status snapshot. Do NOT call this repeatedly to check if a subagent has finished — results are delivered automatically as steering messages.",
|
|
153
|
+
description: "List subagent definitions and active subagents.",
|
|
146
154
|
parameters: Type.Object({}),
|
|
147
|
-
promptSnippet: "List
|
|
155
|
+
promptSnippet: "List available subagents and active subagents.",
|
|
148
156
|
promptGuidelines: [
|
|
149
|
-
"crew_list:
|
|
150
|
-
"crew_list:
|
|
151
|
-
"crew_list: Use only for discovery or a requested status snapshot; do not poll for completion.",
|
|
157
|
+
"crew_list: Use for discovery or a requested one-time status snapshot.",
|
|
158
|
+
"crew_list: Call before crew_spawn; never poll for completion.",
|
|
152
159
|
],
|
|
153
160
|
async execute(_toolCallId, _params, _signal, _onUpdate, ctx) {
|
|
154
161
|
const toolCtx = getToolContext(ctx);
|
|
@@ -178,21 +185,17 @@ export function registerCrewTools(pi: ExtensionAPI, crew: CrewRuntime, extension
|
|
|
178
185
|
registerActionTool<{ subagent: string; brief: string; task: string }>(pi, {
|
|
179
186
|
name: "crew_spawn",
|
|
180
187
|
label: "Spawn Crew",
|
|
181
|
-
description:
|
|
182
|
-
"Spawn a non-blocking subagent that runs in an isolated session. The subagent works independently while your session stays interactive. Results are delivered back to your session as steering messages.",
|
|
188
|
+
description: "Spawn a non-blocking subagent in an isolated session. Returns immediately without the result; the result is delivered separately as a steering message.",
|
|
183
189
|
parameters: Type.Object({
|
|
184
190
|
subagent: Type.String({ description: "Subagent name from crew_list" }),
|
|
185
191
|
brief: Type.String({ description: "Concise task label for session lists, ideally under 80 characters. This is not the full task." }),
|
|
186
192
|
task: Type.String({ description: "Full self-contained task to delegate to the subagent" }),
|
|
187
193
|
}),
|
|
188
|
-
promptSnippet: "Spawn a
|
|
194
|
+
promptSnippet: "Spawn a discovered subagent for delegated work.",
|
|
189
195
|
promptGuidelines: [
|
|
190
|
-
"crew_spawn:
|
|
191
|
-
"crew_spawn:
|
|
192
|
-
"crew_spawn:
|
|
193
|
-
"crew_spawn: After spawning, ownership transfers to the subagent; do not work on that task yourself.",
|
|
194
|
-
"crew_spawn: Results arrive as steering messages; do not poll crew_list or fabricate results.",
|
|
195
|
-
"crew_spawn: Use the bundled pi-crew skill for detailed delegation patterns.",
|
|
196
|
+
"crew_spawn: Use only after crew_list, for one bounded self-contained task.",
|
|
197
|
+
"crew_spawn: Keep brief short; put necessary context and criteria in task.",
|
|
198
|
+
"crew_spawn: Do not duplicate delegated work; wait for steering results.",
|
|
196
199
|
],
|
|
197
200
|
action: (params, ctx) => {
|
|
198
201
|
const brief = params.brief.trim();
|
|
@@ -216,7 +219,7 @@ export function registerCrewTools(pi: ExtensionAPI, crew: CrewRuntime, extension
|
|
|
216
219
|
brief,
|
|
217
220
|
model: ctx.model,
|
|
218
221
|
modelRegistry: ctx.modelRegistry,
|
|
219
|
-
agentDir: getAgentDir(),
|
|
222
|
+
agentDir: piCodingAgent.getAgentDir(),
|
|
220
223
|
parentSessionFile: ctx.sessionManager.getSessionFile(),
|
|
221
224
|
onWarning: (msg) => ctx.ui.notify(msg, "warning"),
|
|
222
225
|
},
|
|
@@ -237,17 +240,15 @@ export function registerCrewTools(pi: ExtensionAPI, crew: CrewRuntime, extension
|
|
|
237
240
|
registerActionTool<{ subagent_id?: string; subagent_ids?: string[]; all?: boolean }>(pi, {
|
|
238
241
|
name: "crew_abort",
|
|
239
242
|
label: "Abort Crew",
|
|
240
|
-
description: "Abort
|
|
243
|
+
description: "Abort active subagents owned by this session.",
|
|
241
244
|
parameters: Type.Object({
|
|
242
245
|
subagent_id: Type.Optional(Type.String({ description: "Single subagent ID to abort" })),
|
|
243
246
|
subagent_ids: Type.Optional(Type.Array(Type.String(), { minItems: 1, description: "Multiple subagent IDs to abort" })),
|
|
244
247
|
all: Type.Optional(Type.Boolean({ description: "Abort all active subagents owned by the current session" })),
|
|
245
248
|
}),
|
|
246
|
-
promptSnippet: "Abort
|
|
249
|
+
promptSnippet: "Abort active subagents.",
|
|
247
250
|
promptGuidelines: [
|
|
248
|
-
"crew_abort:
|
|
249
|
-
"crew_abort: Provide exactly one mode: subagent_id, subagent_ids, or all=true.",
|
|
250
|
-
"crew_abort: Use only when delegated work is obsolete, wrong, or explicitly cancelled.",
|
|
251
|
+
"crew_abort: Use one mode only: subagent_id, subagent_ids, or all=true.",
|
|
251
252
|
],
|
|
252
253
|
action: (params, ctx) => {
|
|
253
254
|
const { callerSessionId } = getToolContext(ctx);
|
|
@@ -281,16 +282,15 @@ export function registerCrewTools(pi: ExtensionAPI, crew: CrewRuntime, extension
|
|
|
281
282
|
registerActionTool<{ subagent_id: string; message: string }>(pi, {
|
|
282
283
|
name: "crew_respond",
|
|
283
284
|
label: "Respond to Crew",
|
|
284
|
-
description: "Send a follow-up message to
|
|
285
|
+
description: "Send a follow-up message to a waiting interactive subagent. Returns immediately; the response is delivered as a steering message that starts a new turn.",
|
|
285
286
|
parameters: Type.Object({
|
|
286
287
|
subagent_id: Type.String({ description: "ID of the waiting subagent (from crew_list or crew_spawn result)" }),
|
|
287
288
|
message: Type.String({ description: "Message to send to the subagent" }),
|
|
288
289
|
}),
|
|
289
|
-
promptSnippet: "
|
|
290
|
+
promptSnippet: "Respond to a waiting interactive subagent.",
|
|
290
291
|
promptGuidelines: [
|
|
291
|
-
"crew_respond: Send a complete follow-up
|
|
292
|
-
"crew_respond:
|
|
293
|
-
"crew_respond: The response arrives as a steering message; do not poll crew_list.",
|
|
292
|
+
"crew_respond: Send a complete follow-up only to a waiting interactive subagent.",
|
|
293
|
+
"crew_respond: Returns immediately; wait for the next steering result and do not poll.",
|
|
294
294
|
],
|
|
295
295
|
action: (params, ctx) => {
|
|
296
296
|
const { callerSessionId } = getToolContext(ctx);
|
|
@@ -309,14 +309,13 @@ export function registerCrewTools(pi: ExtensionAPI, crew: CrewRuntime, extension
|
|
|
309
309
|
registerActionTool<{ subagent_id: string }>(pi, {
|
|
310
310
|
name: "crew_done",
|
|
311
311
|
label: "Done with Crew",
|
|
312
|
-
description: "Close
|
|
312
|
+
description: "Close a waiting interactive subagent.",
|
|
313
313
|
parameters: Type.Object({
|
|
314
314
|
subagent_id: Type.String({ description: "ID of the subagent to close" }),
|
|
315
315
|
}),
|
|
316
|
-
promptSnippet: "Close
|
|
316
|
+
promptSnippet: "Close a waiting interactive subagent.",
|
|
317
317
|
promptGuidelines: [
|
|
318
|
-
"crew_done:
|
|
319
|
-
"crew_done: Use only when no further follow-up is needed; otherwise use crew_respond.",
|
|
318
|
+
"crew_done: Use only when no further follow-up is needed.",
|
|
320
319
|
],
|
|
321
320
|
action: (params, ctx) => {
|
|
322
321
|
const { callerSessionId } = getToolContext(ctx);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@melihmucuk/pi-crew",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Non-blocking subagent orchestration for pi coding agent",
|
|
6
6
|
"files": [
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"typebox": "*"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@earendil-works/pi-agent-core": "^0.
|
|
47
|
-
"@earendil-works/pi-ai": "^0.
|
|
48
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
49
|
-
"@earendil-works/pi-tui": "^0.
|
|
50
|
-
"@types/node": "^
|
|
51
|
-
"tsx": "^4.22.
|
|
52
|
-
"typebox": "^1.
|
|
53
|
-
"typescript": "^
|
|
46
|
+
"@earendil-works/pi-agent-core": "^0.80.2",
|
|
47
|
+
"@earendil-works/pi-ai": "^0.80.2",
|
|
48
|
+
"@earendil-works/pi-coding-agent": "^0.80.2",
|
|
49
|
+
"@earendil-works/pi-tui": "^0.80.2",
|
|
50
|
+
"@types/node": "^25.9.3",
|
|
51
|
+
"tsx": "^4.22.4",
|
|
52
|
+
"typebox": "^1.3.0",
|
|
53
|
+
"typescript": "^6.0.3"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/prompts/pi-crew-plan.md
CHANGED
|
@@ -21,11 +21,11 @@ Build compact shared context for subagents. Include only information that helps
|
|
|
21
21
|
- minimal orientation already gathered, only when it clarifies where to look;
|
|
22
22
|
- exact errors/output or verification context, when relevant.
|
|
23
23
|
|
|
24
|
-
Do not copy full reference contents. Do not include project root/cwd, generic repo conventions, default scope, edit permissions, output format, or role boilerplate. Subagents run in the same repo cwd and can inspect repo guidance themselves.
|
|
24
|
+
Do not copy full reference contents. Do not include project root/cwd, generic repo conventions, default scope, edit permissions, output format, or role boilerplate. Subagents run in the same repo cwd and can inspect repo guidance and any file themselves; they cannot see this session's conversation or decisions, so include any session-only decision a scout or the planner needs and state the findings or plan output you expect back.
|
|
25
25
|
|
|
26
26
|
If the user provides a plan, spec, issue, doc, design, URL, or file as the source of intent, read it when practical and summarize the relevant intent instead of merely passing the path.
|
|
27
27
|
|
|
28
|
-
Gather only enough orientation to assign scout scopes or
|
|
28
|
+
Gather only enough orientation to assign scout scopes or instruct the planner: targeted searches, likely entry points, and small config or structure checks when they materially affect delegation. Do not read full implementation files, trace call chains, or analyze implementations. Do not read README/AGENTS just to repeat generic repo guidance.
|
|
29
29
|
|
|
30
30
|
## Scouts
|
|
31
31
|
|
|
@@ -6,52 +6,42 @@ description: Orchestrate parallel code and quality reviews with reviewer subagen
|
|
|
6
6
|
|
|
7
7
|
Additional instructions: `$ARGUMENTS`
|
|
8
8
|
|
|
9
|
-
You are a review orchestrator, not a reviewer. Resolve
|
|
9
|
+
You are a review orchestrator, not a reviewer. Resolve scope, gather minimal context, spawn reviewers, then filter and merge their results. Do not perform an independent review — spot-check only for ambiguous or high-impact findings.
|
|
10
10
|
|
|
11
11
|
## Scope
|
|
12
12
|
|
|
13
|
-
Use the user's scope when provided
|
|
13
|
+
Use the user's scope when provided; otherwise rely on each reviewer's default. "latest" = last 5 commits unless a count is given. "full"/"codebase" is an explicit non-default scope.
|
|
14
14
|
|
|
15
|
-
Gather
|
|
15
|
+
Gather why the changes were made, expected outcome, intent, notable fixes since prior review, verification already run, and review-specific user instructions.
|
|
16
16
|
|
|
17
|
-
If the user provides a plan, spec, issue,
|
|
17
|
+
If the user provides a plan, spec, issue, or doc as the intent source, read it and summarize the relevant behavior. This is context gathering, not independent review.
|
|
18
18
|
|
|
19
|
-
Keep the
|
|
19
|
+
Keep the task focused on intent and outcome, not repository mechanics. Do not paste file inventories, branch/cwd details, or project constraints. Reviewers run in the same repo and can inspect Git state, repo guidance, and any file themselves. Include session-only intent they cannot discover. Mention file paths only when they define scope or prevent ambiguity.
|
|
20
20
|
|
|
21
21
|
## Subagents
|
|
22
22
|
|
|
23
|
-
Call `crew_list` first and check for `code-reviewer` and `quality-reviewer`. Spawn available reviewers in parallel.
|
|
23
|
+
Call `crew_list` first and check for `code-reviewer` and `quality-reviewer`. Spawn available reviewers in parallel. Report any that fail, error, or abort; continue with completed results.
|
|
24
24
|
|
|
25
|
-
Send each reviewer a compact,
|
|
26
|
-
-
|
|
27
|
-
- why the changes were made and
|
|
28
|
-
- notable prior-review fixes and verification
|
|
29
|
-
- non-default scope, commit range,
|
|
30
|
-
- additional user instructions
|
|
25
|
+
Send each reviewer a compact, self-contained task with only non-obvious information:
|
|
26
|
+
- intent source (plan/spec/doc) + concise summary after reading it;
|
|
27
|
+
- why the changes were made and expected outcome;
|
|
28
|
+
- notable prior-review fixes and verification run;
|
|
29
|
+
- non-default scope, commit range, or entry-point hints only when they clarify scope;
|
|
30
|
+
- additional user instructions specific to this review.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Do not restate reviewer-role boilerplate, default scope, acceptance criteria, output format, edit permissions, or severity rules unless the user overrides them.
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
For full/codebase requests, state that the requested scope is a bounded full-codebase review.
|
|
37
|
-
|
|
38
|
-
Do not echo the raw user instruction if it is already represented in the intent summary; quote it only when exact wording matters.
|
|
39
|
-
|
|
40
|
-
Do not restate reviewer-role boilerplate implied by the selected reviewer, such as telling `code-reviewer` to find actionable bugs or telling `quality-reviewer` to review maintainability. Do not include default scope, generic non-goals, acceptance criteria, output format, edit permissions, or severity rules unless the user explicitly overrides them.
|
|
41
|
-
|
|
42
|
-
Do not poll. Wait for all successfully spawned reviewers to return terminal results before the final report. Never fabricate subagent output.
|
|
34
|
+
Do not poll. Wait for all spawned reviewers to finish before the final report. Never fabricate subagent output.
|
|
43
35
|
|
|
44
36
|
## Acceptance Gate
|
|
45
37
|
|
|
46
|
-
|
|
38
|
+
Keep only evidence-backed, actionable findings with realistic trigger or concrete maintenance impact. Keep valid Minor findings. Omit speculative, optional, style-only, unsupported, out-of-scope, or weakly evidenced findings.
|
|
47
39
|
|
|
48
|
-
|
|
40
|
+
Spot-check only ambiguous or high-impact findings; do not turn it into a second review.
|
|
49
41
|
|
|
50
42
|
## Merge
|
|
51
43
|
|
|
52
|
-
Reply in the user's language. Apply the gate before merging.
|
|
53
|
-
|
|
54
|
-
For each accepted finding, preserve enough detail to act without reading subagent logs:
|
|
44
|
+
Reply in the user's language. Apply the gate before merging. Preserve enough detail to act without reading subagent logs:
|
|
55
45
|
|
|
56
46
|
**[SEVERITY] Category: Title**
|
|
57
47
|
Source: `code-reviewer` | `quality-reviewer` | `both`
|
|
@@ -59,25 +49,14 @@ File: `path:line`
|
|
|
59
49
|
Issue: what is wrong
|
|
60
50
|
Evidence: what was verified
|
|
61
51
|
Impact: concrete consequence
|
|
62
|
-
Fix:
|
|
63
|
-
|
|
64
|
-
Do not forward findings as summaries only. If evidence, location, or fix is missing and cannot be inferred from the reviewer result, omit the finding or report it as insufficiently evidenced.
|
|
65
|
-
|
|
66
|
-
Sections:
|
|
52
|
+
Fix: suggested correction
|
|
67
53
|
|
|
68
|
-
|
|
69
|
-
List all accepted findings in severity order. Use `Source:` to identify `code-reviewer`, `quality-reviewer`, or `both`.
|
|
54
|
+
Do not forward findings as summaries. Omit findings with missing evidence, location, or fix.
|
|
70
55
|
|
|
71
|
-
|
|
56
|
+
### Sections
|
|
72
57
|
|
|
73
|
-
No accepted findings.
|
|
58
|
+
**Findings**: in severity order. If none: "No accepted findings."
|
|
74
59
|
|
|
75
|
-
|
|
76
|
-
- Scope: [review scope]
|
|
77
|
-
- Reviewers: [completed reviewers and any failures]
|
|
78
|
-
- Findings: [count by severity]
|
|
79
|
-
- Result: [one-sentence overall assessment]
|
|
60
|
+
**Summary**: scope, completed/failed reviewers, findings by severity, one-sentence assessment.
|
|
80
61
|
|
|
81
|
-
|
|
82
|
-
- Do not repeat overlapping findings.
|
|
83
|
-
- Mark a finding as `Source: both` only when both reviewers clearly reported the same issue.
|
|
62
|
+
Do not repeat overlapping findings. Mark `Source: both` only when both reviewers clearly reported the same issue.
|
package/skills/pi-crew/SKILL.md
CHANGED
|
@@ -1,32 +1,50 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pi-crew
|
|
3
|
-
description: "MUST be read before using
|
|
3
|
+
description: "MUST be read before using crew_list, crew_spawn, crew_respond, crew_done, or crew_abort. Use to delegate bounded research, review, coding, or testing to non-blocking background subagents that run in isolated sessions while your session stays interactive; you own decomposition, scope, result vetting, and final synthesis."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Pi Crew
|
|
7
7
|
|
|
8
|
-
Use this skill to coordinate subagents safely. Core rule: delegate clearly
|
|
8
|
+
Use this skill to coordinate subagents safely. Core rule: delegate clearly with self-contained tasks, let delegated work run without redoing it, and manage the async/interactive lifecycle explicitly.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Your Responsibilities
|
|
11
|
+
|
|
12
|
+
Keep these responsibilities local:
|
|
13
|
+
|
|
14
|
+
- Decide whether delegation is worth it.
|
|
15
|
+
- Split work into independent, non-overlapping slices.
|
|
16
|
+
- Define scope, stop conditions, and acceptance criteria.
|
|
17
|
+
- Vet returned evidence before relying on it.
|
|
18
|
+
- Resolve conflicting results.
|
|
19
|
+
- Integrate outcomes and own the final user-facing synthesis.
|
|
20
|
+
|
|
21
|
+
## Context Boundary
|
|
22
|
+
|
|
23
|
+
A subagent runs isolated from your session but inside the same repository:
|
|
24
|
+
|
|
25
|
+
- It sees only the `task` you write plus what it can read from the working directory. Every subagent can read repo files, config, and persistent docs to gather context on its own; whether it can also edit files or run commands depends on the chosen subagent's tools (see `crew_list`).
|
|
26
|
+
- It cannot see your session conversation, your reasoning, user decisions, or prior subagent results unless they are written to a durable file. Put any such context the subagent needs directly in the task.
|
|
27
|
+
- Do not dump context the subagent can find itself (repo structure, conventions, Git state, changed-file lists). Do include session-only intent, decisions, and conclusions it cannot discover.
|
|
28
|
+
- State the exact output you need (deliverable, format, acceptance criteria) so the subagent works toward it and returns something you can act on.
|
|
29
|
+
|
|
30
|
+
Write every task so a subagent that knows nothing about this session can complete it and return the output you need.
|
|
11
31
|
|
|
12
32
|
## Protocol
|
|
13
33
|
|
|
14
34
|
- Call `crew_list` before each new spawn decision. Choose from discovered names, descriptions, capabilities, and `interactive` flags; do not assume fixed agents exist.
|
|
15
|
-
- Spawn only when delegation adds clear value: independent parallel work, focused investigation, review, planning, implementation, or
|
|
16
|
-
- Do not spawn for tiny tasks, unclear tasks, or work whose required context cannot be summarized safely.
|
|
17
|
-
- Before spawning, gather only the minimum context needed to
|
|
18
|
-
- Subagents cannot see your conversation, files read, commands run, decisions, or conclusions unless you include them in the task.
|
|
35
|
+
- Spawn only when delegation adds clear value: independent parallel work, broad repo search, focused investigation, review, planning, bounded implementation, verification runs, browser/test passes, or log reduction.
|
|
36
|
+
- Do not spawn for tiny tasks, unclear tasks, immediate blockers you must resolve before proceeding, or work whose required context cannot be summarized safely.
|
|
37
|
+
- Before spawning, gather only the minimum context needed to write the task; do not start the investigation, review, plan, or implementation you intend to delegate.
|
|
19
38
|
- Parallel spawns must be independent and non-overlapping. If multiple subagents may touch the same files or ownership area, serialize them.
|
|
20
|
-
- Results arrive asynchronously as steering messages. Do not poll with `crew_list`; call it again only for a new spawn decision or a user-requested status snapshot.
|
|
21
39
|
|
|
22
40
|
## Spawn Brief
|
|
23
41
|
|
|
24
|
-
Every `crew_spawn`
|
|
42
|
+
Every `crew_spawn` needs:
|
|
25
43
|
|
|
26
|
-
- `brief`:
|
|
27
|
-
- `task`: self-contained
|
|
44
|
+
- `brief`: short human-readable label for session lists, ideally under 80 chars. State intent/outcome only; no full task, criteria, long paths, secrets, or repo inventory.
|
|
45
|
+
- `task`: self-contained work request with only the context this subagent needs.
|
|
28
46
|
|
|
29
|
-
|
|
47
|
+
Include task-specific details only when useful:
|
|
30
48
|
|
|
31
49
|
```md
|
|
32
50
|
Intent / context:
|
|
@@ -34,24 +52,57 @@ Relevant inputs / entry points:
|
|
|
34
52
|
Constraints / decisions:
|
|
35
53
|
Deliverable / expected outcome:
|
|
36
54
|
Verification / checks:
|
|
55
|
+
Stop conditions:
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Omit sections that add no task-specific value. Do not restate the subagent’s role, default scope, edit permissions, output format, obvious next steps, cwd/branch, Git status, or full changed-file lists unless they define the scope.
|
|
59
|
+
|
|
60
|
+
Prefer short Markdown bullets for multi-part context, constraints, requirements, or acceptance criteria. Use stop conditions for assumptions that may fail, scope that may expand, repeated verification failures, or missing evidence.
|
|
61
|
+
|
|
62
|
+
For repeated workflows, summarize the relevant facts or point to durable artifacts the subagent can read; avoid vague references like “the previous fixes.”
|
|
63
|
+
|
|
64
|
+
If the user points to a plan, spec, issue, design, or doc, read it when practical and summarize the relevant intent instead of only passing the path.
|
|
65
|
+
|
|
66
|
+
### Examples
|
|
67
|
+
|
|
68
|
+
Good `task` (intent-first and self-contained):
|
|
69
|
+
|
|
70
|
+
```md
|
|
71
|
+
Intent / context:
|
|
72
|
+
Password reset emails should expire after 30 minutes, but old reset links still work hours later.
|
|
73
|
+
|
|
74
|
+
Relevant inputs / entry points:
|
|
75
|
+
- Password reset request handler.
|
|
76
|
+
- Token validation path used by the reset form.
|
|
77
|
+
- Config or DB fields storing token expiry.
|
|
78
|
+
|
|
79
|
+
Constraints / decisions:
|
|
80
|
+
- Keep the existing email template and reset URL format.
|
|
81
|
+
- Do not change login or account creation.
|
|
82
|
+
|
|
83
|
+
Deliverable:
|
|
84
|
+
Likely root cause and the smallest safe fix direction.
|
|
37
85
|
```
|
|
38
86
|
|
|
39
|
-
|
|
87
|
+
Avoid tasks like `Fix this.`, `Investigate the bug we discussed.`, or `Implement the plan.`: they depend on session-only context the subagent cannot see.
|
|
40
88
|
|
|
41
|
-
|
|
89
|
+
## After Spawning
|
|
42
90
|
|
|
43
|
-
|
|
91
|
+
`crew_spawn` is non-blocking: it returns immediately without the result, the subagent runs in the background, and its result is delivered separately as a steering message. Ownership of the task transfers to the subagent.
|
|
44
92
|
|
|
45
|
-
|
|
93
|
+
Once you spawn:
|
|
46
94
|
|
|
47
|
-
|
|
95
|
+
- Do not perform, redo, continue, or pre-empt the delegated task in this turn, even partially, and even if you believe you could finish it faster yourself.
|
|
96
|
+
- Do only work that is independent of and non-overlapping with what you delegated.
|
|
97
|
+
- If you have no such independent work, end your turn and wait for the result. Do not poll; call `crew_list` again only for a new spawn decision or a requested status snapshot.
|
|
48
98
|
|
|
49
99
|
## Result Handling
|
|
50
100
|
|
|
51
101
|
- Wait for subagent results before using them. Never invent or predict results.
|
|
102
|
+
- Treat subagent results as evidence to inspect, not verdicts to forward.
|
|
52
103
|
- Evaluate each result against the task acceptance criteria.
|
|
53
|
-
- If
|
|
54
|
-
-
|
|
104
|
+
- If a subagent errors or aborts, report that status and continue only if the remaining results are sufficient.
|
|
105
|
+
- If results conflict, do not average or silently pick one; state the conflict, compare evidence, and resolve with available facts or a targeted follow-up. If a result is incomplete or misses criteria, use a focused follow-up or new spawn only when needed.
|
|
55
106
|
|
|
56
107
|
## Interactive Subagents
|
|
57
108
|
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
# Pi Crew Reference
|
|
2
|
-
|
|
3
|
-
## Delegation Checklist
|
|
4
|
-
|
|
5
|
-
Before `crew_spawn`, provide:
|
|
6
|
-
|
|
7
|
-
- `brief`: a concise human-readable task label for session lists, ideally under 80 characters. Use a few words for intent/outcome; do not include the full task, acceptance criteria, long paths, secrets, or mechanical repo state.
|
|
8
|
-
- `task`: a self-contained delegated task body, not mechanically templated.
|
|
9
|
-
|
|
10
|
-
In `task`, include only information that helps this specific subagent do this specific task:
|
|
11
|
-
|
|
12
|
-
- Intent, expected outcome, and relevant user decisions.
|
|
13
|
-
- User-provided references, plus a concise summary after reading them when practical.
|
|
14
|
-
- File paths, symbols, entry points, commands, errors, or logs only when they genuinely clarify the task.
|
|
15
|
-
- Non-default scope, constraints, assumptions, or verification context only when they matter.
|
|
16
|
-
- Gaps or unresolved questions the subagent should account for.
|
|
17
|
-
|
|
18
|
-
Do not restate boilerplate implied by the selected subagent’s role, name, or description. Avoid repeating default scope, edit permissions, output format, generic repo guidance, cwd/branch details, or mechanical Git state the subagent can inspect itself.
|
|
19
|
-
|
|
20
|
-
Do not rely on hidden active-session context. If the subagent needs a decision, conclusion, user intent, or prior result that is not discoverable from files/tools, include it.
|
|
21
|
-
|
|
22
|
-
## Good Brief
|
|
23
|
-
|
|
24
|
-
```md
|
|
25
|
-
Intent / context:
|
|
26
|
-
Password reset emails should expire after 30 minutes. Users report that old reset links still work several hours later.
|
|
27
|
-
|
|
28
|
-
Relevant inputs / entry points:
|
|
29
|
-
- The password reset request handler.
|
|
30
|
-
- The token validation path used by the reset form.
|
|
31
|
-
- Any configuration or database fields that store token expiry.
|
|
32
|
-
|
|
33
|
-
Constraints / decisions:
|
|
34
|
-
- Preserve the existing email template and reset URL format.
|
|
35
|
-
- Do not change login or account creation behavior.
|
|
36
|
-
|
|
37
|
-
Deliverable:
|
|
38
|
-
Identify the likely root cause and the smallest safe fix direction.
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Bad Briefs
|
|
42
|
-
|
|
43
|
-
```md
|
|
44
|
-
Fix this.
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
```md
|
|
48
|
-
Investigate the bug we discussed.
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
```md
|
|
52
|
-
Implement the plan.
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
```md
|
|
56
|
-
Goal: Review the current uncommitted changes for actionable bugs.
|
|
57
|
-
Scope: Current repo changes, staged/unstaged/untracked files.
|
|
58
|
-
Non-goals: Do not modify files.
|
|
59
|
-
Expected output: Findings with severity and fix direction.
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
These depend on hidden conversation state, restate subagent boilerplate, or carry mechanical repository state instead of task-specific intent.
|
|
63
|
-
|
|
64
|
-
## Parallel Delegation
|
|
65
|
-
|
|
66
|
-
Use parallel subagents only when tasks are independent:
|
|
67
|
-
|
|
68
|
-
- Good: one reviewer checks correctness while another checks maintainability.
|
|
69
|
-
- Good: scouts inspect separate modules with non-overlapping files.
|
|
70
|
-
- Bad: two workers edit the same file or feature area simultaneously.
|
|
71
|
-
|
|
72
|
-
If ownership overlaps, serialize the work.
|
|
73
|
-
|
|
74
|
-
## Failure and Conflict Handling
|
|
75
|
-
|
|
76
|
-
- If a subagent errors or aborts, report that status clearly and continue only if remaining results are sufficient.
|
|
77
|
-
- If a result misses the task-specific deliverable, ask a focused follow-up or spawn a new subagent with a corrected brief.
|
|
78
|
-
- If results conflict, do not average them or pick silently. State the conflict, compare evidence, and resolve only with available facts or a targeted follow-up.
|
|
79
|
-
- If a task becomes obsolete, abort the relevant active subagent.
|
|
80
|
-
|
|
81
|
-
## Tool Notes
|
|
82
|
-
|
|
83
|
-
- `crew_list`: discovery before a new spawn decision or requested status snapshot; never completion polling.
|
|
84
|
-
- `crew_spawn`: provide `brief` plus a self-contained `task`; ownership transfers after spawn.
|
|
85
|
-
- `crew_respond`: send a follow-up to a waiting interactive subagent; fire-and-forget.
|
|
86
|
-
- `crew_done`: close a waiting interactive subagent when complete.
|
|
87
|
-
- `crew_abort`: abort active owned subagents only when obsolete, wrong, or cancelled.
|