@nukcole-xinluo9510/pi-critic-guy 0.1.0 → 0.1.2

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 (2) hide show
  1. package/README.md +95 -29
  2. package/package.json +17 -4
package/README.md CHANGED
@@ -1,6 +1,63 @@
1
- # pi-critic-guy
1
+ # 🧐 Critic Guy
2
2
 
3
- Pi extension — spawn a second-opinion code reviewer by typing `critic` into your pi session.
3
+ **A pi extension that trusts the model.** Type `critic` in any pi session and get a
4
+ second opinion — from an independent, read-only reviewer you spawn with a single word.
5
+
6
+ No extra tools. No agent files. No configuration. Just say `critic`.
7
+
8
+ <p align="center">
9
+ <img src="https://raw.githubusercontent.com/luoxin9510/pi-critic-guy/main/assets/philosophy.png" alt="Critic Guy — freedom in the middle, rails at the edge" width="840">
10
+ </p>
11
+
12
+ ```
13
+ critic
14
+ critic review the auth code
15
+ critic using claude check for race conditions
16
+ critic model=deepseek-v4-flash review the error handling
17
+ ```
18
+
19
+ ---
20
+
21
+ ## Why it's different — built the pi way
22
+
23
+ pi's core bet is simple: **the model is capable — give it good context and good tools,
24
+ then get out of the way.** Critic Guy is built on exactly that bet.
25
+
26
+ It does **not** wrap reviewing in a rigid tool with fixed modes and schemas. It teaches
27
+ the model a *capability* and hands over the judgment:
28
+
29
+ - **What to review?** The model picks the most valuable target from your conversation —
30
+ you don't have to spell it out.
31
+ - **One critic or several in parallel?** The model decides, splitting large scope into
32
+ focused reviewers however it sees fit.
33
+
34
+ The only thing Critic Guy locks down is the **boundary** — and it locks it down with
35
+ *mechanism*, not by asking the model nicely:
36
+
37
+ - The critic spawns as a fresh `pi -p` session with **read-only tools** (`read`, `grep`,
38
+ `find`, `ls`) — it physically cannot edit files, write files, or run shell commands.
39
+ - `--offline -ne` means the child never hangs on startup network calls and never
40
+ re-loads this extension (so no runaway nesting).
41
+ - Its persona refuses to read credentials, secrets, or dotfiles.
42
+
43
+ > **Freedom in the middle, hard rails at the edge.**
44
+ > Judgment goes to the model; safety is enforced in code.
45
+
46
+ That's the whole philosophy — and it's why Critic Guy stays a tiny prompt injection
47
+ instead of a 1000-line tool. It's the most pi-native way to get a critic.
48
+
49
+ ## Highlights
50
+
51
+ - ðŸŠķ **Zero dependencies, zero config** — no companion extension, no `reviewer.md`,
52
+ nothing to install beyond this package.
53
+ - 🔒 **Safe by construction** — the reviewer is read-only and isolated; the boundary is
54
+ enforced by `--tools`, not by trust.
55
+ - 🧠 **Model-driven** — you decide *that* you want a review; the model decides *what* and
56
+ *how*.
57
+ - ðŸ’ļ **Zero overhead when idle** — instructions are injected **only** on turns where you
58
+ actually type `critic`. Silent the rest of the time.
59
+ - ðŸŽŊ **Model-aware** — resolves the reviewer model from your current session, or one you
60
+ name with `using <name>` / `model=<id>`.
4
61
 
5
62
  ## Install
6
63
 
@@ -8,49 +65,58 @@ Pi extension — spawn a second-opinion code reviewer by typing `critic` into yo
8
65
  # From npm
9
66
  pi add npm:@nukcole-xinluo9510/pi-critic-guy
10
67
 
11
- # Or from local path during development
68
+ # Or from a local checkout during development
12
69
  pi add /path/to/pi-critic-guy
