@melihmucuk/pi-crew 1.0.16 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +8 -8
  2. package/agents/code-reviewer.md +2 -2
  3. package/agents/oracle.md +1 -1
  4. package/agents/planner.md +5 -1
  5. package/agents/quality-reviewer.md +2 -2
  6. package/agents/scout.md +2 -2
  7. package/agents/worker.md +3 -3
  8. package/extension/agent-catalog.ts +369 -0
  9. package/extension/agent-config-fields.ts +359 -0
  10. package/extension/agent-discovery.ts +49 -717
  11. package/extension/index.ts +4 -2
  12. package/extension/integration/crew-tool-actions.ts +306 -0
  13. package/extension/integration/crew-tool-executor.ts +109 -0
  14. package/extension/integration/register-tools.ts +10 -2
  15. package/extension/integration/tool-presentation.ts +0 -20
  16. package/extension/integration/tools/crew-abort.ts +14 -84
  17. package/extension/integration/tools/crew-done.ts +7 -26
  18. package/extension/integration/tools/crew-list.ts +4 -60
  19. package/extension/integration/tools/crew-respond.ts +8 -29
  20. package/extension/integration/tools/crew-spawn.ts +15 -56
  21. package/extension/message-delivery-policy.ts +22 -0
  22. package/extension/runtime/crew-runtime.ts +60 -223
  23. package/extension/runtime/{delivery-coordinator.ts → owner-session-coordinator.ts} +44 -37
  24. package/extension/runtime/subagent-lifecycle.ts +203 -0
  25. package/extension/runtime/subagent-registry.ts +50 -6
  26. package/extension/runtime/subagent-transitions.ts +100 -0
  27. package/extension/subagent-messages.ts +9 -17
  28. package/package.json +8 -6
  29. package/prompts/pi-crew-plan.md +14 -13
  30. package/prompts/pi-crew-review.md +20 -16
  31. package/skills/pi-crew/REFERENCE.md +32 -20
  32. package/skills/pi-crew/SKILL.md +13 -10
  33. package/extension/integration/tools/tool-deps.ts +0 -16
  34. package/extension/integration.ts +0 -13
  35. package/extension/runtime/subagent-state.ts +0 -59
@@ -6,31 +6,36 @@ 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 the review scope, gather only enough context to brief subagents, spawn reviewers, then filter and merge their results. Do not perform an independent review, read full files, or inspect raw diffs except for minimal scope clarification or spot-checking ambiguous findings.
9
+ You are a review orchestrator, not a reviewer. Resolve the review scope, gather only enough task-specific context to brief subagents, spawn reviewers, then filter and merge their results. Do not perform an independent review or inspect raw diffs except for minimal scope clarification or spot-checking ambiguous findings.
10
10
 
11
11
  ## Scope
12
12
 
13
- Use the user's scope when provided. Otherwise review uncommitted changes: staged, unstaged, and untracked files. If “latest” or “recent” is requested, review the last 5 commits unless a count is given.
13
+ Use the user's scope when provided. Otherwise rely on each reviewer’s default scope. If “latest” or “recent” is requested, review the last 5 commits unless a count is given.
14
14
 
15
- Gather minimal context: repo root, current branch, git status, relevant diff stats/name-only, untracked files, and any user instructions. Keep the brief neutral and descriptive, not analytical. Stop when scope and changed files are clear.
15
+ Gather minimal review context: why the changes were made, expected behavior/outcome, feature or bug intent, notable fixes since any prior review, verification already run, and user instructions that are specific to this review.
16
+
17
+ If the user provides a plan, spec, issue, doc, or design file as the source of intent, read it and summarize the behavior the implementation should satisfy. This is allowed context gathering, not independent code review.
18
+
19
+ Keep the brief focused on task-specific intent and outcome, not repository mechanics or reviewer boilerplate. Do not paste full changed-file, staged/unstaged, untracked, branch, cwd, or project-constraint inventories for default reviews; reviewers run in the same repo cwd and can inspect Git state and repo guidance themselves. Include file paths or entry points only when they define scope, identify an intent source, prevent ambiguity, or highlight non-obvious areas.
16
20
 
