lastlight-core 0.34.0 → 0.35.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 (106) hide show
  1. package/config/default.yaml +100 -138
  2. package/dist/admin/routes.js +3 -0
  3. package/dist/admin/routes.js.map +1 -1
  4. package/dist/config/config.d.ts +11 -0
  5. package/dist/config/config.js +93 -30
  6. package/dist/config/config.js.map +1 -1
  7. package/dist/engine/executors/orchestrator.d.ts +13 -0
  8. package/dist/engine/executors/orchestrator.js +22 -2
  9. package/dist/engine/executors/orchestrator.js.map +1 -1
  10. package/dist/engine/github/github.d.ts +42 -0
  11. package/dist/engine/github/github.js +41 -0
  12. package/dist/engine/github/github.js.map +1 -1
  13. package/dist/engine/github/review-poster.d.ts +16 -3
  14. package/dist/engine/github/review-poster.js +3 -3
  15. package/dist/engine/github/review-poster.js.map +1 -1
  16. package/dist/engine/github/review-summary.d.ts +2 -2
  17. package/dist/engine/github/review-summary.js +1 -1
  18. package/dist/engine/github/review-summary.js.map +1 -1
  19. package/dist/engine/pr-decisions.d.ts +7 -0
  20. package/dist/engine/pr-decisions.js +84 -97
  21. package/dist/engine/pr-decisions.js.map +1 -1
  22. package/dist/engine/pr-discussion.d.ts +23 -0
  23. package/dist/engine/pr-discussion.js +55 -0
  24. package/dist/engine/pr-discussion.js.map +1 -0
  25. package/dist/engine/pr-intent.d.ts +32 -0
  26. package/dist/engine/pr-intent.js +55 -0
  27. package/dist/engine/pr-intent.js.map +1 -0
  28. package/dist/engine/pr-state.d.ts +10 -2
  29. package/dist/engine/pr-state.js +14 -2
  30. package/dist/engine/pr-state.js.map +1 -1
  31. package/dist/engine/review-spec.d.ts +2 -87
  32. package/dist/engine/review-spec.js +2 -445
  33. package/dist/engine/review-spec.js.map +1 -1
  34. package/dist/engine/review-triage.d.ts +27 -9
  35. package/dist/engine/review-triage.js +20 -7
  36. package/dist/engine/review-triage.js.map +1 -1
  37. package/dist/evals-api.d.ts +7 -0
  38. package/dist/evals-api.js +21 -0
  39. package/dist/evals-api.js.map +1 -1
  40. package/dist/sandbox/docker.d.ts +8 -0
  41. package/dist/sandbox/docker.js +25 -0
  42. package/dist/sandbox/docker.js.map +1 -1
  43. package/dist/sandbox/k8s/kubernetes-sandbox.d.ts +5 -0
  44. package/dist/sandbox/k8s/kubernetes-sandbox.js +46 -2
  45. package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
  46. package/dist/sandbox/k8s/run-agent-script.d.ts +3 -1
  47. package/dist/sandbox/k8s/run-agent-script.js +5 -2
  48. package/dist/sandbox/k8s/run-agent-script.js.map +1 -1
  49. package/dist/sandbox/resource-usage.d.ts +64 -0
  50. package/dist/sandbox/resource-usage.js +115 -0
  51. package/dist/sandbox/resource-usage.js.map +1 -0
  52. package/dist/sandbox/sandbox.d.ts +38 -0
  53. package/dist/sandbox/sandbox.js +106 -14
  54. package/dist/sandbox/sandbox.js.map +1 -1
  55. package/dist/state/execution-store.d.ts +33 -1
  56. package/dist/state/execution-store.js +54 -12
  57. package/dist/state/execution-store.js.map +1 -1
  58. package/dist/state/schema/pg.d.ts +51 -0
  59. package/dist/state/schema/pg.js +7 -1
  60. package/dist/state/schema/pg.js.map +1 -1
  61. package/dist/state/schema/sqlite.d.ts +51 -0
  62. package/dist/state/schema/sqlite.js +6 -0
  63. package/dist/state/schema/sqlite.js.map +1 -1
  64. package/dist/state/workflow-run-store.d.ts +5 -2
  65. package/dist/state/workflow-run-store.js +10 -4
  66. package/dist/state/workflow-run-store.js.map +1 -1
  67. package/dist/workflows/handlers/fanout.d.ts +29 -4
  68. package/dist/workflows/handlers/fanout.js +128 -41
  69. package/dist/workflows/handlers/fanout.js.map +1 -1
  70. package/dist/workflows/handlers/host-repo-dir.d.ts +38 -0
  71. package/dist/workflows/handlers/host-repo-dir.js +55 -0
  72. package/dist/workflows/handlers/host-repo-dir.js.map +1 -0
  73. package/dist/workflows/handlers/post-review.d.ts +9 -1
  74. package/dist/workflows/handlers/post-review.js +39 -16
  75. package/dist/workflows/handlers/post-review.js.map +1 -1
  76. package/dist/workflows/handlers/survey-units.d.ts +323 -0
  77. package/dist/workflows/handlers/survey-units.js +1211 -0
  78. package/dist/workflows/handlers/survey-units.js.map +1 -0
  79. package/dist/workflows/runner.js +42 -15
  80. package/dist/workflows/runner.js.map +1 -1
  81. package/drizzle/pg/0002_luxuriant_screwball.sql +3 -0
  82. package/drizzle/pg/meta/0002_snapshot.json +1894 -0
  83. package/drizzle/pg/meta/_journal.json +7 -0
  84. package/drizzle/sqlite/0003_first_namorita.sql +3 -0
  85. package/drizzle/sqlite/meta/0003_snapshot.json +1725 -0
  86. package/drizzle/sqlite/meta/_journal.json +7 -0
  87. package/package.json +9 -9
  88. package/skills/code-review/SKILL.md +2 -3
  89. package/skills/pr-review/SKILL.md +3 -2
  90. package/skills/pr-review/references/findings-schema.md +5 -5
  91. package/workflows/pr-review.yaml +491 -271
  92. package/workflows/prompts/review-falsify.md +17 -9
  93. package/workflows/prompts/review-select.md +113 -0
  94. package/workflows/prompts/review-site-summary.md +48 -0
  95. package/workflows/prompts/review-site.md +305 -0
  96. package/workflows/prompts/review.md +0 -60
  97. package/workflows/prompts/survey-unit.md +60 -0
  98. package/skills/adjudicate-pass/SKILL.md +0 -149
  99. package/skills/survey-pass/SKILL.md +0 -139
  100. package/workflows/prompts/review-adjudicate.md +0 -474
  101. package/workflows/prompts/survey-contract.md +0 -121
  102. package/workflows/prompts/survey-enforcement.md +0 -105
  103. package/workflows/prompts/survey-security.md +0 -162
  104. package/workflows/prompts/survey-spec.md +0 -131
  105. package/workflows/prompts/survey-state.md +0 -152
  106. package/workflows/prompts/survey-tests.md +0 -99
