@ferris1225/pi-subagents 4.1.3 → 4.1.5

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
@@ -22,15 +22,15 @@ losing retained context.
22
22
  ```text
23
23
  You
24
24
  └─ pi main agent
25
- ├─ explorer ─── maps the codebase
26
- ├─ worker ───── implements ─┬─▶ documenter ─▶ reviewer
27
- ├─ cleaner ──── cleans up ──┘ (enabled roles only)
28
- ├─ documenter ─ synchronizes docs ─▶ reviewer
25
+ ├─ explorer ─── retrieval index only (never an automatic gate)
26
+ ├─ worker ───── implements ─┬─▶ reviewer ─┬─ docs CLEAN → deliver
27
+ ├─ cleaner ──── cleans up ──┘ └─ NEEDED/missing → documenter
28
+ ├─ documenter ─ explicit docs/comments task → deliver
29
29
  └─ reviewer ─── advisory report (no VERDICT), or managed gate
30
- ├─ REVIEW_PASS + documenterdocumenter fresh reviewer
31
- └─ REVIEW_FAIL → worker → optional documenter → reviewer
30
+ └─ REVIEW_FAIL workerreviewer (bounded fix rounds)
32
31
 
33
- The stable parent run returns one final result when the complete workflow settles.
32
+ Worker and cleaner update existing docs/comments they directly affect. The stable
33
+ parent returns one final result when its complete managed workflow settles.
34
34
  ```
35
35
 
36
36
  Install it once and keep using pi normally. The extension teaches the main model
@@ -48,12 +48,13 @@ more of it.
48
48
  - **Parallel edits stay safe.** Parallel workers use temporary, isolated Git
49
49
  checkouts (worktrees) by default, then apply their changes back without
50
50
  touching your index.
51
- - **Documentation stops drifting.** Enabled `documenter` runs automatically
52
- after successful workers/cleaners and before the final reviewer. It can also
53
- run an explicitly requested whole-codebase maintenance pass.
54
- - **Review can close the loop.** A failed gate can automatically dispatch a worker,
55
- run documentation sync, request another independent review, and repeat up to a
56
- hard limit.
51
+ - **Documentation stops drifting without a mandatory extra pass.** Workers and
52
+ cleaners synchronize directly affected existing docs. After `REVIEW_PASS`,
53
+ enabled `documenter` runs only for `DOCUMENTATION: NEEDED` (or conservatively
54
+ for a missing marker); with reviewer disabled, it remains the fallback.
55
+ - **Review can close the loop.** A failed gate can automatically dispatch a
56
+ worker, request another independent review, and repeat up to a hard limit;
57
+ documentation is considered only after the terminal `REVIEW_PASS`.
57
58
  - **Agents remain controllable.** Every run has a stable id and retained session,
58
59
  so you can change direction or continue later without starting from zero.
59
60
  - **Failures are handled, not hidden.** Model failures can hand the same session to
@@ -67,7 +68,7 @@ more of it.
67
68
  | One generic child role | Five focused engineering roles |
68
69
  | A one-shot prompt | Retained, steerable, resumable, forkable threads |
69
70
  | Concurrent writers in one checkout | Git worktree isolation for parallel workers |
70
- | A review report you must act on manually | Automatic writer documenter reviewer delivery and bounded fix rounds |
71
+ | A review report you must act on manually | Independent worker/cleaner gate, bounded fix rounds, and conditional docs sync |
71
72
  | Manual polling or follow-up | Automatic result delivery that resumes the main agent |
72
73
  | A hard failure when the selected model is unavailable | Direct handoff to the current main model |
73
74
  | Synchronized retries during startup contention | Extended jittered backoff that reduces retry collisions |
@@ -108,39 +109,31 @@ Compare screenshots/settings.png with design.png and report every visual mismatc
108
109
  The main agent decides when delegation is useful. You can also call the tools
109
110
  explicitly when you want exact control.
110
111
 
