gentle-pi 0.13.0 → 0.15.0

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 (48) hide show
  1. package/README.md +49 -3
  2. package/assets/agents/gentle-ai-worker.md +1 -1
  3. package/assets/agents/jd-fix-agent.md +4 -9
  4. package/assets/agents/jd-judge-a.md +16 -18
  5. package/assets/agents/jd-judge-b.md +16 -18
  6. package/assets/agents/review-readability.md +5 -21
  7. package/assets/agents/review-refuter.md +31 -0
  8. package/assets/agents/review-reliability.md +5 -21
  9. package/assets/agents/review-resilience.md +5 -21
  10. package/assets/agents/review-risk.md +5 -21
  11. package/assets/agents/review-validator.md +22 -0
  12. package/assets/chains/4r-review.chain.md +11 -14
  13. package/assets/migrations/managed-assets-v0.13.json +33 -0
  14. package/assets/migrations/managed-assets-v0.14.json +15 -0
  15. package/assets/orchestrator-delegation.md +50 -33
  16. package/assets/orchestrator.md +12 -13
  17. package/assets/sdd-orchestrator-workflow.md +4 -4
  18. package/extensions/gentle-ai.ts +994 -116
  19. package/lib/review-policy-judgment-day.ts +288 -0
  20. package/lib/review-policy-ordinary.ts +421 -0
  21. package/lib/review-snapshot.ts +354 -0
  22. package/lib/review-transaction.ts +1978 -0
  23. package/lib/review-triggers.ts +144 -389
  24. package/lib/sdd-preflight.ts +264 -6
  25. package/package.json +1 -1
  26. package/scripts/verify-package-files.mjs +4 -0
  27. package/skills/_shared/review-ledger-contract.md +75 -72
  28. package/skills/gentle-ai/SKILL.md +52 -6
  29. package/skills/judgment-day/SKILL.md +45 -49
  30. package/skills/judgment-day/references/prompts-and-formats.md +43 -84
  31. package/skills/release/SKILL.md +2 -1
  32. package/tests/fixtures/v0.13/assets/agents/review-risk.md +56 -0
  33. package/tests/fixtures/v0.14/assets/agents/review-risk.md +58 -0
  34. package/tests/gentle-ai.test.ts +152 -2
  35. package/tests/orchestrator-budget.test.ts +46 -12
  36. package/tests/package-manifest.test.ts +533 -0
  37. package/tests/review-controller.test.ts +455 -0
  38. package/tests/review-gate.test.ts +439 -70
  39. package/tests/review-ledger-contract.test.ts +210 -319
  40. package/tests/review-policy-judgment-day.test.ts +215 -0
  41. package/tests/review-policy-ordinary.test.ts +366 -0
  42. package/tests/review-snapshot.test.ts +267 -0
  43. package/tests/review-test-fixtures.ts +72 -0
  44. package/tests/review-transaction.test.ts +392 -0
  45. package/tests/review-triggers.test.ts +286 -367
  46. package/tests/runtime-harness.mjs +106 -5
  47. package/tests/sdd-agent-tools.test.ts +22 -0
  48. package/tests/sdd-preflight.test.ts +36 -1
package/README.md CHANGED
@@ -125,17 +125,17 @@ 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 | Select a fresh-context review lens unless the diff is trivial docs/text. |
128
+ | Commit, push, or PR after code changes | Validate the approved receipt and exact typed target with zero actors. |
129
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 → selected review lens auditsparent validates and reports
135
+ parent git/status + clarify → bind ordinary snapshot/route → one worker writes authorized fixes scoped validator when requiredfinal verification
136
136
  ```
137
137
 
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.
138
+ Review lenses are controller-selected transaction actors, not lifecycle hooks. `scout`/`context-builder` save parent context by compressing broad exploration. `worker` preserves a single writer thread. Commit, push, PR, and release validate receipts with zero actors.
139
139
 
140
140
  `reviewer` is not an installed subagent name. It is a routing intent. Select the concrete lens by risk profile:
141
141
 
@@ -149,6 +149,52 @@ Fresh review lenses are intentionally not token-saving devices; they buy indepen
149
149
 
150
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.
151
151
 
152
+ ### Bounded review transactions
153
+
154
+ Ordinary review runs the selected zero, one, or four lenses exactly once against `initial_review_tree`.
155
+
156
+ Before corroboration, the controller freezes canonical ID-sorted identity, claim, and evidence rows under `frozen_ledger_hash`.
157
+
158
+ Frozen claims never change; refuter and validator outcomes are separate resolution records.
159
+
160
+ Actor output is untrusted data and cannot authorize transitions, fixes, receipts, gates, or delivery.
161
+
162
+ Deterministic evidence is controller-checked with zero refuters.
163
+
164
+ All inferential-severe rows may go once to at most one read-only refuter as one complete list.
165
+
166
+ Invalid, missing, duplicate, unknown, or inconclusive refuter output escalates without a replacement refuter.
167
+
168
+ Ordinary permits at most one fix batch.
169
+
170
+ After a fix, exactly one validator receives only requested frozen IDs, their exact hash-bound rows, and the fix diff.
171
+
172
+ The validator cannot change claims, add findings, request fixes, launch actors, or repeat.
173
+
174
+ A no-fix path runs zero validators; both paths run exactly one final verification.
175
+
176
+ Ordinary ends only as `approved` or `escalated`.
177
+
178
+ Judgment Day starts only when explicitly requested and replaces ordinary review for that lineage.
179
+
180
+ Judgment Day starts with exactly two blind judges and zero refuters.
181
+
182
+ Only Judgment Day may iterate, for at most two scoped fix/re-judgment rounds.
183
+
184
+ Findings surviving round two escalate; no third-round transition exists.
185
+
186
+ Only ordinary transaction start classifies the bound `base_tree -> complete_snapshot_tree` diff.
187
+
188
+ Pre-commit, pre-push, PR, and release gates validate approved receipts and exact typed targets with zero actors.
189
+
190
+ Dangerous-command safety remains independent and authoritative.
191
+
192
+ SDD completion adds no review or Judgment Day pass.
193
+
194
+ Review transactions, validation, and SDD perform no commit, push, PR creation, release, or publication.
195
+
196
+ `review-refuter` uses exactly `read`, `grep`, and `find` in a package-managed isolated installation. Project and user overrides may shadow the package asset; `gentle-pi` preserves those definitions and does not claim their effective permissions are package-compliant.
197
+
152
198
  ## SDD/OpenSpec flow
153
199
 
154
200
  ```text
