@diegopetrucci/pi-extensions 0.1.54 → 0.1.57

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.
Files changed (79) hide show
  1. package/.pi-fleet-tested-version +1 -1
  2. package/README.md +5 -3
  3. package/extensions/agent-workflow-audit/.pi-fleet-tested-version +1 -1
  4. package/extensions/agent-workflow-audit/package.json +1 -1
  5. package/extensions/annotate-git-diff/.pi-fleet-tested-version +1 -1
  6. package/extensions/annotate-git-diff/package.json +2 -2
  7. package/extensions/annotate-last-message/.pi-fleet-tested-version +1 -1
  8. package/extensions/annotate-last-message/package.json +1 -1
  9. package/extensions/brrr/.pi-fleet-tested-version +1 -1
  10. package/extensions/brrr/README.md +3 -3
  11. package/extensions/brrr/index.ts +26 -6
  12. package/extensions/brrr/package.json +1 -1
  13. package/extensions/claude-fast/.pi-fleet-tested-version +1 -1
  14. package/extensions/claude-fast/README.md +3 -3
  15. package/extensions/claude-fast/index.ts +1 -2
  16. package/extensions/claude-fast/package.json +1 -1
  17. package/extensions/code-reviewer/.pi-fleet-tested-version +1 -0
  18. package/extensions/code-reviewer/README.md +84 -0
  19. package/extensions/code-reviewer/index.ts +1288 -0
  20. package/extensions/code-reviewer/package.json +35 -0
  21. package/extensions/confirm-destructive/.pi-fleet-tested-version +1 -1
  22. package/extensions/confirm-destructive/package.json +1 -1
  23. package/extensions/context-cap/.pi-fleet-tested-version +1 -1
  24. package/extensions/context-cap/package.json +1 -1
  25. package/extensions/context-inspector/.pi-fleet-tested-version +1 -1
  26. package/extensions/context-inspector/README.md +4 -2
  27. package/extensions/context-inspector/index.ts +10 -4
  28. package/extensions/context-inspector/package.json +1 -1
  29. package/extensions/contrarian/.pi-fleet-tested-version +1 -1
  30. package/extensions/contrarian/index.ts +96 -92
  31. package/extensions/contrarian/package.json +1 -1
  32. package/extensions/dirty-repo-guard/.pi-fleet-tested-version +1 -1
  33. package/extensions/dirty-repo-guard/package.json +1 -1
  34. package/extensions/dynamic-context-pruning/.pi-fleet-tested-version +1 -0
  35. package/extensions/dynamic-context-pruning/README.md +435 -0
  36. package/extensions/dynamic-context-pruning/index.ts +2546 -0
  37. package/extensions/dynamic-context-pruning/package.json +34 -0
  38. package/extensions/git-footer/.pi-fleet-tested-version +1 -1
  39. package/extensions/git-footer/package.json +1 -1
  40. package/extensions/gnosis/.pi-fleet-tested-version +1 -1
  41. package/extensions/gnosis/package.json +1 -1
  42. package/extensions/illustrations-to-explain-things/.pi-fleet-tested-version +1 -1
  43. package/extensions/illustrations-to-explain-things/package.json +1 -1
  44. package/extensions/inline-bash/.pi-fleet-tested-version +1 -1
  45. package/extensions/inline-bash/package.json +1 -1
  46. package/extensions/librarian/.pi-fleet-tested-version +1 -1
  47. package/extensions/librarian/README.md +1 -1
  48. package/extensions/librarian/index.ts +39 -8
  49. package/extensions/librarian/package.json +1 -1
  50. package/extensions/minimal-footer/.pi-fleet-tested-version +1 -1
  51. package/extensions/minimal-footer/README.md +3 -3
  52. package/extensions/minimal-footer/index.ts +1 -1
  53. package/extensions/minimal-footer/package.json +1 -1
  54. package/extensions/notify/.pi-fleet-tested-version +1 -1
  55. package/extensions/notify/README.md +3 -3
  56. package/extensions/notify/index.ts +4 -6
  57. package/extensions/notify/package.json +1 -1
  58. package/extensions/openai-fast/.pi-fleet-tested-version +1 -1
  59. package/extensions/openai-fast/README.md +5 -5
  60. package/extensions/openai-fast/index.ts +11 -5
  61. package/extensions/openai-fast/package.json +2 -2
  62. package/extensions/oracle/.pi-fleet-tested-version +1 -1
  63. package/extensions/oracle/index.ts +97 -90
  64. package/extensions/oracle/package.json +1 -1
  65. package/extensions/permission-gate/.pi-fleet-tested-version +1 -1
  66. package/extensions/permission-gate/README.md +11 -4
  67. package/extensions/permission-gate/index.ts +156 -17
  68. package/extensions/permission-gate/package.json +5 -3
  69. package/extensions/quiet-tools/.pi-fleet-tested-version +1 -1
  70. package/extensions/quiet-tools/package.json +1 -1
  71. package/extensions/review/.pi-fleet-tested-version +1 -1
  72. package/extensions/review/README.md +1 -1
  73. package/extensions/review/index.ts +4 -4
  74. package/extensions/review/package.json +1 -1
  75. package/extensions/todo/.pi-fleet-tested-version +1 -1
  76. package/extensions/todo/package.json +1 -1
  77. package/extensions/triage-comments/.pi-fleet-tested-version +1 -1
  78. package/extensions/triage-comments/package.json +1 -1
  79. package/package.json +12 -7
