@deathbeam/pi-delegate 0.0.12 → 0.0.13
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 +3 -2
- package/agents/explore.md +1 -1
- package/agents/general.md +1 -1
- package/agents/researcher.md +1 -1
- package/agents/reviewer.md +1 -1
- package/index.ts +20 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Use `/delegate` command to view and manage jobs in a full-screen TUI.
|
|
|
8
8
|
```sh
|
|
9
9
|
# Choose one:
|
|
10
10
|
pi install npm:@deathbeam/pi-delegate # this package
|
|
11
|
-
pi install git:github.com/deathbeam/pi-packages # all
|
|
11
|
+
pi install git:github.com/deathbeam/pi-packages # all my packages
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Configuration
|
|
@@ -45,7 +45,8 @@ thinking: low
|
|
|
45
45
|
Explore the codebase and report relevant paths.
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
Omit `tools` to inherit active tools. `model` can also be an explicit `provider/model`.
|
|
48
|
+
Omit `tools` to inherit active tools. `model` can also be an explicit `provider/model`. The model sees the agent list from
|
|
49
|
+
when the extension loaded, so run `/reload` after adding agents or changing their descriptions.
|
|
49
50
|
|
|
50
51
|
## Development
|
|
51
52
|
|
package/agents/explore.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: explore
|
|
3
|
-
description: "Read-only codebase
|
|
3
|
+
description: "Read-only codebase search: finds files, callers, and data flow. Use proactively for open-ended searches and before editing unfamiliar code; launch one per independent area."
|
|
4
4
|
tools: read, grep, find, ls
|
|
5
5
|
model: cheap
|
|
6
6
|
thinking: low
|
package/agents/general.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: general
|
|
3
|
-
description:
|
|
3
|
+
description: Multi-step work in its own context; can inspect, edit, run commands, and validate. Use for independent subtasks, repetitive edits across many files, or test and build runs whose output you need only summarized.
|
|
4
4
|
tools: read, grep, find, ls, bash, edit, write
|
|
5
5
|
model: balanced
|
|
6
6
|
thinking: high
|
package/agents/researcher.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: researcher
|
|
3
|
-
description: Web research with cited sources. Use
|
|
3
|
+
description: Web research with cited sources. Use proactively whenever the answer needs external docs, versions, or current facts, instead of searching and fetching pages yourself.
|
|
4
4
|
tools: read, web_search, web_fetch
|
|
5
5
|
model: balanced
|
|
6
6
|
thinking: medium
|
package/agents/reviewer.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: reviewer
|
|
3
|
-
description: Independent review of a diff, plan, or finished change. Use before claiming work is done.
|
|
3
|
+
description: Independent review of a diff, plan, or finished change. Use proactively before claiming non-trivial work is done.
|
|
4
4
|
tools: read, grep, find, ls, bash
|
|
5
5
|
model: strong
|
|
6
6
|
thinking: high
|
package/index.ts
CHANGED
|
@@ -350,16 +350,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
350
350
|
viewing = undefined;
|
|
351
351
|
});
|
|
352
352
|
|
|
353
|
-
pi.on("before_agent_start", (event, ctx) => {
|
|
354
|
-
const agents = discoverAgents(ctx.cwd, configFor(ctx.cwd).agentDirs);
|
|
355
|
-
// pi wraps each section in a tag of the same name, so this content stays untagged.
|
|
356
|
-
event.systemPromptOptions.sections.agents = [
|
|
357
|
-
"Available agents:",
|
|
358
|
-
...agents.map((agent) => `- ${agent.name}: ${agent.description}`),
|
|
359
|
-
"Delegation is authorized here. Before context-heavy work, identify independent scopes and delegate them in parallel. Keep brief checks, decisions, and synthesis in the parent; agents work in isolated contexts and return follow-up reports.",
|
|
360
|
-
].join("\n");
|
|
361
|
-
});
|
|
362
|
-
|
|
363
353
|
pi.registerMessageRenderer(RESULT_MESSAGE, (message, { expanded }, theme) => {
|
|
364
354
|
const report = message.details as DelegateReport | undefined;
|
|
365
355
|
if (!report?.agent) return undefined;
|
|
@@ -618,22 +608,37 @@ export default function (pi: ExtensionAPI) {
|
|
|
618
608
|
},
|
|
619
609
|
});
|
|
620
610
|
|
|
611
|
+
const cwd = process.cwd();
|
|
612
|
+
const agentList = discoverAgents(cwd, configFor(cwd).agentDirs).map(
|
|
613
|
+
(agent) => `- ${agent.name}${agent.model ? ` (${agent.model})` : ""}: ${agent.description}`,
|
|
614
|
+
);
|
|
615
|
+
|
|
621
616
|
pi.registerTool({
|
|
622
617
|
name: "delegate",
|
|
623
618
|
label: "Delegate",
|
|
624
|
-
description:
|
|
625
|
-
"
|
|
626
|
-
|
|
619
|
+
description: [
|
|
620
|
+
"Start a background Pi agent on one focused task. Returns a job id immediately; the agent's report arrives later as a follow-up message.",
|
|
621
|
+
"",
|
|
622
|
+
"Available agents (default model in parentheses):",
|
|
623
|
+
...agentList,
|
|
624
|
+
"",
|
|
625
|
+
"The agent gets the project instructions but not this conversation: it cannot see the user's request, the files you read, or your decisions. Write `task` as a self-contained brief: the goal and why, what you already know (paths, symbols, errors), scope and constraints, whether to edit files or only report, and what to return (format, length, path:line evidence).",
|
|
626
|
+
].join("\n"),
|
|
627
|
+
promptSnippet:
|
|
628
|
+
"Delegate a focused task to a background agent with its own context; only its report comes back, as a later follow-up message",
|
|
627
629
|
promptGuidelines: [
|
|
630
|
+
"Delegation is authorized: use delegate proactively, without waiting for the user to ask, whenever work matches an agent's description. Your context is the scarce resource: everything you read stays in it, is re-sent with every later request, and brings compaction closer. A delegate works in a fresh context, often on a cheaper model, and returns only its report.",
|
|
631
|
+
"Delegate when you need the conclusion rather than the raw material: open-ended searches (more than ~3 queries), understanding code across several files you will not edit, web research, long command output such as test runs and builds, independent subtasks, and reviews of finished work. Work directly for a known file path, one targeted search, a quick command, or code you will edit yourself.",
|
|
632
|
+
"Start every independent delegate before waiting on any, ideally in one message. Keep decisions and synthesis yourself. Trust reports instead of repeating their searches; read only what you act on.",
|
|
628
633
|
"While delegates run, stay outside their scopes; delegate any new context-heavy investigation before tracing it yourself. When a report is the next dependency, end your turn with a brief waiting status. Completion will wake you.",
|
|
629
634
|
"Read every required delegate report before claiming the task is done. Never sleep, poll, or call any tool solely to wait (including `bash` with `true`, `echo`, or `sleep 0`). Use delegate_list only for a one-time status check.",
|
|
630
635
|
],
|
|
631
636
|
parameters: Type.Object({
|
|
632
|
-
agent: Type.String({ description: "Agent name
|
|
637
|
+
agent: Type.String({ description: "Agent name from the list in this tool's description." }),
|
|
633
638
|
description: Type.String({
|
|
634
639
|
description: "Short 3-8 word summary of this delegation, shown in the transcript.",
|
|
635
640
|
}),
|
|
636
|
-
task: Type.String({ description: "
|
|
641
|
+
task: Type.String({ description: "Self-contained brief; the agent cannot see this conversation." }),
|
|
637
642
|
model: Type.Optional(
|
|
638
643
|
Type.String({ description: "Model tier (cheap, balanced, strong) or an explicit provider/model." }),
|
|
639
644
|
),
|