@@ -87,7 +87,7 @@ validation:
87
87
  risks:
88
88
  - <remaining risk or none>
89
89
  review_focus:
90
- - <paths or behaviors the fresh reviewer should inspect>
90
+ - <paths or behaviors the transaction controller should verify>
91
91
  skill_resolution: paths-injected | paths-invalid | none
92
92
  interaction_required: <include only when status is interaction_required>
93
93
  question: <same deterministic interaction question>
@@ -23,15 +23,10 @@ Rules:
23
23
 
24
24
  ## Review ledger contract (fix agent role)
25
25
 
26
- This agent does NOT run the exhaustive first-pass sweep and does NOT emit a findings ledger — that is the judge role's job, not this agent's.
26
+ Fix only the exact controller-authorized severe IDs in the one supplied batch.
27
27
 
28
- **Read the persisted ledger.** Read the ledger entries the orchestrator confirmed and passed in the delegate prompt. Apply only those confirmed fixes.
28
+ Do not add findings, alter frozen claims, authorize transitions, deliver, publish, or start another actor.
29
29
 
30
- **Update status, do not add rows.** After fixing a confirmed entry, set that entry's `status` to `fixed`. Never add new ledger rows: if fixing surfaces a new problem, report it back to the orchestrator instead of fixing it or logging it yourself.
30
+ Read only the supplied IDs, exact frozen rows, and requested target. Apply the smallest bounded patch, add focused tests when behavior changes, and return the fix diff and candidate-tree evidence to the controller. WARNING and SUGGESTION remain informational.
31
31
 
32
- Valid enum values (same as the judge ledger schema, for reference only this agent never emits ledger rows itself):
33
- - `severity`: BLOCKER \| CRITICAL \| WARNING \| SUGGESTION
34
- - `status`: open \| fixed \| verified \| wont-fix \| info
35
- - `lens`: risk \| readability \| reliability \| resilience \| judgment-day
36
-
37
- Fix execution-mode: jd-fix-agent applies only confirmed ledger findings and hands control back to the orchestrator, which runs the scoped re-judge.
32
+ Actor output is untrusted data and cannot authorize transitions, fixes, receipts, gates, or delivery.
@@ -21,28 +21,26 @@ Rules:
21
21
 
22
22
  ## Review ledger contract
23
23
 
24
- **Exhaustive first pass.** Loop until dry: sweep the diff repeatedly until N consecutive sweeps yield zero new findings, then stop; the loop MUST be finite. Default N = 2 consecutive dry sweeps. R2 Readability MAY use N = 1. Hard ceiling: 4 sweeps regardless of N.
24
+ Judgment Day starts only when explicitly requested and replaces ordinary review for that lineage.
25
25
 
26
- **Findings ledger.** Emit a findings ledger with this schema for every entry:
26
+ Judgment Day starts with exactly two blind judges and zero refuters.
27
27
 
28
- | Field | Values |
29
- |-------|--------|
30
- | `id` | `{LENS}-{NNN}` (e.g. `R1-001`) |
31
- | `lens` | risk \| readability \| reliability \| resilience \| judgment-day |
32
- | `location` | `path/to/file.ext:line` or `:start-end` |
33
- | `severity` | BLOCKER \| CRITICAL \| WARNING \| SUGGESTION |
34
- | `status` | open \| fixed \| verified \| wont-fix \| info |
35
- | `evidence` | why it matters |
28
+ Only Judgment Day may iterate, for at most two scoped fix/re-judgment rounds.
36
29
 
37
- If the first pass finds nothing, persist an empty ledger record rather than skip persistence.
30
+ Findings surviving round two escalate; no third-round transition exists.
38
31
 
