@dev-loops/core 1.0.0-rc.2 → 1.0.0-rc.4

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 (33) hide show
  1. package/package.json +7 -1
  2. package/src/analysis/diff-analyzer.mjs +31 -5
  3. package/src/claude/hook-decisions.mjs +14 -0
  4. package/src/cli/primitives.mjs +10 -2
  5. package/src/cli/retry-wrapper.mjs +14 -6
  6. package/src/config/config.mjs +1125 -240
  7. package/src/config/extension-defaults.yaml +217 -426
  8. package/src/github/copilot-helpers.mjs +139 -18
  9. package/src/github/issue-ops.mjs +556 -0
  10. package/src/github/ownership-helpers.mjs +79 -0
  11. package/src/github/review-threads.mjs +44 -3
  12. package/src/loop/bash-command-classify.mjs +35 -5
  13. package/src/loop/conductor-routing.mjs +1 -1
  14. package/src/loop/copilot-ci-status.mjs +76 -0
  15. package/src/loop/copilot-loop-iterations.mjs +1 -2
  16. package/src/loop/copilot-loop-state.mjs +9 -5
  17. package/src/loop/default-branch-guard.mjs +380 -0
  18. package/src/loop/gate-carry-forward.mjs +29 -2
  19. package/src/loop/gate-fanin.mjs +481 -31
  20. package/src/loop/handoff-envelope.mjs +43 -23
  21. package/src/loop/main-checkout-ff.mjs +58 -0
  22. package/src/loop/pr-gate-coordination.mjs +204 -47
  23. package/src/loop/pr-title-markers.mjs +76 -15
  24. package/src/loop/queue-board-sync.mjs +26 -9
  25. package/src/loop/reviewer-loop-state.mjs +2 -2
  26. package/src/loop/ui-e2e-scoping.mjs +2 -0
  27. package/src/loop/ui-review-drive.mjs +23 -0
  28. package/src/loop/ui-review-provision.mjs +36 -0
  29. package/src/projects/resolve-project.mjs +14 -7
  30. package/src/tracker/adapter.mjs +127 -0
  31. package/src/tracker/github-adapter.mjs +150 -0
  32. package/src/tracker/index.mjs +50 -0
  33. package/src/tracker/noop-adapter.mjs +35 -0
@@ -4,93 +4,258 @@ version: 1
4
4
  # Precedence: built-in defaults < extension defaults < repo .pi/dev-loop/defaults.* < repo .devloops
5
5
 
6
6
  # Default strategy: extension intends local-first; consumers can still override via repo defaults.
7
- strategy:
8
- default: local-first
7
+ strategy: local-first
9
8
 
10
9
  # Local-first input source: tracker issues vs phase docs.
11
- inputSource:
12
- default: tracker
10
+ inputSource: tracker
13
11
 
14
12
  # Refinement fan-out defaults.
15
13
  refinement:
16
14
  fanOut: 3
17
15
  mode: parallel
18
16
  maxCopilotRounds: 5
19
- stopOnLowSignal: false
20
- lowSignalRoundThreshold: 3
21
- lowSignalMaxComments: 2
22
17
  roles:
23
18
  - scope
24
19
  - coverage
25
20
  - dry
26
21
  - kiss
27
22
 
28
- # Gate review angle definitions for all consumers.
23
+ # Gate review angle definitions for all consumers. A bare string angle is
24
+ # sugar for `{ name }`; `mandatory: true` marks an angle that always runs
25
+ # (was gates.<gate>.mandatoryAngles), and `persona`/`prompt`/`model`/`tier`
26
+ # override the built-in reviewer registry for that angle (was the top-level
27
+ # `personas` map + angle-keyed `models.roles`/`models.roleTiers`).
29
28
  gates:
30
29
  draft:
31
30
  angles:
