@henryqw/pi-subagent 15.1.2 → 15.1.4
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 +8 -2
- package/docs/orchestration.md +5 -5
- package/examples/roles/implementer.md +5 -5
- package/examples/roles/reviewer.md +3 -6
- package/extensions/delegate-flow.ts +7 -7
- package/extensions/subagent.ts +23 -12
- package/extensions/task-name.ts +0 -2
- package/package.json +1 -1
- package/skills/pi-subagent-delegated-development/SKILL.md +19 -42
package/README.md
CHANGED
|
@@ -80,14 +80,19 @@ See the [orchestration guide](./docs/orchestration.md) for full delegation, tran
|
|
|
80
80
|
|
|
81
81
|
The bundled [`pi-subagent-delegated-development`](./skills/pi-subagent-delegated-development/SKILL.md) Skill guides Main's planning and orchestration. It adds no runtime code, config, or Role installation.
|
|
82
82
|
|
|
83
|
+
Implementers remove only task-created temporary, generated, or ignored artifacts. Required deliverables and unrelated files stay intact. They never use `git clean` or blanket deletion, and unclear paths block.
|
|
84
|
+
|
|
85
|
+
For known regressions with a runner that supports test-name filtering, use a test-name filter. Keep broad package or workspace checks to one caller-owned final validation after relevant units integrate. Flow itself does not run that check.
|
|
86
|
+
|
|
83
87
|
Before delegating:
|
|
84
88
|
|
|
89
|
+
- Keep trivial, single-owner, mechanically verifiable edits in Main.
|
|
90
|
+
- For literal UI or copy defects, search the exact text first. Read only its producer and nearby assertions unless ownership remains unclear.
|
|
85
91
|
- Find concrete outcomes that can ship on their own.
|
|
86
92
|
- Split only those outcomes. Give each one owner and a focused check.
|
|
87
93
|
- Run independent work in parallel.
|
|
88
94
|
- Prefer parallel delegation when at least two outcomes are independent.
|
|
89
|
-
-
|
|
90
|
-
- This is a guide, not a quota. Never create units just to reach it.
|
|
95
|
+
- Use only as many units as independent outcomes require. Never create units to reach a count.
|
|
91
96
|
|
|
92
97
|
Its ordinary review loop is optional. Use it only when the caller or repository policy explicitly requires judgment review.
|
|
93
98
|
|
|
@@ -118,6 +123,7 @@ A Flow has 1–8 units with unique non-empty IDs and allows one active Flow. It
|
|
|
118
123
|
- Flow runs each declared command with its arguments. That validation is authoritative for objective checks.
|
|
119
124
|
- Without `review`, Flow fast-forwards the exact validated tip.
|
|
120
125
|
- With `review`, the Reviewer receives the exact `{base, tip, patchPath}` packet and must return exactly `PASS` before the same integration path. Use `review` only for stated judgment that validation cannot decide.
|
|
126
|
+
- Trust a successful Flow result. Do not re-read integrated files or repeat its validation merely to confirm it.
|
|
121
127
|
|
|
122
128
|
A Role selects base tools, extensions, named Skills, instructions, and optional worktree isolation. Named Skills resolve from Main's effective Pi registry. Unavailable names warn and skip.
|
|
123
129
|
|
package/docs/orchestration.md
CHANGED
|
@@ -110,16 +110,16 @@ Flow has no dependency graph, saved state, automatic retry, aggregate review, or
|
|
|
110
110
|
|
|
111
111
|
## Per-delegation resources and isolation
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
`delegate_task` first preflights every requested Role name, so an initially unknown Role starts no sibling. Then, after receiving an executor permit, every single entry, parallel sibling, and chain step independently:
|
|
114
114
|
|
|
115
|
-
1.
|
|
116
|
-
2. resolves its route and named Skills from the latest effective Pi context
|
|
115
|
+
1. reloads its effective Role by requested name;
|
|
116
|
+
2. resolves its route and named Skills from the latest effective Pi context;
|
|
117
117
|
3. creates its Role launch policy; and
|
|
118
|
-
4. when the Role requests `isolation: worktree`, creates a worktree identified by the tool call, mode, and input index.
|
|
118
|
+
4. when the reloaded Role requests `isolation: worktree`, creates a worktree identified by the tool call, mode, and input index.
|
|
119
119
|
|
|
120
120
|
Separate deterministic identities produce separate worktree paths and branches. Parallel siblings cannot collide, and a chain does not base one step's worktree on the preceding step's branch. `{previous}` passes text only. There is no implicit shared worktree or hidden workflow state.
|
|
121
121
|
|
|
122
|
-
A worktree starts from Main's current `HEAD`. Clean worktrees with no child commits are pruned; committed, dirty, switched, unmeasurable, or otherwise recoverable work is preserved and reported.
|
|
122
|
+
A worktree starts from Main's current `HEAD`. Clean worktrees with no child commits are pruned; committed, dirty, switched, unmeasurable, or otherwise recoverable work is preserved and reported. For `delegate_task`, non-git directories and repositories with an unborn `HEAD` use Main's working directory. Git submodules reject worktree isolation, and setup failure in a real repository throws rather than silently sharing Main's checkout. `delegate_flow` requires a Git repository with a committed `HEAD`.
|
|
123
123
|
|
|
124
124
|
If steps must share files, make that an explicit caller decision: use an intentionally shared workspace, merge preserved child commits, or pass state through a caller-owned store. Do not rely on chain order to imply filesystem sharing.
|
|
125
125
|
|
|
@@ -14,12 +14,12 @@ skills: []
|
|
|
14
14
|
isolation: worktree
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
Implement the bounded outcome, not a preassigned file list. Work in the assigned cwd. Read applicable repository instructions and domain context
|
|
17
|
+
Implement the bounded outcome, not a preassigned file list. Work in the assigned cwd. Read applicable repository instructions and domain context; inspect the relevant flow, callers, and tests before editing. Preserve unrelated work. Fix the root cause with the smallest complete diff using existing patterns and dependencies. Add no speculative work. Stop when complete or blocked.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Run focused checks required by the task. Before reporting, remove only task-created, non-deliverable temporary, generated, or ignored files. Preserve required deliverables, unrelated and pre-existing files, and user data. Never use `git clean` or blanket deletion. If ownership or necessity is uncertain, report the exact path as a blocker.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Access credentials or the network, create extra artifacts, or broaden scope only when the task requires it. Never invoke external LLM APIs, SDKs, agent harnesses, or model CLIs.
|
|
22
22
|
|
|
23
|
-
Commit completed scoped changes
|
|
23
|
+
Commit completed scoped changes unless the task says otherwise. Do not create or manage another worktree. Leave the assigned worktree and branch intact. Never push or open a pull request without explicit authorization.
|
|
24
24
|
|
|
25
|
-
Report briefly: outcome, commit, checks
|
|
25
|
+
Report briefly: outcome, commit, checks, and remaining risks.
|
|
@@ -10,11 +10,8 @@ extensions: []
|
|
|
10
10
|
skills: []
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
Review read-only
|
|
13
|
+
Review the supplied candidate read-only. Use only supplied requirements and named files or evidence; do not prepare Git or broaden discovery. If evidence is insufficient, say so and stop.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
2. Flow exact review: only with an explicit judgment criterion, use the same assigned Unit Worktree and exact Review Packet `{base, tip, patchPath}`. Treat the exact patch at `patchPath` as authoritative; read only referenced files/context. Declared validation is authoritative for objective verification. Judge only the explicit criterion; never infer a diff from another branch/worktree.
|
|
15
|
+
Report only actionable correctness risks introduced by the change, not style preferences, speculative hypotheticals, or unrelated pre-existing issues. Run no commands or tests. Never edit, write, commit, push, manage Git or worktrees, or invoke external LLM APIs, SDKs, agent harnesses, or model CLIs.
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Output exactly `PASS` when there are no findings. Otherwise output findings only, ordered by severity, with file:line evidence, impact, and smallest valid fix; any finding blocks approval. Never combine `PASS` with findings. Stop when supplied evidence is covered; in Flow, stop after its criterion.
|
|
17
|
+
Output exactly `PASS` when there are no findings. Otherwise output findings only, ordered by severity, with file:line evidence, impact, and the smallest valid fix. Any finding blocks approval; never combine `PASS` with findings. Stop when the supplied evidence is covered.
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import { Type, type Static } from "typebox";
|
|
21
21
|
import { Check } from "typebox/value";
|
|
22
22
|
import { MODEL_CLASS_GUIDANCE } from "./model-class-policy.ts";
|
|
23
|
-
import {
|
|
23
|
+
import { TaskNameSchema, normalizeTaskName } from "./task-name.ts";
|
|
24
24
|
|
|
25
25
|
const MAX_UNITS = 8;
|
|
26
26
|
const GIT_TIMEOUT_MS = 30_000;
|
|
@@ -247,7 +247,7 @@ function reviewerTask(unit: FlowUnitRequest, review: string, packet: { base: str
|
|
|
247
247
|
...unit.validation.map((validation) => `- ${JSON.stringify(validation)}`),
|
|
248
248
|
"",
|
|
249
249
|
`Review Packet: ${JSON.stringify(packet)}`,
|
|
250
|
-
"
|
|
250
|
+
"In the assigned Unit Worktree, treat the exact patch at patchPath as authoritative. Read only referenced context, judge only the criterion above, and never infer a diff from another branch or worktree.",
|
|
251
251
|
].join("\n");
|
|
252
252
|
}
|
|
253
253
|
|
|
@@ -550,7 +550,7 @@ export function registerDelegateFlow(pi: ExtensionAPI, runtime: DelegateFlowRunt
|
|
|
550
550
|
const tip = oid(tipResult.stdout, "Unit HEAD");
|
|
551
551
|
const branchTip = oid(await requireGit(["rev-parse", "--verify", `refs/heads/${unit.worktree.branch}^{commit}`], unit.worktree.cwd, signal), "Unit branch tip");
|
|
552
552
|
if (tip !== branchTip) return { block: `Unit ${JSON.stringify(unit.request.id)} branch no longer names its checked-out HEAD.` };
|
|
553
|
-
const status = await requireGit(["status", "--porcelain=v1", "--untracked-files=all"], unit.worktree.cwd, signal);
|
|
553
|
+
const status = await requireGit(["status", "--porcelain=v1", "--untracked-files=all", "--ignore-submodules=none"], unit.worktree.cwd, signal);
|
|
554
554
|
if (status) return { block: `Unit Worktree is dirty:\n${capOutput(status)}` };
|
|
555
555
|
const flags = await inspectIndexFlags(unit.worktree.cwd, git, signal);
|
|
556
556
|
if (flags.failure) throw new Error(`Unit index inspection failed: ${flags.failure}`);
|
|
@@ -770,10 +770,10 @@ export function registerDelegateFlow(pi: ExtensionAPI, runtime: DelegateFlowRunt
|
|
|
770
770
|
description: "Run 1–8 independent Implementers in isolated Unit Worktrees, validate and serially fast-forward each tip, with exact review only for units that declare a judgment criterion.",
|
|
771
771
|
promptSnippet: "Run a deterministic parallel-implementation, serial-verification Flow",
|
|
772
772
|
promptGuidelines: [
|
|
773
|
-
"Use delegate_flow only for
|
|
774
|
-
|
|
775
|
-
`For
|
|
776
|
-
"If
|
|
773
|
+
"Use delegate_flow only for independent commuting units; sequence dependent work elsewhere. Separate independently useful outcomes, but never manufacture units, split an invariant, or overlap mutable ownership. Combine work that overlaps files, APIs, schemas, generated output, package metadata, lockfiles, or invariants.",
|
|
774
|
+
"Each delegate_flow unit needs one bounded outcome, explicit requirements, and an authoritative command/argument validation gate. Discover unclear scope first. Add review only for judgment validation cannot establish.",
|
|
775
|
+
`For delegate_flow, ${MODEL_CLASS_GUIDANCE}`,
|
|
776
|
+
"If delegate_flow blocks, inspect its classification and call delegate_flow_continue once with explicit repair guidance; modelClass may replace that repair's current class.",
|
|
777
777
|
],
|
|
778
778
|
parameters: DelegateFlowSchema,
|
|
779
779
|
prepareArguments: parseDelegateFlow,
|
package/extensions/subagent.ts
CHANGED
|
@@ -54,8 +54,6 @@ import {
|
|
|
54
54
|
type ParsedWorkflow,
|
|
55
55
|
type WorkflowEntry,
|
|
56
56
|
} from "./workflow.ts";
|
|
57
|
-
import { TASK_NAME_CONTRACT } from "./task-name.ts";
|
|
58
|
-
|
|
59
57
|
const WIDGET_KEY = "subagent-status";
|
|
60
58
|
const WIDGET_INTERVAL_MS = 80;
|
|
61
59
|
const MAX_WIDGET_ITEMS = 8;
|
|
@@ -596,11 +594,10 @@ export default function subagentExtension(
|
|
|
596
594
|
description: `Delegate one selected single, parallel, or chain workflow of bounded tasks to isolated Pi Subagents. Roles: ${roleSummary()}.`,
|
|
597
595
|
promptSnippet: "Delegate one bounded single, parallel, or chain workflow to isolated roles",
|
|
598
596
|
promptGuidelines: [
|
|
599
|
-
"
|
|
600
|
-
|
|
601
|
-
`For
|
|
602
|
-
"
|
|
603
|
-
"delegate_task background applies to the whole selected workflow and returns before results exist; use it only when the user explicitly asks for non-blocking work.",
|
|
597
|
+
"Use delegate_task with exactly one mode: role+name+task for one task, tasks for 1–8 independent tasks, or chain for 1–8 dependent tasks using {previous}. Prefer parallel whenever at least two outcomes are independently deliverable and verifiable; never split one invariant.",
|
|
598
|
+
"Each delegate_task entry needs one bounded outcome, scope and exclusions, context and constraints, deliverable, and focused validation. Discover unclear scope first; never pass the parent request unchanged. Parallel mutations need non-overlapping ownership; read-only tasks may overlap only for distinct questions. Keep integration and cross-cutting decisions in Main.",
|
|
599
|
+
`For delegate_task, ${MODEL_CLASS_GUIDANCE} A direct model replaces only the selected route's model; its thinking level stays unchanged.`,
|
|
600
|
+
"Use delegate_task background only when the user explicitly requests non-blocking work.",
|
|
604
601
|
],
|
|
605
602
|
parameters: WorkflowSchema,
|
|
606
603
|
prepareArguments(args) {
|
|
@@ -619,10 +616,9 @@ export default function subagentExtension(
|
|
|
619
616
|
};
|
|
620
617
|
throwIfAborted();
|
|
621
618
|
let workflow: ParsedWorkflow;
|
|
622
|
-
let roles: Role[];
|
|
623
619
|
try {
|
|
624
620
|
workflow = parseWorkflow(params);
|
|
625
|
-
roles = loadRoles();
|
|
621
|
+
const roles = loadRoles();
|
|
626
622
|
const knownRoles = new Set(roles.map(({ name }) => name));
|
|
627
623
|
for (const { role } of workflow.delegations) {
|
|
628
624
|
if (!knownRoles.has(role)) {
|
|
@@ -633,7 +629,22 @@ export default function subagentExtension(
|
|
|
633
629
|
throw boundedError(error);
|
|
634
630
|
}
|
|
635
631
|
throwIfAborted();
|
|
636
|
-
const
|
|
632
|
+
const reloadRole = (name: string): Role => {
|
|
633
|
+
let freshRoles: Role[];
|
|
634
|
+
try {
|
|
635
|
+
freshRoles = loadRoles();
|
|
636
|
+
} catch (error) {
|
|
637
|
+
throw boundedError(new Error(
|
|
638
|
+
`Couldn't reload Subagent role ${JSON.stringify(name)} after it waited for an executor permit. Fix the Role configuration and retry: ${error instanceof Error ? error.message : String(error)}`,
|
|
639
|
+
{ cause: error },
|
|
640
|
+
));
|
|
641
|
+
}
|
|
642
|
+
const role = freshRoles.find((candidate) => candidate.name === name);
|
|
643
|
+
if (role) return role;
|
|
644
|
+
throw boundedError(new Error(
|
|
645
|
+
`Subagent role ${JSON.stringify(name)} disappeared while waiting for an executor permit. Restore it and retry. Available roles: ${freshRoles.map(({ name: available }) => available).join(", ") || "none"}.`,
|
|
646
|
+
));
|
|
647
|
+
};
|
|
637
648
|
|
|
638
649
|
// Resolve against the latest known session context after each FIFO permit.
|
|
639
650
|
const launchCtx = () => latestCtx ?? ctx;
|
|
@@ -681,7 +692,6 @@ export default function subagentExtension(
|
|
|
681
692
|
const runWorkflow = async (workflowSignal: AbortSignal | undefined, emitToolUpdates: boolean) => {
|
|
682
693
|
try {
|
|
683
694
|
return await runForegroundWorkflow<EphemeralSubagentResult>(toolCallId, foregroundWorkflow, async (entry: WorkflowEntry) => {
|
|
684
|
-
const role = rolesByName.get(entry.delegation.role)!;
|
|
685
695
|
let model: string | undefined;
|
|
686
696
|
let thinkingLevel: string | undefined;
|
|
687
697
|
let worktree: WorktreeInfo | undefined;
|
|
@@ -701,7 +711,7 @@ export default function subagentExtension(
|
|
|
701
711
|
id: entry.id,
|
|
702
712
|
index: entry.index,
|
|
703
713
|
name: entry.delegation.name,
|
|
704
|
-
role: role
|
|
714
|
+
role: entry.delegation.role,
|
|
705
715
|
...(model === undefined ? {} : { model }),
|
|
706
716
|
...(thinkingLevel === undefined ? {} : { thinkingLevel }),
|
|
707
717
|
...(worktreePayload === undefined ? {} : { worktreePayload }),
|
|
@@ -723,6 +733,7 @@ export default function subagentExtension(
|
|
|
723
733
|
prepare: async () => {
|
|
724
734
|
// Route and effective Role resources resolve only after this entry's
|
|
725
735
|
// shared executor permit, before isolated state is created.
|
|
736
|
+
const role = reloadRole(entry.delegation.role);
|
|
726
737
|
const launch = resolveLaunch(role, entry.delegation);
|
|
727
738
|
notifyMissingSkills(role, launch);
|
|
728
739
|
model = modelReference(launch.model);
|
package/extensions/task-name.ts
CHANGED
|
@@ -3,13 +3,11 @@ import { Type, type Static } from "typebox";
|
|
|
3
3
|
|
|
4
4
|
const TASK_NAME_MAX_LENGTH = 29 as const;
|
|
5
5
|
const TASK_NAME_LIMIT_WORDING = `about five words and fewer than ${TASK_NAME_MAX_LENGTH + 1} characters`;
|
|
6
|
-
const TASK_NAME_WORDING = `short descriptive name of ${TASK_NAME_LIMIT_WORDING}`;
|
|
7
6
|
|
|
8
7
|
export const TASK_NAME_CONTRACT = {
|
|
9
8
|
minLength: 1,
|
|
10
9
|
maxLength: TASK_NAME_MAX_LENGTH,
|
|
11
10
|
description: `Short descriptive task name, ${TASK_NAME_LIMIT_WORDING}; C0/C1 control characters are rejected.`,
|
|
12
|
-
promptGuidance: `Use a ${TASK_NAME_WORDING} without C0/C1 control characters.`,
|
|
13
11
|
controlRanges: DISPLAY_TEXT_CONTRACT.controlRanges,
|
|
14
12
|
pattern: DISPLAY_TEXT_CONTRACT.pattern,
|
|
15
13
|
} as const;
|
package/package.json
CHANGED
|
@@ -1,61 +1,38 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pi-subagent-delegated-development
|
|
3
|
-
description: Use
|
|
3
|
+
description: Use only when implementation merits delegation for isolation, parallelism, long-running execution, or explicit judgment; then choose Delegate Flow or ordinary delegation.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Delegated Development
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Keep a trivial, single-owner, mechanically verifiable edit in Main when its producer and regression assertion are known. Delegate only when isolation, independent parallel work, long-running execution, or explicit judgment materially helps.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
You are Main, the planner/orchestrator. Follow the selected tool's guidelines for mode, decomposition, task packets, ownership, validation, and model routing. Do not implement child work, use external model tools, push, publish, or release.
|
|
11
11
|
|
|
12
|
-
Before
|
|
12
|
+
## Before delegation
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
- Apply repository prohibitions. Resolve conflicts first and copy relevant rules into affected tasks. Include them in `review` only when validation cannot prove compliance. Repository policy overrides generic preservation or migration assumptions. If compatibility is disallowed, require deletion of replaced paths and forbid legacy readers, aliases, adapters, dual schemas, deprecation paths, and fallbacks.
|
|
15
|
+
- For a literal UI or copy defect, search the exact quoted text first, then read only its producer and nearby regression assertions. Broaden only when ownership remains unclear.
|
|
16
|
+
- Name neighboring behavior that must stay unchanged. Include the exact test name or error when known CI evidence exists; never claim a validation command matches unknown CI.
|
|
17
|
+
- A Flow unit must fit one Implementer launch before the configured maximum runtime. Cohesion does not justify combining separately verifiable milestones. Split oversized dependent work into serial one-unit Flows after each milestone integrates, or use ordinary sequencing.
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Give every unit a bounded objective, owned scope and exclusions, and its direct validation command/argument array. Each task packet must name the neighboring behavior that must stay unchanged. Include the exact test name or error when known CI evidence exists. Never claim a validation command matches unknown CI.
|
|
19
|
-
|
|
20
|
-
Each delegation must own one concrete outcome with one focused validation story. Order declared validation from the cheapest focused check to broader required checks. If the affected flow or scope is not yet known, perform bounded read-only discovery first. Do not pass the parent request unchanged. Choose `modelClass` according to the delegation tool's guidance. Add non-empty `review` only for an explicit judgment that automated validation cannot establish. Call `delegate_flow` with 1–8 units; the runtime always supplies the effective Implementer and supplies the Reviewer only when a unit needs review.
|
|
19
|
+
For a known regression, use an exact test-name filter when supported; for Node: `node --test --test-name-pattern "exact test name" test/example.test.ts`. Keep unit validation focused. Run any required broad or cross-unit check once in Main after integration. Do not duplicate checks against the same state. Flow has no post-merge validation.
|
|
21
20
|
|
|
22
21
|
## Runtime Flow
|
|
23
22
|
|
|
24
|
-
The runtime owns
|
|
25
|
-
|
|
26
|
-
Trust the structured Flow outcome. Never edit a child worktree, manage its branches, prepare review evidence, reimplement Flow, or manually integrate its changes. Do not repeat Flow validation after it has completed or integrated a unit.
|
|
27
|
-
|
|
28
|
-
A successful Flow owns integration and cleanup. A blocked outcome is repairable once: provide one explicit continuation and no more:
|
|
29
|
-
|
|
30
|
-
```ts
|
|
31
|
-
delegate_flow_continue({ guidance: "Address the reported block and complete the bounded unit.", modelClass: "balanced" })
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Make the guidance specific to the reported implementation, validation, or review failure. Omit `modelClass` to retain an explicit blocked-unit class or otherwise use each frozen Role's default; supply it only to replace both defaults for that one repair. Do not call continuation unless Flow reports a repairable block. If continuation or Flow returns a terminal failure, inspect each exact retained path reported by the runtime directly, then reslice or manually recover from Main; do not retry the Flow or guess a rebase resolution. Do not run `git worktree list` merely to rediscover a retained path.
|
|
35
|
-
|
|
36
|
-
A cleanup warning does not undo successful integration. Report a cleanup warning from a successful Flow as-is. Do not investigate it unless the user asks or cleanup is part of acceptance.
|
|
37
|
-
|
|
38
|
-
## Ordinary delegation
|
|
39
|
-
|
|
40
|
-
Use `delegate_task` for a single bounded task, independent parallel tasks, or dependent chain work that is not a Flow. Give each entry its objective, exact scope and exclusions, relevant context and constraints, expected deliverable, and focused validation. Choose `modelClass` according to the delegation tool's guidance. A direct `model` replaces only the selected route's model. The route keeps its thinking level. Keep integration and cross-cutting decisions in Main.
|
|
41
|
-
|
|
42
|
-
### Optional evidence loop for implementation
|
|
43
|
-
|
|
44
|
-
Use this caller-managed loop only when the caller or repository policy explicitly requires judgment review. It is not required for every ordinary implementation.
|
|
45
|
-
|
|
46
|
-
After implementation and focused validation, launch `delegate_task` with `role: "reviewer"` to select the effective `reviewer` Role. A same-named user Role remains effective. The task packet must state:
|
|
23
|
+
The runtime owns unit worktrees, Git identity, rebasing, committed-state inspection, declared validation, conditional exact read-only review, fast-forward integration, and cleanup. Validation is authoritative. Without `review`, Flow integrates the exact validated tip. With `review`, it supplies `{base, tip, patchPath}` and requires exactly `PASS`.
|
|
47
24
|
|
|
48
|
-
|
|
49
|
-
- the exact acceptance criteria;
|
|
50
|
-
- exact candidate evidence visible from the Reviewer's working directory and the supplied validation evidence;
|
|
51
|
-
- the exact output contract: return `PASS` alone on approval, or findings only.
|
|
25
|
+
Trust the structured Flow outcome. Never edit child worktrees, manage branches, prepare review evidence, reimplement Flow, or integrate manually. After successful integration, do not re-read implementation, tests, manifests, or commit stats merely to confirm it. Check Main's status only for a caller-owned requirement. Do not repeat Flow validation.
|
|
52
26
|
|
|
53
|
-
|
|
27
|
+
For a repairable block, call `delegate_flow_continue` once with guidance specific to the failure. Omit `modelClass` to retain the unit class or frozen Role defaults; supply it only to replace both defaults for that repair. On terminal failure, inspect the exact retained paths reported by Flow, then reslice or recover in Main. Do not retry Flow, guess a rebase resolution, or rediscover a reported path with `git worktree list`.
|
|
54
28
|
|
|
55
|
-
|
|
29
|
+
Report a cleanup warning from a successful Flow as-is. Investigate only when the user asks or cleanup is acceptance.
|
|
56
30
|
|
|
57
|
-
|
|
31
|
+
## Optional ordinary review
|
|
58
32
|
|
|
59
|
-
|
|
33
|
+
Use a caller-managed review only when the caller or repository policy explicitly requires judgment. Never layer it onto Flow.
|
|
60
34
|
|
|
61
|
-
|
|
35
|
+
1. After implementation and focused validation, call `delegate_task` with `role: "reviewer"`; a same-named user Role remains effective.
|
|
36
|
+
2. Supply read-only scope, acceptance criteria, validation evidence, visible candidate evidence, and the output contract: `PASS` alone or findings only. If the Reviewer cannot see an isolated candidate, use Flow instead.
|
|
37
|
+
3. Empty output fails. Retry only when explicit policy requires it; a second empty result blocks completion.
|
|
38
|
+
4. On findings, repair them together, validate once, and re-review once with the original criteria, findings, and repaired evidence. Only `PASS` completes the loop; surface further findings and stop.
|