@@ -1 +1 @@
1
- 0.80.3
1
+ 0.80.6
package/README.md CHANGED
@@ -2,10 +2,11 @@
2
2
 
3
3
  [![Total npm downloads](https://img.shields.io/npm/dt/%40diegopetrucci%2Fpi-extensions?label=total%20npm%20downloads)](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.
@@ -13,7 +14,7 @@ A collection of [pi](https://pi.dev) agent extensions I made.
13
14
  ### Providers
14
15
 
15
16
  - [`claude-fast`](./extensions/claude-fast): Adds `/claude-fast` to enable Anthropic Claude Fast mode for supported Claude Opus models by injecting `speed: "fast"`.
16
- - [`openai-fast`](./extensions/openai-fast): Adds `/fast` to enable OpenAI Codex Fast mode for ChatGPT-auth GPT-5.4 and GPT-5.5 by injecting the priority service tier.
17
+ - [`openai-fast`](./extensions/openai-fast): Adds `/fast` to enable OpenAI Codex Fast mode for ChatGPT-auth GPT-5.4, GPT-5.5, and GPT-5.6 Codex variants by injecting the priority service tier.
17
18
 
18
19
  ### UI
19
20
 
@@ -33,12 +34,13 @@ 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
 
39
41
  - [`confirm-destructive`](./extensions/confirm-destructive): Confirms before destructive session actions like clear, switch, and fork.
40
42
  - [`dirty-repo-guard`](./extensions/dirty-repo-guard): Prompts before new sessions, session switches, or forks when the current git repo has uncommitted changes.
41
- - [`permission-gate`](./extensions/permission-gate): Prompts for confirmation before dangerous bash commands like `rm -rf`, `sudo`, and `chmod 777`.
43
+ - [`permission-gate`](./extensions/permission-gate): Prompts for confirmation before dangerous bash commands and protected `write`/`edit` targets like `.git`, `node_modules`, and secret-bearing `.env` files.
42
44
 
43
45
  ### Quality of life
44
46
 
@@ -1 +1 @@
1
- 0.80.3
1
+ 0.80.6
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-agent-workflow-audit",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "A pi extension that runs an isolated repo workflow audit and returns only the final report to the main session.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1 +1 @@
1
- 0.80.3
1
+ 0.80.6
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-annotate-git-diff",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "A standalone pi extension that adds /annotate-git-diff, a native Glimpse UI for annotating git diffs and sending feedback to the editor.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -42,7 +42,7 @@
42
42
  "@earendil-works/pi-coding-agent": "*"
43
43
  },
44
44
  "dependencies": {
45
- "@tailwindcss/browser": "^4.3.0",
45
+ "@tailwindcss/browser": "^4.3.2",
46
46
  "glimpseui": "^0.8.1",
47
47
  "monaco-editor": "0.52.2"
48
48
  },
@@ -1 +1 @@
1
- 0.80.3
1
+ 0.80.6
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-annotate-last-message",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "A standalone pi extension that adds /annotate-last-message, a native Glimpse UI for annotating the latest assistant reply.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1 +1 @@
1
- 0.80.3
1
+ 0.80.6
@@ -32,10 +32,10 @@ Then reload pi:
32
32
 
33
33
  Config files are merged, with project config overriding global config:
34
34
 
35
- - `~/.pi/agent/extensions/brrr.json`
36
- - `<project>/.pi/brrr.json`
35
+ - `~/<pi-config-dir>/agent/extensions/brrr.json`
36
+ - `<project>/<pi-config-dir>/brrr.json`
37
37
 
38
- Project config is only read after Pi reports that the project is trusted.
38
+ Here `<pi-config-dir>` is Pi's runtime config directory name (`CONFIG_DIR_NAME`; `.pi` by default). Project config is only read after Pi reports that the project is trusted.
39
39
 
40
40
  The default config expects your webhook in `BRRR_WEBHOOK_URL`:
41
41
 
@@ -5,18 +5,17 @@
5
5
  * for more input.
6
6
  *
7
7
  * Config files (project overrides global):
8
- * - ~/.pi/agent/extensions/brrr.json
9
- * - <cwd>/.pi/brrr.json, when the project is trusted
8
+ * - ~/<pi-config-dir>/agent/extensions/brrr.json
9
+ * - <cwd>/<pi-config-dir>/brrr.json, when the project is trusted
10
10
  */
11
11
 
12
12
  import { execFile } from "node:child_process";
13
13
  import { existsSync, readFileSync } from "node:fs";
14
14
  import { basename, join } from "node:path";
15
15
  import { promisify } from "node:util";
16
- import { getAgentDir, type ExtensionAPI, type ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
16
+ import { CONFIG_DIR_NAME, getAgentDir, type ExtensionAPI, type ExtensionCommandContext, type SessionEntry } from "@earendil-works/pi-coding-agent";
17
17
 
18
18
  const execFileAsync = promisify(execFile);
19
- const CONFIG_DIR_NAME = ".pi";
20
19
 
21
20
  interface BrrrConfig {
22
21
  enabled: boolean;
@@ -180,6 +179,25 @@ function lastAssistantMessage(messages: readonly unknown[]): string | undefined
180
179
  return undefined;
181
180
  }
182
181
 
182
+ type SessionMessageSource = {
183
+ buildContextEntries(): SessionEntry[];
184
+ };
185
+
186
+ function sessionMessages(sessionManager: SessionMessageSource | undefined): readonly unknown[] {
187
+ if (!sessionManager) return [];
188
+
189
+ return sessionManager
190
+ .buildContextEntries()
191
+ .flatMap((entry: SessionEntry) => (entry.type === "message" ? [entry.message] : []));
192
+ }
193
+
194
+ function resolveAssistantMessage(
195
+ sessionManager: SessionMessageSource | undefined,
196
+ fallbackMessages: readonly unknown[],
197
+ ): string | undefined {
198
+ return lastAssistantMessage(sessionMessages(sessionManager)) ?? lastAssistantMessage(fallbackMessages);
199
+ }
200
+
183
201
  function truncateMessage(value: string): string {
184
202
  const trimmed = value.trim();
185
203
  if (trimmed.length <= 800) return trimmed;
@@ -237,7 +255,7 @@ export default function brrrExtension(pi: ExtensionAPI) {
237
255
  },
238
256
  });
239
257
 
240
- pi.on("agent_end", async (event, ctx) => {
258
+ pi.on("agent_settled", async (event, ctx) => {
241
259
  const config = loadConfig(ctx);
242
260
  if (!config.enabled) return;
243
261
  if (config.onlyWhenInteractive && !ctx.hasUI) return;
@@ -246,7 +264,9 @@ export default function brrrExtension(pi: ExtensionAPI) {
246
264
  if (!webhook || !isBrrrWebhookUrl(webhook)) return;
247
265
  if (await shouldSkipForIdleThreshold(config.idleSeconds)) return;
248
266
 
249
- const assistantMessage = config.includeLastAssistantMessage ? lastAssistantMessage(event.messages as readonly unknown[]) : undefined;
267
+ const assistantMessage = config.includeLastAssistantMessage
268
+ ? resolveAssistantMessage(ctx.sessionManager, (event as { messages?: readonly unknown[] }).messages ?? [])
269
+ : undefined;
250
270
  const message = truncateMessage(assistantMessage || formatTemplate(config.message, ctx.cwd));
251
271
  const result = await sendBrrr(webhook, {
252
272
  title: formatTemplate(config.title, ctx.cwd),
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-brrr",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "A pi extension that sends brrr push notifications when pi is ready for input.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1 +1 @@
1
- 0.80.3
1
+ 0.80.6
@@ -42,16 +42,16 @@ The extension defaults to off so installing the full collection does not acciden
42
42
  Optional global config:
43
43
 
44
44
  ```text
45
- ~/.pi/agent/extensions/claude-fast.json
45
+ ~/<pi-config-dir>/agent/extensions/claude-fast.json
46
46
  ```
47
47
 
48
48
  Optional project config:
49
49
 
50
50
  ```text
51
- .pi/claude-fast.json
51
+ <project>/<pi-config-dir>/claude-fast.json
52
52
  ```
53
53
 
54
- Project config overrides global config after Pi reports that the project is trusted.
54
+ Here `<pi-config-dir>` is Pi's runtime config directory name (`CONFIG_DIR_NAME`; `.pi` by default). Project config overrides global config after Pi reports that the project is trusted.
55
55
 
56
56
  ```json
57
57
  {
@@ -1,13 +1,12 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
3
  import {
4
+ CONFIG_DIR_NAME,
4
5
  getAgentDir,
5
6
  type ExtensionAPI,
6
7
  type ExtensionContext,
7
8
  } from "@earendil-works/pi-coding-agent";
8
9
 
9
- const CONFIG_DIR_NAME = ".pi";
10
-
11
10
  const EXTENSION_ID = "claude-fast";
12
11
  const PROVIDER_ID = "anthropic";
13
12
  const API_ID = "anthropic-messages";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-claude-fast",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "A pi extension that enables Anthropic Claude Fast mode for supported Claude Opus models by injecting speed=fast.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -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.