32
- - scope
33
- - coverage
34
- - correctness
35
- - ci-guard
36
- - contract-surface
37
- - link-check
38
- - config-drift
39
- - gate-evidence
40
- - no-op
41
- - input-validation
42
- - threat-model
43
- - packaging-runtime
44
- - state-concurrency
45
- - renderer-security
46
- - determinism
47
- - pr-comments
31
+ - name: scope
32
+ persona: review
33
+ prompt: Check whether every changed file belongs in this PR. Flag unrelated or out-of-scope changes. The PR description's scope section is the contract.
34
+ - name: coverage
35
+ persona: review
36
+ prompt: "Check whether tests cover the changed behavior adequately. Look for missing edge cases, untested error paths, and acceptance-criteria gaps. Also flag test-name quality issues: test names that misrepresent what is actually asserted, overly broad names that hide gaps, and names that don't match the behavior under test. Flag missing negative-case coverage: malformed-argument tests, error-contract tests, and edge-case coverage for boundary conditions, empty inputs, and unexpected states. Do not accept happy-path-only test suites."
37
+ - name: correctness
38
+ persona: review
39
+ prompt: Check whether the implementation matches the acceptance criteria and PR description. Flag logic errors, contract violations, and behavior mismatches.
40
+ - name: ci-guard
41
+ persona: review
42
+ prompt: |-
43
+ Audit CI/workflow semantics for reproducibility and correctness: - Verify CI configuration is deterministic (no floating version ranges
44
+ in install steps, lockfile is respected).
45
+ - Check that branch-protection rules and status-check requirements
46
+ match the stated merge policy.
47
+ - Flag non-reproducible install steps and missing lockfile enforcement. - Verify that CI failure precedence is correct: a failing required check
48
+ must block merge regardless of other passing checks.
49
+ - Flag pending check-run states that could silently hide failures. - Flag Node.js support-floor mismatches between CI matrices,
50
+ package.json engines, and documented requirements.
51
+ - name: contract-surface
52
+ persona: review
53
+ prompt: Review this change for public contract-surface drift. Check whether documented schema fields, state/sentinel names, runtime values, tests, and CLI output agree. Verify CLI --help usage matches accepted flags. Compare stdout JSON success shape and stderr JSON error shape against documented examples. Flag optional fields documented as always emitted but conditionally omitted, or fields emitted but undocumented. Stay repo-agnostic; cite concrete changed files and give minimal fixes.
54
+ - name: link-check
55
+ persona: review
56
+ prompt: |-
57
+ Validate link and path correctness: - Check that all Markdown relative links resolve to existing files
58
+ or sections.
59
+ - Flag placeholder links (e.g. href targets still using example URLs,
60
+ 404 references, or TODO links).
61
+ - When the repo provides `scripts/docs/validate-links.mjs`, run it
62
+ for the mechanical link pass and report any failures.
63
+ - Flag symlink-backed doc pointers that point to missing targets. - This persona complements mechanical link validation with context-aware
64
+ judgment for link intent and anchor correctness.
65
+ - name: config-drift
66
+ persona: review
67
+ prompt: |-
68
+ Cross-check config, schema, and documentation for contract drift: - Verify that configuration files (.pi/dev-loop/settings.yaml,
69
+ package.json, CI workflows, skill manifests) agree on canonical
70
+ status tokens, support floors, and required flags.
71
+ - Flag any instance where two sources of truth disagree about the
72
+ supported contract (e.g. one doc says a flag is required, another
73
+ says it's optional).
74
+ - Check that the engines.node field matches CI matrix and any
75
+ documented Node.js support floor.
76
+ - Flag inconsistencies within a single doc that could confuse
77
+ consumers (e.g. one section says "default: true" and another
78
+ section implies the opposite).
79
+ - name: gate-evidence
80
+ persona: review
81
+ prompt: |-
82
+ Verify that required workflow checkpoint evidence is present and valid: - Check that the draft checkpoint verdict comment exists. While the PR is
83
+ still draft, it must also reference the current head SHA. After the PR
84
+ leaves draft, the `draft_gate` checkpoint verdict comment is a one-time transition record
85
+ and head-SHA matching no longer applies.
86
+ - Check that the pre-approval checkpoint verdict comment exists when the PR
87
+ is in a ready/merge state.
88
+ - Flag any PR that transitions to ready/merge states without visible
89
+ checkpoint evidence for the current head.
90
+ - When draft-first enforcement is configured, verify that a draft-gate
91
+ comment was posted before the PR was marked ready.
92
+ - This persona is opt-in for the draft gate (uncomment to add).
93
+ On first PR it checks for any checkpoint evidence (not only draft_gate since
94
+ no prior gate exists).
95
+ - name: no-op
96
+ persona: review
97
+ prompt: |-
98
+ Flag workflow or tool invocations that are effectively no-ops: - Check that shell commands and tool calls actually affect output,
99
+ state, or exit behavior rather than discarding their effect.
100
+ - Flag tool invocations that look successful but pass arguments in
101
+ a way that produces no meaningful change.
102
+ - Flag commands whose output is generated but never consumed. - Flag patterns where a tool is called in a loop but only the last
103
+ iteration's result is used (or none at all).
104
+ - name: input-validation
105
+ persona: review
106
+ prompt: Review this change for input-validation drift. Check repo slug, issue number, host, SHA, whitespace, and sentinel normalization. Prefer shared parsers/helpers over ad hoc validation. Flag malformed inputs that slip through, confusing errors, path traversal-like segments, and inconsistent trimming/normalization across CLI/API entrypoints. Recommend minimal tests for accepted and rejected forms.
107
+ - name: threat-model
108
+ persona: review
109
+ prompt: "Adversarially threat-model this change end to end — you are an attacker with control over every caller-/plan-influenced input (descriptors, paths, URLs, flags, env, fixture data). Do NOT spot-check; return a trust-boundary CHECKLIST and a verdict per item. Enumerate exhaustively for every seam the diff touches: (1) INPUT ALLOWLISTS — are actions/commands/schemes/hosts allowlisted (not denylisted), and enforced BEFORE any dangerous use (browser launch, exec, read)? (2) NAVIGATION/ORIGIN CONFINEMENT — same-origin/scheme enforced both pre-launch AND at runtime after every redirect / click / server-response (a pre-check the runtime can defeat is a hole). (3) RESOURCE/LOOP BOUNDS — step/size/time/recursion caps on attacker-influenced counts. (4) DATA-AT-REST + CLEANUP — sensitive intermediate artifacts minimized and removed on EVERY fail-closed path (not just the happy path); no off-origin/partial artifact left on disk on error. (5) EXPORTED/ENTRY-POINT TRUST — does every exported function / alternate entry self-validate, or can it bypass the parse-time validation the CLI does? (6) ERROR/TEARDOWN SAFETY — a throw in rm/close/teardown must not break the fail-closed envelope or leak state. (7) PATH TRAVERSAL / DESERIALIZATION — reject absolute/`..`/escape-base paths before read; no unsafe deserialization of untrusted data. (8) SHELL/PROCESS — no unescaped interpolation into a shell; prefer argv arrays; no `shell:true` with caller input. For each category that applies, state whether the change is safe and cite the guarding code (file:line) or flag the specific abuse and a failing-input example. If a category does not apply to the touched seam, say so explicitly rather than skipping it."
110
+ - name: packaging-runtime
111
+ persona: review
112
+ prompt: "Review this change for packaging/runtime asset contract gaps. Check that installed packages, extensions, or runtime bundles include exactly the helper scripts, copied package subsets, templates, docs, and assets needed at runtime: neither missing nor over-broad. Compare install docs, fixture assertions, allow-lists, and import paths. Flag runtime-only dependencies not covered by packaging tests."
113
+ - name: state-concurrency
114
+ persona: review
115
+ prompt: Review this change for state concurrency and locking risks. Check state-file read/modify/write paths, lock acquisition/release, stale lock handling, concurrent invocations, atomic writes, managed process cleanup, and stderr/error capture. Flag races that can clobber state or leave orphaned locks/processes. Recommend narrow deterministic concurrency or cleanup tests.
116
+ - name: renderer-security
117
+ persona: review
118
+ prompt: Review this change for renderer security. Check HTML text escaping, URL encoding, attribute encoding, JSON/script embedding, and rendering of user-controlled content. Treat titles, names, URLs, statuses, errors, and external payload fields as untrusted. Flag raw interpolation into HTML or attributes and tests that expect unsafe output.
119
+ - name: determinism
120
+ persona: review
121
+ prompt: Review this change for determinism. Check ordering, tie-breakers, localeCompare use, time/random/environment dependence, polling/count assumptions, and mocks/stubs that allow unexpected extra calls. Require stable sorting, strict stubs, deterministic fixture data, and tests independent of locale, timezone, filesystem order, and network timing.
122
+ - name: pr-comments
123
+ persona: review
124
+ prompt: |-
125
+ Scan PR comments for unresolved issues before declaring the gate clean. Check all PR comments and review threads for: - Comments from the repository owner or collaborators that point out
126
+ implementation bugs, logic errors, contract violations, or security
127
+ issues
128
+ - Unresolved review threads that raise implementation concerns Flag any unresolved comment that identifies a concrete implementation problem as a blocking finding (severity: high or medium). Do not flag: - Resolved threads - Style nits, formatting suggestions, or cosmetic feedback - Comments from non-collaborators or bots - Outdated comments that were already addressed in a later commit If no unresolved implementation concerns exist, return clean.
48
129
  - contradiction-lens
49
130
  - code-conformance
50
131
  - semantic-drift
51
- excludeAngles: []
132
+ - name: pr-description
133
+ mandatory: true
134
+ persona: review
135
+ prompt: 'Review the PR description for completeness, contract fitness, and checkbox formatting before this PR is marked ready for review. The PR body is the implementation contract — it must have: - A Summary section explaining what changed and why - A Scope and context section defining the boundary of the change - An Acceptance criteria section with the linked issue acceptance criteria - A Definition of done section - A Non-goals section - A Validation command section describing exactly how to verify the change - The "Closes #N" line must match the linked issue; flag changes that alter or remove the operator-intended close target Checkboxes (`- [ ]` / `- [x]`, or `* [ ]` / `* [x]`) must appear inside genuine Markdown list items. Flag any checkbox marker used outside a list item (including table cells) as a medium finding. Flag any checkbox marker wrapped in backticks (e.g. `` `[x]` ``) as a medium finding. Flag PRs where the body is a single sentence or lacks any of these sections. Do not block on formatting preferences other than checkbox correctness.'
52
136
  required: true
53
137
  requireCi: true
54
- mandatoryAngles:
55
- - pr-description
56
- # Gate findings comments live ON the PR (the local-first spec-of-record /
57
- # human-review surface), so they are evidence, not tracker noise — keep them on.
58
- postFindingsComments: true
138
+ # Diff-class angle tiers (opt-in, ordered, first match wins). A matching tier
139
+ # replaces this gate's resolved angle set with its own for that round's
140
+ # fan-out (mandatory angles are always kept); it never changes execution
141
+ # mode. A tiered round is still a normal fanout_fanin round:
142
+ # tiers:
143
+ # - name: docs-only
144
+ # match: { kinds: [docs] }
145
+ # angles: [pr-description, link-check, gate-evidence]
146
+ # The gate round's verdict review already carries every finding, so the
147
+ # consolidated findings comment is opt-in duplication — keep it off.
148
+ postFindingsComments: false
149
+ # Grouped fan-out dispatch (AC6, default mode — see resolveFanoutGroups):
150
+ # angles that read the same surface batch onto one reviewer. Angles not
151
+ # named below join the auto-chunked leftover pool. Set `mode: per-angle`
152
+ # to restore full one-reviewer-per-angle fan-out repo-wide (bypasses
153
+ # maxAnglesPerGroup: 1 honors configured groups; the two match in unit size only when no configured multi-angle group matches). `gate:full` forces the full angle set but no
154
+ # longer restores per-angle dispatch (ADR 0047 superseded by 0048) — it
155
+ # dispatches grouped.
156
+ #
157
+ # Two orthogonal dispatch bounds (#1601):
158
+ # maxAnglesPerGroup (N, default 3, min 1) — leftover ungrouped angles
159
+ # auto-chunk into dispatch units of ≤N instead of singletons.
160
+ # maxConcurrent (M, default 4, min 1) — at most M dispatch units per wave.
161
+ # Both count dispatch units (groups), not angles.
162
+ fanout:
163
+ maxAnglesPerGroup: 3
164
+ maxConcurrent: 4
165
+ groups:
166
+ - name: docs-surface
167
+ angles: [docs, link-check, config-drift, contract-surface]
168
+ - name: process
169
+ angles: [scope, pr-description, gate-evidence, pr-checklist-matrix]
170
+ - name: correctness-input
171
+ angles: [correctness, input-validation]
172
+ - name: determinism-state
173
+ angles: [determinism, state-concurrency]
59
174
  preApproval:
60
175
  angles:
61
- - dry
62
- - kiss
63
- - yagni
64
- - srp
65
- - soc
66
- - deep
67
- - ocp
68
- - lsp
69
- - isp
70
- - dip
71
- - docs
72
- - pr-checklist-matrix
176
+ - name: dry
177
+ persona: review
178
+ prompt: Flag duplicated logic, repeated patterns, and copy-pasted code. Prefer one canonical path. Check for restated policies across docs and skills.
179
+ - name: kiss
180
+ persona: review
181
+ prompt: Flag over-engineering and unnecessary complexity. Prefer simple solutions. Question extra layers, abstractions, and indirection that don't earn their keep.
182
+ - name: yagni
183
+ persona: review
184
+ prompt: Flag speculative features, future-proofing, and compatibility shims not required by the current acceptance criteria. YAGNI = You Aren't Gonna Need It.
185
+ - name: srp
186
+ persona: review
187
+ prompt: "Single Responsibility Principle: check that each module, file, class, and function has exactly one reason to change. Flag multi-concern files, god objects, mixed abstractions, and modules that own unrelated responsibilities."
188
+ - name: soc
189
+ persona: review
190
+ prompt: "Separation of Concerns: flag modules that mix distinct concerns (e.g., business logic + I/O, data access + presentation, orchestration + implementation). Each concern should live in its own module with a clear boundary."
191
+ - name: deep
192
+ persona: review
193
+ prompt: |-
194
+ Perform a structural code quality audit of this PR.
195
+ Bring the same rigor as a full-codebase deslop audit, scoped to this change: - Question whether every new file, export, layer, or abstraction is
196
+ genuinely necessary. Prefer deletion over addition.
197
+ - Flag files crossing 1000 lines without strong justification. - Flag new conditionals bolted onto unrelated paths. Push logic into its
198
+ own boundary instead of scattering special cases.
199
+ - Flag thin wrappers, re-export-only files, and identity abstractions
200
+ that add indirection without buying clarity.
201
+ - Flag feature logic leaking into shared or general-purpose modules. - Question cast-heavy, optionality-heavy, or any-typed contracts that
202
+ obscure the real invariant.
203
+
204
+ Be ambitious about simplification: - Look for "code judo" moves: restructurings that preserve behavior while
205
+ deleting whole categories of complexity.
206
+ - Prefer the simpler model. If the change adds moving parts, ask whether
207
+ fewer would achieve the same result.
208
+
209
+ Do not rubber-stamp working-but-messier code. Approval bar: - no structural regression - no missed simplification opportunity - no unjustified file-size explosion - no spaghetti branching growth - no unnecessary abstraction or indirection
210
+ This persona complements full-repo deslop audits: same rigor, applied per-PR.
211
+ - name: ocp
212
+ persona: review
213
+ prompt: |-
214
+ Open/Closed Principle: flag code that requires modifying existing
215
+ modules to add new behavior. Prefer extension points, plugin
216
+ architectures, and config-driven dispatch over patching internals.
217
+ - name: lsp
218
+ persona: review
219
+ prompt: "Liskov Substitution Principle: flag subtypes or implementations that weaken base contracts, throw unexpected errors, or require special-casing in callers. Subtypes must be fully substitutable for their base types."
220
+ - name: isp
221
+ persona: review
222
+ prompt: "Interface Segregation Principle: flag fat interfaces and modules that force consumers to depend on methods or exports they never use. Prefer narrow, role-specific interfaces."
223
+ - name: dip
224
+ persona: review
225
+ prompt: "Dependency Inversion Principle: flag high-level modules depending on low-level implementation details. Check that abstractions are owned by the consumer, not the implementation. Flag concrete imports where an interface/contract should exist."
226
+ - name: docs
227
+ persona: docs
228
+ prompt: "Review documentation correctness for the current change. Check that relative markdown links resolve, symlink-backed doc pointers resolve, navigable doc references are actual markdown links rather than bare backtick path mentions, command/script references still exist and use current names, and index/surface references match the current file tree. Also flag stale command references: removed or renamed npm scripts, CLI commands, or tool invocations that no longer match the current codebase. When the repo provides `scripts/docs/validate-links.mjs`, use it for the mechanical link pass; otherwise keep the review scoped to the touched doc surface and current change only."
229
+ - name: pr-checklist-matrix
230
+ mandatory: true
231
+ persona: review
232
+ prompt: |-
233
+ Verify before approval that the PR checklist and AC/DoD/non-goals matrix are complete. - Every PR checkbox (`- [ ]`) must be checked. If any box is unchecked, flag it as a blocking finding. - The PR body must contain an AC/DoD/non-goals matrix that maps each acceptance criterion
234
+ to its definition-of-done item(s) and lists explicit non-goals.
235
+ - The matrix must have a markdown table with at least a header row and one content row. - Flag the matrix as incomplete if any acceptance criterion, definition-of-done item, or non-goal is missing.
73
236
  - contradiction-lens
74
237
  - correctness-final
75
238
  - ui-validation
76
- excludeAngles: []
77
239
  required: true
78
- mandatoryAngles:
79
- - pr-checklist-matrix
80
240
  # Relaxed spike gate profile (#965). A spike's deliverable is a findings doc,
81
241
  # not production code, so it is intentionally lighter than the production
82
242
  # draft -> pre-approval -> Copilot set: a small docs-first angle set, not a
83
243
  # required gate, and no CI prerequisite. Resolved through the same
84
- # config-merge layering and resolveGateConfig path as draft/preApproval; only
85
- # applies to spike-mode work, so production gates are unaffected.
244
+ # config-merge layering and resolveGateConfig path as draft/preApproval (one
245
+ # unified GateConfig, D2) — only applies to spike-mode work, so production
246
+ # gates are unaffected. `blockCleanOnFindingSeverities`/`dynamic.additive`
247
+ # are accepted but inert for spike (a findings-doc deliverable has no "clean
248
+ # verdict" escalation path or additive dynamic pool).
86
249
  spike:
87
250
  angles:
88
- - scope
89
- - docs
90
- excludeAngles: []
251
+ - name: scope
252
+ persona: review
253
+ prompt: Check whether every changed file belongs in this PR. Flag unrelated or out-of-scope changes. The PR description's scope section is the contract.
254
+ - name: docs
255
+ persona: docs
256
+ prompt: "Review documentation correctness for the current change. Check that relative markdown links resolve, symlink-backed doc pointers resolve, navigable doc references are actual markdown links rather than bare backtick path mentions, command/script references still exist and use current names, and index/surface references match the current file tree. Also flag stale command references: removed or renamed npm scripts, CLI commands, or tool invocations that no longer match the current codebase. When the repo provides `scripts/docs/validate-links.mjs`, use it for the mechanical link pass; otherwise keep the review scoped to the touched doc surface and current change only."
91
257
  required: false
92
258
  requireCi: false
93
- mandatoryAngles: []
94
259
 
95
260
  # Autonomy: only merge requires operator confirmation by default.
96
261
  autonomy:
@@ -121,7 +286,7 @@ localImplementation:
121
286
  maxFiles: 2
122
287
  maxLines: 100
123
288
 
124
- # Queue defaults (repo-specific projectNumber/boardTitle omitted by design).
289
+ # Queue defaults (repo-specific queue.board omitted by design).
125
290
  queue:
126
291
  maxParallel: 3
127
292
  # Local-first is PR-first (issues are skipped, #952), so auto-filing issues is
@@ -129,380 +294,6 @@ queue:
129
294
  maxAutoFiledIssues: 1
130
295
  reDispatchMaxRetries: 1
131
296
 
132
- # Persona registry used by gate review angle resolution.
133
- personas:
134
- refiner:
135
- persona: refiner
136
- prompt: |-
137
- For every refinement, include an AC/DoD/Non-goal coverage matrix:
138
-
139
- | Item | Type (AC/DoD/Non-goal) | Status (Met/Partial/Unmet/Unverified) | Evidence | Notes |
140
- |---|---|---|---|---|
141
- | <exact item text> | AC | Unverified | <reference> | |
142
-
143
- Use exact wording from the source issue(s); when the governing input is a phase doc or other spec instead of an issue, use that source wording exactly for every explicit item.
144
- Include every explicit acceptance criterion, definition-of-done item, and non-goal; do not skip items.
145
- If no explicit definition of done exists, add a `Proposed DoD` subsection before the matrix.
146
- Treat any `Partial`, `Unmet`, or `Unverified` row as incomplete refinement.
147
- A refinement is complete only when no item has `Partial`, `Unmet`, or `Unverified` status.
148
-
149
- When a bounded audit artifact is supplied, add an `Audit inputs` subsection.
150
- Summarize the audited scope, list prioritized findings, include the highest-value follow-up candidates,
151
- and add an explicit `Will not rewrite/broaden in this phase` statement.
152
- For each prioritized finding, classify it as exactly one of: current-phase scope/AC,
153
- DoD expectation, explicit non-goal/defer, or risk/watchpoint.
154
- Do not fabricate audit evidence when none was provided.
155
- defaultModel: null
156
-
157
- audit:
158
- persona: review
159
- prompt: >-
160
- Run a bounded refinement audit. Audit only the named files/areas.
161
- Prefer delete / merge / trim / defer framing over additive rewrite plans.
162
- Produce prioritized findings and highest-value follow-up candidates,
163
- not a whole-repo essay.
164
- Always include a bounded-scope statement and a `not rewriting in this phase`
165
- statement. Findings are planning inputs, not automatic rewrite authorization.
166
- defaultModel: null
167
-
168
- scope:
169
- persona: review
170
- prompt: >-
171
- Check whether every changed file belongs in this PR.
172
- Flag unrelated or out-of-scope changes.
173
- The PR description's scope section is the contract.
174
- defaultModel: null
175
-
176
- coverage:
177
- persona: review
178
- prompt: >-
179
- Check whether tests cover the changed behavior adequately.
180
- Look for missing edge cases, untested error paths,
181
- and acceptance-criteria gaps.
182
- Also flag test-name quality issues: test names that misrepresent
183
- what is actually asserted, overly broad names that hide gaps, and
184
- names that don't match the behavior under test.
185
- Flag missing negative-case coverage: malformed-argument tests,
186
- error-contract tests, and edge-case coverage for boundary
187
- conditions, empty inputs, and unexpected states.
188
- Do not accept happy-path-only test suites.
189
- defaultModel: null
190
-
191
- correctness:
192
- persona: review
193
- prompt: >-
194
- Check whether the implementation matches the acceptance criteria
195
- and PR description. Flag logic errors, contract violations,
196
- and behavior mismatches.
197
- defaultModel: null
198
-
199
- docs:
200
- persona: docs
201
- prompt: >-
202
- Review documentation correctness for the current change. Check that
203
- relative markdown links resolve, symlink-backed doc pointers resolve,
204
- navigable doc references are actual markdown links rather than bare
205
- backtick path mentions, command/script references still exist and use
206
- current names, and index/surface references match the current file tree.
207
- Also flag stale command references: removed or renamed npm scripts,
208
- CLI commands, or tool invocations that no longer match the current
209
- codebase. When the repo provides `scripts/docs/validate-links.mjs`,
210
- use it for the mechanical link pass; otherwise keep the review scoped
211
- to the touched doc surface and current change only.
212
- defaultModel: null
213
-
214
- deep:
215
- persona: review
216
- prompt: >-
217
- Perform a structural code quality audit of this PR.
218
-
219
- Bring the same rigor as a full-codebase deslop audit, scoped to this
220
- change:
221
- - Question whether every new file, export, layer, or abstraction is
222
- genuinely necessary. Prefer deletion over addition.
223
- - Flag files crossing 1000 lines without strong justification.
224
- - Flag new conditionals bolted onto unrelated paths. Push logic into its
225
- own boundary instead of scattering special cases.
226
- - Flag thin wrappers, re-export-only files, and identity abstractions
227
- that add indirection without buying clarity.
228
- - Flag feature logic leaking into shared or general-purpose modules.
229
- - Question cast-heavy, optionality-heavy, or any-typed contracts that
230
- obscure the real invariant.
231
-
232
- Be ambitious about simplification:
233
- - Look for "code judo" moves: restructurings that preserve behavior while
234
- deleting whole categories of complexity.
235
- - Prefer the simpler model. If the change adds moving parts, ask whether
236
- fewer would achieve the same result.
237
-
238
- Do not rubber-stamp working-but-messier code.
239
- Approval bar:
240
- - no structural regression
241
- - no missed simplification opportunity
242
- - no unjustified file-size explosion
243
- - no spaghetti branching growth
244
- - no unnecessary abstraction or indirection
245
-
246
- This persona complements full-repo deslop audits: same rigor,
247
- applied per-PR.
248
- defaultModel: null
249
-
250
- dry:
251
- persona: review
252
- prompt: >-
253
- Flag duplicated logic, repeated patterns, and copy-pasted code.
254
- Prefer one canonical path. Check for restated policies across
255
- docs and skills.
256
- defaultModel: null
257
-
258
- kiss:
259
- persona: review
260
- prompt: >-
261
- Flag over-engineering and unnecessary complexity.
262
- Prefer simple solutions. Question extra layers, abstractions,
263
- and indirection that don't earn their keep.
264
- defaultModel: null
265
-
266
- srp:
267
- persona: review
268
- prompt: >-
269
- Single Responsibility Principle: check that each module, file,
270
- class, and function has exactly one reason to change.
271
- Flag multi-concern files, god objects, mixed abstractions,
272
- and modules that own unrelated responsibilities.
273
- defaultModel: null
274
-
275
- ocp:
276
- persona: review
277
- prompt: >-
278
- Open/Closed Principle: flag code that requires modifying existing
279
- modules to add new behavior. Prefer extension points, plugin
280
- architectures, and config-driven dispatch over patching internals.
281
- defaultModel: null
282
-
283
- lsp:
284
- persona: review
285
- prompt: >-
286
- Liskov Substitution Principle: flag subtypes or implementations
287
- that weaken base contracts, throw unexpected errors, or require
288
- special-casing in callers. Subtypes must be fully substitutable
289
- for their base types.
290
- defaultModel: null
291
-
292
- isp:
293
- persona: review
294
- prompt: >-
295
- Interface Segregation Principle: flag fat interfaces and modules
296
- that force consumers to depend on methods or exports they never
297
- use. Prefer narrow, role-specific interfaces.
298
- defaultModel: null
299
-
300
- dip:
301
- persona: review
302
- prompt: >-
303
- Dependency Inversion Principle: flag high-level modules depending
304
- on low-level implementation details. Check that abstractions are
305
- owned by the consumer, not the implementation. Flag concrete
306
- imports where an interface/contract should exist.
307
- defaultModel: null
308
-
309
- soc:
310
- persona: review
311
- prompt: >-
312
- Separation of Concerns: flag modules that mix distinct concerns
313
- (e.g., business logic + I/O, data access + presentation,
314
- orchestration + implementation). Each concern should live in
315
- its own module with a clear boundary.
316
- defaultModel: null
317
-
318
- yagni:
319
- persona: review
320
- prompt: >-
321
- Flag speculative features, future-proofing, and compatibility shims
322
- not required by the current acceptance criteria.
323
- YAGNI = You Aren't Gonna Need It.
324
- defaultModel: null
325
-
326
- contract-surface:
327
- persona: review
328
- prompt: >-
329
- Review this change for public contract-surface drift. Check whether documented schema fields, state/sentinel names, runtime values, tests, and CLI output agree. Verify CLI --help usage matches accepted flags. Compare stdout JSON success shape and stderr JSON error shape against documented examples. Flag optional fields documented as always emitted but conditionally omitted, or fields emitted but undocumented. Stay repo-agnostic; cite concrete changed files and give minimal fixes.
330
- defaultModel: null
331
-
332
- input-validation:
333
- persona: review
334
- prompt: >-
335
- Review this change for input-validation drift. Check repo slug, issue number, host, SHA, whitespace, and sentinel normalization. Prefer shared parsers/helpers over ad hoc validation. Flag malformed inputs that slip through, confusing errors, path traversal-like segments, and inconsistent trimming/normalization across CLI/API entrypoints. Recommend minimal tests for accepted and rejected forms.
336
- defaultModel: null
337
-
338
- packaging-runtime:
339
- persona: review
340
- prompt: >-
341
- Review this change for packaging/runtime asset contract gaps. Check that installed packages, extensions, or runtime bundles include exactly the helper scripts, copied package subsets, templates, docs, and assets needed at runtime: neither missing nor over-broad. Compare install docs, fixture assertions, allow-lists, and import paths. Flag runtime-only dependencies not covered by packaging tests.
342
- defaultModel: null
343
-
344
- state-concurrency:
345
- persona: review
346
- prompt: >-
347
- Review this change for state concurrency and locking risks. Check state-file read/modify/write paths, lock acquisition/release, stale lock handling, concurrent invocations, atomic writes, managed process cleanup, and stderr/error capture. Flag races that can clobber state or leave orphaned locks/processes. Recommend narrow deterministic concurrency or cleanup tests.
348
- defaultModel: null
349
-
350
- renderer-security:
351
- persona: review
352
- prompt: >-
353
- Review this change for renderer security. Check HTML text escaping, URL encoding, attribute encoding, JSON/script embedding, and rendering of user-controlled content. Treat titles, names, URLs, statuses, errors, and external payload fields as untrusted. Flag raw interpolation into HTML or attributes and tests that expect unsafe output.
354
- defaultModel: null
355
-
356
- threat-model:
357
- persona: review
358
- prompt: >-
359
- Adversarially threat-model this change end to end — you are an attacker with control over every caller-/plan-influenced input (descriptors, paths, URLs, flags, env, fixture data). Do NOT spot-check; return a trust-boundary CHECKLIST and a verdict per item. Enumerate exhaustively for every seam the diff touches: (1) INPUT ALLOWLISTS — are actions/commands/schemes/hosts allowlisted (not denylisted), and enforced BEFORE any dangerous use (browser launch, exec, read)? (2) NAVIGATION/ORIGIN CONFINEMENT — same-origin/scheme enforced both pre-launch AND at runtime after every redirect / click / server-response (a pre-check the runtime can defeat is a hole). (3) RESOURCE/LOOP BOUNDS — step/size/time/recursion caps on attacker-influenced counts. (4) DATA-AT-REST + CLEANUP — sensitive intermediate artifacts minimized and removed on EVERY fail-closed path (not just the happy path); no off-origin/partial artifact left on disk on error. (5) EXPORTED/ENTRY-POINT TRUST — does every exported function / alternate entry self-validate, or can it bypass the parse-time validation the CLI does? (6) ERROR/TEARDOWN SAFETY — a throw in rm/close/teardown must not break the fail-closed envelope or leak state. (7) PATH TRAVERSAL / DESERIALIZATION — reject absolute/`..`/escape-base paths before read; no unsafe deserialization of untrusted data. (8) SHELL/PROCESS — no unescaped interpolation into a shell; prefer argv arrays; no `shell:true` with caller input. For each category that applies, state whether the change is safe and cite the guarding code (file:line) or flag the specific abuse and a failing-input example. If a category does not apply to the touched seam, say so explicitly rather than skipping it.
360
- defaultModel: null
361
-
362
- determinism:
363
- persona: review
364
- prompt: >-
365
- Review this change for determinism. Check ordering, tie-breakers, localeCompare use, time/random/environment dependence, polling/count assumptions, and mocks/stubs that allow unexpected extra calls. Require stable sorting, strict stubs, deterministic fixture data, and tests independent of locale, timezone, filesystem order, and network timing.
366
- defaultModel: null
367
-
368
- ci-guard:
369
- persona: review
370
- prompt: >-
371
- Audit CI/workflow semantics for reproducibility and correctness:
372
- - Verify CI configuration is deterministic (no floating version ranges
373
- in install steps, lockfile is respected).
374
- - Check that branch-protection rules and status-check requirements
375
- match the stated merge policy.
376
- - Flag non-reproducible install steps and missing lockfile enforcement.
377
- - Verify that CI failure precedence is correct: a failing required check
378
- must block merge regardless of other passing checks.
379
- - Flag pending check-run states that could silently hide failures.
380
- - Flag Node.js support-floor mismatches between CI matrices,
381
- package.json engines, and documented requirements.
382
- defaultModel: null
383
-
384
- link-check:
385
- persona: review
386
- prompt: >-
387
- Validate link and path correctness:
388
- - Check that all Markdown relative links resolve to existing files
389
- or sections.
390
- - Flag placeholder links (e.g. href targets still using example URLs,
391
- 404 references, or TODO links).
392
- - When the repo provides `scripts/docs/validate-links.mjs`, run it
393
- for the mechanical link pass and report any failures.
394
- - Flag symlink-backed doc pointers that point to missing targets.
395
- - This persona complements mechanical link validation with context-aware
396
- judgment for link intent and anchor correctness.
397
- defaultModel: null
398
-
399
- pr-description:
400
- persona: review
401
- prompt: >-
402
- Review the PR description for completeness, contract fitness, and checkbox formatting before this PR is marked ready for review.
403
- The PR body is the implementation contract — it must have:
404
- - A Summary section explaining what changed and why
405
- - A Scope and context section defining the boundary of the change
406
- - An Acceptance criteria section with the linked issue acceptance criteria
407
- - A Definition of done section
408
- - A Non-goals section
409
- - A Validation command section describing exactly how to verify the change
410
- - The "Closes #N" line must match the linked issue; flag changes that alter or remove the operator-intended close target
411
- Checkboxes (`- [ ]` / `- [x]`, or `* [ ]` / `* [x]`) must appear inside genuine Markdown list items. Flag any checkbox marker used outside a list item (including table cells) as a worth-fixing-now finding.
412
- Flag any checkbox marker wrapped in backticks (e.g. `` `[x]` ``) as a worth-fixing-now finding.
413
- Flag PRs where the body is a single sentence or lacks any of these sections.
414
- Do not block on formatting preferences other than checkbox correctness.
415
- defaultModel: null
416
-
417
- acceptance-criteria:
418
- persona: review
419
- prompt: >-
420
- Verify that each acceptance criterion and definition-of-done item from the
421
- linked issue/PR is actually satisfied by the implementation — not merely
422
- listed. For every criterion, cite the concrete code/test/behavior evidence
423
- that meets it; flag any criterion that is unmet, only partially met, or
424
- unverifiable from the diff as a blocking finding. Confirm definition-of-done
425
- items (tests, docs, validation) are done and that declared non-goals are
426
- respected (no scope creep).
427
- defaultModel: null
428
-
429
- pr-checklist-matrix:
430
- persona: review
431
- prompt: >-
432
- Verify before approval that the PR checklist and AC/DoD/non-goals matrix are complete.
433
- - Every PR checkbox (`- [ ]`) must be checked. If any box is unchecked, flag it as a blocking finding.
434
- - The PR body must contain an AC/DoD/non-goals matrix that maps each acceptance criterion
435
- to its definition-of-done item(s) and lists explicit non-goals.
436
- - The matrix must have a markdown table with at least a header row and one content row.
437
- - Flag the matrix as incomplete if any acceptance criterion, definition-of-done item, or non-goal is missing.
438
- defaultModel: null
439
-
440
- pr-comments:
441
- persona: review
442
- prompt: >-
443
- Scan PR comments for unresolved issues before declaring the gate clean.
444
- Check all PR comments and review threads for:
445
- - Comments from the repository owner or collaborators that point out
446
- implementation bugs, logic errors, contract violations, or security
447
- issues
448
- - Unresolved review threads that raise implementation concerns
449
- Flag any unresolved comment that identifies a concrete implementation
450
- problem as a blocking finding (severity: must-fix or worth-fixing-now).
451
- Do not flag:
452
- - Resolved threads
453
- - Style nits, formatting suggestions, or cosmetic feedback
454
- - Comments from non-collaborators or bots
455
- - Outdated comments that were already addressed in a later commit
456
- If no unresolved implementation concerns exist, return clean.
457
- config-drift:
458
- persona: review
459
- prompt: >-
460
- Cross-check config, schema, and documentation for contract drift:
461
- - Verify that configuration files (.pi/dev-loop/settings.yaml,
462
- package.json, CI workflows, skill manifests) agree on canonical
463
- status tokens, support floors, and required flags.
464
- - Flag any instance where two sources of truth disagree about the
465
- supported contract (e.g. one doc says a flag is required, another
466
- says it's optional).
467
- - Check that the engines.node field matches CI matrix and any
468
- documented Node.js support floor.
469
- - Flag inconsistencies within a single doc that could confuse
470
- consumers (e.g. one section says "default: true" and another
471
- section implies the opposite).
472
- defaultModel: null
473
-
474
- gate-evidence:
475
- persona: review
476
- prompt: >-
477
- Verify that required workflow checkpoint evidence is present and valid:
478
- - Check that the draft checkpoint verdict comment exists. While the PR is
479
- still draft, it must also reference the current head SHA. After the PR
480
- leaves draft, the `draft_gate` checkpoint verdict comment is a one-time transition record
481
- and head-SHA matching no longer applies.
482
- - Check that the pre-approval checkpoint verdict comment exists when the PR
483
- is in a ready/merge state.
484
- - Flag any PR that transitions to ready/merge states without visible
485
- checkpoint evidence for the current head.
486
- - When draft-first enforcement is configured, verify that a draft-gate
487
- comment was posted before the PR was marked ready.
488
- - This persona is opt-in for the draft gate (uncomment to add).
489
- On first PR it checks for any checkpoint evidence (not only draft_gate since
490
- no prior gate exists).
491
- defaultModel: null
492
-
493
- no-op:
494
- persona: review
495
- prompt: >-
496
- Flag workflow or tool invocations that are effectively no-ops:
497
- - Check that shell commands and tool calls actually affect output,
498
- state, or exit behavior rather than discarding their effect.
499
- - Flag tool invocations that look successful but pass arguments in
500
- a way that produces no meaningful change.
501
- - Flag commands whose output is generated but never consumed.
502
- - Flag patterns where a tool is called in a loop but only the last
503
- iteration's result is used (or none at all).
504
- defaultModel: null
505
-
506
297
  # Internal path patterns for internal-only PR detection.
507
298
  internalPathPatterns:
508
299
  - "^scripts/"