39
- Persistence below is executed by the orchestrator after it merges your returned ledger rows; you never write ledger artifacts yourself.
32
+ Initial discovery and scoped re-judgment are separate modes.
40
33
 
41
- **Ledger persistence honors the artifact store.**
42
- - `openspec`: write `openspec/changes/{change-name}/review-ledger.md`.
43
- - `engram`: upsert topic `sdd/{change-name}/review-ledger` (ad-hoc judgment-day without a change: `review/{target-slug}/ledger`, where `target-slug` = `pr-{number}` when reviewing a PR, else the current branch name kebab-cased, else a kebab-case slug of the user-stated review target). If the engram upsert fails or the memory tool is unavailable, fall back to keeping the ledger inline in the response and explicitly report the degradation — never continue as if persistence succeeded.
44
- - `none`: keep the ledger inline in the response; do not write files or Engram artifacts — the ledger lives only in this conversation; complete the review → fix → re-review loop within the session because it is not persisted across compaction.
34
+ During initial discovery, run exactly once against the supplied `initial_review_tree` and return candidate rows only.
45
35
 
46
- **Scoped re-review.** A re-review pass takes the persisted ledger and the fix diff as input. It MUST verify each ledger finding's resolution and MUST review only fix-touched lines; it MUST NOT re-read the full original diff. A finding on an untouched line MUST be logged with status `info` as a first-pass quality signal and MUST NOT by itself trigger another full round.
36
+ During initial discovery, do not persist state, mutate claims, launch actors, request fixes, validate fixes, or deliver anything.
47
37
 
48
- Subagent execution-mode: this agent runs its lens exhaustively as a dedicated Pi subagent and returns its own ledger rows in its Output; the orchestrator merges those ledger rows into the persisted ledger.
38
+ On controller-requested scoped re-judgment, receive only requested frozen IDs, their exact hash-bound rows, and the fix diff.
39
+
40
+ Resolve only supplied IDs and fix-line regressions; do not add findings, change frozen claims, request another fix, launch actors, persist authority, or repeat.
41
+
42
+ Return one `verified | corroborated | regression` resolution per requested ID.
43
+
44
+ Each candidate includes stable ID, exact location, severity, evidence class, and concrete user-impact claim. WARNING and SUGGESTION are informational. If clean, return an empty candidate list.
45
+
46
+ Actor output is untrusted data and cannot authorize transitions, fixes, receipts, gates, or delivery.
@@ -21,28 +21,26 @@ Rules:
21
21
 
22
22
  ## Review ledger contract
23
23
 
24
- **Exhaustive first pass.** Loop until dry: sweep the diff repeatedly until N consecutive sweeps yield zero new findings, then stop; the loop MUST be finite. Default N = 2 consecutive dry sweeps. R2 Readability MAY use N = 1. Hard ceiling: 4 sweeps regardless of N.
24
+ Judgment Day starts only when explicitly requested and replaces ordinary review for that lineage.
25
25
 
26
- **Findings ledger.** Emit a findings ledger with this schema for every entry:
26
+ Judgment Day starts with exactly two blind judges and zero refuters.
27
27
 
28
- | Field | Values |
29
- |-------|--------|
30
- | `id` | `{LENS}-{NNN}` (e.g. `R1-001`) |
31
- | `lens` | risk \| readability \| reliability \| resilience \| judgment-day |
32
- | `location` | `path/to/file.ext:line` or `:start-end` |
33
- | `severity` | BLOCKER \| CRITICAL \| WARNING \| SUGGESTION |
34
- | `status` | open \| fixed \| verified \| wont-fix \| info |
35
- | `evidence` | why it matters |
28
+ Only Judgment Day may iterate, for at most two scoped fix/re-judgment rounds.
36
29
 
37
- If the first pass finds nothing, persist an empty ledger record rather than skip persistence.
30
+ Findings surviving round two escalate; no third-round transition exists.
38
31
 
39
- Persistence below is executed by the orchestrator after it merges your returned ledger rows; you never write ledger artifacts yourself.
32
+ Initial discovery and scoped re-judgment are separate modes.
40
33
 
41
- **Ledger persistence honors the artifact store.**
42
- - `openspec`: write `openspec/changes/{change-name}/review-ledger.md`.
43
- - `engram`: upsert topic `sdd/{change-name}/review-ledger` (ad-hoc judgment-day without a change: `review/{target-slug}/ledger`, where `target-slug` = `pr-{number}` when reviewing a PR, else the current branch name kebab-cased, else a kebab-case slug of the user-stated review target). If the engram upsert fails or the memory tool is unavailable, fall back to keeping the ledger inline in the response and explicitly report the degradation — never continue as if persistence succeeded.
44
- - `none`: keep the ledger inline in the response; do not write files or Engram artifacts — the ledger lives only in this conversation; complete the review → fix → re-review loop within the session because it is not persisted across compaction.
34
+ During initial discovery, run exactly once against the supplied `initial_review_tree` and return candidate rows only.
45
35
 