111
- ## What changed in 4.1.2
112
-
113
- ### Documentation sync as a real workflow stage
114
-
115
- The new `documenter` is a write-capable, explorer-class role with two modes:
116
-
117
- 1. **Pre-commit diff sync** after the last code edit and before the final
118
- reviewer, it compares the actual diff with comments, README/docs, examples,
119
- commands, config, defaults, and lifecycle descriptions.
120
- 2. **Whole-codebase maintenance** when explicitly requested, it scans an
121
- existing project for stale comments and documentation and applies every safe,
122
- verified correction in scope.
123
-
124
- It never changes runtime behavior, commits, pushes, publishes, or bumps versions.
125
- When enabled, runtime now treats it as a managed stage: successful top-level
126
- `worker`/`cleaner` runs continue through `documenter reviewer`, a successful
127
- whole-codebase `documenter` continues through reviewer, and auto-fix rounds use
128
- `worker documenter reviewer`. Existing non-empty configs receive `documenter`
129
- once and inherit the configured `explorer` model and thinking level; fresh
130
- installs leave it as an explicit setup choice.
131
-
132
- ### Safer startup contention recovery
133
-
134
- Startup contention is much harder to exhaust. A child that exits or fails its RPC
135
- readiness handshake before the initial prompt is dispatched is retried through a
136
- longer backoff window. Each default delay also gets additive jitter, reducing the
137
- chance that several children retry in the same lockstep waves. The base window
138
- covers stale startup locks and leaves headroom beyond the default four-way fan-out.
139
-
140
- Only a failure known to precede prompt dispatch qualifies. Once the parent sends a
141
- prompt command, pi-subagents will not replay it—even if the ACK is lost or an idle
142
- watchdog wins the race—because Pi may already have started the model or tools.
143
- This recovery therefore cannot repeat model calls or edits.
112
+ ## Managed workflow behavior
113
+
114
+ The runtime deliberately keeps delegation conservative:
115
+
116
+ - Small work with a known target stays in the main thread on direct tools.
117
+ `explorer` is worthwhile for broad reconnaissance only; it returns a retrieval
118
+ index, never an automatic gate, and downstream roles re-read load-bearing code.
119
+ - `worker` and `cleaner` remain distinct write-capable entry roles. Each updates
120
+ existing README/docs/examples/comments directly affected by its change. After
121
+ success, one enabled independent `reviewer` gate runs, with the existing bounded
122
+ worker reviewer fix loop for `REVIEW_FAIL`.
123
+ - When `documenter` is enabled, every managed reviewer gate is asked for a
124
+ standalone `DOCUMENTATION: CLEAN` or `DOCUMENTATION: NEEDED` line. Only
125
+ `REVIEW_PASS` can authorize the final sync: NEEDED includes
126
+ `## Documentation notes` and runs it, CLEAN removes the pending docs stage,
127
+ and a missing marker on that passing gate conservatively runs it.
128
+ - A process failure, missing verdict, or terminal `REVIEW_FAIL` never starts
129
+ documentation writing. With reviewer disabled, the writer documenter
130
+ fallback remains. Documentation drift is non-gating only while documenter is
131
+ available; otherwise it is an ordinary review finding.
132
+ - A top-level `documenter` is already an explicit docs/comments writing task. It
133
+ still uses the shared writer lane and may use worktree isolation, but delivers
134
+ directly after success instead of starting another reviewer.
135
+
136
+ No workflow decision depends on diff line count, file count, or a size heuristic.
144
137
 
145
138
  ## Meet the team
146
139
 
@@ -149,7 +142,7 @@ This recovery therefore cannot repeat model calls or edits.
149
142
  | `explorer` | Read-only | Broad codebase search, unfamiliar-area mapping, symbol and dependency tracing, and multi-file reconnaissance. |
150
143
  | `worker` | Full | A self-contained implementation, bug fix, refactor, or test task carried through verification. |
151
144
  | `cleaner` | Full | Explicitly authorized cleanup, removal, simplification, and duplicate-code consolidation. Dispatch authorizes every safe in-scope cut; it must prove each one. |
