@fyeeme/pi-review 2.0.0 → 2.0.1
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 +77 -132
- package/agents/cleaner-altitude.md +18 -0
- package/agents/cleaner-efficiency.md +19 -0
- package/agents/cleaner-reuse.md +16 -0
- package/agents/cleaner-simplification.md +16 -0
- package/agents/finder-conventions.md +23 -0
- package/agents/finder-cross-file.md +21 -0
- package/agents/finder-diff-scan.md +23 -0
- package/agents/finder-language-pitfall.md +21 -0
- package/agents/finder-removed-behavior.md +21 -0
- package/agents/finder-wrapper-proxy.md +23 -0
- package/agents/gap-hunter.md +24 -0
- package/agents/verifier.md +33 -0
- package/index.ts +34 -29
- package/package.json +17 -15
- package/prompts/review.md +23 -0
- package/prompts/simplify.parallel.md +45 -0
- package/prompts/simplify.single.md +23 -0
- package/skills/{code-review → review}/SKILL.md +134 -33
- package/skills/simplify/SKILL.md +98 -41
- package/src/config.ts +103 -0
- package/src/diff.ts +306 -0
- package/src/dispatch.ts +238 -0
- package/src/strategy.ts +76 -0
- package/src/tools/review_report.ts +17 -15
- package/src/commands/code-review.ts +0 -100
- package/src/commands/code-simplify.ts +0 -100
- package/src/tools/subagent.ts +0 -367
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fyeeme/pi-review",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "Review & cleanup
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Review & cleanup assets for pi: /review and /simplify commands dispatching declarative prompt templates (parallel strategy as frontmatter data) plus review methodology skills and finder/verifier agent definitions. Spawning lives in @fyeeme/pi-subagents; this package registers the review_report findings sink and the generic dispatcher.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "fyeeme",
|
|
@@ -9,25 +9,29 @@
|
|
|
9
9
|
"node": ">=18"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [
|
|
12
|
-
"pi-package",
|
|
13
12
|
"pi",
|
|
13
|
+
"pi-package",
|
|
14
14
|
"code-review",
|
|
15
15
|
"simplify",
|
|
16
16
|
"cleanup",
|
|
17
|
-
"subagent",
|
|
18
|
-
"fan-out",
|
|
19
17
|
"review"
|
|
20
18
|
],
|
|
21
19
|
"files": [
|
|
22
20
|
"*.ts",
|
|
23
21
|
"src/**/*.ts",
|
|
24
22
|
"skills/**/*.md",
|
|
23
|
+
"prompts/**/*.md",
|
|
24
|
+
"agents/**/*.md",
|
|
25
25
|
"README.md",
|
|
26
26
|
"LICENSE"
|
|
27
27
|
],
|
|
28
28
|
"pi": {
|
|
29
29
|
"extensions": [
|
|
30
30
|
"./index.ts"
|
|
31
|
+
],
|
|
32
|
+
"skills": [
|
|
33
|
+
"skills/review",
|
|
34
|
+
"skills/simplify"
|
|
31
35
|
]
|
|
32
36
|
},
|
|
33
37
|
"scripts": {
|
|
@@ -35,20 +39,18 @@
|
|
|
35
39
|
"typecheck": "tsc"
|
|
36
40
|
},
|
|
37
41
|
"dependencies": {
|
|
38
|
-
"@fyeeme/pi-
|
|
42
|
+
"@fyeeme/pi-subagents": "2.1.1"
|
|
39
43
|
},
|
|
40
44
|
"peerDependencies": {
|
|
41
|
-
"@earendil-works/pi-ai": ">=0.84.
|
|
42
|
-
"@earendil-works/pi-coding-agent": ">=0.84.
|
|
43
|
-
"@earendil-works/pi-tui": ">=0.84.
|
|
44
|
-
"
|
|
45
|
-
"typebox": ">=1.0.0",
|
|
46
|
-
"typescript": ">=5.0.0"
|
|
45
|
+
"@earendil-works/pi-ai": ">=0.84.4",
|
|
46
|
+
"@earendil-works/pi-coding-agent": ">=0.84.4",
|
|
47
|
+
"@earendil-works/pi-tui": ">=0.84.4",
|
|
48
|
+
"typebox": ">=1.0.0"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
|
-
"@earendil-works/pi-ai": "0.84.
|
|
50
|
-
"@earendil-works/pi-coding-agent": "0.84.
|
|
51
|
-
"@earendil-works/pi-tui": "0.84.
|
|
51
|
+
"@earendil-works/pi-ai": "0.84.4",
|
|
52
|
+
"@earendil-works/pi-coding-agent": "0.84.4",
|
|
53
|
+
"@earendil-works/pi-tui": "0.84.4",
|
|
52
54
|
"@types/node": "22.19.19",
|
|
53
55
|
"jiti": "2.7.0",
|
|
54
56
|
"typebox": "1.1.38",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "/review trigger — effort-level code review via the review skill"
|
|
3
|
+
vars: [effort, effort-source, extra-args, skill, finder-max-turns, verifier-max-turns, gap-hunt-max-turns, verify]
|
|
4
|
+
---
|
|
5
|
+
Run a code review now. Effective effort: {{effort}} ({{effort-source}}){{extra-args}}.
|
|
6
|
+
|
|
7
|
+
First load the review skill with the read tool: {{skill}}. Then follow it
|
|
8
|
+
exactly — dispatch the finder / verifier / gap-hunter agents it calls for
|
|
9
|
+
through the `subagent` tool (bundled agents: finder-diff-scan,
|
|
10
|
+
finder-removed-behavior, finder-cross-file, finder-language-pitfall,
|
|
11
|
+
finder-wrapper-proxy, cleaner-reuse, cleaner-simplification,
|
|
12
|
+
cleaner-efficiency, cleaner-altitude, finder-conventions, verifier,
|
|
13
|
+
gap-hunter), with `maxTurns: {{finder-max-turns}}` per finder batch,
|
|
14
|
+
`maxTurns: {{verifier-max-turns}}` per verifier and `maxTurns: {{gap-hunt-max-turns}}`
|
|
15
|
+
for the gap-hunt as the skill instructs.
|
|
16
|
+
|
|
17
|
+
The `subagent` tool is a pi extension tool in your session toolset — judge
|
|
18
|
+
its availability from that list, never via `mcp` tool search (which only
|
|
19
|
+
indexes MCP-server tools and cannot see extension tools).
|
|
20
|
+
|
|
21
|
+
Verification guidance (the skill's `--fix` flow consumes it):
|
|
22
|
+
|
|
23
|
+
{{verify}}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "/simplify trigger — PARALLEL mode (4-agent fan-out via the subagent tool)"
|
|
3
|
+
parallel-when:
|
|
4
|
+
context-below: 0.8
|
|
5
|
+
diff-chars-below: 400000
|
|
6
|
+
vars: [target, scope-label, pct, git-command, context-package, skill, verify, simplify-max-turns]
|
|
7
|
+
---
|
|
8
|
+
Clean up the changed code now. Target: {{target}}.
|
|
9
|
+
|
|
10
|
+
Dispatcher decided PARALLEL mode (context {{pct}} full; scope {{scope-label}}).
|
|
11
|
+
Follow the phases IN ORDER — do not launch anything before Phase 0 is done.
|
|
12
|
+
|
|
13
|
+
## Phase 0 — read the diff (visible, before any agent launches)
|
|
14
|
+
|
|
15
|
+
{{context-package}}
|
|
16
|
+
|
|
17
|
+
Run exactly this command (the dispatcher already resolved the scope — do not
|
|
18
|
+
re-derive a different range):
|
|
19
|
+
|
|
20
|
+
{{git-command}}
|
|
21
|
+
|
|
22
|
+
Read the full diff, then write a 2–4 line change-intent summary BEFORE
|
|
23
|
+
launching anything — that summary and your first-hand reading are what you
|
|
24
|
+
will use to merge, dedup, and judge the agents' findings in Phase 2.
|
|
25
|
+
|
|
26
|
+
## Phase 1 — launch the 4 cleanup agents
|
|
27
|
+
|
|
28
|
+
Call the `subagent` tool in parallel mode with 4 tasks, one per agent —
|
|
29
|
+
cleaner-reuse, cleaner-simplification, cleaner-efficiency, cleaner-altitude —
|
|
30
|
+
each task being: "Review the changed code of {{target}} for <angle> findings.
|
|
31
|
+
Run this first to see the diff: {{git-command}}. Report file:line — one-line
|
|
32
|
+
summary — the concrete cost." Set `maxTurns: {{simplify-max-turns}}` on the call (the slowest
|
|
33
|
+
agent pins the wave's wall time; a capped agent still owes partial output).
|
|
34
|
+
The agents' angle guidance rides their own definitions — do not write the
|
|
35
|
+
agent prompts yourself or inline the diff anywhere. The tool's result carries
|
|
36
|
+
the four findings reports.
|
|
37
|
+
|
|
38
|
+
## Phase 2 — apply, verify, report
|
|
39
|
+
|
|
40
|
+
When the tool result arrives, merge/dedup the findings against your Phase 0
|
|
41
|
+
reading, then load {{skill}} via the read tool and follow its Phase 2
|
|
42
|
+
(snapshot → apply → verify → auto-revert on failure → report via
|
|
43
|
+
review_report with `fanned_out: true` — the 4-agent fan-out actually ran).
|
|
44
|
+
Never apply changes the findings don't justify.
|
|
45
|
+
{{verify}}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "/simplify trigger — SINGLE-PASS mode (angles worked inline, no fan-out)"
|
|
3
|
+
vars: [target, reasons, scope-label, too-large, git-command, context-package, skill, verify]
|
|
4
|
+
---
|
|
5
|
+
Clean up the changed code now. Target: {{target}}.
|
|
6
|
+
|
|
7
|
+
Dispatcher decided SINGLE-PASS mode ({{reasons}}). Scope: {{scope-label}}.
|
|
8
|
+
|
|
9
|
+
## Phase 0 — read the diff first
|
|
10
|
+
|
|
11
|
+
{{context-package}}
|
|
12
|
+
|
|
13
|
+
Run exactly this command (the dispatcher already resolved the scope — do not
|
|
14
|
+
re-derive a different range):
|
|
15
|
+
|
|
16
|
+
{{git-command}}
|
|
17
|
+
|
|
18
|
+
Read the full diff, then write a 2–4 line change-intent summary before
|
|
19
|
+
reviewing.{{too-large}}
|
|
20
|
+
|
|
21
|
+
Then load {{skill}} via the read tool and follow its single-pass body. Work
|
|
22
|
+
the four angles inline — do not fake fan-out.
|
|
23
|
+
{{verify}}
|
|
@@ -1,16 +1,45 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: "Review the current diff for correctness bugs and reuse/simplification/efficiency cleanups at the given effort level. Fresh reverse of CC `/code-review`
|
|
2
|
+
name: review
|
|
3
|
+
description: "Review the current diff, or a PR number/branch/path target, for correctness bugs and reuse/simplification/efficiency cleanups at the given effort level (low/medium: fewer, high-confidence findings; high→max: broader coverage, may include uncertain findings). Fresh reverse of CC `/review` (its own name there is `code-review`), re-verified against CLI v2.1.261 (2026-09-05; originally reversed from v2.1.223). Effort semantics: medium = precision, high+ = recall. Pass --fix to apply, --comment to post findings (GitHub inline / GitLab MR note), --share to publish a review page."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<!--
|
|
7
|
-
Origin: Claude Code built-in skill `/
|
|
7
|
+
Origin: Claude Code built-in skill `/review` (CLI v2.1.223), freshly
|
|
8
8
|
reverse-engineered 2026-08-06 from bin/claude.exe strings. This file is
|
|
9
9
|
sourced DIRECTLY from the 2.1.223 binary — NOT carried forward from the
|
|
10
10
|
earlier v2.1.220 reconstruction. Every section below was located in the
|
|
11
11
|
extracted strings (cc_strings_223.txt) and verified.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
── RE-VERIFIED against CLI v2.1.261 (bin/claude.exe raw bytes, 2026-09-05) ──
|
|
14
|
+
- The 2.1.217-era background Workflow (phases Scope/Find/Verify/Sweep/
|
|
15
|
+
Synthesize) is GONE — the phase prompts now live inline in the skill
|
|
16
|
+
and dispatch via the Agent tool; per the bundled changelog, high/
|
|
17
|
+
xhigh/max now run inside a background agent (a CC host capability Pi
|
|
18
|
+
has no counterpart for — Pi runs inline in the session).
|
|
19
|
+
- 2.1.261 ships flag-gated effort variants (e.g. an inline, dedup-only
|
|
20
|
+
xhigh WITHOUT verify, alongside the fan-out + 1-vote-verify shape).
|
|
21
|
+
This skill keeps the uniform linearization: medium+ = fan-out +
|
|
22
|
+
grouped verify; sweep at xhigh/max.
|
|
23
|
+
- Angle bodies A–E and Reuse/Simplification/Efficiency/Conventions are
|
|
24
|
+
byte-identical to what we carried; **Altitude** gained CC's
|
|
25
|
+
root-cause phrasing + "name that change" (synced below).
|
|
26
|
+
- NEW sweep focus list ("what the first pass tends to miss") — synced
|
|
27
|
+
into Phase 3 and agents/gap-hunter.md.
|
|
28
|
+
- --comment gained GitLab: ONE general MR note via `glab mr note`
|
|
29
|
+
(glab has no single verb for line-anchored comments); GitHub inline
|
|
30
|
+
falls back to `gh api repos/{owner}/{repo}/pulls/{pr}/comments`,
|
|
31
|
+
suggestion block only when it fully fixes the issue — synced below.
|
|
32
|
+
- Output contract unchanged: {level, findings} with file/line/summary/
|
|
33
|
+
short_summary(≤60)/failure_scenario/category/verdict; outcome 三档
|
|
34
|
+
fixed / skipped / no_change_needed on re-report — all still match.
|
|
35
|
+
NEW: CC forbids creating/publishing an artifact of the review ("the
|
|
36
|
+
tool call is the report"); Pi keeps --share as the explicit opt-in
|
|
37
|
+
and forbids UNSOLICITED artifacts instead.
|
|
38
|
+
- `ultra` (deep multi-agent cloud review) still exists upstream; still
|
|
39
|
+
omitted here (requires claude.ai cloud access, which Pi lacks).
|
|
40
|
+
Sticky last-effort (codeReviewLastEffort) unchanged.
|
|
41
|
+
|
|
42
|
+
What CC 2.1.227 contained (historical basis, verified 2026-08-11):
|
|
14
43
|
- Effort quad tuple {correctnessAngles, perAngle, maxFindings, sweep}:
|
|
15
44
|
medium {3,6,8,false} / high {3,6,10,false} / xhigh {5,8,15,true} / max
|
|
16
45
|
same structure as xhigh. medium = precision; high+ = recall
|
|
@@ -32,9 +61,9 @@ description: "Review the current diff for correctness bugs and reuse/simplificat
|
|
|
32
61
|
- Fixed-later obligation (CC Q8m): later fixes in the session must
|
|
33
62
|
re-report findings with updated outcome.
|
|
34
63
|
|
|
35
|
-
Invocation: /
|
|
64
|
+
Invocation: /review [low|medium|high|xhigh|max] [--fix] [--comment] [--share] [<target>]
|
|
36
65
|
target = Class#method | file path | PR number | branch name
|
|
37
|
-
With no level given, the /
|
|
66
|
+
With no level given, the /review HANDLER reuses the last level you
|
|
38
67
|
typed (CC 2.1.223 codeReviewLastEffort); the skill always receives a
|
|
39
68
|
concrete level.
|
|
40
69
|
(CC also supports `ultra` — deep multi-agent review in the cloud.
|
|
@@ -55,16 +84,23 @@ description: "Review the current diff for correctness bugs and reuse/simplificat
|
|
|
55
84
|
(mode: parallel), or runs angles sequentially if unavailable.
|
|
56
85
|
3. Verify — CC uses the Agent tool; Pi uses `subagent` for the
|
|
57
86
|
independent verify agent (fallback: self-check).
|
|
58
|
-
4. Workflow — CC
|
|
59
|
-
Scope/Find/Verify/Sweep/Synthesize)
|
|
60
|
-
|
|
61
|
-
|
|
87
|
+
4. Workflow — CC 2.1.217 routed high/xhigh/max to a background Workflow
|
|
88
|
+
(phases Scope/Find/Verify/Sweep/Synthesize); 2.1.261 removed
|
|
89
|
+
it and runs the phases inline via its Agent tool, with high+
|
|
90
|
+
inside a background agent. Pi has neither host capability, so
|
|
91
|
+
this skill runs INLINE and linearizes those phases into the
|
|
92
|
+
flow below; the Phase 0.5 scope block is our absorption of
|
|
93
|
+
the old workflow's Scope phase (kept: it still turns N
|
|
94
|
+
repeated subagent discoveries into one).
|
|
62
95
|
5. ultra — dropped (cloud-only).
|
|
63
|
-
6. --share — CC uses the Artifact tool; Pi uses lavish-axi.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
96
|
+
6. --share — CC uses the Artifact tool; Pi uses lavish-axi. CC 2.1.261
|
|
97
|
+
forbids UNSOLICITED review artifacts; --share stays the
|
|
98
|
+
explicit opt-in.
|
|
99
|
+
7. --comment— CC uses mcp__github_inline_comment (fallback `gh api`) and
|
|
100
|
+
posts GitLab MRs as one general note via `glab mr note`; Pi
|
|
101
|
+
mirrors both fallbacks (see the --comment section).
|
|
102
|
+
|
|
103
|
+
Prerequisite: the `subagent` tool (@fyeeme/pi-subagents; parallel mode) for
|
|
68
104
|
medium and above, and for the xhigh/max gap-hunter. lavish-axi
|
|
69
105
|
for --share. low runs standalone (no subagents).
|
|
70
106
|
-->
|
|
@@ -188,6 +224,37 @@ finder agents in a single batch (mode: parallel) so they run concurrently;
|
|
|
188
224
|
otherwise do not fake the fan-out — work the angles yourself in sequence in
|
|
189
225
|
this same context, or report that the subagent capability is unavailable.
|
|
190
226
|
|
|
227
|
+
**Checking `subagent` availability** — wherever this skill says "if the
|
|
228
|
+
`subagent` tool is available", decide from THIS session's tool list, never by
|
|
229
|
+
probing: `subagent` is a pi extension tool registered alongside
|
|
230
|
+
read/bash/edit, not an MCP server tool, so the `mcp` gateway's tool search
|
|
231
|
+
answers "No tools matching subagent" even when the tool is registered and
|
|
232
|
+
callable. If it is in your toolset, use it without further verification; if it
|
|
233
|
+
is genuinely absent, take the sequential fallback above.
|
|
234
|
+
|
|
235
|
+
**Finder turn budget(Pi adaptation — the same runaway-exploration guard the
|
|
236
|
+
Phase 3 gap-hunt already carries)** — a finder that exhausts its turn cap
|
|
237
|
+
mid-read returns NOTHING and silently loses its whole angle (observed on a
|
|
238
|
+
168-file diff: 7/10 finders burned their full turn budget with zero output,
|
|
239
|
+
and the coverage hole cascaded into two extra compensation waves). Constrain
|
|
240
|
+
every finder batch:
|
|
241
|
+
|
|
242
|
+
1. **Set `maxTurns: 20` on the `subagent` call** — the slowest finder pins
|
|
243
|
+
the wave's wall time; 20 turns covers the highest-risk hunks of any
|
|
244
|
+
single angle, and a capped finder still owes partial output (next item).
|
|
245
|
+
(20 is the built-in default — if the trigger message states a different
|
|
246
|
+
finder budget, use that instead.)
|
|
247
|
+
2. **Declare the budget inside each finder prompt** — e.g. "You have ~15
|
|
248
|
+
tool calls. Spend them on the highest-risk hunks first; when half are
|
|
249
|
+
spent, stop opening new files."
|
|
250
|
+
3. **Final-message contract** — the finder's LAST assistant message must be
|
|
251
|
+
its JSON candidate array (an empty `[]` is a valid answer). Partial
|
|
252
|
+
output beats none: candidates that never reach text never reach verify.
|
|
253
|
+
4. **A finder that hits max-turns with no JSON is a FAILED finder**, not an
|
|
254
|
+
empty angle: re-dispatch that single angle on a narrower file slice
|
|
255
|
+
before Phase 2 (or fold it into the xhigh/max gap-hunt), and note the
|
|
256
|
+
re-dispatch in the report.
|
|
257
|
+
|
|
191
258
|
**Finder allocation** (CC inline, verified 2.1.227): the number of correctness
|
|
192
259
|
angles comes from the effort quad tuple, taken **in order A→E** (`slice(0, N)`
|
|
193
260
|
— do not hand-pick angles; that makes runs unreproducible):
|
|
@@ -272,10 +339,11 @@ alternative.
|
|
|
272
339
|
|
|
273
340
|
### Altitude
|
|
274
341
|
|
|
275
|
-
Check that each change
|
|
276
|
-
bandaid. Special cases layered on shared
|
|
277
|
-
isn't deep enough — prefer
|
|
278
|
-
special cases
|
|
342
|
+
Check that each change fixes the root cause at the right depth rather than
|
|
343
|
+
patching a symptom with a fragile bandaid. Special cases layered on shared
|
|
344
|
+
infrastructure are a sign the fix isn't deep enough — prefer the simpler,
|
|
345
|
+
more general change to the underlying mechanism over adding special cases,
|
|
346
|
+
and name that change.
|
|
279
347
|
### Conventions (CLAUDE.md)
|
|
280
348
|
Find the CLAUDE.md files that govern the changed code: the user-level
|
|
281
349
|
~/.claude/CLAUDE.md, the repo-root CLAUDE.md, plus any CLAUDE.md or
|
|
@@ -303,7 +371,9 @@ Then verify each candidate **grouped by location**. If the `subagent` tool is
|
|
|
303
371
|
available: group the deduplicated candidates by `(file, line)`; dispatch ONE
|
|
304
372
|
independent verify agent per group (mode: parallel, one prompt per group),
|
|
305
373
|
giving it the scope block, the diff, the relevant file(s), and the full
|
|
306
|
-
candidate list for that location with each candidate's index.
|
|
374
|
+
candidate list for that location with each candidate's index. Set
|
|
375
|
+
`maxTurns: 15` on each verifier call (15 is the built-in default — a
|
|
376
|
+
different verifier budget stated in the trigger message wins). The verifier
|
|
307
377
|
returns a verdict per candidate:
|
|
308
378
|
|
|
309
379
|
```
|
|
@@ -344,7 +414,8 @@ lost an anchor. These are PLAUSIBLE.
|
|
|
344
414
|
keeps the candidate: do NOT drop it on uncertainty ("speculative", "depends
|
|
345
415
|
on runtime state"). That is the recall contract of high+. Medium is the
|
|
346
416
|
precision level: there, additionally weigh whether a maintainer would act on
|
|
347
|
-
the finding before keeping it.
|
|
417
|
+
the finding before keeping it. At xhigh/max a missed bug ships — err on the
|
|
418
|
+
side of surfacing hardest there.
|
|
348
419
|
|
|
349
420
|
**REFUTED** only when constructible from the code: factually wrong (quote the
|
|
350
421
|
actual line); provably impossible (type/constant/invariant — show it); already
|
|
@@ -354,8 +425,13 @@ handled in this diff (cite the guard); or pure style with no observable effect.
|
|
|
354
425
|
|
|
355
426
|
At **xhigh and max**, after Phase 2 dedup, dispatch ONE fresh finder agent (the
|
|
356
427
|
`subagent` tool) that has never seen the candidates and hunts only for gaps not
|
|
357
|
-
already listed — **at most 8 new candidates**.
|
|
358
|
-
|
|
428
|
+
already listed — **at most 8 new candidates**. Focus the hunt on what the first
|
|
429
|
+
pass tends to miss (CC 2.1.261 sweep list): moved/extracted code that dropped a
|
|
430
|
+
guard or anchor; second-tier footguns (dataclass default evaluated once,
|
|
431
|
+
`hash()` non-determinism, lock-scope shrink, predicate methods with side
|
|
432
|
+
effects); setup/teardown asymmetry in tests; config defaults flipped. If
|
|
433
|
+
nothing new turns up, return an empty sweep — do not pad. Feed anything it
|
|
434
|
+
finds back through Phase 2 verify before keeping it.
|
|
359
435
|
|
|
360
436
|
Constrain it so exploration can't run away (Pi adaptation — CC's workflow bounds
|
|
361
437
|
this differently):
|
|
@@ -365,7 +441,9 @@ this differently):
|
|
|
365
441
|
results: the diff, the enclosing functions, the deduplicated finding list,
|
|
366
442
|
and any search results. The gap-hunt agent **analyzes**, it does not
|
|
367
443
|
**discover**.
|
|
368
|
-
2. **Set `maxTurns: 15`** on the `subagent` call — caps it at 15 assistant turns
|
|
444
|
+
2. **Set `maxTurns: 15`** on the `subagent` call — caps it at 15 assistant turns
|
|
445
|
+
(built-in default — a different gap-hunt budget stated in the trigger
|
|
446
|
+
message wins).
|
|
369
447
|
3. **Declare a tool-call budget in the prompt** — e.g. "You have ONLY 3 tool
|
|
370
448
|
calls to read files. Read them now, then analyze from this message's
|
|
371
449
|
context."
|
|
@@ -384,7 +462,11 @@ to CC's `ReportFindings`) — call it **once** with
|
|
|
384
462
|
ranked most-severe first (empty array if nothing survived verification). The
|
|
385
463
|
tool renders the Chinese Markdown report (table + details) back to the
|
|
386
464
|
conversation AND writes a machine-readable JSON to `<cwd>/.pi/review/` for CI /
|
|
387
|
-
`--fix` / `--comment`. Do **not** also hand-write the Markdown table.
|
|
465
|
+
`--fix` / `--comment`. Do **not** also hand-write the Markdown table. Also do
|
|
466
|
+
**not** spontaneously produce a review page/artifact when `--share` was not
|
|
467
|
+
passed — the `review_report` call IS the report (CC 2.1.261: "do not create
|
|
468
|
+
or publish an artifact of the review — the tool call is the report");
|
|
469
|
+
`--share` is the only explicit exception.
|
|
388
470
|
|
|
389
471
|
Each finding in the array carries: `file`, `line` (optional), `category`
|
|
390
472
|
(`correctness` / `reuse` / `simplification` / `efficiency` / `altitude` /
|
|
@@ -431,31 +513,50 @@ findings to the working tree instead of stopping at the report: fix each one
|
|
|
431
513
|
directly — correctness bugs and reuse/simplification/efficiency cleanups alike.
|
|
432
514
|
Skip any finding whose fix would change intended behavior, require changes well
|
|
433
515
|
outside the reviewed diff, or that you judge to be a false positive — note the
|
|
434
|
-
skip rather than arguing with it.
|
|
516
|
+
skip rather than arguing with it. If a verification command was detected (see
|
|
517
|
+
the trigger message's verification line), run it BEFORE re-reporting: a finding
|
|
518
|
+
whose fix breaks verification is reverted and re-reported as `skipped`
|
|
519
|
+
(verification is opportunistic — with no detected command, re-report directly
|
|
520
|
+
and say verification was not run). Then call `review_report` once more to
|
|
435
521
|
re-report (same `report_id`), setting `outcome` on each finding (`fixed` =
|
|
436
522
|
applied and verified / `skipped` = real but not applied, incl. reverted /
|
|
437
523
|
`no_change_needed` = not applicable or already handled). This structured
|
|
438
524
|
re-report replaces the hand-written summary and makes the fix result
|
|
439
|
-
machine-consumable.
|
|
525
|
+
machine-consumable. Make that call immediately after the fixes land, before
|
|
526
|
+
any prose summary (CC 2.1.261: the host UI's per-finding status updates only
|
|
527
|
+
from it).
|
|
440
528
|
If `review_report` is unavailable, fall back to a brief text summary of what was
|
|
441
529
|
fixed and what was skipped.
|
|
442
530
|
|
|
443
531
|
## Posting comments (--comment)
|
|
444
532
|
|
|
445
|
-
The `--comment` flag was passed.
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
533
|
+
The `--comment` flag was passed. After producing the findings list:
|
|
534
|
+
|
|
535
|
+
- **GitHub PR target** — post each finding as an inline PR comment on the
|
|
536
|
+
corresponding `file`/`line`, one call per finding; include a suggestion
|
|
537
|
+
block only when it fully fixes the issue (CC 2.1.261 rule). If no
|
|
538
|
+
inline-comment tool is available on Pi, fall back to `gh api
|
|
539
|
+
repos/{owner}/{repo}/pulls/{pr}/comments`; if `gh` is unavailable too,
|
|
540
|
+
print the findings as text and note that inline posting was unavailable.
|
|
541
|
+
- **GitLab MR target** — post the findings as ONE general MR note via
|
|
542
|
+
`glab mr note -m "<body>"` from inside the project's checkout — every
|
|
543
|
+
finding with its file:line, the issue, and the suggested fix (CC 2.1.261;
|
|
544
|
+
glab has no single verb for line-anchored comments, so post the general
|
|
545
|
+
note unless the user explicitly asks for inline threads — those need
|
|
546
|
+
`glab api projects/:id/merge_requests/:iid/discussions`). If `glab` is
|
|
547
|
+
unavailable, print the findings instead.
|
|
548
|
+
- **Not a PR/MR target** — print the findings to the terminal and note that
|
|
549
|
+
`--comment` was ignored.
|
|
449
550
|
|
|
450
551
|
## Publishing a shareable review (--share)
|
|
451
552
|
|
|
452
553
|
The `--share` flag was passed. After producing the findings list, also publish
|
|
453
554
|
them as an artifact so they can be shared and iterated on outside the terminal.
|
|
454
555
|
|
|
455
|
-
1. Write a self-contained HTML review page to `.lavish/
|
|
556
|
+
1. Write a self-contained HTML review page to `.lavish/review-<n>.html`
|
|
456
557
|
(create `.lavish/` in the repo root if missing). The page must render with no
|
|
457
558
|
server and carry every finding plus its context.
|
|
458
|
-
2. Open it with `lavish-axi .lavish/
|
|
559
|
+
2. Open it with `lavish-axi .lavish/review-<n>.html` so the reader can
|
|
459
560
|
review, annotate, and send feedback back through the poll.
|
|
460
561
|
|
|
461
562
|
Page structure (follow lavish design guidance — clear visual hierarchy, no
|