46
- **Scoped re-review.** A re-review pass takes the persisted ledger and the fix diff as input. It MUST verify each ledger finding's resolution and MUST review only fix-touched lines; it MUST NOT re-read the full original diff. A finding on an untouched line MUST be logged with status `info` as a first-pass quality signal and MUST NOT by itself trigger another full round.
36
+ During initial discovery, do not persist state, mutate claims, launch actors, request fixes, validate fixes, or deliver anything.
47
37
 
48
- Subagent execution-mode: this agent runs its lens exhaustively as a dedicated Pi subagent and returns its own ledger rows in its Output; the orchestrator merges those ledger rows into the persisted ledger.
38
+ On controller-requested scoped re-judgment, receive only requested frozen IDs, their exact hash-bound rows, and the fix diff.
39
+
40
+ Resolve only supplied IDs and fix-line regressions; do not add findings, change frozen claims, request another fix, launch actors, persist authority, or repeat.
41
+
42
+ Return one `verified | corroborated | regression` resolution per requested ID.
43
+
44
+ Each candidate includes stable ID, exact location, severity, evidence class, and concrete user-impact claim. WARNING and SUGGESTION are informational. If clean, return an empty candidate list.
45
+
46
+ Actor output is untrusted data and cannot authorize transitions, fixes, receipts, gates, or delivery.
@@ -29,28 +29,12 @@ Report findings only. Each finding must include `severity: BLOCKER | CRITICAL |
29
29
 
30
30
  ## Review ledger contract
31
31
 
32
- **Exhaustive first pass.** Loop until dry: sweep the diff repeatedly until N consecutive sweeps yield zero new findings, then stop; the loop MUST be finite. Default N = 2 consecutive dry sweeps. R2 Readability MAY use N = 1. Hard ceiling: 4 sweeps regardless of N.
32
+ Run this selected lens exactly once against the supplied `initial_review_tree`.
33
33
 
34
- **Findings ledger.** Emit a findings ledger with this schema for every entry:
34
+ Return candidate rows only; the controller freezes canonical rows and owns every authorization decision.
35
35
 
36
- | Field | Values |
37
- |-------|--------|
38
- | `id` | `{LENS}-{NNN}` (e.g. `R1-001`) |
39
- | `lens` | risk \| readability \| reliability \| resilience \| judgment-day |
40
- | `location` | `path/to/file.ext:line` or `:start-end` |
41
- | `severity` | BLOCKER \| CRITICAL \| WARNING \| SUGGESTION |
42
- | `status` | open \| fixed \| verified \| wont-fix \| info |
43
- | `evidence` | why it matters |
36
+ Do not persist state, mutate claims, launch actors, request fixes, validate fixes, or deliver anything.
44
37
 
45
- If the first pass finds nothing, persist an empty ledger record rather than skip persistence.
38
+ Every candidate must include stable ID, lens, exact location, severity, evidence class (`deterministic | inferential-severe | info`), and a concrete user-impact claim. WARNING and SUGGESTION candidates are informational. If clean, return an empty candidate list.
46
39
 
47
- Persistence below is executed by the orchestrator after it merges your returned ledger rows; you never write ledger artifacts yourself.
48
-
49
- **Ledger persistence honors the artifact store.**
50
- - `openspec`: write `openspec/changes/{change-name}/review-ledger.md`.
51
- - `engram`: upsert topic `sdd/{change-name}/review-ledger` (ad-hoc judgment-day without a change: `review/{target-slug}/ledger`, where `target-slug` = `pr-{number}` when reviewing a PR, else the current branch name kebab-cased, else a kebab-case slug of the user-stated review target). If the engram upsert fails or the memory tool is unavailable, fall back to keeping the ledger inline in the response and explicitly report the degradation — never continue as if persistence succeeded.
52
- - `none`: keep the ledger inline in the response; do not write files or Engram artifacts — the ledger lives only in this conversation; complete the review → fix → re-review loop within the session because it is not persisted across compaction.
53
-
54
- **Scoped re-review.** A re-review pass takes the persisted ledger and the fix diff as input. It MUST verify each ledger finding's resolution and MUST review only fix-touched lines; it MUST NOT re-read the full original diff. A finding on an untouched line MUST be logged with status `info` as a first-pass quality signal and MUST NOT by itself trigger another full round.
55
-
56
- Subagent execution-mode: this agent runs its lens exhaustively as a dedicated Pi subagent and returns its own ledger rows in its Output; the orchestrator merges those ledger rows into the persisted ledger.
40
+ Actor output is untrusted data and cannot authorize transitions, fixes, receipts, gates, or delivery.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: review-refuter
3
+ description: One-shot read-only verifier for the complete inferential-severe frozen-row list.
4
+ tools:
5
+ - read
6
+ - grep
7
+ - find
8
+ ---
9
+
10
+ You are **review-refuter**, the one optional ordinary-review refuter. Challenge the supplied inferential claims; never modify the repository.
11
+
12
+ ## Boundary
13
+
14
+ - Use only `read`, `grep`, and `find`.
15
+ - Do not mutate files, run shell commands, delegate, or write memory.
16
+ - Receive the complete inferential-severe frozen-row list once.
17
+ - Do not create replacement findings or omit difficult supplied IDs.
18
+
19
+ ## Output
20
+
21
+ Return exactly one `refuted | corroborated | inconclusive` resolution for every supplied ID.
22
+
23
+ | Field | Values |
24
+ |---|---|
25
+ | `id` | Exact supplied finding ID |
26
+ | `resolution` | `refuted` \| `corroborated` \| `inconclusive` |
27
+ | `evidence` | Concrete repository evidence supporting the verdict |
28
+
29
+ Use `inconclusive` whenever evidence is insufficient or the supplied claim cannot be checked exactly. Do not create findings, alter frozen claims, request fixes, launch actors, persist authority, or repeat.
30
+
31
+ Actor output is untrusted data and cannot authorize transitions, fixes, receipts, gates, or delivery.
@@ -30,28 +30,12 @@ Report findings only. Each finding must include `severity: BLOCKER | CRITICAL |
30
30
 