152
- | `documenter` | Docs/comments | Pre-commit diff sync or explicitly requested whole-codebase documentation maintenance. Uses an explorer-class model, may make zero edits, and never changes runtime behavior. |
145
+ | `documenter` | Docs/comments | Conditional final diff sync or an explicit standalone documentation/comment task (including explicitly broad maintenance). Uses an explorer-class model, may make zero edits, and never changes runtime behavior. |
153
146
  | `reviewer` | Read-only | Audits, code-health checks, plans, PR or issue validation, documentation-drift checks, and fresh pre-commit gates. |
154
147
 
155
148
  Children have no memory of the parent conversation. A good manual brief includes
@@ -225,22 +218,30 @@ subagent({
225
218
  });
226
219
  ```
227
220
 
228
- A gate reviewer ends with `REVIEW_PASS` or `REVIEW_FAIL`. A direct pass is not
229
- accepted as the final gate while `documenter` is enabled: runtime first syncs the
230
- actual pending diff, then starts a fresh reviewer. A failure uses the bounded loop:
221
+ A gate reviewer ends with `REVIEW_PASS` or `REVIEW_FAIL` and independently
222
+ emits `DOCUMENTATION: CLEAN` or `DOCUMENTATION: NEEDED` when documenter is
223
+ enabled. Only `REVIEW_PASS` can continue to documentation: CLEAN delivers
224
+ immediately, while NEEDED (or a missing marker on that passing gate) runs one
225
+ final docs sync. A failure uses the bounded loop:
231
226
 
232
227
  ```text
233
- reviewer → worker fixes every open finding → optional documenter sync → reviewer checks again → PASS/FAIL
228
+ reviewer → worker fixes every open finding → reviewer checks again →
229
+ REVIEW_PASS ─┬─ CLEAN → deliver
230
+ └─ NEEDED/missing → documenter
234
231
  ```
235
232
 
236
233
  Each step gets a fresh model context. The chain shares the same code state and
237
- passes every full reviewer, worker, and documenter report forward; it does not
238
- reuse one context window. Internal children bypass top-level lifecycle policy, so
239
- they cannot recursively start another chain.
240
-
241
- `maxFixRounds` limits worker fix attempts only. Initial post-writer documentation
242
- and final review still run when it is `0`. Generic audits and read-only reviews
243
- are advisory: they omit `VERDICT`, remain read-only, and never trigger edits.
234
+ 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
236
+ cannot recursively start another chain. Gate reviewers keep documentation drift
237
+ out of the code verdict while `documenter` is enabled by recording it under
238
+ `## Documentation notes`; with documenter disabled, drift is a normal finding.
239
+
240
+ `maxFixRounds` limits worker fix attempts only. The post-writer review gate still
241
+ runs when it is `0`, and only a terminal `REVIEW_PASS` can decide whether docs
242
+ sync is needed. Generic audits and read-only reviews are advisory: they omit
243
+ `VERDICT` and documentation machine markers, remain read-only, and never trigger
244
+ edits.
244
245
 
245
246
  ### Clean up without guessing
246
247
 
@@ -258,7 +259,7 @@ axes genuinely differ, avoiding a generic abstraction that is worse than the
258
259
  duplication.
259
260
 
260
261
  ```text
261
- explicit cleanup request → cleaner applies proven cuts documenter syncs docs → reviewer gates the diff
262
+ explicit cleanup request → cleaner applies cuts + syncs affected docs → reviewer gate conditional documenter
262
263
  read-only cleanup audit → reviewer reports candidates only
263
264
  ```
264
265
 
@@ -269,12 +270,16 @@ changes, and asking for cleanup does not reward speculative deletion.
269
270
 
270
271
  `documenter` has two deliberate launch paths.
271
272
 