17
21
  ## Subagents
18
22
 
19
23
  Call `crew_list` first and check for `code-reviewer` and `quality-reviewer`. Spawn available reviewers in parallel. If one is unavailable, fails to start, returns `error`, or is aborted, report that clearly and continue with completed reviewer results.
20
24
 
21
- Send each reviewer a self-contained brief with:
22
- - repo root and branch;
23
- - resolved in-scope review target;
24
- - explicit out-of-scope boundaries;
25
- - commit range or changed file list;
26
- - staged/unstaged/untracked status when relevant;
27
- - short file/group summary;
28
- - additional user instructions;
29
- - instruction to ignore the reviewer’s own default scope if it differs from this brief.
25
+ Send each reviewer a compact, task-specific brief. Include only information that helps this specific review beyond the selected reviewer’s obvious role:
26
+ - user-provided intent source, e.g. plan/spec/doc path, plus a concise summary after reading it;
27
+ - why the changes were made and what outcome is expected;
28
+ - notable prior-review fixes and verification already run, when known;
29
+ - non-default scope, commit range, file paths, or entry-point hints only when they define or clarify scope;
30
+ - additional user instructions that are specific to this review.
31
+
32
+ If you include a Goal, make it specific to the change intent, not the reviewer role or default scope. Prefer omitting Goal when Context/Intent already states the task clearly.
33
+
34
+ For default reviews, do not include a Scope section or mention uncommitted/current repo changes in the subagent brief unless needed to disambiguate scope. If you need to state task-specific emphasis, use `Review focus:` instead of `Scope:`.
35
+
36
+ Do not echo the raw user instruction if it is already represented in the intent summary; quote it only when exact wording matters.
30
37
 
31
- Add agent-specific non-goals:
32
- - `code-reviewer`: review realistic actionable bugs; do not do maintainability/style review.
33
- - `quality-reviewer`: review maintainability structure; do not hunt for bugs.
38
+ 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.
34
39
 
35
40
  Do not poll. Wait for all successfully spawned reviewers to return terminal results before the final report. Never fabricate subagent output.
36
41
 
@@ -67,4 +72,3 @@ Rules:
67
72
  - Do not repeat overlapping findings.
68
73
  - Do not present a single-reviewer finding as consensus.
69
74
  - If both reviewers report no accepted findings, say so clearly.
70
- - Review only; do not change code.
@@ -2,30 +2,35 @@
2
2
 
3
3
  ## Delegation Checklist
4
4
 
5
- Before `crew_spawn`, ensure the brief includes:
5
+ Before `crew_spawn`, ensure the brief is self-contained but not mechanically templated. Include only information that helps this specific subagent do this specific task:
6
6
 
7
- - User goal and agreed decisions.
8
- - Relevant files, symbols, entry points, commands, errors, or logs.
9
- - Scope, constraints, and non-goals.
10
- - Whether the subagent may edit files or must only report.
11
- - Whether the task is exploratory, implementation, review, planning, or verification.
12
- - Expected output format.
13
- - Acceptance criteria.
14
- - Verification command, if known.
7
+ - Intent, expected outcome, and relevant user decisions.
8
+ - User-provided references, plus a concise summary after reading them when practical.
9
+ - File paths, symbols, entry points, commands, errors, or logs only when they genuinely clarify the task.
10
+ - Non-default scope, constraints, assumptions, or verification context only when they matter.
11
+ - Gaps or unresolved questions the subagent should account for.
15
12
 
16
- Do not rely on hidden active-session context. If the subagent needs it, include it.
13
+ 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.
14
+
15
+ 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.
17
16
 
18
17
  ## Good Brief
19
18
 