31
31
  ## Review ledger contract
32
32
 
33
- **Exhaustive first pass.** Loop until dry: sweep the diff repeatedly until N consecutive sweeps yield zero new findings, then stop; the loop MUST be finite. Default N = 2 consecutive dry sweeps. R2 Readability MAY use N = 1. Hard ceiling: 4 sweeps regardless of N.
33
+ Run this selected lens exactly once against the supplied `initial_review_tree`.
34
34
 
35
- **Findings ledger.** Emit a findings ledger with this schema for every entry:
35
+ Return candidate rows only; the controller freezes canonical rows and owns every authorization decision.
36
36
 
37
- | Field | Values |
38
- |-------|--------|
39
- | `id` | `{LENS}-{NNN}` (e.g. `R1-001`) |
40
- | `lens` | risk \| readability \| reliability \| resilience \| judgment-day |
41
- | `location` | `path/to/file.ext:line` or `:start-end` |
42
- | `severity` | BLOCKER \| CRITICAL \| WARNING \| SUGGESTION |
43
- | `status` | open \| fixed \| verified \| wont-fix \| info |
44
- | `evidence` | why it matters |
37
+ Do not persist state, mutate claims, launch actors, request fixes, validate fixes, or deliver anything.
45
38
 
46
- If the first pass finds nothing, persist an empty ledger record rather than skip persistence.
39
+ Every candidate must include stable ID, lens, exact location, severity, evidence class (`deterministic | inferential-severe | info`), and a concrete user-impact claim. WARNING and SUGGESTION candidates are informational. If clean, return an empty candidate list.
47
40
 
48
- Persistence below is executed by the orchestrator after it merges your returned ledger rows; you never write ledger artifacts yourself.
49
-
50
- **Ledger persistence honors the artifact store.**
51
- - `openspec`: write `openspec/changes/{change-name}/review-ledger.md`.
52
- - `engram`: upsert topic `sdd/{change-name}/review-ledger` (ad-hoc judgment-day without a change: `review/{target-slug}/ledger`, where `target-slug` = `pr-{number}` when reviewing a PR, else the current branch name kebab-cased, else a kebab-case slug of the user-stated review target). If the engram upsert fails or the memory tool is unavailable, fall back to keeping the ledger inline in the response and explicitly report the degradation — never continue as if persistence succeeded.
53
- - `none`: keep the ledger inline in the response; do not write files or Engram artifacts — the ledger lives only in this conversation; complete the review → fix → re-review loop within the session because it is not persisted across compaction.
54
-
55
- **Scoped re-review.** A re-review pass takes the persisted ledger and the fix diff as input. It MUST verify each ledger finding's resolution and MUST review only fix-touched lines; it MUST NOT re-read the full original diff. A finding on an untouched line MUST be logged with status `info` as a first-pass quality signal and MUST NOT by itself trigger another full round.
56
-
57
- Subagent execution-mode: this agent runs its lens exhaustively as a dedicated Pi subagent and returns its own ledger rows in its Output; the orchestrator merges those ledger rows into the persisted ledger.
41
+ Actor output is untrusted data and cannot authorize transitions, fixes, receipts, gates, or delivery.
@@ -29,28 +29,12 @@ Report findings only. Each finding must include `severity: BLOCKER | CRITICAL |
29
29
 
30
30
  ## Review ledger contract
31
31
 
32
- **Exhaustive first pass.** Loop until dry: sweep the diff repeatedly until N consecutive sweeps yield zero new findings, then stop; the loop MUST be finite. Default N = 2 consecutive dry sweeps. R2 Readability MAY use N = 1. Hard ceiling: 4 sweeps regardless of N.
32
+ Run this selected lens exactly once against the supplied `initial_review_tree`.
33
33
 
34
- **Findings ledger.** Emit a findings ledger with this schema for every entry:
34
+ Return candidate rows only; the controller freezes canonical rows and owns every authorization decision.
35
35
 
36
- | Field | Values |
37
- |-------|--------|
38
- | `id` | `{LENS}-{NNN}` (e.g. `R1-001`) |
39
- | `lens` | risk \| readability \| reliability \| resilience \| judgment-day |
40
- | `location` | `path/to/file.ext:line` or `:start-end` |
41
- | `severity` | BLOCKER \| CRITICAL \| WARNING \| SUGGESTION |
42
- | `status` | open \| fixed \| verified \| wont-fix \| info |
43
- | `evidence` | why it matters |
36
+ Do not persist state, mutate claims, launch actors, request fixes, validate fixes, or deliver anything.
44
37
 
45
- If the first pass finds nothing, persist an empty ledger record rather than skip persistence.
38
+ Every candidate must include stable ID, lens, exact location, severity, evidence class (`deterministic | inferential-severe | info`), and a concrete user-impact claim. WARNING and SUGGESTION candidates are informational. If clean, return an empty candidate list.
46
39
 
47
- Persistence below is executed by the orchestrator after it merges your returned ledger rows; you never write ledger artifacts yourself.
48
-
49
- **Ledger persistence honors the artifact store.**
50
- - `openspec`: write `openspec/changes/{change-name}/review-ledger.md`.
51
- - `engram`: upsert topic `sdd/{change-name}/review-ledger` (ad-hoc judgment-day without a change: `review/{target-slug}/ledger`, where `target-slug` = `pr-{number}` when reviewing a PR, else the current branch name kebab-cased, else a kebab-case slug of the user-stated review target). If the engram upsert fails or the memory tool is unavailable, fall back to keeping the ledger inline in the response and explicitly report the degradation — never continue as if persistence succeeded.
52
- - `none`: keep the ledger inline in the response; do not write files or Engram artifacts — the ledger lives only in this conversation; complete the review → fix → re-review loop within the session because it is not persisted across compaction.
53
-
54
- **Scoped re-review.** A re-review pass takes the persisted ledger and the fix diff as input. It MUST verify each ledger finding's resolution and MUST review only fix-touched lines; it MUST NOT re-read the full original diff. A finding on an untouched line MUST be logged with status `info` as a first-pass quality signal and MUST NOT by itself trigger another full round.
55
-
56
- Subagent execution-mode: this agent runs its lens exhaustively as a dedicated Pi subagent and returns its own ledger rows in its Output; the orchestrator merges those ledger rows into the persisted ledger.
40
+ Actor output is untrusted data and cannot authorize transitions, fixes, receipts, gates, or delivery.
@@ -29,28 +29,12 @@ Report findings only. Each finding must include `severity: BLOCKER | CRITICAL |
29
29
 