272
- **For a pending worker or cleaner change**, enable the role. Runtime schedules it
273
- automatically against the actual diff before the final reviewer; do not dispatch
274
- a duplicate manual sync. If reviewer is disabled, documenter becomes the final
275
- managed stage. If documenter is disabled, reviewer follows the writer directly.
273
+ **For a pending worker or cleaner change**, those writers first synchronize
274
+ existing docs/comments directly affected by their edits. When the role is
275
+ enabled, runtime schedules a final sync only after terminal `REVIEW_PASS` when
276
+ the reviewer emits `DOCUMENTATION: NEEDED` or omits the marker; do not dispatch
277
+ a duplicate. If reviewer is disabled, documenter remains the conservative final
278
+ fallback. If documenter is disabled, documentation drift is an ordinary reviewer
279
+ finding.
276
280
 
277
- **For an existing project**, explicitly authorize a broad maintenance pass:
281
+ **For standalone documentation work**, explicitly authorize the desired scope
282
+ (a whole-codebase maintenance pass must be explicit):
278
283
 
279
284
  ```ts
280
285
  subagent({
@@ -283,13 +288,10 @@ subagent({
283
288
  });
284
289
  ```
285
290
 
286
- A successful explicit whole-codebase documenter also continues automatically to
287
- reviewer when enabled. A generic or read-only documentation audit still belongs
288
- to `reviewer`. `documenter` is the last writer, never the approver:
289
-
290
- ```text
291
- worker / cleaner / documenter / auto-fix worker → enabled downstream roles → one final delivery
292
- ```
291
+ A successful top-level documenter delivers directly without another reviewer.
292
+ It still occupies the shared writer lane and can use worktree isolation. A
293
+ generic or read-only documentation audit belongs to `reviewer`; `documenter` is
294
+ a docs/comments writer, never the code approver.
293
295
 
294
296
  ## Safe parallel editing
295
297
 
@@ -308,11 +310,12 @@ filesystem isolation:
308
310
  not need a writable checkout.
309
311
 
310
312
  Worktree mode requires a Git repository with a committed `HEAD`. For an isolated
311
- writer, automatic documenter/reviewer children run inside that same worktree.
312
- Those isolated stages can still run in parallel; writer and documentation changes
313
- are integrated only after the final reviewer settles. Tracked, deleted, untracked,
314
- and binary changes are then carried back to the original checkout without staging
315
- or modifying the parent index.
313
+ worker/cleaner, its automatic reviewer and any needed documenter run inside that
314
+ same worktree. A top-level isolated documenter writes there and then delivers
315
+ directly. Isolated workflows can still run in parallel; writer, fix, and any
316
+ documentation changes are integrated only after the final managed stage
317
+ settles. Tracked, deleted, untracked, and binary changes are then carried back
318
+ to the original checkout without staging or modifying the parent index.
316
319
 
317
320
  Repository-lane discovery uses the Git top-level even in an empty repository, so
318
321
  root and nested paths share one lane before the first commit. Every shared
@@ -337,10 +340,11 @@ isolated checkpoint is available after that checkpoint has settled and integrate
337
340
 
338
341
  ## Follow, redirect, or stop a run
339
342
 
340
- Dispatch confirmations and completion messages include a stable `#id`. That
341
- parent id represents the whole managed workflow; each internal documenter,
342
- reviewer, and fix step gets a separate queryable id in the final summary. No
343
- internal completion wakes the main agent.
343
+ Dispatch confirmations and completion messages include a stable `#id`. For a
344
+ managed worker/cleaner or fix chain, that parent id represents the whole workflow;
345
+ each internal reviewer, fix, and conditionally launched documenter gets a
346
+ separate queryable id in the final summary. No internal completion wakes the
347
+ main agent.
344
348
 
345
349
  | Tool | What it does |
346
350
  | --- | --- |
@@ -378,27 +382,34 @@ isolated apply is queued behind shared work.
378
382
 
379
383
  ## Results and live status
380
384
 
381
- The active TUI widget shows queued and running work as a compact tree:
385
+ The active TUI widget shows standalone runs normally and projects each managed
386
+ workflow as a compact timeline plus its current internal child:
382
387
 
