gentle-pi 0.10.6 → 0.10.8

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 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 | Run a fresh-context `reviewer` 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 reviewer before continuing. |
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 → fresh reviewer audits → parent validates and reports
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 reviewers 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.
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
 
@@ -1,7 +1,13 @@
1
1
  ---
2
2
  name: jd-fix-agent
3
3
  description: Judgment Day surgical fix agent for confirmed findings. Can edit code and run focused tests.
4
- tools: read, grep, glob, edit, write, bash
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - edit
9
+ - write
10
+ - bash
5
11
  ---
6
12
 
7
13
  You are the Judgment Day fix agent for Gentle AI.
@@ -1,7 +1,11 @@
1
1
  ---
2
2
  name: jd-judge-a
3
3
  description: Judgment Day blind adversarial reviewer A. Read-only; reports findings and does not fix code.
4
- tools: read, grep, glob, bash
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - bash
5
9
  ---
6
10
 
7
11
  You are Judgment Day judge A for Gentle AI.
@@ -1,7 +1,11 @@
1
1
  ---
2
2
  name: jd-judge-b
3
3
  description: Judgment Day blind adversarial reviewer B. Read-only; independently reports findings and does not fix code.
4
- tools: read, grep, glob, bash
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - bash
5
9
  ---
6
10
 
7
11
  You are Judgment Day judge B for Gentle AI.
@@ -1,7 +1,11 @@
1
1
  ---
2
2
  name: review-readability
3
3
  description: R2 Readability reviewer — naming, complexity, intention, maintainability, review size, and context clarity.
4
- tools: read, grep, glob, bash
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - bash
5
9
  ---
6
10
 
7
11
  You are **R2 Readability**, a read-only reviewer. Find clarity problems; do not fix them.
@@ -1,7 +1,11 @@
1
1
  ---
2
2
  name: review-reliability
3
3
  description: R3 Reliability reviewer — behavior-first tests, coverage value, edge cases, determinism, contracts, and regressions.
4
- tools: read, grep, glob, bash
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - bash
5
9
  ---
6
10
 
7
11
  You are **R3 Reliability**, a read-only reviewer. Find test and behavior risks; do not fix them.
@@ -1,7 +1,11 @@
1
1
  ---
2
2
  name: review-resilience
3
3
  description: R4 Resilience reviewer — fallbacks, retry/backoff, graceful degradation, observability, load, rollback, and SLO risks.
4
- tools: read, grep, glob, bash
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - bash
5
9
  ---
6
10
 
7
11
  You are **R4 Resilience**, a read-only reviewer. Find operational failure risks; do not fix them.
@@ -1,7 +1,11 @@
1
1
  ---
2
2
  name: review-risk
3
3
  description: R1 Risk reviewer — security, privilege boundaries, data exposure, dependency risks, and merge-blocking vulnerabilities.
4
- tools: read, grep, glob, bash
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - bash
5
9
  ---
6
10
 
7
11
  You are **R1 Risk**, a read-only reviewer. Find security risks; do not fix them.
@@ -1,7 +1,17 @@
1
1
  ---
2
2
  name: sdd-apply
3
3
  description: Implement SDD tasks with strict TDD evidence and review workload guard.
4
- tools: read, grep, glob, edit, write, bash, mem_search, mem_get_observation, mem_save, mem_update
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - edit
9
+ - write
10
+ - bash
11
+ - mem_search
12
+ - mem_get_observation
13
+ - mem_save
14
+ - mem_update
5
15
  ---
6
16
 
7
17
  You are the SDD apply executor for Gentle AI.
@@ -1,7 +1,16 @@
1
1
  ---
2
2
  name: sdd-archive
3
3
  description: Archive a verified SDD change into OpenSpec source specs.
4
- tools: read, grep, glob, write, edit, bash, mem_search, mem_get_observation, mem_save
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - write
9
+ - edit
10
+ - bash
11
+ - mem_search
12
+ - mem_get_observation
13
+ - mem_save
5
14
  ---
6
15
 
7
16
  You are the SDD archive executor for Gentle AI.
@@ -1,7 +1,15 @@
1
1
  ---
2
2
  name: sdd-design
3
3
  description: Design the technical approach for an SDD change.
