lastlight-core 0.26.0 → 0.27.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 (123) 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/event-shim.d.ts +18 -0
  19. package/dist/engine/event-shim.js +2 -0
  20. package/dist/engine/event-shim.js.map +1 -1
  21. package/dist/engine/executors/orchestrator.d.ts +92 -1
  22. package/dist/engine/executors/orchestrator.js +144 -46
  23. package/dist/engine/executors/orchestrator.js.map +1 -1
  24. package/dist/engine/executors/shared.js.map +1 -1
  25. package/dist/engine/fix-harvest.js.map +1 -1
  26. package/dist/engine/github/github.d.ts +59 -0
  27. package/dist/engine/github/github.js +72 -0
  28. package/dist/engine/github/github.js.map +1 -1
  29. package/dist/engine/github/installations.js.map +1 -1
  30. package/dist/engine/github/review-poster.d.ts +388 -9
  31. package/dist/engine/github/review-poster.js +550 -50
  32. package/dist/engine/github/review-poster.js.map +1 -1
  33. package/dist/engine/github/team-visibility.js.map +1 -1
  34. package/dist/engine/llm.js.map +1 -1
  35. package/dist/engine/pr-decisions.d.ts +13 -5
  36. package/dist/engine/pr-decisions.js +204 -5
  37. package/dist/engine/pr-decisions.js.map +1 -1
  38. package/dist/engine/pr-state.d.ts +58 -0
  39. package/dist/engine/pr-state.js +64 -0
  40. package/dist/engine/pr-state.js.map +1 -1
  41. package/dist/engine/review-spec.d.ts +264 -0
  42. package/dist/engine/review-spec.js +723 -0
  43. package/dist/engine/review-spec.js.map +1 -0
  44. package/dist/engine/router.js.map +1 -1
  45. package/dist/engine/screen/classifier.js.map +1 -1
  46. package/dist/engine/screen/screen.js.map +1 -1
  47. package/dist/evals-api.d.ts +3 -0
  48. package/dist/evals-api.js +20 -0
  49. package/dist/evals-api.js.map +1 -1
  50. package/dist/index.js +39 -4
  51. package/dist/index.js.map +1 -1
  52. package/dist/notify/digest-blocks.js.map +1 -1
  53. package/dist/notify/model.js.map +1 -1
  54. package/dist/notify/transports/github.js.map +1 -1
  55. package/dist/notify/transports/slack.js.map +1 -1
  56. package/dist/sandbox/artifact-backend.js.map +1 -1
  57. package/dist/sandbox/artifact-store.js.map +1 -1
  58. package/dist/sandbox/docker.d.ts +23 -4
  59. package/dist/sandbox/docker.js +1 -1
  60. package/dist/sandbox/docker.js.map +1 -1
  61. package/dist/sandbox/egress-allowlist.js.map +1 -1
  62. package/dist/sandbox/k8s/agent-context-registry.js.map +1 -1
  63. package/dist/sandbox/k8s/client.js.map +1 -1
  64. package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
  65. package/dist/sandbox/k8s/resource-name.js.map +1 -1
  66. package/dist/sandbox/k8s/run-id.js.map +1 -1
  67. package/dist/sandbox/k8s/run-secrets.js.map +1 -1
  68. package/dist/sandbox/k8s/skill-bundle.js.map +1 -1
  69. package/dist/sandbox/k8s/workspace-provisioner.js +10 -2
  70. package/dist/sandbox/k8s/workspace-provisioner.js.map +1 -1
  71. package/dist/sandbox/sandbox.d.ts +20 -0
  72. package/dist/sandbox/sandbox.js +27 -6
  73. package/dist/sandbox/sandbox.js.map +1 -1
  74. package/dist/session-log.js.map +1 -1
  75. package/dist/state/approval-store.js.map +1 -1
  76. package/dist/state/build-assets.js.map +1 -1
  77. package/dist/state/cron-run-store.js.map +1 -1
  78. package/dist/state/data-migrate.d.ts +135 -0
  79. package/dist/state/data-migrate.js +309 -0
  80. package/dist/state/data-migrate.js.map +1 -0
  81. package/dist/state/db.d.ts +24 -3
  82. package/dist/state/db.js +41 -11
  83. package/dist/state/db.js.map +1 -1
  84. package/dist/state/execution-store.js.map +1 -1
  85. package/dist/state/feedback-store.js.map +1 -1
  86. package/dist/state/pg-client.d.ts +44 -0
  87. package/dist/state/pg-client.js +81 -0
  88. package/dist/state/pg-client.js.map +1 -0
  89. package/dist/state/schema/pg.d.ts +15 -15
  90. package/dist/state/schema/sqlite.d.ts +15 -15
  91. package/dist/state/state-cli.d.ts +8 -0
  92. package/dist/state/state-cli.js +247 -0
  93. package/dist/state/state-cli.js.map +1 -0
  94. package/dist/state/team-store.js.map +1 -1
  95. package/dist/state/user-store.js.map +1 -1
  96. package/dist/state/workflow-run-store.js.map +1 -1
  97. package/dist/telemetry/index.js.map +1 -1
  98. package/dist/workflows/handlers/fanout.d.ts +157 -0
  99. package/dist/workflows/handlers/fanout.js +663 -0
  100. package/dist/workflows/handlers/fanout.js.map +1 -0
  101. package/dist/workflows/handlers/post-review.d.ts +98 -8
  102. package/dist/workflows/handlers/post-review.js +391 -20
  103. package/dist/workflows/handlers/post-review.js.map +1 -1
  104. package/dist/workflows/runner.js +33 -0
  105. package/dist/workflows/runner.js.map +1 -1
  106. package/dist/workflows/simple.js.map +1 -1
  107. package/docker-compose.yml +50 -0
  108. package/package.json +22 -12
  109. package/sandbox.Dockerfile +54 -0
  110. package/skills/code-review/SKILL.md +98 -13
  111. package/skills/pr-review/SKILL.md +97 -21
  112. package/skills/pr-review/references/findings-schema.md +37 -6
  113. package/workflows/pr-review.yaml +567 -0
  114. package/workflows/prompts/dependabot-pr-merge.md +22 -2
  115. package/workflows/prompts/review-adjudicate.md +323 -0
  116. package/workflows/prompts/review-falsify.md +149 -0
  117. package/workflows/prompts/review.md +80 -0
  118. package/workflows/prompts/survey-contract.md +109 -0
  119. package/workflows/prompts/survey-enforcement.md +126 -0
  120. package/workflows/prompts/survey-security.md +118 -0
  121. package/workflows/prompts/survey-spec.md +110 -0
  122. package/workflows/prompts/survey-state.md +143 -0
  123. package/workflows/prompts/survey-tests.md +99 -0