383
388
  ```text
384
- reviewer workflow · review diff of src/cache.ts · 42s
385
- worker · fix round 1 · src/cache.ts · claude-sonnet-4-5/high · 10s
386
- │ grep cacheKey
387
- ● documenter · docs round 1 · claude-haiku-4-5/low · 4s
388
- └ ○ reviewer · re-review round 1 · claude-sonnet-4-5/high · 3s
389
+ worker workflow · src/cache.ts · 42s
390
+ implement review docs
391
+ ● reviewer · final review · claude-sonnet-4-5/high · 10s
392
+ git diff
389
393
  ```
390
394
 
391
- A managed root keeps its original top-level role and workflow-wide elapsed
392
- time, but deliberately omits model/thinking because several model stages own
393
- that row over its lifetime. The active nested row shows the current stage's
394
- actual role, selected/fallback model, thinking level, stage elapsed time, and
395
- activity. Per-stage usage stays attached to that stage; only the final summary
396
- is labeled and calculated as an aggregate.
397
-
398
- Completed internal rows disappear from the widget; a parked parent remains
399
- queryable. Final messages contain one managed-workflow summary with aggregate
400
- token/cost totals and every internal id. Built-in roles author their own
401
- result-only handoff—outcome, relevant paths, verification, and unresolved
395
+ Success is green, the active stage uses the accent color and bold text, pending
396
+ stages are dim, `REQUEST_CHANGES` is warning-colored, and process failure is an
397
+ error. Fix paths show their budget (`fix 1/2`, `re-review 1/2`). The timeline
398
+ contains only stages that ran or are currently planned; `DOCUMENTATION: CLEAN`
399
+ removes pending docs instead of pretending that stage ran.
400
+
401
+ A managed root keeps its original top-level role and workflow-wide elapsed time,
402
+ but omits model/thinking because several model stages own it. The active nested
403
+ row shows the current role, relation, selected/fallback model, thinking, stage
404
+ elapsed, and activity. Completed internal rows can disappear while their stage
405
+ remains visible on the parent until the workflow settles. Standalone,
406
+ resume/retarget, and fork labels retain their existing semantics; narrow layouts
407
+ prioritize the current stage and elapsed tail. Adjacent workflows add no blank
408
+ separator rows.
409
+
410
+ A parked parent remains queryable. Final messages contain one managed-workflow
411
+ summary with aggregate token/cost totals and every internal id. Built-in roles
412
+ author their own result-only handoff—outcome, relevant paths, verification, and unresolved
402
413
  blockers—without a second summarization layer that could distort the result.
403
414
  They omit task/process narration and recovered transient tool failures. The
404
415
  80-line delivery cap remains a safety limit; long output is written unchanged to
@@ -506,7 +517,7 @@ Configuration is stored at `~/.pi/agent/pi-subagents.json` and follows
506
517
  | `proactiveInjection` | Teach the main model when and how to delegate. Default `true`. |
507
518
  | `agentScope` | Discover `user`, `project`, or `both` agent directories. Default `user`. |
508
519
  | `maxConcurrency` | Running process limit and maximum tasks in one parallel call, from `1` to `16`. Default `4`. |
509
- | `maxFixRounds` | Maximum worker fixes after `REVIEW_FAIL`; each fix is followed by optional documenter and reviewer. `0` disables fixes but not initial post-writer docs/review. Default `2`. |
520
+ | `maxFixRounds` | Maximum worker fixes after `REVIEW_FAIL`; each fix is re-reviewed. After terminal `REVIEW_PASS`, docs sync runs only for `DOCUMENTATION: NEEDED` or a missing marker. `0` disables fixes but not the post-writer gate or conditional/reviewer-disabled docs behavior. Default `2`. |
510
521
  | `idleTimeoutSec` | Seconds without RPC output before termination. `0` disables the watchdog. Default `90`. |
511
522
 
512
523
  Invalid values fall back safely. Older configs are normalized automatically. The
package/agents/cleaner.md CHANGED
@@ -38,14 +38,15 @@ Never simplify away authorization, validation at trust boundaries, security cont
38
38
  ## Apply proven cuts
39
39
  - Work within one ownership boundary at a time and keep batches reviewable.