13
70
  ```
14
71
 
15
- ## Usage
72
+ That's it. No other setup.
16
73
 
17
- In any pi session, just type:
18
-
19
- ```
20
- critic
21
- critic review the auth code
22
- critic model=deepseek-v4-flash review the error handling
23
- critic using claude check for security issues
24
- ```
25
-
26
- The extension injects "Critic Guy" instructions into the system prompt on turns where you mention `critic`. It resolves the model dynamically from your current session, the model registry, or the model you specify via `using <name>` or `model=<id>`.
27
-
28
- ### What it does
74
+ ## Usage
29
75
 
30
- - Detects the word `critic` in your prompt (word boundary, won't match "critical")
31
- - Resolves the reviewer model (your current model, or one you specify)
32
- - Injects instructions to spawn a subagent via the `subagent` tool
33
- - Keeps the reviewer on a short leash — read-only tools (`read`, `grep`, `find`, `ls`)
76
+ In any pi session, just mention `critic`:
34
77
 
35
- ### Parallel reviews
78
+ | You type | What happens |
79
+ |---|---|
80
+ | `critic` | Model picks the most valuable thing from the conversation and reviews it |
81
+ | `critic review the auth code` | Targeted review of what you point at |
82
+ | `critic using claude` | Spawn the critic on a model matching "claude" |
83
+ | `critic model=deepseek-v4-flash` | Spawn the critic on an exact model id |
36
84
 
37
- For large codebases, the injected instructions tell the LLM to split the review into parallel subagents focusing on different aspects (correctness, design, error handling).
85
+ Word-boundary matching means `critical`, `criticism`, etc. will **not** trigger it —
86
+ only a standalone `critic`.
38
87
 
39
88
  ## How it works
40
89
 
41
- The extension hooks into `before_agent_start`. When `critic` is detected:
90
+ Critic Guy hooks `before_agent_start`. On any turn where you mention `critic`:
42
91
 
43
- 1. It appends a "Capability: Critic Guy" section to the system prompt
44
- 2. The capability tells the LLM to spawn a `reviewer` subagent
45
- 3. The reviewer runs in an isolated context with read-only tools
92
+ 1. It resolves the reviewer model (your current model, the registry, or one you named).
93
+ 2. It appends a short **"Capability: Critic Guy"** section to the system prompt — the
94
+ capability, the resolved model id, and one spawn command with the hard-boundary flags.
95
+ 3. The model spawns one or more critics:
96
+ ```bash
97
+ pi -p --offline -ne --no-session -nc --model "<resolved>" \
98
+ --tools read,grep,find,ls \
99
+ --append-system-prompt "<reviewer persona>" \
100
+ "Task: review <files> ..."
101
+ ```
102
+ 4. Each critic reads the named files in its own isolated context and returns a critique,
103
+ which the model relays to you.
46
104
 
47
- The reviewer agent is defined in your pi agent directory (`~/.pi/agent/agents/reviewer.md`). It uses `claude-sonnet-4-5` and has access to `bash` for `git diff`.
105
+ If the system prompt is already very large, Critic Guy skips injection that turn and says
106
+ so — it never silently no-ops.
48
107
 
49
108
  ## Requirements
50
109
 
51
110
  - pi 0.79+
52
- - `subagent` extension enabled (built-in example, see `pi subagent list`)
53
- - `reviewer` agent defined (example at `packages/coding-agent/examples/extensions/subagent/agents/reviewer.md`)
111
+
112
+ (Yes, that's the whole list.)
113
+
114
+ ## Development
115
+
116
+ ```bash
117
+ npm run check # tsc --noEmit
118
+ npm test # node --test (matchModel + parseModelQuery)
119
+ ```
54
120
 
55
121
  ## License
56
122
 
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "@nukcole-xinluo9510/pi-critic-guy",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Pi extension — spawn a second-opinion reviewer by typing \"critic\"",
7
- "keywords": ["pi-package", "pi", "critic", "review", "code-review"],
7
+ "keywords": [
8
+ "pi-package",
9
+ "pi",
10
+ "critic",
11
+ "review",
12
+ "code-review"
13
+ ],
8
14
  "license": "MIT",
9
15
  "repository": {
10
16
  "type": "git",
@@ -14,12 +20,19 @@
14
20
  "check": "tsc --noEmit",
15
21
  "test": "node --experimental-strip-types --test test/index.test.ts"
16
22
  },
17
- "files": ["extensions", "README.md", "LICENSE"],
23
+ "files": [
24
+ "extensions",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
18
28
  "publishConfig": {
19
29
  "access": "public"
20
30
  },
21
31
  "pi": {
22
- "extensions": ["./extensions"]
32
+ "extensions": [
33
+ "./extensions"
34
+ ],
35
+ "image": "https://raw.githubusercontent.com/luoxin9510/pi-critic-guy/main/assets/philosophy.png"
23
36
  },
24
37
  "peerDependencies": {
25
38
  "@earendil-works/pi-coding-agent": ">=0.79"