20
19
  ```md
21
- Goal: Investigate why `crew_done` emits duplicate result messages.
22
- Context: Closing an interactive subagent should dispose the session without sending another result.
23
- Relevant files / entry points: `extension/runtime/crew-runtime.ts`, `extension/integration/tools/crew-done.ts`, `AGENTS.md`.
24
- Constraints: Do not change tool schemas. Do not edit unrelated lifecycle behavior.
25
- Non-goals: Do not refactor session ownership or delivery routing.
26
- Acceptance criteria: Identify root cause and minimal fix direction.
27
- Expected output: Root cause, minimal fix proposal, and verification command. Do not edit files.
28
- Verification: `npm run typecheck` if implementation is later requested.
20
+ Intent / context:
21
+ Password reset emails should expire after 30 minutes. Users report that old reset links still work several hours later.
22
+
23
+ Relevant inputs / entry points:
24
+ - The password reset request handler.
25
+ - The token validation path used by the reset form.
26
+ - Any configuration or database fields that store token expiry.
27
+
28
+ Constraints / decisions:
29
+ - Preserve the existing email template and reset URL format.
30
+ - Do not change login or account creation behavior.
31
+
32
+ Deliverable:
33
+ Identify the likely root cause and the smallest safe fix direction.
29
34
  ```
30
35
 
31
36
  ## Bad Briefs
@@ -42,7 +47,14 @@ Investigate the bug we discussed.
42
47
  Implement the plan.
43
48
  ```
44
49
 
45
- These depend on hidden conversation state and produce inconsistent results.
50
+ ```md
51
+ Goal: Review the current uncommitted changes for actionable bugs.
52
+ Scope: Current repo changes, staged/unstaged/untracked files.
53
+ Non-goals: Do not modify files.
54
+ Expected output: Findings with severity and fix direction.
55
+ ```
56
+
57
+ These depend on hidden conversation state, restate subagent boilerplate, or carry mechanical repository state instead of task-specific intent.
46
58
 
47
59
  ## Parallel Delegation
48
60
 
@@ -57,7 +69,7 @@ If ownership overlaps, serialize the work.
57
69
  ## Failure and Conflict Handling
58
70
 
59
71
  - If a subagent errors or aborts, report that status clearly and continue only if remaining results are sufficient.
60
- - If a result misses acceptance criteria, ask a focused follow-up or spawn a new subagent with a corrected brief.
72
+ - If a result misses the task-specific deliverable, ask a focused follow-up or spawn a new subagent with a corrected brief.
61
73
  - 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.
62
74
  - If a task becomes obsolete, abort the relevant active subagent.
63
75
 
@@ -21,20 +21,23 @@ See [REFERENCE.md](REFERENCE.md) for examples and detailed handling patterns.
21
21
 
22
22
  ## Spawn Brief
23
23
 
24
- Send a self-contained task. Include only relevant sections:
24
+ Send a self-contained task, but do not fill a template mechanically. Use only sections that add task-specific value, for example:
25
25
 
26
26
  ```md
