@diegopetrucci/pi-extensions 0.1.54 → 0.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/extensions/code-reviewer/.pi-fleet-tested-version +1 -0
- package/extensions/code-reviewer/README.md +84 -0
- package/extensions/code-reviewer/index.ts +1280 -0
- package/extensions/code-reviewer/package.json +35 -0
- package/extensions/dynamic-context-pruning/.pi-fleet-tested-version +1 -0
- package/extensions/dynamic-context-pruning/README.md +435 -0
- package/extensions/dynamic-context-pruning/index.ts +2546 -0
- package/extensions/dynamic-context-pruning/package.json +34 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@diegopetrucci/pi-extensions)
|
|
4
4
|
|
|
5
|
-
A collection of [pi](https://pi.dev) agent extensions I made.
|
|
5
|
+
A collection of [pi](https://pi.dev) agent extensions I made. (btw, [I am also building my own harness on top of pi](https://github.com/diegopetrucci/the-last-harness). have a look!)
|
|
6
6
|
|
|
7
7
|
### Subagents
|
|
8
8
|
|
|
9
|
+
- [`code-reviewer`](./extensions/code-reviewer): Adds a read-only `code_reviewer` subagent tool that reviews local changes for ticket fit, diff mismatches, correctness, security, simplicity, and validation gaps without implementing fixes, auto-selects a contrarian-style opposite-provider review model when available, and clamps requested thinking to the chosen model's capabilities.
|
|
9
10
|
- [`contrarian`](./extensions/contrarian): Adds a read-only contrarian tool that spins up an isolated subprocess to stress-test plans, designs, assumptions, bug hypotheses, and conclusions by steelmanning the strongest opposing case.
|
|
10
11
|
- [`librarian`](./extensions/librarian): Adds a GitHub research scout with a local repo checkout cache disabled by default under the OS user cache directory, toggleable with `/librarian-cache`, configurable subagent model/thinking defaults via `/librarian-config`, and cached repos expiring after 7 days of non-use.
|
|
11
12
|
- [`oracle`](./extensions/oracle): Adds an Amp-style read-only oracle tool that auto-selects the strongest reasoning model on the current provider/subscription, supports persisted `/oracle` model/thinking defaults, requests xhigh reasoning by default and clamps to model capabilities, and shows live status while running.
|
|
@@ -33,6 +34,7 @@ A collection of [pi](https://pi.dev) agent extensions I made.
|
|
|
33
34
|
|
|
34
35
|
- [`context-cap`](./extensions/context-cap): Caps effective model context windows at 200k tokens by default so pi avoids the `dumb zone`; toggle temporarily with `/context-cap`.
|
|
35
36
|
- [`context-inspector`](./extensions/context-inspector): Adds `/context`, a local self-contained HTML dashboard that breaks down where the current session context is going, with category overview, top offenders, and drilldown search.
|
|
37
|
+
- [`dynamic-context-pruning`](./extensions/dynamic-context-pruning): Automatically prunes duplicate tool results, stale errored inputs, and superseded file-op outputs from long sessions behind a cache-aware net-benefit gate, with a `/prune` picker and `/context-pruning` status/control commands.
|
|
36
38
|
|
|
37
39
|
### Safety
|
|
38
40
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.80.3
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# code-reviewer
|
|
2
|
+
|
|
3
|
+
Adds a read-only `code_reviewer` subagent tool that adapts The Last Harness [`code-reviewer`](https://github.com/diegopetrucci/the-last-harness/blob/main/agents/subagents/code-reviewer.md) prompt into a standalone pi extension.
|
|
4
|
+
|
|
5
|
+
Use it when you want an isolated second-pass review of a proposed change against the local checkout. The tool stays read-only, checks ticket fit and scope first, then looks for diff mismatches, correctness bugs, security/safety issues, unnecessary complexity, and missing validation.
|
|
6
|
+
|
|
7
|
+
This package is adapted from the TLH code-reviewer workflow for use as a standalone pi extension.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
### Standalone npm package
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pi install npm:@diegopetrucci/pi-code-reviewer
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Collection package
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pi install npm:@diegopetrucci/pi-extensions
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### GitHub package
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pi install git:github.com/diegopetrucci/pi-extensions
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Then reload pi:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
/reload
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## `code_reviewer` tool behavior
|
|
36
|
+
|
|
37
|
+
The tool accepts:
|
|
38
|
+
|
|
39
|
+
- `task` — required review target and success criteria
|
|
40
|
+
- `diff` — optional diff, patch, or change summary
|
|
41
|
+
- `context` — optional extra constraints or known risks
|
|
42
|
+
|
|
43
|
+
When called, it launches an isolated in-memory child agent with:
|
|
44
|
+
|
|
45
|
+
- no inherited extensions, skills, prompt templates, themes, context files, or agents files;
|
|
46
|
+
- an auto-selected review model that prefers contrarian-style opposite-provider and opposite-family candidates before same-provider fallbacks;
|
|
47
|
+
- requested thinking taken from the active session when available, otherwise defaulting to `high` for reasoning models and `off` for non-reasoning models, then clamped to the selected model's supported level;
|
|
48
|
+
- read-only tools only: `read`, `grep`, `find`, `ls`, and guarded `bash`;
|
|
49
|
+
- a local-checkout path guard for file inspection;
|
|
50
|
+
- a bash guard that allows only direct read-only `git`, `gh`, or `pwd` invocations.
|
|
51
|
+
|
|
52
|
+
The review prompt prioritizes:
|
|
53
|
+
|
|
54
|
+
1. ticket fit and scope
|
|
55
|
+
2. diff accuracy
|
|
56
|
+
3. correctness and regressions
|
|
57
|
+
4. security and safety
|
|
58
|
+
5. simplicity and maintainability
|
|
59
|
+
6. tests and validation gaps
|
|
60
|
+
|
|
61
|
+
The final output is concise and includes a verdict, findings, validation notes, a scope check, and run details that show the final selected model and effective thinking level.
|
|
62
|
+
|
|
63
|
+
## Read-only guarantees
|
|
64
|
+
|
|
65
|
+
- The subagent is explicitly instructed not to implement changes.
|
|
66
|
+
- Runtime guards block write/edit tools, shell control operators, pipelines, redirection, path traversal outside the checkout, mutating `git`/`gh` commands, `npm`/publish commands, and other filesystem mutation.
|
|
67
|
+
- Built-in file-inspection tools are preferred over shell commands for local files.
|
|
68
|
+
|
|
69
|
+
## Example
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
Use code_reviewer on this task before merging:
|
|
73
|
+
|
|
74
|
+
{
|
|
75
|
+
"task": "Review ticket pe-7lpt implementation for scope fit and correctness.",
|
|
76
|
+
"context": "Focus on whether the new extension stays runtime-only and keeps tools read-only."
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Limitations
|
|
81
|
+
|
|
82
|
+
- The subagent has an 8-turn and 8-minute budget.
|
|
83
|
+
- The review quality depends on the local checkout matching the change being reviewed.
|
|
84
|
+
- `gh`-based inspection is available only when GitHub CLI is installed and authenticated, but the tool can still review local changes without it.
|