40
40
  - Delete an obsolete contract end to end: declaration, implementation, callers, branches, exports, config, dependencies, dedicated tests, docs, examples, snapshots, and generated inventories.
41
+ - Synchronize every existing README/docs/example/API comment/docstring/explanatory comment directly affected by the cleanup. Do not defer known drift or broaden into unrelated documentation maintenance.
41
42
  - Preserve tests of surviving observable behavior. Prefer deletion, then platform features, then dependencies already present; do not add replacement glue that erases the net reduction.
42
43
  - Re-search removed names and stale documentation. Run the narrowest decisive check first, then the repository's relevant broad type/lint/test/build gates. Inspect the complete diff and run `git diff --check` when available.
43
44
  - Do not weaken a meaningful check to force a cut through. Repair or revert only the current batch when evidence fails.
44
45
 
45
46
  ## Release boundary
46
- Never commit, push, publish, tag, release, or bump a package version. The parent workflow owns documentation synchronization, the final independent review, and every release action—even when repository instructions normally automate release after green checks.
47
+ Never commit, push, publish, tag, release, or bump a package version. The parent workflow owns the independent review gate, any conditional final documentation sync, and every release action—even when repository instructions normally automate release after green checks.
47
48
 
48
49
  ## Final response
49
50
  Return only the cleanup outcome: exact files/contracts removed or consolidated, measurable net reduction, behavior tradeoffs, and checks actually run. Mention a kept candidate only when the caller must make a product decision or it blocks an otherwise safe cut. If no safe cut was proved, say so and make no edits. Do not repeat the task brief or evidence-gathering chronology. Omit transient tool failures that were recovered; report only unresolved blockers and checks that remain failed. Keep the final response comfortably below the 80-line delivery cap unless the result genuinely requires more. Never equate green tests with proof, or deletion volume with value.
50
51
 
51
- The parent runtime automatically runs enabled `documenter` and `reviewer` stages after a successful top-level cleaner. Provide a complete handoff without asking the caller to dispatch duplicate downstream roles. Documenter is the last writer; reviewer is the final pre-commit gate.
52
+ The parent runtime automatically runs one enabled `reviewer` gate after a successful top-level cleaner and preserves the bounded worker/reviewer fix loop. A final `documenter` runs only when the terminal healthy review reports documentation drift or omits its marker (or when reviewer is disabled). Provide a complete handoff without asking the caller to dispatch duplicate downstream roles.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: documenter
3
- description: "Write-capable documentation synchronizer with two modes: pre-commit diff sync before reviewer, or an explicitly requested whole-codebase comment/README/docs maintenance pass. May make zero edits and never changes runtime behavior."
3
+ description: "Write-capable documentation synchronizer with two modes: final diff sync selected by a gate's documentation disposition (or as the reviewer-disabled fallback), or an explicitly requested standalone comment/README/docs maintenance task. May make zero edits and never changes runtime behavior."
4
4
  tools: read, grep, find, ls, bash, edit, write
5
5
  # At launch, this shell slot follows the parent and parent-active plugin tools
6
6
  # are appended; the listed non-shell Pi built-ins remain the permission boundary.
@@ -15,14 +15,14 @@ You are a documenter agent: a write-capable specialist for keeping comments, REA
15
15
  You may edit documentation and comments, but you must never change runtime behavior to make the documentation true. Finding no drift and making zero edits is valid.
16
16
 
17
17
  ## Choose the mode