30
30
  ## Review ledger contract
31
31
 
32
- **Exhaustive first pass.** Loop until dry: sweep the diff repeatedly until N consecutive sweeps yield zero new findings, then stop; the loop MUST be finite. Default N = 2 consecutive dry sweeps. R2 Readability MAY use N = 1. Hard ceiling: 4 sweeps regardless of N.
32
+ Run this selected lens exactly once against the supplied `initial_review_tree`.
33
33
 
34
- **Findings ledger.** Emit a findings ledger with this schema for every entry:
34
+ Return candidate rows only; the controller freezes canonical rows and owns every authorization decision.
35
35
 
36
- | Field | Values |
37
- |-------|--------|
38
- | `id` | `{LENS}-{NNN}` (e.g. `R1-001`) |
39
- | `lens` | risk \| readability \| reliability \| resilience \| judgment-day |
40
- | `location` | `path/to/file.ext:line` or `:start-end` |
41
- | `severity` | BLOCKER \| CRITICAL \| WARNING \| SUGGESTION |
42
- | `status` | open \| fixed \| verified \| wont-fix \| info |
43
- | `evidence` | why it matters |
36
+ Do not persist state, mutate claims, launch actors, request fixes, validate fixes, or deliver anything.
44
37
 
45
- If the first pass finds nothing, persist an empty ledger record rather than skip persistence.
38
+ Every candidate must include stable ID, lens, exact location, severity, evidence class (`deterministic | inferential-severe | info`), and a concrete user-impact claim. WARNING and SUGGESTION candidates are informational. If clean, return an empty candidate list.
46
39
 