27
- Goal:
28
- Context:
29
- Relevant files / entry points:
30
- Constraints:
31
- Non-goals:
32
- Acceptance criteria:
33
- Expected output:
34
- Verification:
27
+ Intent / context:
28
+ Relevant inputs / entry points:
29
+ Constraints / decisions:
30
+ Deliverable / expected outcome:
31
+ Verification / checks:
35
32
  ```
36
33
 
37
- Include paths, exact errors/output, edit permissions, task type, and constraints when they matter. Prefer path references over copying large file contents.
34
+ Omit sections that would only restate the selected subagent’s role, default scope, edit permissions, output format, or obvious next steps.
35
+
36
+ Include only information that helps this specific subagent do this specific task: intent, expected outcome, relevant decisions, exact errors/output, unusual constraints, and file paths or entry points that genuinely clarify the task. Use short Markdown sections and bullets when they improve scanability, especially for multi-part intent, constraints, observations, requirements, or acceptance criteria; avoid dense paragraphs.
37
+
38
+ Do not restate boilerplate implied by the selected subagent’s role, name, or description. Avoid repeating default scope, output format, edit permissions, or repo guidance. Subagents run in the same cwd as the orchestrator, so do not include mechanical Git state they can inspect themselves, such as full changed-file lists, staged/unstaged/untracked inventories, branch/cwd details, or generic project constraints, unless those details define a non-default scope or prevent ambiguity.
39
+
40
+ If the user points to a plan, spec, issue, design, or doc as task intent, read it when practical and summarize the relevant intent instead of merely passing the path. Prefer explaining why the work matters and what outcome is expected over restating repository state.
38
41
 
39
42
  ## Result Handling
40
43
 
@@ -1,16 +0,0 @@
1
- import type {
2
- ExtensionAPI,
3
- ExtensionContext,
4
- } from "@earendil-works/pi-coding-agent";
5
- import type { AgentDiscoveryWarning } from "../../agent-discovery.js";
6
- import type { CrewRuntime } from "../../runtime/crew-runtime.js";
7
-
8
- export interface CrewToolDeps {
9
- pi: ExtensionAPI;
10
- crew: CrewRuntime;
11
- extensionDir: string;
12
- notifyDiscoveryWarnings: (
13
- ctx: ExtensionContext,
14
- warnings: AgentDiscoveryWarning[],
15
- ) => void;
16
- }
@@ -1,13 +0,0 @@
1
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
- import type { CrewRuntime } from "./runtime/crew-runtime.js";
3
- import { registerCrewMessageRenderers } from "./integration/register-renderers.js";
4
- import { registerCrewTools } from "./integration/register-tools.js";
5
-
6
- export function registerCrewIntegration(
7
- pi: ExtensionAPI,
8
- crew: CrewRuntime,
9
- extensionDir: string,
10
- ): void {
11
- registerCrewTools(pi, crew, extensionDir);
12
- registerCrewMessageRenderers(pi);
13
- }
@@ -1,59 +0,0 @@
1
- import { randomBytes } from "node:crypto";
2
- import type { AgentSession } from "@earendil-works/pi-coding-agent";
3
- import type { AgentConfig } from "../agent-discovery.js";
4
- import type { SubagentStatus } from "../subagent-messages.js";
5
-
6
- export interface SubagentState {
7
- id: string;
8
- agentConfig: AgentConfig;
9
- task: string;
10
- status: SubagentStatus;
11
- ownerSessionId: string;
12
- session: AgentSession | null;
13
- turns: number;
14
- contextTokens: number;
15
- model: string | undefined;
16
- error?: string;
17
- result?: string;
18
- promptAbortController?: AbortController;
19
- unsubscribe?: () => void;
20
- }
21
-
22
- export interface ActiveAgentSummary {
23
- id: string;
24
- agentName: string;
25
- status: SubagentStatus;
26
- turns: number;
27
- contextTokens: number;
28
- model: string | undefined;
29
- }
30
-
31
- export function generateId(name: string, existingIds: Set<string>): string {
32
- for (let i = 0; i < 10; i++) {
33
- const id = `${name}-${randomBytes(4).toString("hex")}`;
34
- if (!existingIds.has(id)) return id;
35
- }
36
- return `${name}-${randomBytes(8).toString("hex")}`;
37
- }
38
-
39
- // Status may change externally via abort(). Standalone function avoids TS narrowing.
40
- export function isAborted(state: SubagentState): boolean {
41
- return state.status === "aborted";
42
- }
43
-
44
- export function isAbortableStatus(status: SubagentStatus): boolean {
45
- return status === "running" || status === "waiting";
46
- }
47
-
48
- export function buildActiveAgentSummary(
49
- state: SubagentState,
50
- ): ActiveAgentSummary {
51
- return {
52
- id: state.id,
53
- agentName: state.agentConfig.name,
54
- status: state.status,
55
- turns: state.turns,
56
- contextTokens: state.contextTokens,
57
- model: state.model,
58
- };
59
- }