gentle-pi 0.10.5 → 0.10.7
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 +16 -4
- package/assets/orchestrator.md +23 -9
- package/extensions/pi-pretty.ts +9 -1
- package/package.json +1 -1
- package/skills/gentle-ai/SKILL.md +18 -4
- package/tests/gentle-ai.test.ts +30 -4
- package/tests/package-manifest.test.ts +12 -0
package/README.md
CHANGED
|
@@ -125,17 +125,29 @@ The goal is not ceremony. The goal is to avoid accidental chaos. Once a task sto
|
|
|
125
125
|
| --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
|
|
126
126
|
| Reading 4+ files to understand a flow | Launch `scout`, `context-builder`, or the closest read-only mapping subagent. |
|
|
127
127
|
| Touching 2+ non-trivial code files | Delegate one writer; do not continue inline unless delegation is unavailable. |
|
|
128
|
-
| Commit, push, or PR after code changes |
|
|
129
|
-
| Wrong cwd, worktree/git accident, merge recovery, confusing test/env issue | Stop and run a fresh audit
|
|
128
|
+
| Commit, push, or PR after code changes | Select a fresh-context review lens unless the diff is trivial docs/text. |
|
|
129
|
+
| Wrong cwd, worktree/git accident, merge recovery, confusing test/env issue | Stop and run a fresh audit through the relevant review lens before continuing. |
|
|
130
130
|
| Long monolithic session with accumulating complexity, roughly 20 tool calls, 5 exploratory reads, or 2 non-mechanical edits | Pause and delegate the remaining work, or stop and explain the exact blocker. |
|
|
131
131
|
|
|
132
132
|
The intended balanced loop for a bounded bugfix is:
|
|
133
133
|
|
|
134
134
|
```text
|
|
135
|
-
parent git/status + clarify → scout when context-heavy → one worker writes →
|
|
135
|
+
parent git/status + clarify → scout when context-heavy → one worker writes → selected review lens audits → parent validates and reports
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
-
Fresh
|
|
138
|
+
Fresh review lenses are intentionally not token-saving devices; they buy independent judgment. `scout`/`context-builder` save parent context by compressing broad exploration. `worker` preserves a single writer thread.
|
|
139
|
+
|
|
140
|
+
`reviewer` is not an installed subagent name. It is a routing intent. Select the concrete lens by risk profile:
|
|
141
|
+
|
|
142
|
+
| Context | Review lens |
|
|
143
|
+
| --- | --- |
|
|
144
|
+
| Clear naming, structure, maintainability, small refactors | `review-readability` |
|
|
145
|
+
| Behavior, state, tests, determinism, regressions | `review-reliability` |
|
|
146
|
+
| Shell/process integration, partial failures, recovery, degraded dependencies | `review-resilience` |
|
|
147
|
+
| Security, permissions, data exposure/loss, architecture, dependencies | `review-risk` |
|
|
148
|
+
| Large PR, hot path, or >400 changed lines | Full 4R: `review-risk`, `review-resilience`, `review-readability`, `review-reliability` |
|
|
149
|
+
|
|
150
|
+
If multiple rows match, run the narrow set that covers the risk. For example, shell integration that mutates live state should use `review-reliability` plus `review-resilience`, not `review-readability` by default.
|
|
139
151
|
|
|
140
152
|
## SDD/OpenSpec flow
|
|
141
153
|
|
package/assets/orchestrator.md
CHANGED
|
@@ -88,7 +88,7 @@ If `subagent_*` tools are unavailable, fall back to Pi's native `Agent` tool or
|
|
|
88
88
|
|
|
89
89
|
### Pi Subagent Model Routing
|
|
90
90
|
|
|
91
|
-
For generic Pi subagents (`delegate`, `worker`, `scout`,
|
|
91
|
+
For generic Pi subagents (`delegate`, `worker`, `scout`, review lens agents, `context-builder`, `oracle`, `planner`, `researcher`, or other non-SDD agents), do not pass the `model` parameter by default. Let `pi-subagents` resolve model and thinking from `.pi/settings.json`, `.pi/subagents.json`, global subagent config, and runtime defaults.
|
|
92
92
|
|
|
93
93
|
SDD model assignment tables apply only to SDD/Judgment-Day phase agents. They must not be used for generic Pi delegation.
|
|
94
94
|
|
|
@@ -97,7 +97,7 @@ Only pass `model` for generic subagents when the user explicitly requests a mode
|
|
|
97
97
|
Default balanced pattern for bounded implementation:
|
|
98
98
|
|
|
99
99
|
```text
|
|
100
|
-
parent clarifies and checks git → scout/context-builder when context-heavy → one worker writes →
|
|
100
|
+
parent clarifies and checks git → scout/context-builder when context-heavy → one worker writes → selected review lens audits diff → parent validates and reports
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
Do not make every task SDD. Do make non-trivial tasks multi-agent at the narrowest useful point.
|
|
@@ -139,10 +139,10 @@ These are parent-orchestrator stop rules. Once any trigger fires, the parent MUS
|
|
|
139
139
|
|
|
140
140
|
1. **4-file rule**: if understanding requires reading 4+ files, launch `scout`, `context-builder`, or the closest read-only mapping subagent with fresh context and a narrow mapping task. State the fallback agent/runtime if the preferred one is unavailable.
|
|
141
141
|
2. **Multi-file write rule**: if implementation will touch 2+ non-trivial files, delegate one writer; inline writing is allowed only for trivial/mechanical edits or when the parent explicitly records why no delegation runtime is available. A fresh review still follows delegated implementation.
|
|
142
|
-
3. **PR rule**: before commit/push/PR for code changes,
|
|
143
|
-
4. **Incident rule**: after wrong `cwd`, accidental repo/worktree mutation, failed merge recovery, confusing test command, or environment workaround, stop and run a fresh audit
|
|
142
|
+
3. **PR rule**: before commit/push/PR for code changes, select a fresh-context review lens unless the diff is trivial docs/text-only.
|
|
143
|
+
4. **Incident rule**: after wrong `cwd`, accidental repo/worktree mutation, failed merge recovery, confusing test command, or environment workaround, stop and run a fresh audit through the relevant review lens before continuing.
|
|
144
144
|
5. **Long-session rule**: if accumulating work is no longer clearly local — roughly 20 tool calls, 5 exploratory file reads, or 2 non-mechanical edits without delegation — pause and delegate the remaining work instead of silently continuing monolithically.
|
|
145
|
-
6. **Fresh review rule**: use fresh-context
|
|
145
|
+
6. **Fresh review rule**: use fresh-context review lens subagents for adversarial review of diffs, conflicts, PR readiness, and incidents. Use continuity-oriented workers only for implementation work that needs inherited state.
|
|
146
146
|
|
|
147
147
|
### Cost and Context Balance
|
|
148
148
|
|
|
@@ -150,7 +150,7 @@ Prefer delegation when fresh context improves correctness more than token saving
|
|
|
150
150
|
|
|
151
151
|
- Use `scout`/`context-builder` to compress broad repo exploration into a short handoff instead of loading many files into the parent.
|
|
152
152
|
- Use a single `worker` for one writer thread; do not run parallel writers unless isolated worktrees are explicitly approved.
|
|
153
|
-
- Use fresh
|
|
153
|
+
- Use fresh concrete review lens agents after implementation, conflict resolution, or incidents because their value is independence from the parent's assumptions. Do not call a generic `reviewer` subagent; choose from `review-risk`, `review-reliability`, `review-resilience`, `review-readability`, or the full 4R set.
|
|
154
154
|
- Use `outputMode: "file-only"` for large child reports and summarize only decisions, blockers, and paths in the parent thread.
|
|
155
155
|
- Avoid delegation for truly local one-file fixes, quick state checks, and already-understood mechanical edits.
|
|
156
156
|
|
|
@@ -159,21 +159,35 @@ Prefer delegation when fresh context improves correctness more than token saving
|
|
|
159
159
|
Bugfix with unfamiliar flow:
|
|
160
160
|
|
|
161
161
|
```text
|
|
162
|
-
parent git/status + clarify → scout fresh maps flow/files → parent decides → worker fork implements + tests →
|
|
162
|
+
parent git/status + clarify → scout fresh maps flow/files → parent decides → worker fork implements + tests → selected review lens audits diff → parent validates
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
Conflict or dependency-marker cleanup:
|
|
166
166
|
|
|
167
167
|
```text
|
|
168
|
-
parent reproduces/checks conflict → parent or worker resolves →
|
|
168
|
+
parent reproduces/checks conflict → parent or worker resolves → selected review lens checks markers, package/lock consistency, and repo cleanliness → parent reports/pushes
|
|
169
169
|
```
|
|
170
170
|
|
|
171
171
|
After tooling/worktree incident:
|
|
172
172
|
|
|
173
173
|
```text
|
|
174
|
-
stop writes → parent captures git status →
|
|
174
|
+
stop writes → parent captures git status → selected review lens audits affected repos/worktrees with no edits → parent applies only confirmed recovery steps
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
+
### Review Lens Selection
|
|
178
|
+
|
|
179
|
+
`reviewer` is an intent, not an installed subagent name. The parent must select concrete review agents by risk profile:
|
|
180
|
+
|
|
181
|
+
| Context | Review lens |
|
|
182
|
+
| --- | --- |
|
|
183
|
+
| Clear naming, structure, maintainability, small refactors | `review-readability` |
|
|
184
|
+
| Behavior, state, tests, determinism, regressions | `review-reliability` |
|
|
185
|
+
| Shell/process integration, partial failures, recovery, degraded dependencies | `review-resilience` |
|
|
186
|
+
| Security, permissions, data exposure/loss, architecture, dependencies | `review-risk` |
|
|
187
|
+
| Large PR, hot path, or >400 changed lines | Full 4R: `review-risk`, `review-resilience`, `review-readability`, `review-reliability` |
|
|
188
|
+
|
|
189
|
+
If multiple rows match, run the narrow set that covers the risk. Example: shell integration that mutates live state should use `review-reliability` plus `review-resilience`, not `review-readability` by default.
|
|
190
|
+
|
|
177
191
|
## SDD Workflow
|
|
178
192
|
|
|
179
193
|
SDD phases:
|
package/extensions/pi-pretty.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const packageJsonPath = realpathSync(
|
|
6
|
+
fileURLToPath(new URL("../package.json", import.meta.url)),
|
|
7
|
+
);
|
|
8
|
+
const requireFromRealPackage = createRequire(packageJsonPath);
|
|
9
|
+
const piPrettyModule = requireFromRealPackage("@heyhuynhgiabuu/pi-pretty");
|
|
2
10
|
|
|
3
11
|
const piPrettyExtension =
|
|
4
12
|
typeof piPrettyModule === "function"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gentle-pi",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"description": "Turn Pi into el Gentleman: a senior-architect development harness with SDD/OpenSpec, subagents, strict TDD evidence, review guardrails, and skill discovery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@ When asked who or what you are, answer as el Gentleman: a Pi-specific coding-age
|
|
|
18
18
|
- If tests exist, follow strict TDD: RED, GREEN, TRIANGULATE, REFACTOR, and record evidence.
|
|
19
19
|
- Keep one parent session responsible for orchestration; child subagents should receive concrete phase work and must not spawn more subagents.
|
|
20
20
|
- Parent-only delegation triggers apply after complexity appears: 4+ files for understanding, 2+ non-trivial files to write, commit/PR after code changes, tooling/worktree incidents, or long sessions with accumulating complexity.
|
|
21
|
-
- As parent, prefer `scout`/`context-builder` for context-heavy exploration, one forked `worker` for implementation, and fresh-context
|
|
21
|
+
- As parent, prefer `scout`/`context-builder` for context-heavy exploration, one forked `worker` for implementation, and fresh-context review lenses for adversarial review before PRs and after incidents. Do not call a generic `reviewer` subagent; select the concrete lens: `review-risk`, `review-reliability`, `review-resilience`, `review-readability`, or the full 4R set.
|
|
22
22
|
- Keep writes single-threaded unless the user explicitly approves isolated parallel worktrees.
|
|
23
23
|
- Forecast review workload before large changes; ask before producing oversized or multi-area diffs.
|
|
24
24
|
- Never claim persistent memory is available because of el Gentleman itself; memory is provided by separate packages/tools when active.
|
|
@@ -44,15 +44,29 @@ clarify → explore → proposal → spec → design → tasks → apply → ver
|
|
|
44
44
|
For bounded implementation with subagents:
|
|
45
45
|
|
|
46
46
|
```text
|
|
47
|
-
clarify → scout/context-builder when context-heavy → one worker →
|
|
47
|
+
clarify → scout/context-builder when context-heavy → one worker → selected review lens(es) → worker fixes → verify
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
Hard delegation triggers:
|
|
51
51
|
|
|
52
52
|
- **4-file rule**: reading 4+ files to understand means delegate exploration.
|
|
53
53
|
- **Multi-file write rule**: touching 2+ non-trivial files means use one worker or at least fresh review before completion.
|
|
54
|
-
- **PR rule**: before commit/push/PR for code changes,
|
|
55
|
-
- **Incident rule**: after wrong cwd, accidental worktree/repo mutation, merge recovery, confusing test command, or environment workaround, run fresh audit.
|
|
54
|
+
- **PR rule**: before commit/push/PR for code changes, select a fresh review lens unless the diff is trivial docs/text.
|
|
55
|
+
- **Incident rule**: after wrong cwd, accidental worktree/repo mutation, merge recovery, confusing test command, or environment workaround, run a fresh audit through the relevant review lens.
|
|
56
56
|
- **Long-session rule**: after roughly 20 tool calls, 5 exploratory reads, or 2 non-mechanical edits with no delegation and accumulating complexity, pause and choose a subagent or justify not doing so.
|
|
57
57
|
|
|
58
|
+
## Review Lens Selection
|
|
59
|
+
|
|
60
|
+
Never request a subagent named `reviewer`; it is an intent, not an installed agent. Select concrete review agents by risk profile:
|
|
61
|
+
|
|
62
|
+
| Context | Review lens |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| Clear naming, structure, maintainability, small refactors | `review-readability` |
|
|
65
|
+
| Behavior, state, tests, determinism, regressions | `review-reliability` |
|
|
66
|
+
| Shell/process integration, partial failures, recovery, degraded dependencies | `review-resilience` |
|
|
67
|
+
| Security, permissions, data exposure/loss, architecture, dependencies | `review-risk` |
|
|
68
|
+
| Large PR, hot path, or >400 changed lines | Full 4R: `review-risk`, `review-resilience`, `review-readability`, `review-reliability` |
|
|
69
|
+
|
|
70
|
+
If multiple rows match, run the narrow set that covers the risk. Example: shell integration that mutates live state should use `review-reliability` plus `review-resilience`, not `review-readability` by default.
|
|
71
|
+
|
|
58
72
|
The package ensures SDD agents and chains are available as global Pi runtime assets. Project-local SDD files are overrides/debug copies only. Use `/gentle-ai:install-sdd --force` only for recovery or intentional global refresh.
|
package/tests/gentle-ai.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import test from "node:test";
|
|
@@ -16,7 +16,7 @@ test("agent discovery skips skills directories", async (t) => {
|
|
|
16
16
|
const root = mkdtempSync(join(tmpdir(), "gentle-pi-agents-"));
|
|
17
17
|
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
18
18
|
const dotAgents = join(root, ".agents");
|
|
19
|
-
writeMarkdown(join(dotAgents, "
|
|
19
|
+
writeMarkdown(join(dotAgents, "review-risk.md"), "name: review-risk\n");
|
|
20
20
|
writeMarkdown(join(dotAgents, "team", "worker.md"), "name: worker\n");
|
|
21
21
|
writeMarkdown(join(dotAgents, "skills", "ai-sdk", "SKILL.md"), "name: ai-sdk\n");
|
|
22
22
|
writeMarkdown(
|
|
@@ -29,14 +29,40 @@ test("agent discovery skips skills directories", async (t) => {
|
|
|
29
29
|
|
|
30
30
|
assert.deepEqual(
|
|
31
31
|
syncAgents.map((agent) => agent.name),
|
|
32
|
-
["
|
|
32
|
+
["review-risk", "worker"],
|
|
33
33
|
);
|
|
34
34
|
assert.deepEqual(
|
|
35
35
|
asyncAgents.map((agent) => agent.name),
|
|
36
|
-
["
|
|
36
|
+
["review-risk", "worker"],
|
|
37
37
|
);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
+
test("runtime guidance routes review intent to concrete lenses", () => {
|
|
41
|
+
const guidedFiles = [
|
|
42
|
+
"README.md",
|
|
43
|
+
"assets/orchestrator.md",
|
|
44
|
+
"skills/gentle-ai/SKILL.md",
|
|
45
|
+
];
|
|
46
|
+
const forbiddenGenericRoutes = [
|
|
47
|
+
/fresh-context `reviewer`/,
|
|
48
|
+
/fresh reviewer audits/,
|
|
49
|
+
/reviewer fresh audits/,
|
|
50
|
+
/run a fresh-context `reviewer`/,
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
for (const file of guidedFiles) {
|
|
54
|
+
const content = readFileSync(file, "utf8");
|
|
55
|
+
assert.match(content, /Review Lens Selection|review lens/);
|
|
56
|
+
assert.match(content, /review-risk/);
|
|
57
|
+
assert.match(content, /review-reliability/);
|
|
58
|
+
assert.match(content, /review-resilience/);
|
|
59
|
+
assert.match(content, /review-readability/);
|
|
60
|
+
for (const forbidden of forbiddenGenericRoutes) {
|
|
61
|
+
assert.doesNotMatch(content, forbidden, `${file} must not route to generic reviewer`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
40
66
|
test("agent model discovery prioritizes SDD and Judgment Day agents", (t) => {
|
|
41
67
|
const root = mkdtempSync(join(tmpdir(), "gentle-pi-model-agents-"));
|
|
42
68
|
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
@@ -58,3 +58,15 @@ test("package manifest installs pi-pretty through a wrapper without bundling nat
|
|
|
58
58
|
"pi-pretty must not be bundled because its native optional dependencies are platform-specific",
|
|
59
59
|
);
|
|
60
60
|
});
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
test("pi-pretty wrapper uses real package path resolution for pnpm symlink installs", () => {
|
|
64
|
+
const wrapper = readFileSync(
|
|
65
|
+
join(PACKAGE_ROOT, "extensions", "pi-pretty.ts"),
|
|
66
|
+
"utf8",
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
assert.match(wrapper, /realpathSync/);
|
|
70
|
+
assert.match(wrapper, /createRequire/);
|
|
71
|
+
assert.match(wrapper, /@heyhuynhgiabuu\/pi-pretty/);
|
|
72
|
+
});
|