4
- tools: read, grep, glob, write, edit, mem_search, mem_get_observation, mem_save
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - write
9
+ - edit
10
+ - mem_search
11
+ - mem_get_observation
12
+ - mem_save
5
13
  ---
6
14
 
7
15
  You are the SDD design executor for Gentle AI.
@@ -1,7 +1,12 @@
1
1
  ---
2
2
  name: sdd-explore
3
3
  description: Explore an SDD change idea before proposal.
4
- tools: read, grep, glob, webfetch, mem_save
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - webfetch
9
+ - mem_save
5
10
  ---
6
11
 
7
12
  You are the SDD explore executor for Gentle AI.
@@ -2,7 +2,16 @@
2
2
  name: sdd-init
3
3
  description: Initialize project SDD context, testing capabilities, and skill registry.
4
4
  model: openai-codex/gpt-5.3-codex
5
- tools: read, grep, glob, write, bash, mem_search, mem_get_observation, mem_save, mem_update
5
+ tools:
6
+ - read
7
+ - grep
8
+ - glob
9
+ - write
10
+ - bash
11
+ - mem_search
12
+ - mem_get_observation
13
+ - mem_save
14
+ - mem_update
6
15
  ---
7
16
 
8
17
  You are the SDD init executor for Gentle AI.
@@ -1,7 +1,17 @@
1
1
  ---
2
2
  name: sdd-onboard
3
3
  description: Guide a user through a complete SDD cycle on a small real project change.
4
- tools: read, grep, glob, write, edit, bash, mem_search, mem_get_observation, mem_save, mem_update
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - write
9
+ - edit
10
+ - bash
11
+ - mem_search
12
+ - mem_get_observation
13
+ - mem_save
14
+ - mem_update
5
15
  ---
6
16
 
7
17
  You are the SDD onboard executor for Gentle AI.
@@ -1,7 +1,15 @@
1
1
  ---
2
2
  name: sdd-proposal
3
3
  description: Write an SDD proposal for an approved change idea.
4
- tools: read, grep, glob, write, edit, mem_search, mem_get_observation, mem_save
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - write
9
+ - edit
10
+ - mem_search
11
+ - mem_get_observation
12
+ - mem_save
5
13
  ---
6
14
 
7
15
  You are the SDD proposal executor for Gentle AI.
@@ -1,7 +1,15 @@
1
1
  ---
2
2
  name: sdd-spec
3
3
  description: Write SDD delta specs with requirements and scenarios.
4
- tools: read, grep, glob, write, edit, mem_search, mem_get_observation, mem_save
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - write
9
+ - edit
10
+ - mem_search
11
+ - mem_get_observation
12
+ - mem_save
5
13
  ---
6
14
 
7
15
  You are the SDD spec executor for Gentle AI.
@@ -1,7 +1,13 @@
1
1
  ---
2
2
  name: sdd-status
3
3
  description: Show read-only structured SDD status for an active change.
4
- tools: read, grep, glob, bash, mem_search, mem_get_observation
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - bash
9
+ - mem_search
10
+ - mem_get_observation
5
11
  ---
6
12
 
7
13
  You are the SDD status executor for Gentle AI.
@@ -1,7 +1,17 @@
1
1
  ---
2
2
  name: sdd-sync
3
3
  description: Sync verified SDD delta specs into OpenSpec canonical specs without archiving the change.
4
- tools: read, grep, glob, write, edit, bash, mem_search, mem_get_observation, mem_save, mem_update
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - write
9
+ - edit
10
+ - bash
11
+ - mem_search
12
+ - mem_get_observation
13
+ - mem_save
14
+ - mem_update
5
15
  ---
6
16
 
7
17
  You are the SDD sync executor for Gentle AI.
@@ -1,7 +1,15 @@
1
1
  ---
2
2
  name: sdd-tasks
3
3
  description: Break SDD design/specs into implementation tasks with review workload forecast.
4
- tools: read, grep, glob, write, edit, mem_search, mem_get_observation, mem_save
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - write
9
+ - edit
10
+ - mem_search
11
+ - mem_get_observation
12
+ - mem_save
5
13
  ---
6
14
 
7
15
  You are the SDD tasks executor for Gentle AI.
@@ -1,7 +1,16 @@
1
1
  ---
2
2
  name: sdd-verify
3
3
  description: Verify implementation against SDD specs, tasks, strict TDD evidence, and review workload boundaries.
