@melihmucuk/pi-crew 1.0.8 → 1.0.10
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/agents/code-reviewer.md +58 -18
- package/agents/oracle.md +9 -4
- package/agents/planner.md +25 -3
- package/agents/quality-reviewer.md +62 -21
- package/agents/scout.md +33 -26
- package/agents/worker.md +16 -0
- package/dist/index.js +0 -20
- package/dist/integration/tools/crew-list.js +10 -18
- package/dist/integration/tools/crew-respond.js +3 -0
- package/dist/integration/tools/crew-spawn.js +2 -1
- package/package.json +1 -1
- package/prompts/pi-crew-plan.md +95 -119
- package/prompts/pi-crew-review.md +89 -115
- package/dist/prompt-injection.d.ts +0 -8
- package/dist/prompt-injection.js +0 -39
|
@@ -15,26 +15,16 @@ export function registerCrewListTool({ pi, crew, notifyDiscoveryWarnings, }) {
|
|
|
15
15
|
const callerSessionId = ctx.sessionManager.getSessionId();
|
|
16
16
|
const running = crew.getActiveSummariesForOwner(callerSessionId);
|
|
17
17
|
const lines = [];
|
|
18
|
-
lines.push("## Available
|
|
18
|
+
lines.push("## Available Subagents");
|
|
19
19
|
if (agents.length === 0) {
|
|
20
20
|
lines.push("No valid subagent definitions found. Add `.md` files to `<cwd>/.pi/agents/` or `~/.pi/agent/agents/`.");
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
23
|
for (const agent of agents) {
|
|
24
24
|
lines.push("");
|
|
25
|
-
lines.push(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (agent.model)
|
|
29
|
-
lines.push(` model: ${agent.model}`);
|
|
30
|
-
if (agent.interactive)
|
|
31
|
-
lines.push(" interactive: true");
|
|
32
|
-
if (agent.tools !== undefined) {
|
|
33
|
-
lines.push(` tools: ${agent.tools.length > 0 ? agent.tools.join(", ") : "none"}`);
|
|
34
|
-
}
|
|
35
|
-
if (agent.skills !== undefined) {
|
|
36
|
-
lines.push(` skills: ${agent.skills.length > 0 ? agent.skills.join(", ") : "none"}`);
|
|
37
|
-
}
|
|
25
|
+
lines.push(`name: ${agent.name}`);
|
|
26
|
+
lines.push(`description: ${agent.description}`);
|
|
27
|
+
lines.push(`interactive: ${agent.interactive ? "true" : "false"}`);
|
|
38
28
|
}
|
|
39
29
|
}
|
|
40
30
|
if (warnings.length > 0) {
|
|
@@ -45,7 +35,7 @@ export function registerCrewListTool({ pi, crew, notifyDiscoveryWarnings, }) {
|
|
|
45
35
|
}
|
|
46
36
|
}
|
|
47
37
|
lines.push("");
|
|
48
|
-
lines.push("## Active
|
|
38
|
+
lines.push("## Active Subagents");
|
|
49
39
|
if (running.length === 0) {
|
|
50
40
|
lines.push("No subagents currently active.");
|
|
51
41
|
}
|
|
@@ -53,9 +43,11 @@ export function registerCrewListTool({ pi, crew, notifyDiscoveryWarnings, }) {
|
|
|
53
43
|
for (const agent of running) {
|
|
54
44
|
const icon = STATUS_ICON[agent.status] ?? "❓";
|
|
55
45
|
lines.push("");
|
|
56
|
-
lines.push(
|
|
57
|
-
lines.push(`
|
|
58
|
-
lines.push(`
|
|
46
|
+
lines.push(`id: ${agent.id}`);
|
|
47
|
+
lines.push(`name: ${agent.agentName}`);
|
|
48
|
+
lines.push(`status: ${icon} ${agent.status}`);
|
|
49
|
+
lines.push(`task: ${agent.taskPreview}`);
|
|
50
|
+
lines.push(`turns: ${agent.turns}`);
|
|
59
51
|
}
|
|
60
52
|
}
|
|
61
53
|
const text = lines.join("\n");
|
|
@@ -12,6 +12,9 @@ export function registerCrewRespondTool({ pi, crew }) {
|
|
|
12
12
|
message: Type.String({ description: "Message to send to the subagent" }),
|
|
13
13
|
}),
|
|
14
14
|
promptSnippet: "Send a follow-up message to a waiting interactive subagent.",
|
|
15
|
+
promptGuidelines: [
|
|
16
|
+
"crew_respond: Response is delivered asynchronously as a steering message. Do not poll crew_list.",
|
|
17
|
+
],
|
|
15
18
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
16
19
|
const callerSessionId = ctx.sessionManager.getSessionId();
|
|
17
20
|
const { error } = crew.respond(params.subagent_id, params.message, callerSessionId);
|
|
@@ -14,9 +14,10 @@ export function registerCrewSpawnTool({ pi, crew, extensionDir, notifyDiscoveryW
|
|
|
14
14
|
promptGuidelines: [
|
|
15
15
|
"Use crew_list first to see available subagents before spawning.",
|
|
16
16
|
"crew_spawn: The subagent runs in isolation with no access to your session. Include file paths, requirements, and known locations directly in the task parameter.",
|
|
17
|
-
"crew_spawn: DELEGATE means
|
|
17
|
+
"crew_spawn: DELEGATE means OWNERSHIP TRANSFER. Once you spawn a subagent for a task, that task is exclusively theirs. If you also work on it, you waste the subagent's effort and create conflicting results. After spawning, work on an UNRELATED task or end your turn.",
|
|
18
18
|
"crew_spawn: To avoid duplication, gather only enough context to write a useful task (key files, entry points). Do not pre-investigate the full problem.",
|
|
19
19
|
"crew_spawn: Results arrive asynchronously as steering messages. Do not predict or fabricate results. Wait for all crew-result messages before acting on them.",
|
|
20
|
+
"crew_spawn: Never use crew_list as a completion polling loop. Wait for the steering message.",
|
|
20
21
|
"crew_spawn: Interactive subagents stay alive after responding. Use crew_respond to continue and crew_done to close when finished.",
|
|
21
22
|
],
|
|
22
23
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
package/package.json
CHANGED
package/prompts/pi-crew-plan.md
CHANGED
|
@@ -11,171 +11,147 @@ description: Run parallel subagents to investigate a codebase and produce an imp
|
|
|
11
11
|
## Role
|
|
12
12
|
|
|
13
13
|
This is an orchestration prompt.
|
|
14
|
-
|
|
14
|
+
Understand the task, gather minimal orientation context, delegate discovery to scout subagents, collect their findings, delegate planning to a planner subagent, and relay the planner's result to the user.
|
|
15
15
|
|
|
16
|
-
Do not perform deep
|
|
16
|
+
Do not perform deep investigation yourself.
|
|
17
17
|
Do not write the plan yourself.
|
|
18
|
-
Do not modify
|
|
18
|
+
Do not modify files.
|
|
19
19
|
|
|
20
|
-
##
|
|
21
|
-
|
|
22
|
-
- Do not read full source files before spawning scouts.
|
|
23
|
-
- Do not perform broad codebase searches yourself.
|
|
24
|
-
- Gather only enough context to understand what the task is and how to split the discovery work across scouts.
|
|
25
|
-
- Detailed file reading, pattern analysis, and dependency tracing belong to the scouts.
|
|
26
|
-
- Plan creation belongs to the planner.
|
|
27
|
-
|
|
28
|
-
## Required Workflow
|
|
29
|
-
|
|
30
|
-
### 1) Understand the task
|
|
20
|
+
## Task Resolution
|
|
31
21
|
|
|
32
22
|
Determine the task from:
|
|
33
23
|
|
|
34
|
-
-
|
|
35
|
-
- the current conversation context
|
|
24
|
+
- additional instructions, if provided
|
|
25
|
+
- otherwise the current conversation context
|
|
36
26
|
|
|
37
|
-
If the task is still unclear
|
|
27
|
+
If the task is still unclear, ask the user to clarify before proceeding.
|
|
38
28
|
|
|
39
|
-
Identify
|
|
29
|
+
Identify any user-provided references that subagents may need, including file paths, images, documents, screenshots, or URLs. Include them explicitly in subagent tasks. Do not assume subagents can access this conversation context unless you pass it along.
|
|
40
30
|
|
|
41
|
-
|
|
31
|
+
## Orientation Context
|
|
42
32
|
|
|
43
|
-
|
|
33
|
+
Gather only enough context to assign focused scout tasks.
|
|
44
34
|
|
|
45
|
-
|
|
46
|
-
- key config files (package.json, go.mod, Cargo.toml, etc.) to identify language, framework, dependencies
|
|
47
|
-
- README or AGENTS.md if present, for project conventions
|
|
35
|
+
Start with:
|
|
48
36
|
|
|
49
|
-
|
|
37
|
+
- top-level project structure
|
|
38
|
+
- key config files to identify language, framework, and dependencies
|
|
39
|
+
- README or AGENTS.md if present
|
|
50
40
|
|
|
51
|
-
If
|
|
41
|
+
If needed, do lightweight exploration to find the relevant areas:
|
|
52
42
|
|
|
53
|
-
- browse
|
|
54
|
-
- read a few lines of entry points or index files
|
|
55
|
-
- run targeted searches
|
|
43
|
+
- browse directories
|
|
44
|
+
- read a few lines of entry points or index files
|
|
45
|
+
- run targeted searches for task-related terms
|
|
56
46
|
|
|
57
|
-
|
|
47
|
+
Stop once you can assign specific scout scopes. Watch for diminishing returns: if the last few files or directories you browsed produced no new insight relevant to scoping, you have enough orientation—proceed to assign scouts.
|
|
48
|
+
Do not trace call chains, analyze implementations, or read full files.
|
|
58
49
|
|
|
59
|
-
###
|
|
50
|
+
### Scope Extraction
|
|
60
51
|
|
|
61
|
-
|
|
52
|
+
Before assigning any scout tasks, extract the scope boundary from the user's task:
|
|
62
53
|
|
|
63
|
-
|
|
54
|
+
- **What the task requires** (in scope)
|
|
55
|
+
- **What the task does NOT require** (out of scope)
|
|
56
|
+
- **Scope assumptions** (if any)
|
|
64
57
|
|
|
65
|
-
|
|
66
|
-
- the specific area or question to investigate
|
|
67
|
-
- enough framing so the scout knows what to look for
|
|
58
|
+
Pass this scope boundary explicitly to every scout and to the planner. This gives subagents an explicit contract to check against, rather than having them infer scope from the task description alone.
|
|
68
59
|
|
|
69
|
-
|
|
60
|
+
## Scout Execution
|
|
70
61
|
|
|
71
|
-
|
|
72
|
-
- If the task spans multiple areas (e.g., API + database + frontend), spawn a separate scout per area.
|
|
73
|
-
- If the task requires understanding an existing pattern before proposing changes, dedicate a scout to "find existing patterns/conventions for X".
|
|
74
|
-
- Do not spawn more than 4 scouts. Each scout should have a distinct, non-overlapping investigation focus.
|
|
62
|
+
Call `crew_list` first and verify `scout` is available.
|
|
75
63
|
|
|
76
|
-
Each scout
|
|
64
|
+
Spawn up to 4 scouts in parallel. Each scout must have a distinct, non-overlapping focus.
|
|
77
65
|
|
|
78
|
-
|
|
79
|
-
- project root path
|
|
80
|
-
- the orientation context you already gathered (language, framework, key dependencies, project structure, conventions) so the scout does not repeat this work
|
|
81
|
-
- clear investigation scope (which directories, files, or concepts to explore)
|
|
82
|
-
- what specific information to return (types, interfaces, data flow, dependencies, etc.)
|
|
83
|
-
- any external references from the user (file paths, image paths, documents) that are relevant to this scout's scope, with instructions to inspect them
|
|
84
|
-
- explicit instruction that it is read-only
|
|
66
|
+
Each scout task should include:
|
|
85
67
|
|
|
86
|
-
|
|
68
|
+
- the user's task
|
|
69
|
+
- project root
|
|
70
|
+
- minimal orientation context already gathered
|
|
71
|
+
- **explicit scope boundary** (what's in scope and out of scope for this scout)
|
|
72
|
+
- explicit investigation scope
|
|
73
|
+
- the specific information to return
|
|
74
|
+
- any relevant user-provided references
|
|
75
|
+
- explicit read-only instruction
|
|
87
76
|
|
|
88
|
-
|
|
77
|
+
Keep scout scopes narrow and non-overlapping. A scout that is asked to "investigate the auth system" will explore broadly. A scout that is asked to "find how login tokens are generated and which function validates them" will stay focused. Prefer the latter.
|
|
89
78
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
Do not predict or fabricate scout findings.
|
|
93
|
-
Wait for all `crew-result` messages.
|
|
79
|
+
If the task touches one area, one scout may be enough.
|
|
80
|
+
If it spans multiple areas, split scouts by area or question.
|
|
94
81
|
|
|
95
|
-
Scout
|
|
82
|
+
## Scout Waiting and Recovery
|
|
96
83
|
|
|
97
|
-
|
|
84
|
+
Wait for all spawned scouts to return.
|
|
85
|
+
Do not synthesize partial findings.
|
|
86
|
+
Do not fabricate scout results.
|
|
87
|
+
Do not poll repeatedly while waiting; results arrive asynchronously.
|
|
98
88
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
89
|
+
If a scout fails or times out, retry once.
|
|
90
|
+
If a scout returns without useful findings, reformulate the task and spawn a replacement scout.
|
|
91
|
+
If a retried or replacement scout still fails, proceed with the findings you have and note the gap for the planner.
|
|
102
92
|
|
|
103
|
-
|
|
93
|
+
## Planner Execution
|
|
104
94
|
|
|
105
95
|
Call `crew_list` first and verify `planner` is available.
|
|
106
96
|
|
|
107
|
-
Before spawning the planner
|
|
108
|
-
|
|
109
|
-
- Remove duplicate information that multiple scouts reported.
|
|
110
|
-
- Drop generic observations that are not relevant to the task.
|
|
111
|
-
- Keep all specific findings: file paths, function signatures, type definitions, data flows, constraints, and patterns.
|
|
112
|
-
- Organize by area, not by scout. If two scouts reported on overlapping areas, merge their findings under one heading.
|
|
113
|
-
- If scouts reported conflicting information, include both and flag the contradiction.
|
|
114
|
-
|
|
115
|
-
Then spawn the planner subagent with:
|
|
116
|
-
|
|
117
|
-
- the user's original task description (verbatim)
|
|
118
|
-
- any additional user instructions or constraints
|
|
119
|
-
- all external references from the user (file paths, image paths, screenshots, documents, URLs) with instructions to inspect them directly
|
|
120
|
-
- the processed scout findings, organized by area
|
|
121
|
-
- project root path
|
|
122
|
-
- language, framework, key dependencies
|
|
123
|
-
- relevant conventions or constraints discovered by scouts
|
|
124
|
-
- any gaps in discovery (scouts that failed or returned empty) so the planner knows what was not investigated
|
|
125
|
-
- explicit instruction that comprehensive context has been pre-gathered by scouts, and the planner should rely on the provided findings first; it should only perform its own discovery if the provided context is insufficient for a specific aspect
|
|
126
|
-
|
|
127
|
-
The planner is an interactive subagent. It will respond with one of:
|
|
128
|
-
|
|
129
|
-
- **Blocking Questions**: questions that need user input before a plan can be made
|
|
130
|
-
- **Implementation Plan**: the complete plan
|
|
131
|
-
- **No plan needed**: the task is trivial enough that a plan adds no value
|
|
132
|
-
|
|
133
|
-
### 6) Relay planner output
|
|
134
|
-
|
|
135
|
-
When the planner responds:
|
|
97
|
+
Before spawning the planner:
|
|
136
98
|
|
|
137
|
-
|
|
99
|
+
- remove duplicate scout findings
|
|
100
|
+
- drop irrelevant generic observations
|
|
101
|
+
- drop findings outside the scope boundary (scouts sometimes drift)
|
|
102
|
+
- organize findings by area
|
|
103
|
+
- preserve specific facts, constraints, paths, interfaces, and conflicts
|
|
104
|
+
- watch for diminishing returns: if later findings repeat or add no new specifics, you have enough—proceed to the planner rather than processing further
|
|
138
105
|
|
|
139
|
-
|
|
106
|
+
Spawn the planner with:
|
|
140
107
|
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
108
|
+
- the user's task
|
|
109
|
+
- additional instructions or constraints
|
|
110
|
+
- relevant user-provided references
|
|
111
|
+
- **explicit scope boundary** (in-scope / out-of-scope as extracted from the task)
|
|
112
|
+
- processed scout findings
|
|
113
|
+
- project root
|
|
114
|
+
- language, framework, dependencies
|
|
115
|
+
- relevant conventions
|
|
116
|
+
- any discovery gaps
|
|
145
117
|
|
|
146
|
-
|
|
118
|
+
The planner is interactive. It may return:
|
|
147
119
|
|
|
148
|
-
-
|
|
149
|
-
-
|
|
150
|
-
-
|
|
120
|
+
- Blocking Questions
|
|
121
|
+
- Implementation Plan
|
|
122
|
+
- No plan needed
|
|
151
123
|
|
|
152
|
-
|
|
124
|
+
## Relay
|
|
153
125
|
|
|
154
|
-
|
|
155
|
-
- Briefly explain why no plan is needed.
|
|
156
|
-
- Using the scout findings, suggest that the task can be implemented directly and summarize the relevant context the scouts gathered that would help with implementation.
|
|
126
|
+
Do not rewrite subagent output that is already visible as a steering message.
|
|
157
127
|
|
|
158
|
-
|
|
128
|
+
If the planner returns blocking questions:
|
|
129
|
+
- ask the user to answer them
|
|
130
|
+
- relay the user's response with `crew_respond`
|
|
131
|
+
- wait for the next planner response
|
|
159
132
|
|
|
160
|
-
|
|
161
|
-
-
|
|
133
|
+
If the planner returns an implementation plan:
|
|
134
|
+
- tell the user the plan is ready and ask for approval or feedback
|
|
135
|
+
- relay any feedback with `crew_respond`
|
|
136
|
+
- wait for the updated planner response
|
|
162
137
|
|
|
163
|
-
|
|
138
|
+
If the planner returns no plan needed:
|
|
139
|
+
- close the planner with `crew_done`
|
|
140
|
+
- briefly tell the user no plan is needed and that the task can be implemented directly
|
|
164
141
|
|
|
165
|
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
- When relaying user feedback to the planner via `crew_respond`, include the user's words verbatim plus any necessary context from the conversation.
|
|
142
|
+
If the user approves the plan:
|
|
143
|
+
- close the planner with `crew_done`
|
|
144
|
+
- confirm that the plan is finalized
|
|
169
145
|
|
|
170
146
|
## Language
|
|
171
147
|
|
|
172
|
-
|
|
173
|
-
When spawning scouts and the planner, instruct them to respond in the same language as the user's prompt.
|
|
148
|
+
Respond to the user in the same language as the user's request.
|
|
174
149
|
|
|
175
|
-
##
|
|
150
|
+
## Rules
|
|
176
151
|
|
|
177
|
-
-
|
|
178
|
-
-
|
|
179
|
-
-
|
|
180
|
-
-
|
|
181
|
-
-
|
|
152
|
+
- Do not investigate deeply yourself; delegate to scouts.
|
|
153
|
+
- Do not write, modify, or finalize the plan yourself; use the planner.
|
|
154
|
+
- Never answer planner questions on behalf of the user.
|
|
155
|
+
- Never fabricate subagent results.
|
|
156
|
+
- Always wait for explicit user approval before finalizing the plan.
|
|
157
|
+
- Do not expand scope beyond what the user asked. If scouts return findings outside the task scope, drop them before passing to the planner.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Run parallel code and quality reviews
|
|
2
|
+
description: Run parallel code and quality reviews by gathering minimal context and orchestrating reviewer subagents.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Parallel Review
|
|
@@ -11,29 +11,23 @@ description: Run parallel code and quality reviews to ensure high standards and
|
|
|
11
11
|
## Role
|
|
12
12
|
|
|
13
13
|
This is an orchestration prompt.
|
|
14
|
-
|
|
14
|
+
Determine review scope with minimal context gathering, prepare a short neutral brief, spawn the reviewer subagents, wait for their results, and merge them into one final report.
|
|
15
15
|
|
|
16
|
-
Do not
|
|
16
|
+
Do not perform the review yourself.
|
|
17
|
+
Do not perform a broad second review or re-investigate the whole repository. Your job is orchestration, filtering, and merging. If a reviewer finding is ambiguous, high-impact, or appears out of scope, you may do a minimal spot-check to clarify whether it is concrete enough to include.
|
|
17
18
|
|
|
18
|
-
##
|
|
19
|
+
## Scope Rules
|
|
19
20
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
## Required Workflow
|
|
21
|
+
- If the user specifies a scope (commit, branch, files, PR, or focus area), that scope overrides the default scope.
|
|
22
|
+
- Otherwise, default scope includes:
|
|
23
|
+
- recent commits
|
|
24
|
+
- staged changes
|
|
25
|
+
- unstaged changes
|
|
26
|
+
- untracked files
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
## Context Gathering
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- recent commits
|
|
34
|
-
- staged changes
|
|
35
|
-
- unstaged changes
|
|
36
|
-
- untracked files
|
|
30
|
+
Collect only enough context to define scope and prepare a short brief.
|
|
37
31
|
|
|
38
32
|
Collect:
|
|
39
33
|
|
|
@@ -45,130 +39,110 @@ Collect:
|
|
|
45
39
|
- `git diff --stat`
|
|
46
40
|
- untracked file list
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
Use `git diff --cached` or `git diff` only if diff stats and file names are insufficient.
|
|
50
|
-
|
|
51
|
-
Recent commit range:
|
|
42
|
+
For recent commits:
|
|
52
43
|
|
|
53
44
|
- use `HEAD~3..HEAD` if at least 3 commits exist
|
|
54
45
|
- otherwise use the widest reachable history range
|
|
55
46
|
|
|
56
|
-
|
|
47
|
+
Collect for that range:
|
|
57
48
|
|
|
58
49
|
- `git diff --stat <range>`
|
|
59
50
|
- `git diff --name-only <range>`
|
|
60
51
|
|
|
61
|
-
|
|
52
|
+
Rules:
|
|
62
53
|
|
|
63
|
-
|
|
54
|
+
- Do not read full files before spawning subagents.
|
|
55
|
+
- Do not dump raw diffs into the prompt.
|
|
56
|
+
- Do not inspect every changed file manually.
|
|
57
|
+
- Use full diffs or targeted reads only when file names and diff stats are insufficient to produce a short neutral summary.
|
|
58
|
+
- Keep the brief short and descriptive, not analytical.
|
|
59
|
+
- Watch for diminishing returns: if you have enough to define scope and write the brief, stop gathering context. More git commands or file reads at this stage add noise, not clarity.
|
|
64
60
|
|
|
65
|
-
|
|
61
|
+
## Subagent Preparation
|
|
66
62
|
|
|
67
|
-
|
|
63
|
+
Call `crew_list` first and verify that both are available:
|
|
68
64
|
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
|
|
65
|
+
- `code-reviewer`
|
|
66
|
+
- `quality-reviewer`
|
|
67
|
+
|
|
68
|
+
Prepare one short brief for both reviewers including:
|
|
69
|
+
|
|
70
|
+
- repo root
|
|
71
|
+
- resolved review scope
|
|
72
|
+
- commit range if any
|
|
73
|
+
- staged / unstaged / untracked status
|
|
72
74
|
- changed files
|
|
73
|
-
-
|
|
75
|
+
- short summary per file or file group
|
|
74
76
|
- additional user instructions
|
|
77
|
+
- **explicit scope boundary**: what is being reviewed (in scope) and what is not being reviewed (out of scope). For example: "Only the auth module changes are in scope. The unrelated CSS refactor in the same PR is out of scope for this review."
|
|
75
78
|
|
|
76
|
-
|
|
79
|
+
## Execution
|
|
77
80
|
|
|
78
|
-
-
|
|
79
|
-
- read only specific files or hunks if needed
|
|
80
|
-
- keep it short
|
|
81
|
-
- do not perform review analysis here
|
|
81
|
+
Spawn `code-reviewer` and `quality-reviewer` in parallel.
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
If one reviewer is unavailable or fails to start, report that clearly and continue with the reviewer that is available.
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
Do not produce a final report until all successfully spawned reviewers have returned a result.
|
|
86
|
+
Do not poll or repeatedly check active subagents while waiting; results will be delivered asynchronously.
|
|
86
87
|
|
|
87
|
-
|
|
88
|
-
- `quality-reviewer`
|
|
88
|
+
## Findings Acceptance Gate
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
Each task must include:
|
|
90
|
+
Before including a reviewer finding in the final report, apply these filters:
|
|
92
91
|
|
|
93
|
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
-
|
|
92
|
+
Include a finding only if:
|
|
93
|
+
- it is actionable now
|
|
94
|
+
- it describes a realistic scenario for this project
|
|
95
|
+
- it includes a concrete trigger or maintenance impact
|
|
96
|
+
- it includes evidence or a clear rationale from the reviewer
|
|
97
|
+
- its severity matches the described likelihood and impact
|
|
98
|
+
|
|
99
|
+
Exclude findings that are:
|
|
100
|
+
- speculative or theory-driven (no realistic trigger)
|
|
101
|
+
- based on broken invariants or unsupported usage
|
|
102
|
+
- style preferences or optional refactors without concrete bug risk
|
|
103
|
+
- vague suggestions without concrete trigger, impact, or evidence
|
|
104
|
+
|
|
105
|
+
Do not exclude a legitimate Minor finding that has a concrete trigger and realistic near-term impact. Minor findings with evidence pass the gate; Minor findings without evidence do not.
|
|
102
106
|
|
|
103
|
-
|
|
107
|
+
If a finding clearly fails the gate, omit it rather than forwarding reviewer noise to the user. Prefer omission for weak or optional findings, but do not discard a potentially important finding solely because the reviewer wrote it imperfectly. The merged report should be shorter and more impactful than the raw reviewer outputs, not a concatenation of them.
|
|
104
108
|
|
|
105
|
-
|
|
106
|
-
Do not synthesize partial results.
|
|
107
|
-
Wait for two separate `crew-result` messages.
|
|
109
|
+
## Merge
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
Write the final response in the same language as the user's request.
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
Use the structure below directly. Do not read any subagent definition files just to reconstruct the format.
|
|
113
|
+
Structure:
|
|
113
114
|
|
|
114
|
-
|
|
115
|
+
### Consensus Findings
|
|
115
116
|
|
|
116
|
-
|
|
117
|
+
Merge only findings that are clearly the same issue reported by both reviewers.
|
|
117
118
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
### Code Review Findings
|
|
120
|
+
|
|
121
|
+
Include findings reported only by `code-reviewer`.
|
|
122
|
+
|
|
123
|
+
### Quality Review Findings
|
|
124
|
+
|
|
125
|
+
Include findings reported only by `quality-reviewer`.
|
|
126
|
+
|
|
127
|
+
### Final Summary
|
|
128
|
+
|
|
129
|
+
Include:
|
|
130
|
+
|
|
131
|
+
- review scope
|
|
132
|
+
- which reviewers ran
|
|
133
|
+
- consensus findings count
|
|
134
|
+
- code review findings count
|
|
135
|
+
- quality review findings count
|
|
136
|
+
- overall assessment
|
|
124
137
|
|
|
125
138
|
Rules:
|
|
126
139
|
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
Context: ...
|
|
137
|
-
Suggestion: ...
|
|
138
|
-
Reported by: `code-reviewer`
|
|
139
|
-
|
|
140
|
-
#### C. Quality Review Findings
|
|
141
|
-
|
|
142
|
-
**[SEVERITY] Category: Brief title**
|
|
143
|
-
File: `path/to/file.ts` (functionName or section, line range if identifiable)
|
|
144
|
-
Issue: ...
|
|
145
|
-
Impact: ...
|
|
146
|
-
Suggestion: ...
|
|
147
|
-
Reported by: `quality-reviewer`
|
|
148
|
-
|
|
149
|
-
#### D. Final Summary
|
|
150
|
-
|
|
151
|
-
**Combined Review Summary**
|
|
152
|
-
Files reviewed: [count or list]
|
|
153
|
-
Consensus findings: [count]
|
|
154
|
-
Code review findings: [count by severity]
|
|
155
|
-
Quality review findings: [count by severity]
|
|
156
|
-
Strong signals: [titles found by both reviewers or `none`]
|
|
157
|
-
Overall assessment: [short clear assessment]
|
|
158
|
-
|
|
159
|
-
## Synthesis Rules
|
|
160
|
-
|
|
161
|
-
- do not repeat overlapping issues
|
|
162
|
-
- merge close variants into one item
|
|
163
|
-
- do not invent resolution for reviewer conflicts
|
|
164
|
-
- if both say `No issues found.`, say so explicitly
|
|
165
|
-
- if only one reviewer reports an issue, do not present it as consensus
|
|
166
|
-
- sort by severity
|
|
167
|
-
- no unnecessary introduction
|
|
168
|
-
- review only, no code changes
|
|
169
|
-
|
|
170
|
-
## IMPORTANT
|
|
171
|
-
|
|
172
|
-
- DO NOT perform any code review or quality review analysis yourself.
|
|
173
|
-
- SPAWN the subagents with the review context and WAIT for their results.
|
|
174
|
-
- NEVER PREDICT or FABRICATE results for subagents that have not yet reported back to you.
|
|
140
|
+
- Do not repeat overlapping findings.
|
|
141
|
+
- Do not invent reviewer output, evidence, or counts.
|
|
142
|
+
- Do not present a single-reviewer finding as consensus.
|
|
143
|
+
- Apply the Findings Acceptance Gate before merging. Do not forward weak, speculative, or optional findings; if a single-reviewer finding appears important but ambiguous, do a minimal spot-check before deciding.
|
|
144
|
+
- If both reviewers report no issues, say so explicitly.
|
|
145
|
+
- If one reviewer failed or was unavailable, say so explicitly.
|
|
146
|
+
- Review only. Do not make code changes.
|
|
147
|
+
- Do not perform independent review beyond minimal scope and validity checks on reviewer findings. Only orchestrate reviewers and merge their reported results.
|
|
148
|
+
- Never fabricate subagent results. Wait for all successfully spawned reviewers to return.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { AgentConfig } from "./agent-discovery.js";
|
|
2
|
-
/**
|
|
3
|
-
* Format discovered agent definitions for inclusion in the system prompt.
|
|
4
|
-
* Uses XML format consistent with pi's skill injection.
|
|
5
|
-
*
|
|
6
|
-
* Returns an empty string when no agents are available.
|
|
7
|
-
*/
|
|
8
|
-
export declare function formatAgentsForPrompt(agents: AgentConfig[]): string;
|