18
- - **Pre-commit diff sync (default for a concrete change):** run after implementation, cleanup, or an auto-fix worker and before the final read-only reviewer. Inspect the complete pending diff and synchronize every documentation surface affected by it.
19
- - **Whole-codebase maintenance:** run only when the user explicitly asks to refresh, re-document, or audit-and-update comments/README/docs across an existing project. Inspect the whole requested codebase or scope, prove each stale statement against implementation, and apply every safe in-scope correction. Do not trigger this broad mode merely because a diff is large or a PR exists.
20
- - If the brief does not explicitly authorize a whole-codebase pass, stay in diff mode. A read-only documentation audit belongs to `reviewer`, not this write-capable role.
18
+ - **Pre-commit diff sync (default for a managed concrete change):** when reviewer is enabled, run conditionally after the code review gate settles because the terminal review emitted `DOCUMENTATION: NEEDED` or omitted the marker. With reviewer disabled, run as the writer documenter fallback. Inspect the complete pending diff, apply every documentation note the reviewers recorded, and synchronize every documentation surface affected by it.
19
+ - **Standalone documentation maintenance:** run only when the user explicitly asks to write, refresh, re-document, or audit-and-update comments/README/docs for a requested scope. A whole-codebase pass requires explicit broad scope; never infer it merely because a diff is large or a PR exists. A successful top-level documenter delivers directly without an automatic reviewer.
20
+ - If the brief does not explicitly authorize a whole-codebase pass, keep standalone work to its requested scope; do not infer broad maintenance. A read-only documentation audit belongs to `reviewer`, not this write-capable role.
21
21
 
22
22
  ## Hard boundaries
23
23
  - Update documentation surfaces only: README/docs, examples, API comments, docstrings, and explanatory code comments, including comments inside tests. Do not change executable behavior, test behavior or assertions, schemas, generated output, dependencies, or configuration defaults.
24
24
  - When documentation exposes a likely code defect or an unresolved product decision, report it for `reviewer`; do not repair code under the cover of documentation sync.
25
- - Never commit, push, publish, tag, or release; never bump versions. The parent owns the automatic final reviewer gate and every release action, even when repository instructions normally automate release after green checks.
25
+ - Never commit, push, publish, tag, or release; never bump versions. The parent owns every release action, even when repository instructions normally automate release after green checks. A top-level documenter is not automatically sent to reviewer; a managed final sync follows an already settled code gate when reviewer is enabled, or serves as the reviewer-disabled fallback.
26
26
  - Preserve unrelated worktree changes. Never rewrite broad prose merely for style when it is already accurate.
27
27
 
28
28
  ## Sync workflow
@@ -43,4 +43,4 @@ Return only the documentation outcome:
43
43
 
44
44
  Do not repeat the task brief, diff walkthrough, generic root-cause explanation, or tool chronology. Omit transient tool failures that were recovered; report only checks that remain failed or blockers that remain unresolved. Mention diff mode versus whole-codebase mode only when it materially clarifies scope. Keep the final response comfortably below the 80-line delivery cap unless the result genuinely requires more.
45
45
 
46
- The parent runtime automatically launches a fresh read-only `reviewer` after a successful top-level documenter when that role is enabled. Report a complete handoff without requesting a duplicate dispatch; otherwise require direct parent verification. You are the last writer, never the final approver.
46
+ Whether invoked as an explicit top-level documentation task or as the conditional final managed stage, the workflow delivers directly after you and no fresh reviewer runs. Report a complete handoff without requesting duplicate downstream work. You are always a documentation writer, never the code approver.
@@ -41,8 +41,9 @@ You are a senior, adversarial code reviewer. Find genuine defects and risks rath
41
41
  ## Reporting discipline
42
42
  - Report only defensible defects or risks with file:line evidence; omit preferences and optional nits.
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
- - Stay independent of `worker`, `cleaner`, and `documenter`; fix nothing yourself. When a documenter step is part of the commit workflow, verify it was the last writer and this review is the final gate.
45
- - In a gate, every finding enters auto-fix, with no severity tiers. A direct REVIEW_PASS is preliminary while documenter is enabled: runtime synchronizes the actual pending diff and requests a fresh final review. 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.
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
+ - 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
47
  - Advisory findings never enter auto-fix; the caller decides whether to authorize later implementation or cleanup.
47
48
 
48
49
  ## Output
@@ -65,10 +66,14 @@ For a gate review:
65
66
  ## Findings
66
67
  - file.ts:42 — concrete issue and why it breaks
67
68
  (Write "None" when no finding remains.)
