@ferris1225/pi-subagents 4.1.6 → 4.1.7

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 CHANGED
@@ -119,7 +119,10 @@ The runtime deliberately keeps delegation conservative:
119
119
  - `worker` and `cleaner` remain distinct write-capable entry roles. Each updates
120
120
  existing README/docs/examples/comments directly affected by its change. After
121
121
  success, one enabled independent `reviewer` gate runs, with the existing bounded
122
- worker ↔ reviewer fix loop for `REVIEW_FAIL`.
122
+ worker ↔ reviewer fix loop for `REVIEW_FAIL`. Every gate finding carries a
123
+ concrete fix instruction; the worker implements those instructions or ships a
124
+ sounder fix with an explicit pushback, and re-review judges the resulting code —
125
+ only open findings and defects the fix itself introduced can continue the loop.
123
126
  - When `documenter` is enabled, every managed reviewer gate is asked for a
124
127
  standalone `DOCUMENTATION: CLEAN` or `DOCUMENTATION: NEEDED` line. Only
125
128
  `REVIEW_PASS` can authorize the final sync: NEEDED includes
@@ -225,14 +228,19 @@ immediately, while NEEDED (or a missing marker on that passing gate) runs one
225
228
  final docs sync. A failure uses the bounded loop:
226
229
 
227
230
  ```text
228
- reviewer → worker fixes every open finding reviewer checks again
231
+ reviewer → worker applies each fix instruction (or rebuts with a sounder fix)
232
+ → reviewer re-reviews the result → …
229
233
  REVIEW_PASS ─┬─ CLEAN → deliver
230
234
  └─ NEEDED/missing → documenter
231
235
  ```
232
236
 
233
237
  Each step gets a fresh model context. The chain shares the same code state and
234
238
  passes every full reviewer and worker report forward; it does not reuse one
235
- context window. Internal children bypass top-level lifecycle policy, so they
239
+ context window. Re-review converges instead of re-auditing: it rules on every
240
+ previous finding once, judges the code as it now stands (a sound worker fix
241
+ counts even when it deviates from the instruction), and adds new findings only
242
+ for defects the fix round's own edits introduced or exposed — issues unrelated
243
+ to those edits belong to a fresh gate, not to the loop. Internal children bypass top-level lifecycle policy, so they
236
244
  cannot recursively start another chain. Gate reviewers keep documentation drift
237
245
  out of the code verdict while `documenter` is enabled by recording it under
238
246
  `## Documentation notes`; with documenter disabled, drift is a normal finding.
@@ -43,7 +43,7 @@ You are a senior, adversarial code reviewer. Find genuine defects and risks rath
43
43
  - Return only the review result. Do not repeat the task brief, summarize the implementation, narrate inspection/tool chronology, or explain a root cause when no finding depends on it. Omit transient tool failures that were recovered; report only unresolved coverage gaps.
44
44
  - Stay independent of `worker`, `cleaner`, and `documenter`; fix nothing yourself. When a final documenter is available, documentation drift is not a code-gate finding: record it in a short `## Documentation notes` section and carry it forward on re-review. When documenter is disabled, drift is a normal gate finding.
45
45
  - Every gate (never an advisory review) must classify documentation on its own standalone machine line. Emit `DOCUMENTATION: NEEDED` and include `## Documentation notes` when a sync is needed; otherwise emit `DOCUMENTATION: CLEAN`. Runtime treats a missing marker conservatively as NEEDED. Do not emit this marker for advisory output.
46
- - In a gate, every code/test finding enters auto-fix, with no severity tiers. A direct REVIEW_PASS is final for code: CLEAN delivers directly, while NEEDED/missing runs one conditional documentation sync without reopening the gate. On re-review, rule on each open finding once, concretely adjudicate worker rejections, add only defects the fix introduced or exposed, and never re-open a verified resolution.
46
+ - In a gate, every code/test finding enters auto-fix, with no severity tiers, and every gate finding must end with a concrete fix instruction — what to change, where, and how to verify the fix — because a worker implements exactly those instructions unless it can justify a sounder fix and push back. A direct REVIEW_PASS is final for code: CLEAN delivers directly, while NEEDED/missing runs one conditional documentation sync without reopening the gate. On re-review, judge the code as it now stands: a finding is resolved when the pending diff fixes it soundly, whether or not the worker followed your instruction. Rule on each open finding once, concretely adjudicate worker pushback, add only defects the fix introduced or exposed — never issues unrelated to this round's edits — and never re-open a verified resolution.
47
47
  - Advisory findings never enter auto-fix; the caller decides whether to authorize later implementation or cleanup.