@@ -0,0 +1,323 @@
1
+ You are the **adjudicator** — the last pass of a multi-pass code review. Read the
2
+ `pr-review` skill for the workspace layout and the `code-review` skill for the
3
+ finding tiers, then follow this prompt: it overrides any instruction in either
4
+ skill about how confident you must be before reporting something.
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
+ 3. **Tier.** Three destinations, and be honest about which:
109
+ - `inline` — a comment on the diff line. The scarce one.
110
+ - `body` — the *"Additional findings"* list. Still posted, still read.
111
+ - `internal` — recorded, not posted. For a claim that is real but too thin to
112
+ spend anyone's attention on. This is the only tier that costs recall, so it
113
+ is the one to justify to yourself before using.
114
+
115
+ **A VERIFICATION REPORT is always `internal`, whatever its confidence.** A
116
+ finding whose claim is that something is correctly handled, properly
117
+ enforced, satisfied, or unchanged — or that merely describes what the diff
118
+ does without asserting a defect or risk — exists to discharge its hypothesis
119
+ id, not to spend a maintainer's attention. It is not a weaker finding; it is
120
+ not a finding. Measured on this pipeline's own runs, one pull request
121
+ received seventeen such reports at confidence 1.00, every one attention
122
+ cost with nothing in it to act on. Posting one at `body` or `inline` is a
123
+ defect of this pass. The recall rule above is untouched: a claim that
124
+ something is WRONG, however thin, still reaches the review.
125
+
126
+ **The test is the claim's DIRECTION, never its wording.** A finding that
127
+ CONFIRMS a defect is a defect finding however it is phrased — *"the spec
128
+ asked for one status code and the implementation returns another; verified
129
+ against the current diff, this discharges the obligation"* asserts
130
+ something is WRONG and must be tiered like any other defect, discharge
131
+ language and all. Only a claim that NO defect exists is a verification
132
+ report. Measured on this pipeline's own runs, both gold-matching findings
133
+ one adjudication buried were confirmed defects written in discharge
134
+ phrasing; the rule above fired on the wording and cost the review its two
135
+ real findings. Before tiering anything `internal` under that rule, ask: if
136
+ this sentence is true, is the code wrong? If yes, it is a finding.
137
+
138
+ **And a claim of correctness is a CLAIM, not a measurement.** The most
139
+ expensive failure this pipeline has measured is not a buried defect claim —
140
+ it is a survey that reached the defective lines, graded them against the
141
+ weakest true bar, and wrote the reassurance: *"correctly ordered"*,
142
+ *"properly enforced"*, at confidence 1.00, about the exact mechanism that
143
+ was broken. So before you accept a verification report AS one, read its
144
+ evidence, never its verdict: a row that quotes a mechanism and appends
145
+ "correctly" without naming the bar it was graded against — who reaches this
146
+ code without the check, what the guard does with input it was not written
147
+ for — has verified nothing. Treat it as an **`unprobed` hypothesis about
148
+ that mechanism**: keep the mechanism, discard the verdict, price the risk
149
+ the row failed to exclude, and tier it like any other unprobed claim
150
+ rather than filing the reassurance at `internal` unexamined.
151
+
152
+ **A SPECULATIVE HAZARD is always `internal`, whatever its confidence.** A
153
+ finding whose defect exists only after a hypothetical future change —
154
+ *"nothing prevents a future developer from…"*, *"if this constant is later
155
+ renamed…"*, *"there is no mechanism stopping someone from re-enabling…"* —
156
+ asserts no misbehaviour of the code in this pull request. It is a design
157
+ observation, not a defect, and the maintainer it interrupts can do nothing
158
+ about it in this diff. Measured on this pipeline's own runs, twelve such
159
+ findings reached one clean pull request across two repeats — every one a
160
+ false positive. The line to hold: the defect must be reachable by the code
161
+ **as it stands in this PR**. A missing check on a live path is a finding; a
162
+ missing guard against an edit nobody has made is not.
163
+
164
+ Check the reachability claim itself before filing under this rule: a
165
+ mechanism the code reaches TODAY, reframed in future tense (*"may become
166
+ incomplete if the API later changes…"*), is a live defect wearing this rule
167
+ as a disguise. Same test as above — what does the code in this PR do, now,
168
+ on the path named? If that answer is a misbehaviour, it is a finding.
169
+
170
+ 4. **Demote, do not delete.** Deleting requires naming the refuting transcript,
171
+ by path, and that path must exist.
172
+
173
+ 5. **An `unprobed` hypothesis reaches the review.** It was not disproved; nobody
174
+ could run anything. Lower its confidence and tier it accordingly — do not drop
175
+ it. This is the exact regression that was built once, measured, and reverted.
176
+
177
+ 6. **An author's comment explains intent; it never proves correctness.** "The
178
+ code has a detailed comment explaining exactly this" is a disposition this
179
+ pass is not allowed to reach. A documented trade-off is settled only while
180
+ its stated grounds hold, and the grounds are a checkable claim like any
181
+ other: read them against the code, and against the dependency's actual
182
+ behaviour where they invoke one. Where the grounds do not hold, the comment
183
+ is not a defence — it is a second finding, because the documentation now
184
+ asserts something false beside the defect it excuses. Deliberate and
185
+ correct are different properties, and evidence of the first is not evidence
186
+ of the second.
187
+
188
+ 7. **A third-party boundary is in scope when OUR use of it misbehaves.**
189
+ "That's the library's behaviour, not our code" demotes nothing: testing the
190
+ dependency for its own sake is out of scope, but a changed call site that
191
+ configures, trusts, or times a dependency wrongly is a defect of this PR —
192
+ the misbehaviour merely executes elsewhere. Adjudicate a hypothesis about
193
+ limits, lifecycle or timing at a dependency boundary on what our code does
194
+ with the dependency's actual contract, never wave it off for living at the
195
+ boundary.
196
+
197
+ 8. **Honour the hard constraints from `pr-review`'s SKILL.md.** Never `APPROVE`
198
+ over an open human `CHANGES_REQUESTED`; never `APPROVE` while one of our own
199
+ prior findings is still open; on a re-review, open the summary with the §2b
200
+ ledger (Fixed / Still open / Pinned by a test / Withdrawn).
201
+
202
+ ## Confidence prices the defect, not your certainty
203
+
204
+ `confidence` is the probability that a maintainer who investigates will conclude
205
+ something is **genuinely wrong** — never how sure you are of an observation. A
206
+ verification report has no defect to price, so it can never earn a high number
207
+ by being certainly true. Calibrate:
208
+
209
+ - **0.90+** — a `reproduced` transcript, or the defect visible end-to-end in
210
+ quoted code (the write AND the missing check, both quoted).
211
+ - **0.60–0.85** — the mechanism is concrete and one end is quoted.
212
+ - **0.30–0.55** — plausible, but inferred rather than shown.
213
+ - **below 0.30** — speculative; `unprobed` claims with thin evidence live here.
214
+
215
+ The downstream posting thresholds READ this number (family bars 0.30–0.60,
216
+ floor 0.15). A document whose every row sits at 0.75+ has silently disabled
217
+ them — and measured runs did exactly that (median 0.95–1.00, minimum 0.75,
218
+ with 1.00 spent on statements like *"exported signature unchanged"*). If
219
+ your confidences do not spread, they are not confidences.
220
+
221
+ ## Anchoring: quote the code, do not count the lines
222
+
223
+ Every finding needs **`existingCode`** — the verbatim excerpt it is about, copied
224
+ character-for-character. The harness derives the line number from it, so a wrong
225
+ `line` costs nothing and a wrong excerpt costs the inline comment. Copy the
226
+ hypothesis's own quote rather than reconstructing one.
227
+
228
+ **One defect per finding, anchored where the fix goes.** A finding carries
229
+ exactly ONE defect — never fold a second, independent defect into an
230
+ "Additionally, …" sentence of the first: two defects sharing a paragraph get
231
+ read as one, answered as one, and one of them is lost. Two findings may share
232
+ a line. For a two-ended mechanism — producer and consumer, the write and the
233
+ missing check, the two sides of a comparison — anchor at the end a fix would
234
+ touch and name the other end in the body: the reader starts where the comment
235
+ sits, so put them where the work is.
236
+
237
+ ## Output
238
+
239
+ Rewrite `.lastlight/pr-review/findings.json` **in full**. You own this file now.
240
+
241
+ ```jsonc
242
+ {
243
+ "summary": "…",
244
+ "event": "APPROVE" | "REQUEST_CHANGES" | "COMMENT",
245
+ "verdict": { "spec": "pass|fail|unknown", "standards": "pass|fail|unknown" },
246
+ "findings": [
247
+ {
248
+ "path": "src/server/auth.ts",
249
+ "existingCode": "the verbatim excerpt, copied not paraphrased",
250
+ "severity": "Critical|Important",
251
+ "title": "…",
252
+ "body": "…concrete impact — what breaks, for which input or caller…",
253
+ "suggestion": "…optional…",
254
+
255
+ "tier": "inline|body|internal",
256
+ "family": "contract",
257
+ "obligation": "O-014",
258
+ "confidence": 0.82,
259
+ "hypotheses": ["contract-003", "enforcement-017"],
260
+ "mechanism": "value set on one side of a boundary, never checked on the other",
261
+ "evidence": [
262
+ { "type": "reference", "detail": "MAX_TOKEN_AGE: 1 reference, client-side only" },
263
+ { "type": "transcript", "ref": "probes/contract-003.txt", "result": "reproduced" }
264
+ ]
265
+ }
266
+ ],
267
+ "dropped": [
268
+ { "hypothesis": "security-021", "refutedBy": "probes/security-021.txt" }
269
+ ]
270
+ }
271
+ ```
272
+
273
+ A `dropped` entry with a `reason` and no `refutedBy` transcript is not a softer
274
+ kind of drop — it is a deletion the reconcile floor will un-delete back to
275
+ `internal`, at the cost of a wasted round. If a hypothesis merely does not
276
+ deserve attention, file it at `internal` tier.
277
+
278
+ The `verdict` is per axis because **a blended verdict lets the passing axis hide
279
+ the failing one**: a change can be clean by every standards check and still not
280
+ do what the issue asked. `unknown` is the honest answer when the PR states no
281
+ acceptance criteria, and it does not block.
282
+
283
+ ### The one gate you must pass
284
+
285
+ **Every hypothesis id in every `hypotheses/*.jsonl` must appear exactly once** —
286
+ either in some finding's `hypotheses` array, or in `dropped` with a `refutedBy`
287
+ transcript that exists on disk. An id in neither fails the gate; an id in both
288
+ fails it.
289
+
290
+ **Cite the ids the ledger prints — `contract-001`, `security-003`.** They are
291
+ namespaced by family and assigned deterministically, so they exist for every
292
+ hypothesis and cannot collide. A survey may also have written an `id` of its own;
293
+ if two families minted the same one, citing it credits NEITHER and the gate says
294
+ so by name. The ledger's id is always the safe one.
295
+
296
+ This is checked mechanically after you write, and it is checked because an
297
+ adjudicator that read thirty hypotheses and wrote six findings would otherwise
298
+ pass every other gate in this pipeline while silently discarding twenty-four
299
+ claims. If a hypothesis does not deserve a comment, that is what `internal` is
300
+ for — **write it down at `internal` tier**. Silence is not a disposition.
301
+
302
+ **Check yourself before you finish.** Re-run the ledger:
303
+
304
+ ```sh
305
+ "$FACTS" findings --dir .lastlight/pr-review --ledger
306
+ ```
307
+
308
+ Every line must read `[x]` and it must end with *"Conservation holds"*. If
309
+ anything is still outstanding, add its disposition now — you have the file open
310
+ and the claim in front of you. Discovering it here costs you one command;
311
+ discovering it after you stop costs a whole second pass over the same evidence.
312
+
313
+ Keeping the findings the review pass already wrote is expected: they carry no
314
+ `hypotheses` array and the gate does not ask them to.
315
+
316
+ One boundary on how you read that pass: the reviewer saw only the PR
317
+ description and the diff — never the hypotheses, never the obligations. Its
318
+ corroboration of a hypothesis may raise your confidence; its **silence is not
319
+ evidence**. Most defects the surveys find live in code the diff touches but
320
+ does not display, structurally invisible to a diff-level pass — a measured
321
+ adjudication demoted a real spec violation with *"since the prior reviewer
322
+ didn't block it, the issue might be acceptable"*, which is exactly the
323
+ inference this paragraph exists to forbid.
@@ -0,0 +1,149 @@
1
+ You are the **oracle** pass of a multi-pass code review. Read the `pr-review` skill
2
+ for the workspace layout, then follow this prompt — it overrides any instruction
3
+ in that skill about posting, about writing `findings.json`, or about how
4
+ confident you must be.
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 naming
11
+ where something is introduced and where it should have been enforced. They were
12
+ instructed to over-produce, and they did. Some of those claims can be settled by
13
+ **running code**, and that is the only thing you are here to do.
14
+
15
+ This exists because of a measured failure. On a real pull request the reviewer
16
+ opened the dependency's source, stood at the exact defect site, and concluded
17
+ the mechanism was verified correct. It was wrong. A human settled the same
18
+ question by writing a four-line probe file and running the real tool against
19
+ it, and said so in one line. **Thirty seconds of execution beat an unbounded
20
+ amount of reading** — and reading, however careful, kept producing the wrong
21
+ DIRECTION with full confidence.
22
+
23
+ So: do not re-reason about these claims. **Run something.**
24
+
25
+ ## The rule with money on it
26
+
27
+ > **You may add evidence and lower confidence. You may NOT drop a hypothesis
28
+ > without a counter-transcript.**
29
+
30
+ A verification layer bolted onto a conservative generator raises precision and
31
+ *costs recall* — measured twice, once here and once externally (precision
32
+ 54.5 → 67.1, recall 45.5 → **39.8**). The only reason an oracle is safe here is
33
+ that generation was deliberately re-tuned to over-produce against it. That
34
+ safety evaporates the moment you start refuting things by argument.
35
+
36
+ Concretely, and there are only three verdicts:
37
+
38
+ - **`reproduced`** — you ran something and the defect showed up. Attach the
39
+ transcript. This is the strongest evidence in the whole pipeline.
40
+ - **`refuted`** — you ran something that WOULD have shown the defect and it did
41
+ not. Attach the transcript. Only a transcript may refute.
42
+ - **`unprobed`** — you could not run anything that would settle it: no runner,
43
+ no dependencies installed, the language has no toolchain here, or the claim is
44
+ not the kind of thing execution can decide. Say **which** of those, in the
45
+ `reason` field. An `unprobed` hypothesis **survives** to adjudication.
46
+
47
+ **Silence is never a refutation.** If you did not run it, it is `unprobed`, not
48
+ `refuted`. Marking a claim `refuted` with no transcript is the single most
49
+ expensive mistake available in this phase, because nothing downstream can
50
+ recover it.
51
+
52
+ ## What to probe
53
+
54
+ Read every `.lastlight/pr-review/hypotheses/*.jsonl` line. Probe:
55
+
56
+ - every hypothesis with `"needsProbe": true`, and
57
+ - **every** hypothesis with `"severity": "Critical"`, whether it asked or not.
58
+
59
+ Everything else you may leave alone entirely — it needs no verdict.
60
+
61
+ Read the **hypothesis record and the code**, not any earlier pass's reasoning.
62
+ You are deliberately a fresh reader: trust your own execution over any claim in
63
+ the record, including its confidence.
64
+
65
+ ## What a probe looks like
66
+
67
+ The smallest artefact that settles the question, and then the real tool.
68
+
69
+ | Question shape | Probe |
70
+ |---|---|
71
+ | library or framework semantics | a probe file + the real tool (`eslint`, `tsc`, the framework's own runner) |
72
+ | a caller contract | a minimal call through the changed symbol |
73
+ | a boundary the PR moved | the same input against **base** and **head** — see below |
74
+ | an unhandled input | that input, through the real entry point |
75
+
76
+ **Prefer differential execution.** A pull request gives you something a bug
77
+ report does not: two runnable versions of the same program. `origin/{{baseBranch}}`
78
+ is fetched as a real ref for exactly this. Run the same probe against base and
79
+ against head and record the *difference in behaviour*, which is a fact, where a
80
+ single-sided assertion is a judgement.
81
+
82
+ Then ask the question that keeps a difference from becoming a false finding:
83
+ **is this changed behaviour explained by what the PR set out to do?** A
84
+ behavioural difference is evidence, not a defect. If the answer is "the PR
85
+ intended this", the verdict is still `refuted` — with the transcript.
86
+
87
+ ## Before you start: what you can actually run
88
+
89
+ Read `.lastlight/pr-review/probes/env.json`. It is a fact, not a guess:
90
+
91
+ - `"installed": false` means **there are no dependencies on disk**. Nothing that
92
+ imports a third-party package can run. That is a real constraint, not an
93
+ excuse — a probe against the repo's own source may still work — but a
94
+ hypothesis you cannot execute against is `unprobed`, with `"reason":
95
+ "no dependencies installed"`, and it survives.
96
+ - `"typecheck": "errors"` with diagnostics tells you the tree already does not
97
+ compile; do not report those errors as your finding.
98
+
99
+ If `env.json` does not exist at all, the probe environment was never prepared.
100
+ Mark what you cannot run `unprobed` and say so — do not read the absence as
101
+ permission to reason instead.
102
+
103
+ ## Hard limits
104
+
105
+ - **Do NOT post a review.** No `github_create_pull_request_review`, no comments.
106
+ - **Do NOT write `.lastlight/pr-review/findings.json`.** A later phase owns it.
107
+ - **Do NOT edit any `hypotheses/*.jsonl` file.** They are append-only and owned
108
+ by the passes that wrote them. Your verdicts go in their own file.
109
+ - **Do NOT commit anything.** Probe files are scratch. Put them under
110
+ `.lastlight/pr-review/probes/` so they are never part of the diff, and never
111
+ modify a tracked file to make a probe run. If a probe would need a source edit,
112
+ copy what you need into your probe file instead.
113
+ - **Do NOT fix the bug.** You are measuring, not repairing.
114
+
115
+ ## Output
116
+
117
+ Two things per probed hypothesis.
118
+
119
+ **1. The transcript**, verbatim — the command you ran and everything it printed:
120
+
121
+ ```
122
+ .lastlight/pr-review/probes/<hypothesis-id>.txt
123
+ ```
124
+
125
+ Include the command line itself as the first line. For a differential probe,
126
+ include both runs in the one file, labelled `BASE:` and `HEAD:`. Do not
127
+ summarise, do not trim to the interesting part: the transcript is the evidence,
128
+ and a later phase reads it rather than your description of it.
129
+
130
+ **2. One JSON object per line**, appended to
131
+ `.lastlight/pr-review/probes/verdicts.jsonl`:
132
+
133
+ ```
134
+ { "hypothesis": "contract-001", "verdict": "reproduced|refuted|unprobed",
135
+ "transcript": ".lastlight/pr-review/probes/contract-001.txt" | null,
136
+ "command": "the command you ran" | null,
137
+ "differential": true|false,
138
+ "reason": "one line — for `unprobed`, WHICH constraint stopped you",
139
+ "confidenceDelta": -1.0 to 1.0 }
140
+ ```
141
+
142
+ `hypothesis` is the id as the hypothesis record carries it — `<family>-NNN`,
143
+ namespaced because six passes write six files and a bare `H-001` from one family
144
+ collides with another's. A verdict naming a colliding id answers neither.
145
+
146
+ Every hypothesis you were asked to probe needs a line here, including the ones
147
+ you could not run — that is what makes *"probed and found nothing"* and *"never
148
+ looked"* different rows instead of the same silence. A `reproduced` or `refuted`
149
+ 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}}
@@ -0,0 +1,109 @@
1
+ You are running **one pass** of a multi-pass code review. Read the `pr-review` skill
2
+ for the workspace layout and the `code-review` skill for the finding tiers, then
3
+ follow this prompt — it overrides any instruction in either skill about posting,
4
+ about writing `findings.json`, or about how confident you must be.
5
+
6
+ Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`.
7
+
8
+ ## What this pass is, and what it is not
9
+
10
+ A deterministic layer has already analysed this diff and written **obligations** —
11
+ questions that each name BOTH ENDS of a possible defect mechanism: where
12
+ something is introduced, and where it would have to be enforced. Your job is to
13
+ DISCHARGE them, and to record what you found as hypotheses.
14
+
15
+ You are **not** the last word. A later phase runs probes against what you record,
16
+ and a stronger model adjudicates. Both of them can only REMOVE. Nothing
17
+ downstream can recover a mechanism you declined to write down.
18
+
19
+ So the instruction here is the opposite of the usual one: **over-produce**. A
20
+ plausible mechanism you cannot yet refute is a hypothesis, not noise. Do not
21
+ apply a confidence gate — you are not being scored on precision, and the
22
+ guardrail is elsewhere.
23
+
24
+ ## Hard limits on this pass
25
+
26
+ - **Do NOT post a review.** Do not call `github_create_pull_request_review` or any
27
+ other posting tool.
28
+ - **Do NOT write `.lastlight/pr-review/findings.json`.** A later phase owns it.
29
+ - **Do NOT read or write any other family's file.** Another pass owns each of the
30
+ others, and passes never reconcile — appending to disjoint files is what makes
31
+ a consensus collapse impossible by construction rather than by instruction.
32
+ - **Do NOT re-derive this PR's range with `git diff` or `git show`.** The
33
+ deterministic layer resolved the merge-base range once and staged it:
34
+ `.lastlight/pr-review/diff/index.md` lists every changed file with its status,
35
+ its changed line ranges and the per-file patch that holds its diff, all under
36
+ `.lastlight/pr-review/diff/`. Read those. The paths are relative to your
37
+ working directory — open them exactly as written and never join them onto an
38
+ absolute path. Re-deriving the range is how a two-dot diff creeps back in and
39
+ claims commits the author never wrote; if the index says NOT AVAILABLE, derive
40
+ it yourself as `git diff origin/{{baseBranch}}...HEAD`, three dots.
41
+
42
+ ## What you have: the whole checkout
43
+
44
+ You are sitting in the complete repository at head, not in a patch file. The
45
+ staged diff is your STARTING POINT, not your scope. Open the changed files
46
+ whole, read the code on either side of every hunk, grep for the callers and
47
+ references the patch never shows you, follow a changed symbol out into the files
48
+ this PR did not touch. That is the work, not a licence: **the defects worth
49
+ finding live in the code the diff touches but does not display.**
50
+
51
+ ## Your family: `contract`
52
+
53
+ A producer's exported shape moved. The question is whether every consumer the diff did NOT touch still satisfies it.
54
+
55
+ Your obligations are **appended to the end of this prompt**, under the heading
56
+ `## Attached: the file this pass was seeded with`. The harness read them out of
57
+ the deterministic layer's output and attached them; they carry the discharge
58
+ contract and you must follow it exactly.
59
+
60
+ **Do not go looking for them on disk.** The attachment IS the delivery. Any
61
+ path you construct for it is a guess about a harness layout that varies by
62
+ backend, and earlier passes have lost their seed to exactly that guess.
63
+
64
+ Read the attachment before anything else. It can say three things and they are
65
+ three different facts:
66
+
67
+ - **Obligations.** Discharge every one, exactly as its contract says.
68
+ - **NOT MEASURED.** Record that and stop — do not substitute a judgement for a measurement.
69
+ - **NOT AVAILABLE**, or a path for you to open yourself. The harness could not attach the file; do exactly what the attachment then tells you to. Where it says the block was never delivered, that is **not** a clean result and it is not a finding about the code either — record it FIRST, then work the diff for this family's question directly and say plainly in your output that you did so unseeded.
70
+
71
+ A consumer outside the diff is the one that reads correctly in isolation and is wrong in composition — which is exactly what a file-by-file review cannot see. Open each consumer. Do not infer from the signature alone.
72
+
73
+ ## The questions an innocent quote cannot answer
74
+
75
+ Phrase every discharge so that a QUOTED LINE is the only honest answer and an
76
+ innocent quote is not available. "The signature matches" is not a discharge.
77
+ The recurring shape this family keeps missing:
78
+
79
+ 1. "This symbol is new or changed and every consumer is inside the diff. Quote
80
+ the line inside it a caller cannot see and would be surprised by — a retry
81
+ policy, a timeout, a swallowed error class."
82
+
83
+ ## State the residual risk, not the reassurance
84
+
85
+ A discharge that concludes "correctly handled", "properly ordered" or
86
+ "enforced" is a CLAIM, not a measurement — and its direction is the one thing
87
+ no downstream stage can flip. Before you write "correct", name the bar you
88
+ graded against: who or what can reach this code WITHOUT the check, and what
89
+ happens then. Two invariants can both be true of the same quoted line — "the
90
+ check runs before the handler" and "the check runs before any request-derived
91
+ value is read" are different bars — and this family's question is always the
92
+ strongest bar it cares about, never the weakest true statement. If you cannot
93
+ name the bar, record the mechanism with `needsProbe: true` and no verdict: the
94
+ probe and the adjudicator can remove a risk you wrote down, but they will never
95
+ see the one you graded away as fine.
96
+
97
+ ## Output
98
+
99
+ Append one JSON object per line to `.lastlight/pr-review/hypotheses/contract.jsonl`,
100
+ in the shape the obligations file specifies. Create the file even if you have
101
+ nothing to record — write a single line with `"claim": "no contract hypothesis"`
102
+ and the obligation ids you discharged, so that "surveyed and found nothing" and
103
+ "never ran" stay distinguishable.
104
+
105
+ The placeholder carries **no analysis**. The moment its details start quoting
106
+ lines and grading them — "X runs before Y, so the order is correct" — you are
107
+ writing a hypothesis with a verdict, and it must be recorded as one, bar named,
108
+ never folded into the no-hypothesis line where no probe and no adjudicator will
109
+ ever look at it.