4
- tools: read, grep, glob, bash, write, edit, mem_search, mem_get_observation, mem_save
4
+ tools:
5
+ - read
6
+ - grep
7
+ - glob
8
+ - bash
9
+ - write
10
+ - edit
11
+ - mem_search
12
+ - mem_get_observation
13
+ - mem_save
5
14
  ---
6
15
 
7
16
  You are the SDD verify executor for Gentle AI.
@@ -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`, `reviewer`, `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.
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 → fresh reviewer audits diff → parent validates and reports
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, run a fresh-context reviewer 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 reviewer before continuing.
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 reviewer/audit subagents for adversarial review of diffs, conflicts, PR readiness, and incidents. Use continuity-oriented workers only for implementation work that needs inherited state.
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 `reviewer` agents after implementation, conflict resolution, or incidents because their value is independence from the parent's assumptions.
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 → reviewer fresh audits diff → parent validates
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 → reviewer fresh checks markers, package/lock consistency, and repo cleanliness → parent reports/pushes
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 → reviewer fresh audits affected repos/worktrees with no edits → parent applies only confirmed recovery steps
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gentle-pi",
3
- "version": "0.10.6",
3
+ "version": "0.10.8",
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 `reviewer` agents for adversarial review before PRs and after incidents.
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 → fresh reviewers → worker fixes → verify
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, run fresh review 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 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.
@@ -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, "reviewer.md"), "name: reviewer\n");
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
- ["reviewer", "worker"],
32
+ ["review-risk", "worker"],
33
33
  );
34
34
  assert.deepEqual(
35
35
  asyncAgents.map((agent) => agent.name),
36
- ["reviewer", "worker"],
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 }));
@@ -1,5 +1,5 @@
1
1
  import assert from "node:assert/strict";
2
- import { existsSync, readFileSync } from "node:fs";
2
+ import { existsSync, readdirSync, readFileSync } from "node:fs";
3
3
  import { dirname, join } from "node:path";
4
4
  import test from "node:test";
5
5
  import { fileURLToPath } from "node:url";
@@ -60,6 +60,42 @@ test("package manifest installs pi-pretty through a wrapper without bundling nat
60
60
  });
61
61
 
62
62
 
63
+ function readAgentFrontmatter(file: string): string {
64
+ const source = readFileSync(file, "utf8");
65
+ const match = source.match(/^---\n([\s\S]*?)\n---/);
66
+ assert.ok(match, `${file} must have frontmatter`);
67
+ return match[1];
68
+ }
69
+
70
+ test("packaged agents use YAML list syntax for tool allowlists", () => {
71
+ const agentsDir = join(PACKAGE_ROOT, "assets", "agents");
72
+ const agentFiles = readdirSync(agentsDir).flatMap((entry) =>
73
+ entry.endsWith(".md") ? [join(agentsDir, entry)] : [],
74
+ );
75
+
76
+ assert.ok(agentFiles.length > 0, "gentle-pi must ship packaged agents");
77
+
78
+ for (const file of agentFiles) {
79
+ const frontmatter = readAgentFrontmatter(file);
80
+ assert.doesNotMatch(
81
+ frontmatter,
82
+ /^tools:\s*[^\n,]+(?:,\s*[^\n,]+)+$/m,
83
+ `${file} must not use comma-separated inline tools; pi-subagents expects a YAML list`,
84
+ );
85
+ assert.match(frontmatter, /^tools:\n(?: {2}- [\w-]+\n?)+/m, `${file} must declare tools as a YAML list`);
86
+ }
87
+ });
88
+
89
+ test("jd-fix-agent packaged allowlist includes write tools", () => {
90
+ const frontmatter = readAgentFrontmatter(
91
+ join(PACKAGE_ROOT, "assets", "agents", "jd-fix-agent.md"),
92
+ );
93
+
94
+ for (const tool of ["read", "edit", "write", "bash"]) {
95
+ assert.match(frontmatter, new RegExp(`^ - ${tool}$`, "m"));
96
+ }
97
+ });
98
+
63
99
  test("pi-pretty wrapper uses real package path resolution for pnpm symlink installs", () => {
64
100
  const wrapper = readFileSync(
65
101
  join(PACKAGE_ROOT, "extensions", "pi-pretty.ts"),