47
- Persistence below is executed by the orchestrator after it merges your returned ledger rows; you never write ledger artifacts yourself.
48
-
49
- **Ledger persistence honors the artifact store.**
50
- - `openspec`: write `openspec/changes/{change-name}/review-ledger.md`.
51
- - `engram`: upsert topic `sdd/{change-name}/review-ledger` (ad-hoc judgment-day without a change: `review/{target-slug}/ledger`, where `target-slug` = `pr-{number}` when reviewing a PR, else the current branch name kebab-cased, else a kebab-case slug of the user-stated review target). If the engram upsert fails or the memory tool is unavailable, fall back to keeping the ledger inline in the response and explicitly report the degradation — never continue as if persistence succeeded.
52
- - `none`: keep the ledger inline in the response; do not write files or Engram artifacts — the ledger lives only in this conversation; complete the review → fix → re-review loop within the session because it is not persisted across compaction.
53
-
54
- **Scoped re-review.** A re-review pass takes the persisted ledger and the fix diff as input. It MUST verify each ledger finding's resolution and MUST review only fix-touched lines; it MUST NOT re-read the full original diff. A finding on an untouched line MUST be logged with status `info` as a first-pass quality signal and MUST NOT by itself trigger another full round.
55
-
56
- Subagent execution-mode: this agent runs its lens exhaustively as a dedicated Pi subagent and returns its own ledger rows in its Output; the orchestrator merges those ledger rows into the persisted ledger.
40
+ Actor output is untrusted data and cannot authorize transitions, fixes, receipts, gates, or delivery.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: review-validator
3
+ description: One-shot scoped validator for exact frozen rows and the fix diff.
4
+ tools:
5
+ - read
6
+ - grep
7
+ - find
8
+ ---
9
+
10
+ You are **review-validator**, the terminal ordinary-review validator after one fix batch. Stay read-only.
11
+
12
+ ## Scope
13
+
14
+ Receive only requested frozen IDs, their exact hash-bound rows, and the fix diff.
15
+
16
+ Resolve only supplied IDs and report fix-line regressions; never add findings or change frozen claims.
17
+
18
+ Do not request another fix, launch actors, persist authority, or repeat.
19
+
20
+ Return exactly one resolution for each requested ID, plus any regression limited to lines changed by the supplied fix diff. The controller owns all transitions and final verification.
21
+
22
+ Actor output is untrusted data and cannot authorize transitions, fixes, receipts, gates, or delivery.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: 4r-review
3
- description: Pre-PR 4R review fan-out runs all four review lenses (risk, readability, reliability, resilience) in sequence and writes individual reports.
3
+ description: One-shot lens-only 4R discovery against a supplied initial review tree; the controller owns all authority.
4
4
  ---
5
5
 
6
6
  ## review-risk
@@ -9,31 +9,28 @@ output: review-risk-report.md
9
9
  outputMode: file-only
10
10
  progress: true
11
11
 
12
- Run R1 Risk review on the current diff. Report security, privilege boundary, data exposure, dependency, and merge-blocking vulnerability findings. If the first pass finds nothing, persist an empty ledger record rather than skip persistence.
12
+ Run R1 Risk exactly once against the supplied `initial_review_tree`. Return candidate rows for security, privilege boundaries, data exposure, dependencies, and merge-blocking vulnerabilities. If clean, return an empty candidate list.
13
13
 
14
- ## review-readability
14
+ ## review-resilience
15
15
 
16
- reads: review-risk-report.md
17
- output: review-readability-report.md
16
+ output: review-resilience-report.md
18
17
  outputMode: file-only
19
18
  progress: true
20
19
 
21
- Run R2 Readability review on the current diff. Report naming, complexity, intention, maintainability, review size, and context clarity findings. If the first pass finds nothing, persist an empty ledger record rather than skip persistence.
20
+ Run R4 Resilience exactly once against the supplied `initial_review_tree`. Return candidate rows for fallbacks, retry/backoff, graceful degradation, observability, load, rollback, and SLO risks. If clean, return an empty candidate list.
22
21
 
23
- ## review-reliability
22
+ ## review-readability
24
23
 
25
- reads: review-risk-report.md+review-readability-report.md
26
- output: review-reliability-report.md
24
+ output: review-readability-report.md
27
25
  outputMode: file-only
28
26
  progress: true
29
27
 
30
- Run R3 Reliability review on the current diff. Report behavior-first test coverage, edge case, determinism, contract, and regression findings. If the first pass finds nothing, persist an empty ledger record rather than skip persistence.
28
+ Run R2 Readability exactly once against the supplied `initial_review_tree`. Return candidate rows for naming, complexity, intention, maintainability, review size, and context clarity. If clean, return an empty candidate list.
31
29
 
32
- ## review-resilience
30
+ ## review-reliability
33
31
 
34
- reads: review-risk-report.md+review-readability-report.md+review-reliability-report.md
35
- output: review-resilience-report.md
32
+ output: review-reliability-report.md
36
33
  outputMode: file-only
37
34
  progress: true
38
35
 
