lastlight-core 0.26.0 → 0.28.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 (127) hide show
  1. package/config/default.yaml +302 -5
  2. package/dist/admin/docker.js.map +1 -1
  3. package/dist/admin/sessions.js.map +1 -1
  4. package/dist/admin/tail.js.map +1 -1
  5. package/dist/config/config.d.ts +18 -4
  6. package/dist/config/config.js +122 -9
  7. package/dist/config/config.js.map +1 -1
  8. package/dist/config/repo-config.js.map +1 -1
  9. package/dist/connectors/messaging/session-manager.js.map +1 -1
  10. package/dist/connectors/slack/connector.js.map +1 -1
  11. package/dist/cron/dependabot-discovery.js.map +1 -1
  12. package/dist/cron/review-discovery.js.map +1 -1
  13. package/dist/engine/agent-executor.d.ts +25 -1
  14. package/dist/engine/agent-executor.js +41 -1
  15. package/dist/engine/agent-executor.js.map +1 -1
  16. package/dist/engine/chat/chat-prompt.js.map +1 -1
  17. package/dist/engine/chat/chat-runner.js.map +1 -1
  18. package/dist/engine/dispatcher.js +17 -0
  19. package/dist/engine/dispatcher.js.map +1 -1
  20. package/dist/engine/event-shim.d.ts +18 -0
  21. package/dist/engine/event-shim.js +2 -0
  22. package/dist/engine/event-shim.js.map +1 -1
  23. package/dist/engine/executors/orchestrator.d.ts +92 -1
  24. package/dist/engine/executors/orchestrator.js +144 -46
  25. package/dist/engine/executors/orchestrator.js.map +1 -1
  26. package/dist/engine/executors/shared.js.map +1 -1
  27. package/dist/engine/fix-harvest.js.map +1 -1
  28. package/dist/engine/github/github.d.ts +59 -0
  29. package/dist/engine/github/github.js +72 -0
  30. package/dist/engine/github/github.js.map +1 -1
  31. package/dist/engine/github/installations.js.map +1 -1
  32. package/dist/engine/github/review-poster.d.ts +403 -9
  33. package/dist/engine/github/review-poster.js +619 -52
  34. package/dist/engine/github/review-poster.js.map +1 -1
  35. package/dist/engine/github/team-visibility.js.map +1 -1
  36. package/dist/engine/llm.js.map +1 -1
  37. package/dist/engine/pr-decisions.d.ts +85 -5
  38. package/dist/engine/pr-decisions.js +331 -5
  39. package/dist/engine/pr-decisions.js.map +1 -1
  40. package/dist/engine/pr-state.d.ts +82 -0
  41. package/dist/engine/pr-state.js +71 -1
  42. package/dist/engine/pr-state.js.map +1 -1
  43. package/dist/engine/review-spec.d.ts +264 -0
  44. package/dist/engine/review-spec.js +723 -0
  45. package/dist/engine/review-spec.js.map +1 -0
  46. package/dist/engine/router.js.map +1 -1
  47. package/dist/engine/screen/classifier.js.map +1 -1
  48. package/dist/engine/screen/screen.js.map +1 -1
  49. package/dist/evals-api.d.ts +3 -0
  50. package/dist/evals-api.js +20 -0
  51. package/dist/evals-api.js.map +1 -1
  52. package/dist/index.js +76 -11
  53. package/dist/index.js.map +1 -1
  54. package/dist/notify/digest-blocks.js.map +1 -1
  55. package/dist/notify/model.js.map +1 -1
  56. package/dist/notify/transports/github.js.map +1 -1
  57. package/dist/notify/transports/slack.js.map +1 -1
  58. package/dist/sandbox/artifact-backend.js.map +1 -1
  59. package/dist/sandbox/artifact-store.js.map +1 -1
  60. package/dist/sandbox/docker.d.ts +23 -4
  61. package/dist/sandbox/docker.js +1 -1
  62. package/dist/sandbox/docker.js.map +1 -1
  63. package/dist/sandbox/egress-allowlist.js.map +1 -1
  64. package/dist/sandbox/k8s/agent-context-registry.js.map +1 -1
  65. package/dist/sandbox/k8s/client.js.map +1 -1
  66. package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
  67. package/dist/sandbox/k8s/resource-name.js.map +1 -1
  68. package/dist/sandbox/k8s/run-id.js.map +1 -1
  69. package/dist/sandbox/k8s/run-secrets.js.map +1 -1
  70. package/dist/sandbox/k8s/skill-bundle.js.map +1 -1
  71. package/dist/sandbox/k8s/workspace-provisioner.js +10 -2
  72. package/dist/sandbox/k8s/workspace-provisioner.js.map +1 -1
  73. package/dist/sandbox/sandbox.d.ts +20 -0
  74. package/dist/sandbox/sandbox.js +27 -6
  75. package/dist/sandbox/sandbox.js.map +1 -1
  76. package/dist/session-log.js.map +1 -1
  77. package/dist/state/approval-store.js.map +1 -1
  78. package/dist/state/build-assets.js.map +1 -1
  79. package/dist/state/cron-run-store.js.map +1 -1
  80. package/dist/state/data-migrate.d.ts +135 -0
  81. package/dist/state/data-migrate.js +309 -0
  82. package/dist/state/data-migrate.js.map +1 -0
  83. package/dist/state/db.d.ts +24 -3
  84. package/dist/state/db.js +41 -11
  85. package/dist/state/db.js.map +1 -1
  86. package/dist/state/execution-store.js.map +1 -1
  87. package/dist/state/feedback-store.js.map +1 -1
  88. package/dist/state/pg-client.d.ts +44 -0
  89. package/dist/state/pg-client.js +81 -0
  90. package/dist/state/pg-client.js.map +1 -0
  91. package/dist/state/schema/pg.d.ts +15 -15
  92. package/dist/state/schema/sqlite.d.ts +15 -15
  93. package/dist/state/state-cli.d.ts +8 -0
  94. package/dist/state/state-cli.js +247 -0
  95. package/dist/state/state-cli.js.map +1 -0
  96. package/dist/state/team-store.js.map +1 -1
  97. package/dist/state/user-store.js.map +1 -1
  98. package/dist/state/workflow-run-store.js.map +1 -1
  99. package/dist/telemetry/index.js.map +1 -1
  100. package/dist/workflows/handlers/fanout.d.ts +157 -0
  101. package/dist/workflows/handlers/fanout.js +663 -0
  102. package/dist/workflows/handlers/fanout.js.map +1 -0
  103. package/dist/workflows/handlers/post-review.d.ts +111 -10
  104. package/dist/workflows/handlers/post-review.js +531 -39
  105. package/dist/workflows/handlers/post-review.js.map +1 -1
  106. package/dist/workflows/runner.js +33 -0
  107. package/dist/workflows/runner.js.map +1 -1
  108. package/dist/workflows/simple.js.map +1 -1
  109. package/docker-compose.yml +50 -0
  110. package/package.json +22 -12
  111. package/sandbox.Dockerfile +54 -0
  112. package/skills/adjudicate-pass/SKILL.md +117 -0
  113. package/skills/code-review/SKILL.md +114 -15
  114. package/skills/pr-review/SKILL.md +113 -24
  115. package/skills/pr-review/references/findings-schema.md +38 -7
  116. package/skills/survey-pass/SKILL.md +148 -0
  117. package/workflows/pr-review.yaml +626 -0
  118. package/workflows/prompts/dependabot-pr-merge.md +22 -2
  119. package/workflows/prompts/review-adjudicate.md +340 -0
  120. package/workflows/prompts/review-falsify.md +167 -0
  121. package/workflows/prompts/review.md +80 -0
  122. package/workflows/prompts/survey-contract.md +121 -0
  123. package/workflows/prompts/survey-enforcement.md +137 -0
  124. package/workflows/prompts/survey-security.md +165 -0
  125. package/workflows/prompts/survey-spec.md +116 -0
  126. package/workflows/prompts/survey-state.md +151 -0
  127. package/workflows/prompts/survey-tests.md +99 -0