48
48
 
49
49
  ## Output
@@ -64,7 +64,7 @@ For a gate review:
64
64
  ## Files Reviewed
65
65
  - path/to/file.ts
66
66
  ## Findings
67
- - file.ts:42 — concrete issue and why it breaks
67
+ - file.ts:42 — concrete issue and why it breaks — Fix: the change to make and how to verify it
68
68
  (Write "None" when no finding remains.)
69
69
  ## Documentation notes
70
70
  - exact stale surface and required correction
package/agents/worker.md CHANGED
@@ -34,6 +34,10 @@ Never commit, push, publish, tag, release, or bump a package version. The parent
34
34
  - You cannot dispatch sub-agents (children are leaf processes with no `subagent` tool). When the
35
35
  brief lacks context that needs broad code discovery, state concretely what an `explorer` should
36
36
  retrieve for the caller — do not guess.
37
+ - In an auto-fix round, apply your own judgment to the reviewer's fix instructions: implement each
38
+ instruction when it is sound; when it is wrong, out of scope, or a sounder fix exists, implement
39
+ your fix and push back in your report — cite the finding, refute the instruction's reasoning,
40
+ and describe what you shipped instead. A deviation without reasoning will be re-opened.
37
41
  - The parent runtime automatically runs one enabled `reviewer` gate after a successful top-level worker and preserves the bounded worker/reviewer fix loop. A final `documenter` runs only when that terminal review reports documentation drift or omits its marker (or when reviewer is disabled). Report a complete handoff, but do not ask the caller to duplicate downstream roles. Never treat your own verification as the final gate.
38
42
 
39
43
  ## Output format
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ferris1225/pi-subagents",
3
- "version": "4.1.6",
3
+ "version": "4.1.7",
4
4
  "description": "A managed sub-agent team for pi: specialized roles, pre-commit documentation sync, retained threads, auto-fix chains, model fallback, and Git worktree isolation.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/fixloop.ts CHANGED
@@ -3,6 +3,10 @@
3
3
  *
4
4
  * Successful top-level worker/cleaner runs continue through an independent
5
5
  * code review gate; bounded worker → reviewer fix rounds close its findings.
6
+ * Gate findings carry concrete fix instructions that the worker implements
7
+ * unless it can justify a sounder fix and push back; re-review adjudicates on
8
+ * the resulting code (open findings plus fix-introduced defects only) so the
9
+ * rounds converge instead of re-auditing from scratch.
6
10
  * Reviewers classify documentation drift explicitly, so the low-cost final
7
11
  * documenter runs only when needed (or conservatively when an older/custom
8
12
  * reviewer omits the marker). Direct passing/failing gates use the same policy.