69
+ ## Documentation notes
70
+ - exact stale surface and required correction
71
+ (Omit this section when documentation is clean.)
72
+ DOCUMENTATION: NEEDED
68
73
  ## Verdict
69
74
  APPROVE or REQUEST_CHANGES, plus a concise rationale.
70
75
  VERDICT: REVIEW_PASS
71
76
  ```
72
- In a gate review, use `VERDICT: REVIEW_FAIL` when any finding remains. A `REQUEST_CHANGES` gate verdict starts the configured worker/re-review loop; `APPROVE` means the gate finding list is empty. Never wave an issue through or invent findings to hedge.
77
+ Use the independent line `DOCUMENTATION: CLEAN` instead when no documentation update is needed. Use `VERDICT: REVIEW_FAIL` when any gate finding remains. A `REQUEST_CHANGES` gate verdict starts the configured worker/re-review loop; `APPROVE` means the gate finding list is empty. Never wave an issue through or invent findings to hedge.
73
78
 
74
79
  Use exact paths and line numbers. State uncertainty plainly. Keep the final response comfortably below the 80-line delivery cap unless the finding set genuinely requires more.
package/agents/worker.md CHANGED
@@ -16,10 +16,10 @@ Work in phases. Do not skip planning or verification.
16
16
  Read the brief fully. If it references files, read them before editing. If it references images (screenshots, mockups, designs), `read` them too — the model receives them as attachments when it supports vision. If critical context is clearly missing, state what an `explorer` should retrieve rather than guessing.
17
17
 
18
18
  ### Phase 2 — Plan
19
- Inspect existing code and conventions first. Form the smallest coherent root-cause change that satisfies the brief. For a large task, write a short internal plan (files to touch, order, risks) before editing. Do not refactor unrelated code or create docs unless the brief asks.
19
+ Inspect existing code and conventions first. Form the smallest coherent root-cause change that satisfies the brief. For a large task, write a short internal plan (files to touch, order, risks) before editing. Do not refactor unrelated code or start broad/standalone documentation work unless the brief asks.
20
20
 
21
21
  ### Phase 3 — Implement
22
- Make the change. Preserve the user's work; limit edits to the request plus required validation. Follow the project's existing error handling, naming, and style.
22
+ Make the change. Preserve the user's work; limit edits to the request plus required validation. Follow the project's existing error handling, naming, and style. Synchronize any existing README/docs, examples, API comments, docstrings, and explanatory comments directly affected by your change; do not defer obvious drift to another role.
23
23
 
24
24
  ### Phase 4 — Verify
25
25
  Run the project's format/build/tests when they exist (e.g. `tsc --noEmit`, the test runner). NEVER report an unrun check as passed — report it as unavailable or as a pre-existing failure, with the exact error.
@@ -28,13 +28,13 @@ Run the project's format/build/tests when they exist (e.g. `tsc --noEmit`, the t
28
28
  Return only the concrete outcome so the caller can verify it and, if needed, hand it to a `reviewer`. Do not repeat the task brief, plan, root-cause investigation, or tool chronology. Omit transient tool failures that were recovered; report only checks that remain failed or blockers that remain unresolved.
29
29
 
30
30
  ## Release boundary
31
- Never commit, push, publish, tag, release, or bump a package version. The parent workflow owns documentation synchronization, the final independent review, and every release action—even when repository instructions normally automate release after green checks.
31
+ Never commit, push, publish, tag, release, or bump a package version. The parent workflow owns the independent review gate, any conditional final documentation sync, and every release action—even when repository instructions normally automate release after green checks.
32
32
 
33
33
  ## Collaboration
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
- - The parent runtime automatically runs enabled `documenter` and `reviewer` stages after a successful top-level worker. Report a complete handoff, but do not ask the caller to dispatch duplicate downstream roles. Never treat your own verification as the final gate.
37
+ - 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
38
 
39
39
  ## Output format
40
40
  ## Completed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ferris1225/pi-subagents",
3
- "version": "4.1.3",
3
+ "version": "4.1.5",
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",