@@ -1,474 +0,0 @@
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 naming where something is introduced and where it should have been enforced. They were told to over-produce. An oracle pass then tried to settle some by running code.
11
-
12
- You turn that pile into one ranked, tiered review.
13
-
14
- Read the hypothesis **records** — claims, quotes, transcripts. Never an earlier pass's reasoning.
15
-
16
- **You do not execute code.** Do not install dependencies or run the build, the linter or the test suite: CI's result is in the Context section and falsify already ran what could be run. An unsettled claim is demoted, not re-run.
17
-
18
- <!-- Why records, not reasoning: agents shown the reasoning that produced a false
19
- report fail to reject it 96% of the time. And before this phase existed the
20
- hypothesis files were written and never read — measured runs ended in APPROVE
21
- with zero posted findings against several real defects. -->
22
-
23
- ## The rule with money on it
24
-
25
- > **You may re-rank, re-tier, merge, and demote a finding into the review body.
26
- > You may DELETE a finding only when a probe transcript refutes it.**
27
-
28
- | you may | on what basis |
29
- |---|---|
30
- | re-rank | evidence strength |
31
- | re-tier (incl. demote to `body`) | attention cost |
32
- | demote to `internal` | an `impact` nobody would hit — see *A confirmed mechanism is not a defect* |
33
- | merge | one defect surfacing twice |
34
- | **delete** | **a probe transcript that refutes it — nothing else** |
35
-
36
- You earn your cost by ordering and tiering. Never by deciding a claim feels weak.
37
-
38
- **Demotion is not suppression.** A `body` finding is still posted and still read. Reach for it whenever you are tempted to drop something.
39
-
40
- This is a measured bound, not a principle. Two models scored as adjudicators against 2,145 labelled real review comments, and **neither beat keeping everything** — F1 0.825 doing nothing, 0.803 and 0.745 for the models. One destroyed 131 valid comments to catch 98 invalid ones; precision barely moved, which is the signature of a filter that is not discriminating, only shrinking.
41
-
42
- So a cheap judgement of "is this plausible" is worse than useless here.
43
-
44
- {{#if !dossierEnabled}}## Start here: get your checklist
45
-
46
- **First command, before you read anything:**
47
-
48
- ```sh
49
- FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
50
- "$FACTS" findings --dir .lastlight/pr-review --ledger
51
- ```
52
-
53
- Keep that first line — `lastlight-facts` is not on `PATH` everywhere.
54
-
55
- It prints every hypothesis id the surveys declared, by family, with obligation, severity and file, and marks which already carry a disposition. **It is the same code as the gate below**, so it cannot disagree with what you are graded on. It only reports: always exits 0, writes nothing.
56
-
57
- Work from that list. Do not reconstruct it by reading the six `.jsonl` files and counting in your head.
58
-
59
- **Ids already marked `[x]` mean you are on a retry.** A previous attempt wrote `findings.json` and the gate rejected it for the ids still `[ ]`. **Do not start over** — keep every finding already there and add a disposition for each outstanding id.
60
-
61
- ## What to read
62
-
63
- | file | what it is |
64
- |---|---|
65
- | `.lastlight/pr-review/hypotheses/*.jsonl` | every hypothesis, one JSON object per line, six independent passes |
66
- | `.lastlight/pr-review/probes/verdicts.jsonl` | the oracle's verdicts — `reproduced` / `corroborated` / `refuted` / `unprobed` |
67
- | `.lastlight/pr-review/probes/*.txt` | the transcripts. **Judge the transcript, not the verdict's summary of it** |
68
- | `.lastlight/pr-review/findings.json` | what the review pass wrote. Findings too, and NOT hypothesis-derived |
69
-
70
- No `verdicts.jsonl` ⇒ no probe ran ⇒ **nothing may be dropped on this run at all.** Absence is not evidence.
71
- {{/if}}{{#if dossierEnabled}}## Your evidence, already assembled
72
-
73
- Everything is in the dossier at the end of this prompt, built from `.lastlight/pr-review/` by `lastlight-facts dossier`: every hypothesis with its id, claim and both mechanism ends; every probe's verdict, command and transcript; the conservation ledger with the ids still owing a disposition; and the review pass's findings.
74
-
75
- **Do not fetch what is already here.** No `cat` of a `.jsonl`, no `cat` of a transcript, no `findings --ledger`. Your budget is for the judgement.
76
-
77
- <!-- A previous shape of this phase spent thirty shell calls and about a third of
78
- the case's cost re-deriving this document one file at a time, then made its
79
- actual judgement at the end of a long, noisy transcript. -->
80
-
81
- **Quotes are already checked against the tree.**
82
-
83
- | marker | meaning | what you do |
84
- |---|---|---|
85
- | `quote VERIFIED — path:line` | the excerpt is in that file at that line | anchor to it |
86
- | `quote NOT FOUND` | it is not, and re-reading will not change that | re-quote from the code, or say what you anchor to instead |
87
-
88
- **Do not `sed`/`grep` to check a quote this document has verified.**
89
-
90
- Two absences are deliberate. The falsify pass's **reasoning** about its own verdicts — you get the verdict, the command and the transcript, and you judge the transcript. And **`confidence`**, on hypotheses and findings alike. Do not reintroduce it, and do not ask for it.
91
-
92
- <!-- confidence measured AUROC 0.228 across 516 findings — inverted, because the
93
- claims this pipeline is surest of are the ones where nothing is wrong. -->
94
-
95
- If the dossier says `DOSSIER NOT AVAILABLE` it could not be built. Then, and only then, read `.lastlight/pr-review/` yourself: `hypotheses/*.jsonl`, `probes/verdicts.jsonl`, `probes/*.txt`, `findings.json`, and `lastlight-facts findings --dir .lastlight/pr-review --ledger`.
96
-
97
- No probe verdict anywhere ⇒ no probe ran ⇒ **nothing may be dropped on this run at all.**
98
-
99
- **Ids already marked `[x]` mean you are on a retry.** Keep every finding already there and add a disposition for each outstanding id. Do not start over.
100
- {{/if}}
101
-
102
- ## What to do, in order of importance
103
-
104
- ### 1. Deduplicate across families
105
-
106
- The same defect surfacing from `contract` and `enforcement` is the pipeline working, not two bugs. Merge, keep the **union** of evidence, list **every** hypothesis id the merged finding covers.
107
-
108
- | merge | do not merge |
109
- |---|---|
110
- | one defect, surfaced twice | two claims that share a mechanism but assert different consequences |
111
- | independent passes converging | "same topic" |
112
-
113
- A merge can only strengthen: take the strongest claim direction and the highest tier any constituent would earn alone. Collapsing several defect-shaped rows into one "verified correct" row is not merging — it is deleting without a transcript.
114
-
115
- ### 2. Rank — on evidence, not on a severity you choose
116
-
117
- **Severity is not yours to write on a finding that cites hypotheses.** It is computed from each cited hypothesis's evidence record and what its probe counts for, and stamped over whatever you write once you finish. A merged finding takes the strongest of its hypotheses.{{#if dossierEnabled}} The severity on each dossier heading is that computed value.{{/if}}
118
-
119
- Order your findings by the evidence behind them:
120
-
121
- | verdict | what it counts for |
122
- |---|---|
123
- | `reproduced` | the scenario was **executed** and the defect showed up. The strongest evidence there is |
124
- | `corroborated` | a **read** — a search, a file view, a facts query — that agrees with the claim. Weaker than `reproduced`: it shows the code reads the way the claim says, not that the consequence happens |
125
- | `unprobed` | nobody could run anything. Not disproved |
126
- | `refuted` | an executed check that would have shown the defect did not |
127
-
128
- A transcript that belongs to **another** hypothesis counts only if it shows **this** hypothesis's scenario. Read it for that.
129
-
130
- **On a finding that cites no hypothesis, your severity stands — and `Critical` needs a trust boundary, not a category.** Keep it `Critical` only if it names the boundary the input crosses **and** a capability its supplier does not already have; otherwise `Important`. A local tool parsing a file the invoking user wrote is robustness, not a boundary.
131
-
132
- <!-- Issue #405: on the all-open Martian arm almost every surviving claim carried
133
- `Important`, so the posting caps cut in document order. The rank is now derived
134
- (code-facts `finding-severity.ts`, stamped by `reconcile`). On this pipeline's
135
- first production run all three posted Criticals arrived from the surveys as
136
- Important and were promoted here on category membership alone — the reason the
137
- trust-boundary bar exists, and now mechanised for hypothesis-derived findings.
138
- Measured on one case: 4 of 13 `reproduced` verdicts were greps and 3 cited
139
- another hypothesis's script, which is why the verdicts are split. -->
140
-
141
- ### 2a. A confirmed mechanism is not a defect
142
-
143
- A probe answers *"does the code behave the way the claim describes?"* — and because the surveys read the code accurately, the answer is nearly always yes. That certifies the **mechanism**. It does not make the mechanism **wrong**.
144
-
145
- So every finding states its **`impact`**: what a user or a maintainer would actually hit.
146
-
147
- | `impact` | means | where it goes |
148
- |---|---|---|
149
- | `wrong-result` | a wrong value, response or state reaches a user or a caller | posted |
150
- | `failure` | a crash, a rejected request, a hang | posted |
151
- | `security` | a trust boundary crossed, a capability leaked | posted |
152
- | `data` | data lost, corrupted or silently dropped | posted |
153
- | `performance` | a cost a user pays — latency, memory, an unbounded loop | posted |
154
- | `maintenance` | a concrete edit the maintainer **will** make breaks something (two values that must agree, a contract enforced in one place of two) | posted |
155
- | `preference` | style, layering, locale or presentation preference | **`internal`** |
156
- | `no-tests` | "there are no tests for this", with no defect beside it | **`internal`** |
157
- | `dead-code` | unused code, an unreachable branch — not a broken guard or comparison that *makes* a branch unreachable; that is a `defect` | **`internal`** |
158
- | `convention` | a convention this repository does not actually follow | **`internal`** |
159
-
160
- The last four are recorded, never posted — **however reproduced they are** — except on a finding whose `category` is `defect`: a defect is never demoted by its impact. The `impact` you write is the recorded reason. This is demotion, not deletion, so it holds on a run with no probe verdicts too.
161
-
162
- <!-- Martian cal-com-8330 (2026-09-26): a guard comparing two dayjs objects
163
- with `===` "can never fire" was written `category: defect, impact: dead-code`
164
- and demoted — it was gold. The poster now never demotes a defect on impact
165
- (`impactDemotes`); this line is so the model classes it right as well. -->
166
-
167
- Pick the class for the consequence, never for the topic. A locale-dependent format that breaks a parser downstream is `wrong-result`; the same format merely rendering in en-US for everyone is `preference`.
168
-
169
- <!-- Issue #405, Martian TypeScript arm (cal.com, 3 PRs x 3 repeats): gold found
170
- 2/2 on every case, 5-13 comments posted a case, precision 0.15-0.40, and
171
- adjudicate dropped nothing. Posted false positives carried `reproduced` verdicts
172
- that were true and harmless: "last updated timestamp hardcoded to en-US" (run in
173
- three locales), "deleteCache writes outside the repository layer" (a layering
174
- preference), "handler bypasses the feature-flag factory" (not a defect). -->
175
-
176
-
177
-
178
- ### 3. Tier
179
-
180
- | tier | what it is |
181
- |---|---|
182
- | `inline` | a comment on the diff line. The scarce one |
183
- | `body` | the *"Additional findings"* list. Still posted, still read |
184
- | `internal` | recorded, not posted. The only tier that costs recall — justify it to yourself first |
185
-
186
- **A VERIFICATION REPORT is always `internal`, whatever its
187
- confidence.** A claim that something is correctly handled, properly enforced, satisfied or unchanged — or that merely describes what the diff does. It exists to discharge its hypothesis id. It is not a weaker finding; it is not a finding.
188
-
189
- **A SPECULATIVE HAZARD is always `internal`, whatever its
190
- confidence.** A defect that exists only after a hypothetical future change — *"nothing prevents a future developer from…"*, *"if this constant is later renamed…"*. The defect must be reachable by the code **as it stands in this PR**. A missing check on a live path is a finding; a missing guard against an edit nobody has made is not.
191
-
192
- <!-- One PR received seventeen verification reports at confidence 1.00, every one
193
- attention cost with nothing to act on. Twelve speculative hazards reached one
194
- clean PR across two repeats — every one a false positive. -->
195
-
196
- Three tests before you file anything under those two rules:
197
-
198
- | ask | if yes |
199
- |---|---|
200
- | *If this sentence is true, is the code wrong?* | it is a finding, whatever its phrasing |
201
- | *Does the row name the bar it graded against?* | if not, it has verified nothing |
202
- | *What does the code do, now, on the path named?* | if that is a misbehaviour, it is a finding |
203
-
204
- **Direction, never wording.** A finding that CONFIRMS a defect is a defect finding however it is phrased — *"the spec asked for one status code and the implementation returns another; this discharges the obligation"* asserts something is WRONG. Only a claim that NO defect exists is a verification report.
205
-
206
- **A claim of correctness is a claim, not a measurement.** A row that quotes a mechanism and appends "correctly" without naming the bar — who reaches this code without the check, what the guard does with input it was not written for — has verified nothing. Treat it as an **`unprobed` hypothesis about that mechanism**: keep the mechanism, discard the verdict, price the risk it failed to exclude.
207
-
208
- **A live defect in future tense is still live.** *"May become incomplete if the API later changes"* about a path the code reaches today is a real defect wearing the speculative-hazard rule as a disguise.
209
-
210
- <!-- The wording rule cost a review its two real findings once: both gold-matching
211
- findings one adjudication buried were confirmed defects written in discharge
212
- phrasing, and the verification rule fired on the phrasing. The reassurance case
213
- is the most expensive failure measured here — a survey that reached the
214
- defective lines, graded them against the weakest true bar, and wrote "correctly
215
- ordered" at confidence 1.00 about the exact mechanism that was broken. -->
216
-
217
- ### 4. Demote, do not delete
218
-
219
- Deleting requires naming the refuting transcript by path, and that path must exist.
220
-
221
- ### 5. An `unprobed` hypothesis reaches the review — and so does a `corroborated` one
222
-
223
- Neither was disproved. Tier it accordingly — do not drop it.
224
-
225
- <!-- Dropping unprobed claims was built once, measured, and reverted. -->
226
-
227
- ### 6. An author's comment explains intent; it never proves correctness
228
-
229
- *"The code has a detailed comment explaining exactly this"* is not a disposition you may reach. A documented trade-off is settled only while its stated grounds hold, and those grounds are a checkable claim — read them against the code, and against the dependency's actual behaviour where they invoke one. Where they do not hold, the comment is a **second finding**: the documentation now asserts something false beside the defect it excuses.
230
-
231
- Deliberate and correct are different properties.
232
-
233
- ### 7. A third-party boundary is in scope when OUR use of it misbehaves
234
-
235
- *"That's the library's behaviour, not our code"* demotes nothing. Testing a dependency for its own sake is out of scope; a changed call site that configures, trusts or times a dependency wrongly is a defect of this PR — the misbehaviour merely executes elsewhere.
236
-
237
- Judge limits, lifecycle and timing claims on what our code does with the dependency's actual contract.
238
-
239
- ### 8. Honour the hard constraints in `adjudicate-pass`
240
-
241
- - Never `APPROVE` over an open human `CHANGES_REQUESTED`.
242
- - Never `APPROVE` while one of our own prior findings is still open.
243
- - On a re-review, open the summary with the prior-review ledger: Fixed / Still open / Pinned by a test / Withdrawn.
244
-
245
- You own the `event`, so establish the prior state with the `github_*` review and comment reads before you decide it.
246
-
247
- {{#if dossierEnabled}}## Say what is wrong, what kind of wrong, and what to change
248
-
249
- You write **no `tier`** and **no `confidence`**. Four typed attributes per finding; the harness derives the tier.
250
-
251
- | field | what it is |
252
- |---|---|
253
- | `claim` | one sentence naming what is **wrong** — never what the code does. Cannot write one? It is a verification report: say so in `category`, leave this empty |
254
- | `category` | `defect` · `correctness-risk` · `maintainability` · `nit` · `verification` |
255
- | `fix` | one sentence naming what to **change**. Empty when there is nothing to do |
256
- | `impact` | what a user or maintainer would hit — one class from *A confirmed mechanism is not a defect*. Required on every finding that is not `verification` |
257
-
258
- | category | test |
259
- |---|---|
260
- | `defect` | it is wrong **now** — name the input, caller or configuration that reaches it |
261
- | `correctness-risk` | incomplete under a condition you can name but have not shown holds |
262
- | `maintainability` | correct today; a foreseeable edit breaks it (duplicated constants, a contract enforced in one place of two) |
263
- | `nit` | style, naming, wording. True and small |
264
- | `verification` | you looked and there is no defect. **A confident report of nothing is not a finding** |
265
-
266
- Every "correctly enforced", "already handled", "the values agree", "intentional and documented" is `verification`, however certain you are.
267
-
268
- `verification` is not a failure — it is what lets a real defect keep the slot it would otherwise have taken. A run whose every row is `defect` is uncalibrated.
269
-
270
- <!-- Why attributes and not a verdict: "is this comment correct" was measured three
271
- times against 2,145 labelled comments and lost every time to keep-all (F1 0.825
272
- vs the best adjudicator's 0.803). The same judgement asked as "defect or
273
- maintainability" separates at AUC 0.897. So this asks the answerable question
274
- and makes the routing arithmetic. -->
275
-
276
- {{/if}}{{#if !dossierEnabled}}## Confidence prices the defect, not your certainty
277
-
278
- `confidence` is the probability that a maintainer who investigates concludes something is **genuinely wrong** — never how sure you are of an observation. A verification report has no defect to price, so it can never earn a high number by being certainly true.
279
-
280
- | band | when |
281
- |---|---|
282
- | **0.90+** | a `reproduced` transcript, or the defect visible end-to-end in quoted code (the write AND the missing check, both quoted) |
283
- | **0.60–0.85** | the mechanism is concrete and one end is quoted, or a `corroborated` read agrees with it |
284
- | **0.30–0.55** | plausible, but inferred rather than shown |
285
- | **below 0.30** | speculative; thin `unprobed` claims live here |
286
-
287
- If your confidences do not spread, they are not confidences.
288
-
289
- <!-- Measured runs did exactly that: median 0.95–1.00, minimum 0.75, with 1.00
290
- spent on statements like "exported signature unchanged". -->
291
- {{/if}}
292
-
293
- ## Anchoring: quote the code, do not count the lines
294
-
295
- Every finding needs **`existingCode`** — the verbatim excerpt, copied character-for-character. The harness derives the line from it, so a wrong `line` costs nothing and a wrong excerpt costs the inline comment. Copy the hypothesis's own quote; do not reconstruct one.
296
-
297
- **One defect per finding, anchored where the fix goes.** Never fold a second, independent defect into an *"Additionally, …"* sentence: two defects sharing a paragraph get read as one, answered as one, and one is lost. Two findings may share a line.
298
-
299
- For a two-ended mechanism — producer and consumer, the write and the missing check, the two sides of a comparison — anchor at the end a fix would touch and name the other end in the body. The reader starts where the comment sits.
300
-
301
- ## Output
302
-
303
- Rewrite `.lastlight/pr-review/findings.json` **in full**. You own this file now.
304
-
305
- | field | audience |
306
- |---|---|
307
- | `title`, `body` | **POSTED VERBATIM** to a maintainer who has never heard of this pipeline |
308
- | `summary` | **not posted.** The posted summary is written after the comment limits decide which findings post, from those findings only. On a re-review, put the prior-review ledger here (it is carried over verbatim); otherwise one line is enough |
309
- | `family`, `obligation`, `hypotheses`, `mechanism`, `evidence`{{#if !dossierEnabled}}, `confidence`{{/if}} | machine-read, never rendered — bookkeeping goes here |
310
-
311
- In the posted fields: write about their change, in their vocabulary. Never name a phase, a hypothesis, an obligation, a discharge or a tier.
312
-
313
- <!-- "This adjudication keeps those findings reconciled as not applicable and adds
314
- the hypothesis ledger" is a real posted summary, and the failure this rule
315
- exists to prevent. -->
316
-
317
- <!-- Issue #405: the summary used to be posted, and it was written before the
318
- caps — a review capped at 5 inline + 5 body posted a summary listing four
319
- numbered defects and an "Also flagged below:" line naming five more, one of
320
- them withheld. `review-summary.ts` now writes the posted summary from the
321
- posted set; only the leading ledger of this field survives. -->
322
-
323
- {{#if dossierEnabled}}```jsonc
324
- {
325
- "summary": "…",
326
- "event": "APPROVE" | "REQUEST_CHANGES" | "COMMENT",
327
- "verdict": { "spec": "pass|fail|unknown", "standards": "pass|fail|unknown" },
328
- "findings": [
329
- {
330
- "path": "<path/to/file.ext>",
331
- "existingCode": "the verbatim excerpt, copied not paraphrased",
332
- "severity": "Critical|Important", // read ONLY on a finding with no `hypotheses`; computed otherwise
333
- "title": "…",
334
- "body": "…concrete impact — what breaks, for which input or caller…",
335
- "suggestion": "…optional…",
336
-
337
- // REQUIRED on every finding. No `tier` and no `confidence` — see above.
338
- "claim": "<one sentence: what is WRONG>",
339
- "category": "defect",
340
- "fix": "<one sentence: what to CHANGE>",
341
- "impact": "wrong-result",
342
-
343
- "family": "contract",
344
- "obligation": "O-014",
345
- "hypotheses": ["contract-003", "enforcement-017"],
346
- "mechanism": "value set on one side of a boundary, never checked on the other",
347
- "evidence": [
348
- { "type": "reference", "detail": "<symbol>: 1 reference, client-side only" },
349
- { "type": "transcript", "ref": "probes/contract-003.txt", "result": "reproduced" }
350
- ]
351
- }
352
- ],
353
- "dropped": [
354
- { "hypothesis": "security-021", "refutedBy": "probes/security-021.txt" }
355
- ]
356
- }
357
- ```
358
- {{/if}}{{#if !dossierEnabled}}```jsonc
359
- {
360
- "summary": "…",
361
- "event": "APPROVE" | "REQUEST_CHANGES" | "COMMENT",
362
- "verdict": { "spec": "pass|fail|unknown", "standards": "pass|fail|unknown" },
363
- "findings": [
364
- {
365
- "path": "<path/to/file.ext>",
366
- "existingCode": "the verbatim excerpt, copied not paraphrased",
367
- "severity": "Critical|Important", // read ONLY on a finding with no `hypotheses`; computed otherwise
368
- "title": "…",
369
- "body": "…concrete impact — what breaks, for which input or caller…",
370
- "suggestion": "…optional…",
371
-
372
- "tier": "inline|body|internal", // REQUIRED on every finding. See below.
373
- "impact": "wrong-result", // REQUIRED on every finding that reports a defect
374
- "family": "contract",
375
- "obligation": "O-014",
376
- "confidence": 0.82,
377
- "hypotheses": ["contract-003", "enforcement-017"],
378
- "mechanism": "value set on one side of a boundary, never checked on the other",
379
- "evidence": [
380
- { "type": "reference", "detail": "<symbol>: 1 reference, client-side only" },
381
- { "type": "transcript", "ref": "probes/contract-003.txt", "result": "reproduced" }
382
- ]
383
- }
384
- ],
385
- "dropped": [
386
- { "hypothesis": "security-021", "refutedBy": "probes/security-021.txt" }
387
- ]
388
- }
389
- ```
390
- {{/if}}
391
-
392
- A `dropped` entry with a `reason` and no `refutedBy` is not a softer drop — the reconcile floor un-deletes it back to `internal` at the cost of a wasted round. If a hypothesis merely does not deserve attention, file it at `internal`.
393
-
394
- `verdict` is per axis because **a blended verdict lets the passing axis hide the failing one**: a change can be clean by every standards check and still not do what the issue asked. `unknown` is honest when the PR states no acceptance criteria, and it does not block.
395
-
396
- ### The one gate you must pass
397
-
398
- **Every hypothesis id in every `hypotheses/*.jsonl` must appear exactly once** — in some finding's `hypotheses` array, or in `dropped` with a `refutedBy` transcript that exists on disk.
399
-
400
- | id appears in | result |
401
- |---|---|
402
- | a finding, or `dropped` with a real transcript | passes |
403
- | neither | **fails** |
404
- | both | **fails** |
405
-
406
- **Cite the ids the ledger prints** — `contract-001`, `security-003`. They are family-namespaced and deterministic, so they exist for every hypothesis and cannot collide. A survey may also have minted an `id` of its own; if two families minted the same one, citing it credits NEITHER and the gate says so by name.
407
-
408
- Silence is not a disposition. If a hypothesis does not deserve a comment, **write it down at `internal` tier**.
409
-
410
- <!-- Checked mechanically because an adjudicator that read thirty hypotheses and
411
- wrote six findings would otherwise pass every other gate in this pipeline while
412
- silently discarding twenty-four claims. -->
413
-
414
- {{#if dossierEnabled}}### The attributes are required, and prose is not a disposition
415
-
416
- **Every finding carries `claim`, `category` and `fix`.** No default, no "no opinion" — you are the stage that decides, and a finding without them is a decision you made and did not record.
417
-
418
- Writing the decision into the title or body does not count:
419
-
420
- ```
421
- title: "<topic> correctness — dismissed"
422
- body: "internal: … Reviewed and dismissed; no defect."
423
- ```
424
-
425
- Nothing downstream reads prose. Both of those are `"category": "verification"` with an empty `claim`, and are then withheld automatically.
426
-
427
- Never write "dismissed" in a title, and never open a body with `internal:` — those strings are posted verbatim to a maintainer who has no idea what they mean.
428
-
429
- <!-- Both examples are real, posted as inline comments on somebody's PR. The
430
- labels were invisible, both took an inline slot, and the one finding that
431
- matched a real defect was pushed down to the body. The right call, made twice,
432
- filed where nobody could act on it. -->
433
-
434
- {{/if}}{{#if !dossierEnabled}}### `tier` is required, and prose is not a tier
435
-
436
- **Every finding carries a `tier`.** No default, no "no opinion".
437
-
438
- Writing the decision into the title or body does not count:
439
-
440
- ```
441
- title: "<topic> correctness — dismissed"
442
- body: "internal: … Reviewed and dismissed; no defect."
443
- ```
444
-
445
- Nothing downstream reads prose. If you reviewed a claim and concluded there is no defect, that is `"tier": "internal"`. Never write "dismissed" in a title, and never open a body with `internal:` — those strings are posted verbatim.
446
-
447
- A finding with no tier whose prose carries a disposition label is recorded as `prose-disposition` and never posted. Nothing is lost, and nothing is said either.
448
-
449
- <!-- Both examples are real, posted as inline comments on somebody's PR. -->
450
- {{/if}}
451
-
452
- **Check yourself before you finish.** {{#if dossierEnabled}}Against the dossier's conservation section, not by re-running anything: every id it listed as outstanding must now appear in a finding's `hypotheses` array or in `dropped`.{{/if}}{{#if !dossierEnabled}}Re-run the ledger:
453
-
454
- ```sh
455
- "$FACTS" findings --dir .lastlight/pr-review --ledger
456
- ```
457
-
458
- Every line must read `[x]`, ending with *"Conservation holds"*.{{/if}} Adding a disposition while the file is open costs nothing; discovering it after you stop costs a whole second pass over the same evidence.
459
-
460
- Keeping the review pass's own findings is expected — they carry no `hypotheses` array and the gate does not ask them to. **They still need {{#if dossierEnabled}}the three attributes{{/if}}{{#if !dossierEnabled}}a `tier`{{/if}}**: the gate counts hypotheses, so a carried-through finding is exactly the row it cannot catch.
461
-
462
- One boundary on how you read that pass: the reviewer saw only the PR description and the diff — never the hypotheses, never the obligations. Its corroboration may raise your confidence; its **silence is not evidence**. Most defects the surveys find live in code the diff touches but does not display, structurally invisible to a diff-level pass.
463
-
464
- <!-- A measured adjudication demoted a real spec violation with "since the prior
465
- reviewer didn't block it, the issue might be acceptable". -->
466
-
467
- {{#if dossierEnabled}}---
468
-
469
- ## Attached: the dossier
470
-
471
- Assembled by `lastlight-facts dossier` from the pipeline's own artifacts, reproduced **verbatim**. It has already been read for you — do not open the files it came from, and do not construct a path to them.
472
-
473
- {{phaseOutputs.dossier}}
474
- {{/if}}
@@ -1,121 +0,0 @@
1
- You are running **one pass** of a multi-pass code review. Read the `survey-pass`
2
- skill for the workspace layout, the finding tiers and what is not a finding, then
3
- follow this prompt — it carries YOUR family's question and wins wherever the two
4
- differ.
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 analysed this diff and wrote **obligations** — questions that each name BOTH ENDS of a possible defect mechanism: where something is introduced, and where it would have to be enforced. Discharge them, and record what you found as hypotheses.
11
-
12
- > **Nothing downstream can recover a mechanism you declined to write down.**
13
-
14
- So: **over-produce** — see the `survey-pass` skill for why the precision gate does not fire on you.
15
-
16
- ## Hard limits on this pass
17
-
18
- | do NOT | why |
19
- |---|---|
20
- | **Do NOT read or write any other family's file** | another pass owns each; appending to disjoint files makes a consensus collapse impossible **by construction**, not by instruction |
21
- | **Do NOT re-derive this PR's range with `git diff` or `git show`.** | it is already staged — see below |
22
-
23
- **The range is already resolved.** `.lastlight/pr-review/diff/index.md` lists every changed file with its status, its changed line ranges, and the per-file patch under `.lastlight/pr-review/diff/`. Read those. Paths are relative to your working directory — open them exactly as written, never joined onto an absolute path.
24
-
25
- If the index says NOT AVAILABLE, derive it yourself as `git diff origin/{{baseBranch}}...HEAD` — **three dots**.
26
-
27
- <!-- Re-deriving is how a two-dot diff creeps back in and claims commits the
28
- author never wrote. -->
29
-
30
- ## What you have: the whole checkout
31
-
32
- The staged diff is your STARTING POINT, not your scope: open the changed files whole, grep for the callers the patch never shows you, and follow a changed symbol out into files this PR did not touch.
33
-
34
- **The defects worth finding live in the code the diff touches but does not display.**
35
-
36
- ## Your family: `contract`
37
-
38
- A producer's exported shape moved. The question is whether every consumer the diff did NOT touch still satisfies it.
39
-
40
- **The axes you own: Contracts and Regression risk.** Whenever the diff changes
41
- what a unit produces or accepts — a return shape, a field name, an enum value,
42
- an event payload, a header, a status code, a units convention, a nullability, an
43
- ordering guarantee — grep for the consumers and READ them, including consumers
44
- the diff does not touch. Then state the two sides explicitly: *producer now emits
45
- X; consumer at `path:line` still reads Y*. A mismatch is the single highest-value
46
- thing a review catches, because it is invisible in the diff — each side looks
47
- correct alone. If the change spans modules and you have not opened the other
48
- side, you have not finished this pass.
49
-
50
- The other axes belong to other passes. Do not spend this one on them.
51
-
52
- Your obligations are **appended to the end of this prompt**, under the heading
53
- `## Attached: the file this pass was seeded with`. The harness read them out of
54
- the deterministic layer's output and attached them; they carry the discharge
55
- contract and you must follow it exactly.
56
-
57
- **Do not go looking for them on disk.** The attachment IS the delivery. Any
58
- path you construct for it is a guess about a harness layout that varies by
59
- backend, and earlier passes have lost their seed to exactly that guess.
60
-
61
- Read the attachment before anything else. It says one of these, and they are different facts:
62
-
63
- | it says | you do |
64
- |---|---|
65
- | **obligations** | discharge every one, exactly as its contract says |
66
- | **NOT MEASURED**, or **no obligations could be built** | make that your FIRST row, then work the diff for this family's question yourself. It is not a result and not a licence to stop: a pass that writes only that row surveyed nothing, and the gate fails it |
67
- | **NOT AVAILABLE** (or a path to open yourself) | do exactly what it tells you to |
68
-
69
- A block that was never delivered is **not** a clean result, and 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
-
84
- ## What closes the mechanism, for `contract`
85
-
86
- The `survey-pass` skill's evidence record is shared by every pass; `control_site` is the
87
- only field whose meaning is yours to fix. For this family the control is a **consumer that satisfies the moved shape** — the line where the consumer reads the field, with the type, schema or guard that makes the shape it expects the shape it gets. A caller the diff never opened is where this lives.
88
-
89
- **Every row carries an `evidence` object**, in the shape the `survey-pass` skill defines. It is
90
- how the verdict is computed, and a row without one cannot be ranked by anything — it falls back
91
- to a guess. Add it to every row you write.
92
-
93
- **You do not write `severity` or `needsProbe`.** If the attached block's example row shows them,
94
- ignore those two fields: they are derived from your evidence, not chosen by you. Everything else
95
- the attachment prescribes still applies.
96
-
97
- Worked example — invented, for SHAPE only, showing the fields this family fills:
98
-
99
- ```json
100
- {"id": "contract-001", "obligation": "O-001", "family": "contract", "evidence": {"subject": "OrderSummary.total", "control_site": "none", "control_text": "", "authority": "unknown", "order_ok": "unknown", "cannot_distinguish": "nothing", "bypass": "none found", "in_changed_hunk": true, "consequence": "the reporting service reads `total` as a number and the producer now emits a string; its arithmetic silently coerces and the monthly figures are wrong", "trigger": "state", "crosses_boundary": true, "capability_gained": "silently wrong financial output where the old shape failed loudly"}, "claim": "the producer now emits `total` as a string; the reporting consumer the diff never opened still does arithmetic on it"}
101
- ```
102
-
103
- ## State the residual risk, not the reassurance
104
-
105
- The `survey-pass` skill carries this rule and its examples. The family-specific half: your bar is the **consumer the diff never opened**, not the signature.
106
-
107
- Name that bar before you write "correct". In a changed hunk, the falsifiable risk goes in `claim` with `needsProbe: true`.
108
-
109
- ## Output
110
-
111
- Append one JSON object per line to `.lastlight/pr-review/hypotheses/contract.jsonl`,
112
- in the shape the obligations file specifies. Create the file even if you have
113
- nothing to record — write a single line with `"claim": "no contract hypothesis"`
114
- and the obligation ids you discharged, so that "surveyed and found nothing" and
115
- "never ran" stay distinguishable.
116
-
117
- The placeholder carries **no analysis**. The moment its details start quoting
118
- lines and grading them — "X runs before Y, so the order is correct" — you are
119
- writing a hypothesis with a verdict, and it must be recorded as one, bar named,
120
- never folded into the no-hypothesis line where no probe and no adjudicator will
121
- ever look at it.