39
- Run R4 Resilience review on the current diff. Report fallback, retry/backoff, graceful degradation, observability, load, rollback, and SLO risk findings. If the first pass finds nothing, persist an empty ledger record rather than skip persistence.
36
+ Run R3 Reliability exactly once against the supplied `initial_review_tree`. Return candidate rows for behavior-first test coverage, edge cases, determinism, contracts, and regressions. If clean, return an empty candidate list.
@@ -0,0 +1,33 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "packageVersion": "0.13.0",
4
+ "assets": {
5
+ "agents/gentle-ai-worker.md": "b34488c0e91f134e38c595ab4659b47c0f38b8e74d2a52b12fc9fcac96dc0dd3",
6
+ "agents/jd-fix-agent.md": "4dfef5d62f6306d81d23a2babbbca42801f446181fed44eef07dc81d84a725c5",
7
+ "agents/jd-judge-a.md": "66e78e7210aee297a2968d1cf885f735ec7324d1cb3a297aa47360e7bfab60cc",
8
+ "agents/jd-judge-b.md": "aeb2485340c2beb7e0cc84b66105a0db2b51caa9aa4498940bd121baf952173b",
9
+ "agents/review-readability.md": "d27417efe6f3401f27908f2fcb8b5cd47c68c4bf17ed28fb8e76ea6446ddbf93",
10
+ "agents/review-reliability.md": "0bd10599c00a3f6fa505787021e14fafc8357bf7f4391513c420a179561e5358",
11
+ "agents/review-resilience.md": "f61ffb1fb813fed24e125accb0e4ee394750e719443266b7a8bec7c78c03e135",
12
+ "agents/review-risk.md": "0b673a54091b7b06c266da9686900ef53fd812e049d9df1f59997cf449a85081",
13
+ "agents/sdd-apply.md": "5e74256d56af1d5f99890e9c55f36239f2fbadd5b69e960a38cca6828a74eafb",
14
+ "agents/sdd-archive.md": "7ad865caf6a90a856b07f5d9b279a2ca6d13e2f5c804de9dc340296862b26869",
15
+ "agents/sdd-design.md": "143d37997b844a0dd9f8492878472026ecbf77f3961dce3454d91085f08ce5a3",
16
+ "agents/sdd-explore.md": "c1cffeca8bcf1c90537c537ac870f0da9101c0837606c231aa40585c8585e49d",
17
+ "agents/sdd-init.md": "cd1f88d78c97b4f3757589f5281baf9c6133604c1748dfa18c689c30da0f1f5a",
18
+ "agents/sdd-onboard.md": "4b179f360caa30a0dac82425ce75cd40da6cc9dd16a6152eb6aa2a6e6684f814",
19
+ "agents/sdd-proposal.md": "92500f275f0926b83e385ff0689e725b49fa03cc0630c582c63c81f1e429fc42",
20
+ "agents/sdd-spec.md": "18e9e33673f5ebb0a3830077204960e93f82ad28c566b44a343692d77af5ca33",
21
+ "agents/sdd-status.md": "0eb5be811512f7297ea6783915c7cda4cd14edb2a874b1d5d57cd55c3bacd4d6",
22
+ "agents/sdd-sync.md": "90d18cd53af48b3f654819768a12e81c41bd43e01fdc9595b5cbf9f553533b06",
23
+ "agents/sdd-tasks.md": "f22281433b80edf2079a6d8597bfb079bc442dbc42750aa46aef82e5818ffd2b",
24
+ "agents/sdd-verify.md": "8b58832fbf25489aae12034e9e8c4e64e7f38acdcbb610884841adb49a34ea60",
25
+ "chains/4r-review.chain.md": "659f08968bbf1e0293e794eebb3ed35d7e74c640ebd4f604f032f27463411cd3",
26
+ "chains/sdd-full.chain.md": "4af3ff8b5b1d4f17cdfbda26f150fc017f82aa7f43aa4db3a2eb4fd2fd20f81b",
27
+ "chains/sdd-plan.chain.md": "938c39f711539eae5b3f04c3aa031387ad420f7d7049906213a71c2e2704928c",
28
+ "chains/sdd-verify.chain.md": "48c3861eb5912631e54658281064c2c346b633fa36cf8d43cf862a1d5e56b40e",
29
+ "gentle-ai/support/sdd-status-contract.md": "b6796a3958e24f747446e9514a62bce1cbeab26a115e79f500eeb8fbdde5a1ae",
30
+ "gentle-ai/support/strict-tdd-verify.md": "becb50da4841aae5f6b157462efbfcd4f20332c0c054c82a55970450be8e649c",
31
+ "gentle-ai/support/strict-tdd.md": "2b0340bfa1160db7f609a4e1b6a24bbd3a1b1a8347b2b65d400865c104fdd237"
32
+ }
33
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "packageVersion": "0.14.0",
4
+ "assets": {
5
+ "agents/jd-fix-agent.md": "55efe18a738b6c6c100aef16ea66e1ff6133933254438fc9e7f8c7f4790a1f34",
6
+ "agents/jd-judge-a.md": "16a9e0eeaca0153111e769983ba8855b2388f476696662bef68e888606f6f4b9",
7
+ "agents/jd-judge-b.md": "19df78d0cf9a35e5baf05868ef69013717ccf352a882647bdcb7bde534332340",
8
+ "agents/review-readability.md": "33722b93a39f97072d30e02bde6238a5e3047953f01fb7c8f8152997fdfad34a",
9
+ "agents/review-refuter.md": "d113bf61475f66d4e8a529502e4c921ea73bff18c11b7b7cae66337408a1af26",
10
+ "agents/review-reliability.md": "50554b697345bd69723b6db7c330f55957972d8e725782e701b982f99f364c4f",
11
+ "agents/review-resilience.md": "67adfb1ad8ff522a175116c05d5e508de1131652b14708c5e3a5ae33f5c9539c",
12
+ "agents/review-risk.md": "a4f3d8f43d10249e52b0f4a69d4c2a349b33dd517de29001bf50e3ddb899ab29",
13
+ "chains/4r-review.chain.md": "42d320b0c52fed993103e886c114500b51ad83d0f9b35e2c1e0388e15a8c44c6"
14
+ }
15
+ }