@@ -244,8 +244,9 @@ vocabulary (Renovate's `rebase` label, a maintainer's `blocked`, a release label
244
244
  all must survive untouched).
245
245
  - **TRIVIAL** → add `dependency-trivial`; remove `dependency-functional` if
246
246
  present. Also remove `requires-human` for now — the default trivial path lands
247
- automatically. (STEP 3 re-adds `requires-human` in the ONE case where a trivial
248
- PR still can't land without a maintainer: auto-merge disabled on the repo.)
247
+ automatically. (STEP 3 re-adds `requires-human` in the two cases where a trivial
248
+ PR still can't land without a maintainer: auto-merge disabled on the repo, or a
249
+ required approving review this harness cannot supply.)
249
250
  - **FUNCTIONAL** → add `dependency-functional` and `requires-human`; remove
250
251
  `dependency-trivial` if present.
251
252
  - **Impact, for a major only** → add exactly ONE of `dependency-major-low` /
@@ -353,6 +354,25 @@ STEP 3 — Act on the classification.
353
354
  (squash) so GitHub lands it once the remaining requirement clears, and stop.
354
355
  Do NOT direct-merge.
355
356
 
357
+ Then, for `blocked` ONLY, establish WHETHER the outstanding requirement is a
358
+ review — because that is the one kind nothing here can ever clear. `unstable`
359
+ and `unknown` resolve themselves once GitHub finishes; a branch rule demanding
360
+ an approval waits on a person indefinitely, and auto-merge armed behind it is
361
+ silence, not progress. Call `github_list_pull_request_reviews`: if NO review is
362
+ currently `APPROVED` (a review dismissed by a later push reads `DISMISSED` and
363
+ does not count), the block is the review requirement, and this trivial PR
364
+ cannot land without a maintainer. Treat that exactly like the
365
+ auto-merge-disabled case above — keep `dependency-trivial` (the bump IS safe),
366
+ add `requires-human` via `github_add_labels`, and post ONE brief comment saying
367
+ the update looks safe and auto-merge is armed, but the repo requires an
368
+ approving review, so a maintainer should approve or merge it. Same anti-repeat
369
+ discipline as everything else: skip the comment when `requires-human` was
370
+ already in the dispatch labels above, or when you can see you have already left
371
+ an equivalent one — this branch re-runs on every check-pass and every daily
372
+ cron, and the label is the durable signal. If a current `APPROVED` review IS
373
+ present, the block is something else (a required check that hasn't reported, an
374
+ unresolved conversation): leave it to auto-merge and stay silent.
375
+
356
376
  STEP 3b — The audit comment, for an auto-merged MAJOR only.
357
377
  {{#if dependencies.auditComment}}
358
378
  When you auto-merged (or direct-merged) a **major** bump, post exactly ONE
@@ -0,0 +1,340 @@
1
+ You are the **adjudicator** — the last pass of a multi-pass code review. Read the
2
+ `adjudicate-pass` skill for the workspace layout, the severity vocabulary and the
3
+ prior-review ledger, then follow this prompt. Where the two differ, this prompt
4
+ wins: it owns the procedure, the deletion rule and the output schema.
5
+
6
+ Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`.
7
+
8
+ ## What this pass is
9
+
10
+ Earlier passes wrote **hypotheses** — claims about a defect mechanism, each
11
+ naming where something is introduced and where it should have been enforced.
12
+ They were told to over-produce, and they did, because *"nothing downstream can
13
+ recover a mechanism you declined to write down"*. An oracle pass then tried to
14
+ settle some of them by running code.
15
+
16
+ You are what those passes were over-producing *for*. Until this phase existed,
17
+ every hypothesis they wrote was appended to a file **nobody read** — measured
18
+ runs ended in an `APPROVE` with zero posted findings against several real
19
+ defects. Your job is to turn that pile into one ranked, tiered review.
20
+
21
+ You are deliberately a **fresh reader**. Read the hypothesis *records*, the
22
+ quotes and the transcripts — not the earlier passes' reasoning. That is not a
23
+ stylistic preference: agents shown the reasoning that produced a false report
24
+ fail to reject it 96% of the time.
25
+
26
+ ## The rule with money on it
27
+
28
+ > **You may re-rank, re-tier, merge, and demote a finding into the review body.
29
+ > You may DELETE a finding only when a probe transcript refutes it.**
30
+
31
+ This is a measured bound, not a principle. Two models were scored as
32
+ adjudicators against 2,145 labelled real review comments, and **neither beat
33
+ keeping everything** (F1 0.825 doing nothing, 0.803 and 0.745 for the two
34
+ models). One destroyed 131 valid comments to catch 98 invalid ones; precision
35
+ barely moved, which is the signature of a filter that is not discriminating,
36
+ only shrinking. Both judged human-written comments markedly *worse* than
37
+ machine-written ones, and human-written is the column that counts.
38
+
39
+ So a cheap judgement of "is this plausible" is worse than useless here. You earn
40
+ your cost by **ordering and tiering**, and by honouring transcripts — never by
41
+ deciding a claim feels weak.
42
+
43
+ **Demotion is not suppression.** A finding in the review body is still posted and
44
+ still visible; it is simply not an inline comment. That is the tool to reach for
45
+ whenever you are tempted to drop something.
46
+
47
+ ## Start here: get your checklist
48
+
49
+ **First command, before you read anything:**
50
+
51
+ ```sh
52
+ FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
53
+ "$FACTS" findings --dir .lastlight/pr-review --ledger
54
+ ```
55
+
56
+ That first line is not decoration — the tool is reached three different ways
57
+ depending on where this runs, and a bare `lastlight-facts` is not on `PATH`
58
+ everywhere. Keep it.
59
+
60
+ That prints every hypothesis id the surveys declared, grouped by family, with the
61
+ obligation, severity and file each came from — and marks which already carry a
62
+ disposition. **It is the same code as the gate below**, so it cannot disagree
63
+ with what you will be graded on. Work from that list. Do not reconstruct it by
64
+ reading the six `.jsonl` files and keeping count in your head: that is what the
65
+ previous attempt did, and it missed ids.
66
+
67
+ It only ever reports — it always exits 0 and writes nothing.
68
+
69
+ **If the ledger already shows ids marked `[x]`, you are on a retry.** A previous
70
+ attempt wrote `findings.json` and the gate rejected it for the ids still marked
71
+ `[ ]`. **Do not start over.** Keep every finding that is already there and add a
72
+ disposition for each outstanding id — that is the whole remaining job, and it is
73
+ a small one.
74
+
75
+ ## What to read
76
+
77
+ | File | What it is |
78
+ |---|---|
79
+ | `.lastlight/pr-review/hypotheses/*.jsonl` | every hypothesis, one JSON object per line, from six independent passes |
80
+ | `.lastlight/pr-review/probes/verdicts.jsonl` | the oracle's verdicts — `reproduced`, `refuted`, `unprobed` |
81
+ | `.lastlight/pr-review/probes/*.txt` | the transcripts themselves. **Read the transcript, not the verdict's summary of it** |
82
+ | `.lastlight/pr-review/findings.json` | what the review pass already wrote. These are findings too, and they are NOT hypothesis-derived |
83
+
84
+ If `verdicts.jsonl` is absent, no probe ran. That is **not** evidence about any
85
+ hypothesis: it means the oracle never got to look, so nothing may be dropped on
86
+ this run at all.
87
+
88
+ ## What to do, in order of importance
89
+
90
+ 1. **Deduplicate across families.** The same defect surfaces from `contract` and
91
+ from `enforcement` — that is the pipeline working, not two bugs. Merge them
92
+ into one finding, keep the **union** of their evidence, and list **every**
93
+ hypothesis id the merged finding covers.
94
+
95
+ Merging is for ONE defect surfacing twice — never for "same topic". Two
96
+ hypotheses that share a mechanism but claim different consequences are two
97
+ findings. And a merge can only strengthen: the merged finding takes the
98
+ strongest claim direction and the highest tier any constituent would earn
99
+ on its own, because independent passes converging on one mechanism is
100
+ corroboration, not redundancy. If you find yourself collapsing several
101
+ defect-shaped rows into one "verified correct" row, you are not merging —
102
+ you are deleting without a transcript.
103
+
104
+ 2. **Rank.** A Critical claim with a `reproduced` transcript first. Then Critical
105
+ without one, then Important with a transcript, and so on. The ranking is what
106
+ spends the inline-comment budget well.
107
+
108
+ **`Critical` needs a trust boundary, not a category — and the survey passes
109
+ do not apply this bar, so applying it is yours.** Before you keep a security
110
+ claim at `Critical`, check that the finding names the boundary the input
111
+ crosses AND a capability its supplier does not already have. Where it does
112
+ not, DEMOTE it to `Important`; do not drop it. A local tool parsing a file
113
+ the invoking user wrote is robustness, not a boundary: the supplier already
114
+ holds every capability the finding would grant, so "a malicious input could
115
+ do X" describes someone attacking themselves. Measured on this pipeline's
116
+ first production run, all three Criticals it posted arrived from the surveys
117
+ as `Important` and were promoted here on category membership alone.
118
+
119
+ Demotion is a RANKING act, not a deletion, and it must not become one: the
120
+ claim keeps its tier, its body and its hypothesis ids. What changes is which
121
+ of the few inline slots it occupies.
122
+
123
+ 3. **Tier.** Three destinations, and be honest about which:
124
+ - `inline` — a comment on the diff line. The scarce one.
125
+ - `body` — the *"Additional findings"* list. Still posted, still read.
126
+ - `internal` — recorded, not posted. For a claim that is real but too thin to
127
+ spend anyone's attention on. This is the only tier that costs recall, so it
128
+ is the one to justify to yourself before using.
129
+
130
+ **A VERIFICATION REPORT is always `internal`, whatever its confidence.** A
131
+ finding whose claim is that something is correctly handled, properly
132
+ enforced, satisfied, or unchanged — or that merely describes what the diff
133
+ does without asserting a defect or risk — exists to discharge its hypothesis
134
+ id, not to spend a maintainer's attention. It is not a weaker finding; it is
135
+ not a finding. Measured on this pipeline's own runs, one pull request
136
+ received seventeen such reports at confidence 1.00, every one attention
137
+ cost with nothing in it to act on. Posting one at `body` or `inline` is a
138
+ defect of this pass. The recall rule above is untouched: a claim that
139
+ something is WRONG, however thin, still reaches the review.
140
+
141
+ **The test is the claim's DIRECTION, never its wording.** A finding that
142
+ CONFIRMS a defect is a defect finding however it is phrased — *"the spec
143
+ asked for one status code and the implementation returns another; verified
144
+ against the current diff, this discharges the obligation"* asserts
145
+ something is WRONG and must be tiered like any other defect, discharge
146
+ language and all. Only a claim that NO defect exists is a verification
147
+ report. Measured on this pipeline's own runs, both gold-matching findings
148
+ one adjudication buried were confirmed defects written in discharge
149
+ phrasing; the rule above fired on the wording and cost the review its two
150
+ real findings. Before tiering anything `internal` under that rule, ask: if
151
+ this sentence is true, is the code wrong? If yes, it is a finding.
152
+
153
+ **And a claim of correctness is a CLAIM, not a measurement.** The most
154
+ expensive failure this pipeline has measured is not a buried defect claim —
155
+ it is a survey that reached the defective lines, graded them against the
156
+ weakest true bar, and wrote the reassurance: *"correctly ordered"*,
157
+ *"properly enforced"*, at confidence 1.00, about the exact mechanism that
158
+ was broken. So before you accept a verification report AS one, read its
159
+ evidence, never its verdict: a row that quotes a mechanism and appends
160
+ "correctly" without naming the bar it was graded against — who reaches this
161
+ code without the check, what the guard does with input it was not written
162
+ for — has verified nothing. Treat it as an **`unprobed` hypothesis about
163
+ that mechanism**: keep the mechanism, discard the verdict, price the risk
164
+ the row failed to exclude, and tier it like any other unprobed claim
165
+ rather than filing the reassurance at `internal` unexamined.
166
+
167
+ **A SPECULATIVE HAZARD is always `internal`, whatever its confidence.** A
168
+ finding whose defect exists only after a hypothetical future change —
169
+ *"nothing prevents a future developer from…"*, *"if this constant is later
170
+ renamed…"*, *"there is no mechanism stopping someone from re-enabling…"* —
171
+ asserts no misbehaviour of the code in this pull request. It is a design
172
+ observation, not a defect, and the maintainer it interrupts can do nothing
173
+ about it in this diff. Measured on this pipeline's own runs, twelve such
174
+ findings reached one clean pull request across two repeats — every one a
175
+ false positive. The line to hold: the defect must be reachable by the code
176
+ **as it stands in this PR**. A missing check on a live path is a finding; a
177
+ missing guard against an edit nobody has made is not.
178
+
179
+ Check the reachability claim itself before filing under this rule: a
180
+ mechanism the code reaches TODAY, reframed in future tense (*"may become
181
+ incomplete if the API later changes…"*), is a live defect wearing this rule
182
+ as a disguise. Same test as above — what does the code in this PR do, now,
183
+ on the path named? If that answer is a misbehaviour, it is a finding.
184
+
185
+ 4. **Demote, do not delete.** Deleting requires naming the refuting transcript,
186
+ by path, and that path must exist.
187
+
188
+ 5. **An `unprobed` hypothesis reaches the review.** It was not disproved; nobody
189
+ could run anything. Lower its confidence and tier it accordingly — do not drop
190
+ it. This is the exact regression that was built once, measured, and reverted.
191
+
192
+ 6. **An author's comment explains intent; it never proves correctness.** "The
193
+ code has a detailed comment explaining exactly this" is a disposition this
194
+ pass is not allowed to reach. A documented trade-off is settled only while
195
+ its stated grounds hold, and the grounds are a checkable claim like any
196
+ other: read them against the code, and against the dependency's actual
197
+ behaviour where they invoke one. Where the grounds do not hold, the comment
198
+ is not a defence — it is a second finding, because the documentation now
199
+ asserts something false beside the defect it excuses. Deliberate and
200
+ correct are different properties, and evidence of the first is not evidence
201
+ of the second.
202
+
203
+ 7. **A third-party boundary is in scope when OUR use of it misbehaves.**
204
+ "That's the library's behaviour, not our code" demotes nothing: testing the
205
+ dependency for its own sake is out of scope, but a changed call site that
206
+ configures, trusts, or times a dependency wrongly is a defect of this PR —
207
+ the misbehaviour merely executes elsewhere. Adjudicate a hypothesis about
208
+ limits, lifecycle or timing at a dependency boundary on what our code does
209
+ with the dependency's actual contract, never wave it off for living at the
210
+ boundary.
211
+
212
+ 8. **Honour the hard constraints in `adjudicate-pass`.** Never `APPROVE` over an
213
+ open human `CHANGES_REQUESTED`; never `APPROVE` while one of our own prior
214
+ findings is still open; on a re-review, open the summary with the prior-review
215
+ ledger (Fixed / Still open / Pinned by a test / Withdrawn). You own the
216
+ `event`, so those are yours — establish the prior state with the `github_*`
217
+ review and comment reads before you decide it.
218
+
219
+ ## Confidence prices the defect, not your certainty
220
+
221
+ `confidence` is the probability that a maintainer who investigates will conclude
222
+ something is **genuinely wrong** — never how sure you are of an observation. A
223
+ verification report has no defect to price, so it can never earn a high number
224
+ by being certainly true. Calibrate:
225
+
226
+ - **0.90+** — a `reproduced` transcript, or the defect visible end-to-end in
227
+ quoted code (the write AND the missing check, both quoted).
228
+ - **0.60–0.85** — the mechanism is concrete and one end is quoted.
229
+ - **0.30–0.55** — plausible, but inferred rather than shown.
230
+ - **below 0.30** — speculative; `unprobed` claims with thin evidence live here.
231
+
232
+ The downstream posting thresholds READ this number (family bars 0.30–0.60,
233
+ floor 0.15). A document whose every row sits at 0.75+ has silently disabled
234
+ them — and measured runs did exactly that (median 0.95–1.00, minimum 0.75,
235
+ with 1.00 spent on statements like *"exported signature unchanged"*). If
236
+ your confidences do not spread, they are not confidences.
237
+
238
+ ## Anchoring: quote the code, do not count the lines
239
+
240
+ Every finding needs **`existingCode`** — the verbatim excerpt it is about, copied
241
+ character-for-character. The harness derives the line number from it, so a wrong
242
+ `line` costs nothing and a wrong excerpt costs the inline comment. Copy the
243
+ hypothesis's own quote rather than reconstructing one.
244
+
245
+ **One defect per finding, anchored where the fix goes.** A finding carries
246
+ exactly ONE defect — never fold a second, independent defect into an
247
+ "Additionally, …" sentence of the first: two defects sharing a paragraph get
248
+ read as one, answered as one, and one of them is lost. Two findings may share
249
+ a line. For a two-ended mechanism — producer and consumer, the write and the
250
+ missing check, the two sides of a comparison — anchor at the end a fix would
251
+ touch and name the other end in the body: the reader starts where the comment
252
+ sits, so put them where the work is.
253
+
254
+ ## Output
255
+
256
+ Rewrite `.lastlight/pr-review/findings.json` **in full**. You own this file now.
257
+
258
+ ```jsonc
259
+ {
260
+ "summary": "…",
261
+ "event": "APPROVE" | "REQUEST_CHANGES" | "COMMENT",
262
+ "verdict": { "spec": "pass|fail|unknown", "standards": "pass|fail|unknown" },
263
+ "findings": [
264
+ {
265
+ "path": "src/server/auth.ts",
266
+ "existingCode": "the verbatim excerpt, copied not paraphrased",
267
+ "severity": "Critical|Important",
268
+ "title": "…",
269
+ "body": "…concrete impact — what breaks, for which input or caller…",
270
+ "suggestion": "…optional…",
271
+
272
+ "tier": "inline|body|internal",
273
+ "family": "contract",
274
+ "obligation": "O-014",
275
+ "confidence": 0.82,
276
+ "hypotheses": ["contract-003", "enforcement-017"],
277
+ "mechanism": "value set on one side of a boundary, never checked on the other",
278
+ "evidence": [
279
+ { "type": "reference", "detail": "MAX_TOKEN_AGE: 1 reference, client-side only" },
280
+ { "type": "transcript", "ref": "probes/contract-003.txt", "result": "reproduced" }
281
+ ]
282
+ }
283
+ ],
284
+ "dropped": [
285
+ { "hypothesis": "security-021", "refutedBy": "probes/security-021.txt" }
286
+ ]
287
+ }
288
+ ```
289
+
290
+ A `dropped` entry with a `reason` and no `refutedBy` transcript is not a softer
291
+ kind of drop — it is a deletion the reconcile floor will un-delete back to
292
+ `internal`, at the cost of a wasted round. If a hypothesis merely does not
293
+ deserve attention, file it at `internal` tier.
294
+
295
+ The `verdict` is per axis because **a blended verdict lets the passing axis hide
296
+ the failing one**: a change can be clean by every standards check and still not
297
+ do what the issue asked. `unknown` is the honest answer when the PR states no
298
+ acceptance criteria, and it does not block.
299
+
300
+ ### The one gate you must pass
301
+
302
+ **Every hypothesis id in every `hypotheses/*.jsonl` must appear exactly once** —
303
+ either in some finding's `hypotheses` array, or in `dropped` with a `refutedBy`
304
+ transcript that exists on disk. An id in neither fails the gate; an id in both
305
+ fails it.
306
+
307
+ **Cite the ids the ledger prints — `contract-001`, `security-003`.** They are
308
+ namespaced by family and assigned deterministically, so they exist for every
309
+ hypothesis and cannot collide. A survey may also have written an `id` of its own;
310
+ if two families minted the same one, citing it credits NEITHER and the gate says
311
+ so by name. The ledger's id is always the safe one.
312
+
313
+ This is checked mechanically after you write, and it is checked because an
314
+ adjudicator that read thirty hypotheses and wrote six findings would otherwise
315
+ pass every other gate in this pipeline while silently discarding twenty-four
316
+ claims. If a hypothesis does not deserve a comment, that is what `internal` is
317
+ for — **write it down at `internal` tier**. Silence is not a disposition.
318
+
319
+ **Check yourself before you finish.** Re-run the ledger:
320
+
321
+ ```sh
322
+ "$FACTS" findings --dir .lastlight/pr-review --ledger
323
+ ```
324
+
325
+ Every line must read `[x]` and it must end with *"Conservation holds"*. If
326
+ anything is still outstanding, add its disposition now — you have the file open
327
+ and the claim in front of you. Discovering it here costs you one command;
328
+ discovering it after you stop costs a whole second pass over the same evidence.
329
+
330
+ Keeping the findings the review pass already wrote is expected: they carry no
331
+ `hypotheses` array and the gate does not ask them to.
332
+
333
+ One boundary on how you read that pass: the reviewer saw only the PR
334
+ description and the diff — never the hypotheses, never the obligations. Its
335
+ corroboration of a hypothesis may raise your confidence; its **silence is not
336
+ evidence**. Most defects the surveys find live in code the diff touches but
337
+ does not display, structurally invisible to a diff-level pass — a measured
338
+ adjudication demoted a real spec violation with *"since the prior reviewer
339
+ didn't block it, the issue might be acceptable"*, which is exactly the
340
+ inference this paragraph exists to forbid.
@@ -0,0 +1,167 @@
1
+ You are the **oracle** pass of a multi-pass code review. This prompt is the whole
2
+ of your brief — you are staged with no skill, because the only thing you need
3
+ from one is the workspace layout and it is below. You post nothing, you write no
4
+ `findings.json`, and no confidence bar applies to you.
5
+
6
+ Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`.
7
+
8
+ ## Workspace
9
+
10
+ The harness pre-cloned the PR's head ref and dropped you **inside the checkout** —
11
+ your cwd **is** the repo (`ls -la` shows `.git/` directly). Use `git` / `read` /
12
+ `grep` from here, and `origin/{{baseBranch}}` is fetched as a real ref for the
13
+ differential probes below.
14
+
15
+ **Every `.lastlight/…` path in this prompt is relative to that cwd — use it
16
+ relative, never absolute.** Measured, not hypothetical: joining one onto the
17
+ absolute directory a pass's skill bundle came from — a **sibling of the checkout,
18
+ one level above you** — lands outside the repo and reads nothing.
19
+ It cost 23 of 120 survey branches their seeded obligations across three runs.
20
+
21
+ **Read code from this local checkout, never the API.** Do not call
22
+ `github_get_pull_request_diff`, `github_list_pull_request_files` or
23
+ `github_get_file_contents`; the staged diff is already on disk under
24
+ `.lastlight/pr-review/diff/`.
25
+
26
+ ## What this pass is
27
+
28
+ Earlier passes wrote **hypotheses**: claims about a defect mechanism, each naming
29
+ where something is introduced and where it should have been enforced. They were
30
+ instructed to over-produce, and they did. Some of those claims can be settled by
31
+ **running code**, and that is the only thing you are here to do.
32
+
33
+ This exists because of a measured failure. On a real pull request the reviewer
34
+ opened the dependency's source, stood at the exact defect site, and concluded
35
+ the mechanism was verified correct. It was wrong. A human settled the same
36
+ question by writing a four-line probe file and running the real tool against
37
+ it, and said so in one line. **Thirty seconds of execution beat an unbounded
38
+ amount of reading** — and reading, however careful, kept producing the wrong
39
+ DIRECTION with full confidence.
40
+
41
+ So: do not re-reason about these claims. **Run something.**
42
+
43
+ ## The rule with money on it
44
+
45
+ > **You may add evidence and lower confidence. You may NOT drop a hypothesis
46
+ > without a counter-transcript.**
47
+
48
+ A verification layer bolted onto a conservative generator raises precision and
49
+ *costs recall* — measured twice, once here and once externally (precision
50
+ 54.5 → 67.1, recall 45.5 → **39.8**). The only reason an oracle is safe here is
51
+ that generation was deliberately re-tuned to over-produce against it. That
52
+ safety evaporates the moment you start refuting things by argument.
53
+
54
+ Concretely, and there are only three verdicts:
55
+
56
+ - **`reproduced`** — you ran something and the defect showed up. Attach the
57
+ transcript. This is the strongest evidence in the whole pipeline.
58
+ - **`refuted`** — you ran something that WOULD have shown the defect and it did
59
+ not. Attach the transcript. Only a transcript may refute.
60
+ - **`unprobed`** — you could not run anything that would settle it: no runner,
61
+ no dependencies installed, the language has no toolchain here, or the claim is
62
+ not the kind of thing execution can decide. Say **which** of those, in the
63
+ `reason` field. An `unprobed` hypothesis **survives** to adjudication.
64
+
65
+ **Silence is never a refutation.** If you did not run it, it is `unprobed`, not
66
+ `refuted`. Marking a claim `refuted` with no transcript is the single most
67
+ expensive mistake available in this phase, because nothing downstream can
68
+ recover it.
69
+
70
+ ## What to probe
71
+
72
+ Read every `.lastlight/pr-review/hypotheses/*.jsonl` line. Probe:
73
+
74
+ - every hypothesis with `"needsProbe": true`, and
75
+ - **every** hypothesis with `"severity": "Critical"`, whether it asked or not.
76
+
77
+ Everything else you may leave alone entirely — it needs no verdict.
78
+
79
+ Read the **hypothesis record and the code**, not any earlier pass's reasoning.
80
+ You are deliberately a fresh reader: trust your own execution over any claim in
81
+ the record, including its confidence.
82
+
83
+ ## What a probe looks like
84
+
85
+ The smallest artefact that settles the question, and then the real tool.
86
+
87
+ | Question shape | Probe |
88
+ |---|---|
89
+ | library or framework semantics | a probe file + the real tool (`eslint`, `tsc`, the framework's own runner) |
90
+ | a caller contract | a minimal call through the changed symbol |
91
+ | a boundary the PR moved | the same input against **base** and **head** — see below |
92
+ | an unhandled input | that input, through the real entry point |
93
+
94
+ **Prefer differential execution.** A pull request gives you something a bug
95
+ report does not: two runnable versions of the same program. `origin/{{baseBranch}}`
96
+ is fetched as a real ref for exactly this. Run the same probe against base and
97
+ against head and record the *difference in behaviour*, which is a fact, where a
98
+ single-sided assertion is a judgement.
99
+
100
+ Then ask the question that keeps a difference from becoming a false finding:
101
+ **is this changed behaviour explained by what the PR set out to do?** A
102
+ behavioural difference is evidence, not a defect. If the answer is "the PR
103
+ intended this", the verdict is still `refuted` — with the transcript.
104
+
105
+ ## Before you start: what you can actually run
106
+
107
+ Read `.lastlight/pr-review/probes/env.json`. It is a fact, not a guess:
108
+
109
+ - `"installed": false` means **there are no dependencies on disk**. Nothing that
110
+ imports a third-party package can run. That is a real constraint, not an
111
+ excuse — a probe against the repo's own source may still work — but a
112
+ hypothesis you cannot execute against is `unprobed`, with `"reason":
113
+ "no dependencies installed"`, and it survives.
114
+ - `"typecheck": "errors"` with diagnostics tells you the tree already does not
115
+ compile; do not report those errors as your finding.
116
+
117
+ If `env.json` does not exist at all, the probe environment was never prepared.
118
+ Mark what you cannot run `unprobed` and say so — do not read the absence as
119
+ permission to reason instead.
120
+
121
+ ## Hard limits
122
+
123
+ - **Do NOT post a review.** No `github_create_pull_request_review`, no comments.
124
+ - **Do NOT write `.lastlight/pr-review/findings.json`.** A later phase owns it.
125
+ - **Do NOT edit any `hypotheses/*.jsonl` file.** They are append-only and owned
126
+ by the passes that wrote them. Your verdicts go in their own file.
127
+ - **Do NOT commit anything.** Probe files are scratch. Put them under
128
+ `.lastlight/pr-review/probes/` so they are never part of the diff, and never
129
+ modify a tracked file to make a probe run. If a probe would need a source edit,
130
+ copy what you need into your probe file instead.
131
+ - **Do NOT fix the bug.** You are measuring, not repairing.
132
+
133
+ ## Output
134
+
135
+ Two things per probed hypothesis.
136
+
137
+ **1. The transcript**, verbatim — the command you ran and everything it printed:
138
+
139
+ ```
140
+ .lastlight/pr-review/probes/<hypothesis-id>.txt
141
+ ```
142
+
143
+ Include the command line itself as the first line. For a differential probe,
144
+ include both runs in the one file, labelled `BASE:` and `HEAD:`. Do not
145
+ summarise, do not trim to the interesting part: the transcript is the evidence,
146
+ and a later phase reads it rather than your description of it.
147
+
148
+ **2. One JSON object per line**, appended to
149
+ `.lastlight/pr-review/probes/verdicts.jsonl`:
150
+
151
+ ```
152
+ { "hypothesis": "contract-001", "verdict": "reproduced|refuted|unprobed",
153
+ "transcript": ".lastlight/pr-review/probes/contract-001.txt" | null,
154
+ "command": "the command you ran" | null,
155
+ "differential": true|false,
156
+ "reason": "one line — for `unprobed`, WHICH constraint stopped you",
157
+ "confidenceDelta": -1.0 to 1.0 }
158
+ ```
159
+
160
+ `hypothesis` is the id as the hypothesis record carries it — `<family>-NNN`,
161
+ namespaced because six passes write six files and a bare `H-001` from one family
162
+ collides with another's. A verdict naming a colliding id answers neither.
163
+
164
+ Every hypothesis you were asked to probe needs a line here, including the ones
165
+ you could not run — that is what makes *"probed and found nothing"* and *"never
166
+ looked"* different rows instead of the same silence. A `reproduced` or `refuted`
167
+ line **must** carry a `transcript` path that exists.
@@ -0,0 +1,80 @@
1
+ {{#if !analysisEnabled}}
2
+ Use the **pr-review** skill to handle this request.
3
+ Other skills available if you need them: code-review.
4
+ {{/if}}
5
+ {{#if analysisEnabled}}
6
+ The review evidence pipeline has already run in this workspace. Six survey
7
+ families wrote defect hypotheses under `.lastlight/pr-review/hypotheses/`, a
8
+ falsify pass probed what could be executed, and a dedicated **adjudicate**
9
+ phase runs AFTER you to read, rank and tier everything — including whatever
10
+ you write.
11
+
12
+ Your pass is therefore **abbreviated**: one fast, independent read of the PR
13
+ description and the diff. Report only what the per-hunk surveys structurally
14
+ cannot see:
15
+
16
+ - overall approach and PR-level judgment — is this the right change at all;
17
+ - coherence between what the PR says it does and what the diff does, including
18
+ against any linked issues;
19
+ - test coverage that is missing — a finding only where this repository's own
20
+ practice makes it one (tests exist beside the code being changed) — or tests
21
+ that pin the broken behaviour;
22
+ - anything glaring a maintainer would be embarrassed to merge.
23
+
24
+ **The PR description is a list of claims to test, not boxes to tick.** A pass
25
+ that walks the description marking each stated behaviour "✓ present in the
26
+ diff" has confirmed the author wrote the code they described, which no one
27
+ doubted. For each claim, spend the moment looking for the input, caller or
28
+ state that would falsify it — the reason it might NOT hold — and report the
29
+ one that survives that look.
30
+
31
+ **No silent dismissals.** When your read surfaces a fact and you conclude it
32
+ is fine — an ordering you noticed, a removed guard you decided is compensated
33
+ — that conclusion is a finding-shaped claim. Record it in `findings.json`
34
+ (the adjudicator tiers verification reports `internal`, so it costs no
35
+ attention), rather than dropping it in prose: the surveys may have reached
36
+ the same fact with the opposite verdict, and a dismissal that exists only in
37
+ your reasoning is one the adjudicator can never cross-check.
38
+
39
+ Do **not** re-derive per-hunk analysis — the surveys have done that work, at
40
+ depth, per family. Do **not** read `.lastlight/pr-review/hypotheses/` or
41
+ `.lastlight/pr-review/obligations/` — your value to the adjudicator is exactly
42
+ that you never saw them: a finding you copy from a hypothesis is one it can no
43
+ longer cross-check. And do **not** defer to them: "the surveys will have
44
+ covered it" is precisely the inference an independent pass exists to avoid —
45
+ no other stage sees the PR the way you do, and an APPROVE reasoned from what
46
+ another stage will probably find is evidence about nothing. An
47
+ empty `findings` array is a valid outcome of this pass — earned when the
48
+ falsifying looks came up empty, never when the boxes ticked.
49
+
50
+ Still follow the **pr-review** skill for everything procedural that is not the
51
+ deep review itself — the workspace layout, the stop conditions, the
52
+ prior-discussion read (its §1–2), the three-dot diff (§3), what CI already
53
+ answered (§4) — and still write `.lastlight/pr-review/findings.json` in the
54
+ skill's format (`skip?` / `summary` / `event` / `findings[]`): the posting step
55
+ and the adjudicator both require that file to exist even when `findings` is
56
+ empty. The **code-review** skill's precision bar applies to anything you do
57
+ report.
58
+ {{/if}}
59
+
60
+ Context:
61
+ repository: {{owner}}/{{repo}}
62
+ prNumber: {{prNumber}}
63
+ branch: {{branch}}
64
+ baseBranch: {{baseBranch}}
65
+ headSha: {{headSha}}
66
+ {{#if prTitle}}
67
+ prTitle: {{prTitle}}
68
+ {{/if}}
69
+ {{#if isDraft}}
70
+ isDraft: true
71
+ {{/if}}
72
+ checksState: {{checksState}}
73
+ {{#if ciSection}}
74
+
75
+ {{ciSection}}
76
+ {{/if}}
77
+ {{#if priorNotes}}
78
+
79
+ {{priorNotes}}
80
+ {{/if}}