@@ -139,8 +143,9 @@ export function getManagedWorkflowPlan(
139
143
 
140
144
  /**
141
145
  * Build the worker task brief for one fix round from a reviewer's findings.
142
- * The worker gets the full review text so it can address concrete file:line
143
- * issues, with instructions to fix every reported finding and self-verify.
146
+ * The worker gets the full review text findings plus their fix instructions
147
+ * and closes every finding either by implementing the instruction or by
148
+ * shipping a sounder fix with an explicit per-finding pushback.
144
149
  */
145
150
  export function buildFixTaskBrief(reviewerResult: SingleResult, round: number, maxRounds: number): string {
146
151
  const review = getResultOutput(reviewerResult);
@@ -153,13 +158,15 @@ export function buildFixTaskBrief(reviewerResult: SingleResult, round: number, m
153
158
  review,
154
159
  `---`,
155
160
  ``,
156
- `Fix EVERY finding in the reviewer's findings list — there is no severity triage; all of them get fixed.`,
157
- `If a finding is factually wrong or clearly out of scope, say so explicitly instead of fixing it.`,
161
+ `Each finding in the reviewer's report carries a fix instruction. Close EVERY finding — there is no severity triage; all of them get fixed.`,
162
+ `You own the fix: when an instruction is factually wrong, clearly out of scope, or a sounder fix exists, implement YOUR fix instead,`,
163
+ `then push back explicitly per finding — cite it, refute the instruction's reasoning, and state what you shipped instead.`,
164
+ `A pushback without a working alternative or concrete reasoning will be re-opened.`,
158
165
  `Do NOT refactor unrelated code beyond what the findings require.`,
159
166
  `Synchronize any existing README/docs/examples/comments directly affected by your fixes; do not broaden into standalone documentation maintenance.`,
160
167
  `Do NOT commit, push, publish, tag, or release; do not bump versions. The parent chain still owns re-review and any conditional final documentation sync.`,
161
168
  `After editing, run the project's format/build/tests when they exist and report`,
162
- `exactly what you changed (paths + short rationale) so a reviewer can verify.`,
169
+ `exactly what you changed (paths + short rationale) plus any pushback, so a reviewer can verify.`,
163
170
  remaining > 0
164
171
  ? `A reviewer will re-review your changes automatically after you finish.`
165
172
  : `This is the last auto-fix round; the workflow conditionally runs any needed final documentation sync and then delivers.`,
@@ -304,6 +311,8 @@ export function buildFinalReviewBrief(
304
311
  ``,
305
312
  `Run \`git status\` and \`git diff\` and inspect the actual pending code; the report is context, not proof.`,
306
313
  `Remain read-only. Verify correctness, regressions, and tests.`,
314
+ `Attach a concrete fix instruction to EVERY gate finding: what to change, where, and how to verify the fix.`,
315
+ `A worker will implement your instructions unless it can justify a sounder fix and push back, so make each instruction specific enough to act on.`,
307
316
  ...(options.documenterPending
308
317
  ? [
309
318
  `A conditional documentation sync is available AFTER this gate, so documentation drift is not a code-gate finding.`,
@@ -321,10 +330,11 @@ export function buildFinalReviewBrief(
321
330
 
322
331
  /**
323
332
  * The re-review brief handed to the reviewer after a worker fix round. Includes
324
- * the prior review and worker report so the reviewer can adjudicate rejections
333
+ * the prior review and worker report so the reviewer can adjudicate pushback
325
334
  * instead of restating findings. The convergence contract keeps rounds from
326
- * ping-ponging: rule on the open findings once, add only defects this round's
327
- * edits introduced, never re-open a verified resolution.
335
+ * ping-ponging: judge the resulting code (not instruction obedience), rule on
336
+ * the open findings once, add only defects this round's edits introduced,
337
+ * never re-open a verified resolution.
328
338
  */
329
339
  export function buildReReviewBrief(
330
340
  reviewerResult: SingleResult,
@@ -342,16 +352,17 @@ export function buildReReviewBrief(
342
352
  review,
343
353
  `---`,
344
354
  ``,
345
- `The worker's report (what it changed, plus any finding it rejected as factually wrong or out of scope):`,
355
+ `The worker's report (what it changed, plus any pushback where it replaced your fix instruction with its own fix):`,
346
356
  `---`,
347
357
  workerReport,
348
358
  `---`,
349
359
  ``,
350
- `Rule on EVERY previous finding: resolved, or still open. A finding the worker rejected must be`,
351
- `adjudicated ONCE accept the rejection unless you can concretely refute the worker's reasoning;`,
352
- `never simply restate the finding for another round.`,
353
- `Run \`git diff\` to see what changed, then add NEW findings only when they are defects this round's`,
354
- `edits introduced or exposed (or a load-bearing issue the earlier review genuinely missed).`,
360
+ `Rule on EVERY previous finding: resolved, or still open. Judge the code as it now stands — a finding is`,
361
+ `resolved when the pending diff fixes it soundly, whether or not the worker followed your fix instruction.`,
362
+ `A finding the worker pushed back on must be adjudicated ONCE — accept the worker's fix unless you can`,
363
+ `concretely refute its reasoning; never simply restate the finding for another round.`,
364
+ `Run \`git diff\` to see what changed, then add NEW findings only for defects this round's edits introduced or exposed.`,
365
+ `Re-review never opens findings unrelated to this round's edits; issues the earlier review missed belong to a fresh gate.`,
355
366
  `Do NOT re-open a finding you verified as resolved.`,
356
367
  ...(options.documenterPending
357
368
  ? [