lastlight-core 0.33.1 → 0.34.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 (58) hide show
  1. package/config/default.yaml +137 -48
  2. package/dist/config/config.d.ts +1 -1
  3. package/dist/config/config.js +45 -29
  4. package/dist/config/config.js.map +1 -1
  5. package/dist/engine/event-shim.d.ts +22 -0
  6. package/dist/engine/event-shim.js +98 -0
  7. package/dist/engine/event-shim.js.map +1 -1
  8. package/dist/engine/executors/orchestrator.js +20 -1
  9. package/dist/engine/executors/orchestrator.js.map +1 -1
  10. package/dist/engine/github/review-poster.d.ts +249 -40
  11. package/dist/engine/github/review-poster.js +332 -54
  12. package/dist/engine/github/review-poster.js.map +1 -1
  13. package/dist/engine/github/review-summary.d.ts +61 -0
  14. package/dist/engine/github/review-summary.js +101 -0
  15. package/dist/engine/github/review-summary.js.map +1 -0
  16. package/dist/engine/pr-decisions.d.ts +16 -0
  17. package/dist/engine/pr-decisions.js +127 -11
  18. package/dist/engine/pr-decisions.js.map +1 -1
  19. package/dist/engine/review-spec.d.ts +1 -1
  20. package/dist/engine/review-spec.js +69 -38
  21. package/dist/engine/review-spec.js.map +1 -1
  22. package/dist/sandbox/docker.js +6 -0
  23. package/dist/sandbox/docker.js.map +1 -1
  24. package/dist/sandbox/k8s/run-agent-script.js +5 -0
  25. package/dist/sandbox/k8s/run-agent-script.js.map +1 -1
  26. package/dist/sandbox/sandbox.d.ts +7 -0
  27. package/dist/sandbox/sandbox.js +13 -0
  28. package/dist/sandbox/sandbox.js.map +1 -1
  29. package/dist/sandbox/smol.js +6 -0
  30. package/dist/sandbox/smol.js.map +1 -1
  31. package/dist/session-log.js +4 -0
  32. package/dist/session-log.js.map +1 -1
  33. package/dist/telemetry/openinference.d.ts +13 -0
  34. package/dist/telemetry/openinference.js +13 -0
  35. package/dist/telemetry/openinference.js.map +1 -1
  36. package/dist/telemetry/pi-events.js +16 -1
  37. package/dist/telemetry/pi-events.js.map +1 -1
  38. package/dist/workflows/handlers/fanout.d.ts +42 -7
  39. package/dist/workflows/handlers/fanout.js +145 -19
  40. package/dist/workflows/handlers/fanout.js.map +1 -1
  41. package/dist/workflows/handlers/post-review.d.ts +17 -0
  42. package/dist/workflows/handlers/post-review.js +137 -50
  43. package/dist/workflows/handlers/post-review.js.map +1 -1
  44. package/dist/workflows/runner.js +1 -1
  45. package/dist/workflows/runner.js.map +1 -1
  46. package/package.json +5 -5
  47. package/skills/adjudicate-pass/SKILL.md +24 -20
  48. package/skills/survey-pass/SKILL.md +121 -130
  49. package/workflows/pr-review.yaml +210 -7
  50. package/workflows/prompts/review-adjudicate.md +388 -263
  51. package/workflows/prompts/review-falsify.md +185 -44
  52. package/workflows/prompts/review.md +10 -10
  53. package/workflows/prompts/survey-contract.md +48 -48
  54. package/workflows/prompts/survey-enforcement.md +102 -134
  55. package/workflows/prompts/survey-security.md +53 -56
  56. package/workflows/prompts/survey-spec.md +52 -37
  57. package/workflows/prompts/survey-state.md +54 -53
  58. package/workflows/prompts/survey-tests.md +48 -48
@@ -30,15 +30,14 @@ where something is introduced and where it should have been enforced. They were
30
30
  instructed to over-produce, and they did. Some of those claims can be settled by
31
31
  **running code**, and that is the only thing you are here to do.
32
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.
33
+ Do not re-reason about these claims. **Run something.**
40
34
 
41
- So: do not re-reason about these claims. **Run something.**
35
+ <!-- Why: on a real PR the reviewer opened the dependency's source, stood at the
36
+ exact defect site, and concluded the mechanism was verified correct. It was
37
+ wrong. A human settled the same question with a four-line probe file and the
38
+ real tool, in one line. Thirty seconds of execution beat an unbounded amount of
39
+ reading — and reading, however careful, kept producing the wrong DIRECTION with
40
+ full confidence. -->
42
41
 
43
42
  ## The rule with money on it
44
43
 
@@ -51,22 +50,66 @@ A verification layer bolted onto a conservative generator raises precision and
51
50
  that generation was deliberately re-tuned to over-produce against it. That
52
51
  safety evaporates the moment you start refuting things by argument.
53
52
 
54
- Concretely, and there are only three verdicts:
53
+ There are four verdicts, strongest evidence first:
54
+
55
+ | verdict | means | needs |
56
+ |---|---|---|
57
+ | `reproduced` | you **executed** the scenario the claim names and the defect showed up | a transcript. The strongest evidence in the pipeline |
58
+ | `corroborated` | a **read** — a grep, a file view, a facts query — agrees with a claim about what the code DOES, without executing it | a transcript. Weaker than `reproduced`, and read downstream as weaker |
59
+ | `refuted` | you ran something that WOULD have shown the defect and it did not | a transcript. **Only a transcript may refute** |
60
+ | `unprobed` | nothing you could run would settle it | a `reason` naming WHICH constraint: no runner, no dependencies, no toolchain, or not the kind of claim execution decides |
61
+
62
+ An `unprobed` or `corroborated` hypothesis **survives** to adjudication.
63
+
64
+ ### Structural or behavioural — which one the claim is decides what `reproduced` needs
65
+
66
+ - A **structural** claim is about the shape of the code: *"nothing else calls this"*, *"the signature did not change"*, *"the two constants agree"*. A grep, a file read or a facts query **settles** it, and `reproduced` is right when it shows the claim.
67
+ - A **behavioural** claim says running the code does something wrong: a wrong result, a failure, data lost. A grep or a file read shows the code *reads* the way the claim says — which the survey already knew. That is `corroborated`. `reproduced` needs an **execution that exercised this scenario**: the copied function run on the input the claim names, a differential run, the real entry point.
68
+ - **A script you wrote for another hypothesis** may be cited only when its transcript shows the scenario **this** hypothesis names. Otherwise run this one's own, or record what you have.
69
+
70
+ **The gate checks the mechanical part.** A hypothesis is behavioural when its `evidence` records a `consequence` that happens at head; a `reproduced` verdict on one whose `command` only reads code (`grep`, `rg`, `cat`, `sed -n`, a facts query, …) fails `lastlight-facts probes`.
71
+
72
+ <!-- Issue #405, measured on one Martian case (13 `reproduced`): 5 were real
73
+ execution, 1 a differential git probe, 4 were greps ("grep confirms … is the
74
+ only direct construction") and 3 cited a script another hypothesis had written.
75
+ Across nine probed cases: 52 reproduced, 16 unprobed, 4 refuted, and no defect
76
+ claim ever refuted — `reproduced` had stopped separating anything. -->
77
+
55
78
 
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
79
 
65
80
  **Silence is never a refutation.** If you did not run it, it is `unprobed`, not
66
81
  `refuted`. Marking a claim `refuted` with no transcript is the single most
67
82
  expensive mistake available in this phase, because nothing downstream can
68
83
  recover it.
69
84
 
85
+ ### Reading the code is NOT a probe, and this is now machine-checked
86
+
87
+ Reading is what every earlier pass already did. If that were enough, this phase would not exist.
88
+
89
+ <!-- The first time this phase ran for real it returned nine verdicts, nine of
90
+ them `reproduced`, every one with "command": "code inspection" and a transcript
91
+ that was prose — "Reading source at … lines 78-80 … VERDICT: the claim is
92
+ ACCURATE". Not one ran anything. -->
93
+
94
+ Concretely:
95
+
96
+ - **`"code inspection"` is not a command.** Neither is *"reviewed the diff"*,
97
+ *"traced the callers"* or *"analysed the source"*. A command is something a
98
+ shell ran: `git show …`, `node .lastlight/pr-review/probes/contract-001.mjs`,
99
+ `lastlight-facts facts --repo . …`.
100
+ - **If you executed nothing, the verdict is `unprobed`**, with a `reason` saying
101
+ which constraint stopped you. That is a completely acceptable outcome and it
102
+ costs the finding **nothing**: an `unprobed` hypothesis survives to
103
+ adjudication at lowered confidence, exactly as if you had never been asked.
104
+ There is no pressure here to manufacture a verdict — the only wrong answer is
105
+ a claim of execution that did not happen.
106
+ - **The gate reads your transcript's first line.** `lastlight-facts probes`
107
+ now fails the phase on any `reproduced`, `corroborated` or `refuted` whose
108
+ verdict names no `command`, or whose transcript does not open with that
109
+ command. A file full of
110
+ careful reasoning will not close this loop; one line of `$ node probe.mjs`
111
+ followed by its output will.
112
+
70
113
  ## What to probe
71
114
 
72
115
  Read every `.lastlight/pr-review/hypotheses/*.jsonl` line. Probe:
@@ -102,33 +145,124 @@ Then ask the question that keeps a difference from becoming a false finding:
102
145
  behavioural difference is evidence, not a defect. If the answer is "the PR
103
146
  intended this", the verdict is still `refuted` — with the transcript.
104
147
 
148
+ ## The probe ladder — cheapest first, and the cheap ones are not the weak ones
149
+
150
+ Work **down** this list and stop at the first tier that settles the claim. Every
151
+ tier here runs with **no dependencies installed**, which is the normal state of
152
+ this workspace: nothing below needs a `node_modules`, a package manager or a
153
+ test suite, and you must never invoke one.
154
+
155
+ **1. Differential git probe.** The same input against `origin/{{baseBranch}}`
156
+ and `HEAD`. Costs two `git show` / `git diff` invocations and no runtime at all,
157
+ and it is the strongest cheap evidence there is, because the *difference* is a
158
+ fact where a one-sided reading is a judgement. Use it for anything shaped like
159
+ *"the PR changed the behaviour of X"*.
160
+
161
+ **2. Isolated pure-function execution.** Copy the changed function — or the few
162
+ lines of it the claim is about — into
163
+ `.lastlight/pr-review/probes/<hypothesis-id>.mjs`, stub whatever it calls, and
164
+ run it under plain `node`. Sub-second, dependency-free, and it decides exactly
165
+ the class of claim that reading keeps getting wrong: normalisation, comparison,
166
+ ordering, boundary and case-sensitivity defects. *"Is the email lowercased on
167
+ one path and not the other?"* is four lines and one `node` run; no amount of
168
+ staring at two call sites settles it. Copy, never import, and never edit a
169
+ tracked file to make the copy run.
170
+
171
+ **3. Vendored-binary probe.** Only where a runner is **already on disk** —
172
+ something under an existing `node_modules/.bin`, a checked-in script, a compiler
173
+ the image itself ships. If it is not already there, it does not exist for you:
174
+ do not install it.
175
+
176
+ **"On disk" means inside the checkout** — the repo's own `node_modules/.bin`, a
177
+ checked-in script — plus the harness's own `lastlight-facts`
178
+ (`LASTLIGHT_FACTS_BIN` / `PATH`). Nothing under `$HOME`, a global prefix, a
179
+ package-manager cache or another project counts, whatever happens to be
180
+ installed there. Never search outside the checkout for a dependency (`find /`,
181
+ `find ~`, `ls ~/.nvm`), and never change `PATH` to point outside the workspace.
182
+ If the dependency is not in the checkout, the hypothesis is `unprobed` with
183
+ `"reason": "dependency not installed"`, and it survives to adjudication.
184
+
185
+ <!-- MEASURED (issue #404, martian oc-survey-glmf arm, probes: static,
186
+ --sandbox none): once installs were blocked, falsify went looking for the
187
+ missing dependency on the host — `find / -type d -name dayjs 2>/dev/null`,
188
+ `find ~/.nvm/versions/node -maxdepth 6 -type d -name dayjs`, listing
189
+ `~/.nvm/versions/node/<v>/lib/node_modules/lastlight/`, then
190
+ `export PATH=".../lastlight/node_modules/.bin:$PATH"`; plus `~/.npm`,
191
+ `~/.cache/yarn`, `/usr/lib/node_modules`, `/usr/local/lib/node_modules`,
192
+ `/opt`. 24 of 27 out-of-workspace commands. A `dayjs` found in an unrelated
193
+ global install is not the version the PR pins, so a verdict built on it is
194
+ evidence about some other tree — and the same case probes differently on
195
+ every machine. The `host` command-policy class backs this up. -->
196
+
197
+ **4. Deterministic re-query.** Re-run `lastlight-facts` scoped to the claim
198
+ (`lastlight-facts` if it is on `PATH`, else `/opt/lastlight/bin/lastlight-facts`) —
199
+ `facts` for a symbol's reference count and which of them are inside the diff,
200
+ `contracts` for a signature delta on a changed export, `constants` for a literal
201
+ duplicated outside the diff. This is execution too, and it is the tier people
202
+ forget: it settles *"nothing else calls this"* and *"the signature did not
203
+ change"* against a fresh analysis, which is an artefact **no earlier pass
204
+ produced**. That independence is the whole mechanism — what makes an oracle
205
+ worth anything is being grounded in something the generator did not write, not
206
+ running a program as such.
207
+
208
+ Anything that needs a tier **above** these — a real install, a service, a
209
+ network call, a full test suite — is `unprobed` with that named as the reason,
210
+ and it **survives** to adjudication. Do not install anything to reach it.
211
+
212
+ **Every probe must terminate on its own.** A probe is a question that gets an
213
+ answer and stops; a command that keeps running is not a probe, whatever it
214
+ prints on the way. So: no servers, watchers, REPLs, `--watch`/`--serve`/
215
+ `--inspect`/`--ui` modes, and nothing that opens a port or waits for input.
216
+ Redirect nothing to a pager.
217
+
218
+ Run the tool, in its one-shot form — `--run` not `--watch`, a listing flag not
219
+ the interactive picker, a print/dump flag not an inspector or a UI. The
220
+ correction is the FORM of the invocation, never the choice to execute: reading
221
+ instead of running is the failure this whole phase exists to fix, and the one
222
+ class of claim only execution can settle is the class worth the most.
223
+
224
+ Two things this is not a style rule about. A command that hangs is capped now,
225
+ so the worst case is a wasted cap rather than a wedged run — but a hypothesis
226
+ burned on a hung command is a hypothesis you did not settle. And a subshell that
227
+ *fetches* a package to run it has left tier 3: if the runner is not already on
228
+ disk, it does not exist for you.
229
+
230
+ A cheap probe against an independent artefact is not a degraded version of running the suite. It is the thing that works.
231
+
232
+ <!-- The large false-positive-elimination results in the literature come from
233
+ pipelines that never compile the project at all: Tencent's industrial study
234
+ reports 94-98% of false positives eliminated with a scanner that explicitly
235
+ "does not require code compilation" (arXiv:2601.18844); LLM4PFA removes 72-96%
236
+ while losing 3 of 45 true positives (arXiv:2506.10322), contrasting itself with
237
+ IRIS precisely because IRIS needs a buildable repo. -->
238
+
105
239
  ## Before you start: what you can actually run
106
240
 
107
- Read `.lastlight/pr-review/probes/env.json`. It is a fact, not a guess:
241
+ Read `.lastlight/pr-review/probes/env.json`. It is a fact, not a guess.
108
242
 
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.
243
+ | field | meaning | what you do |
244
+ |---|---|---|
245
+ | `"installed": false` | no dependencies on disk — nothing importing a third-party package can run | tiers 1, 2 and 4 all still work; what you cannot execute is `unprobed`, `"reason": "no dependencies installed"`, and it survives |
246
+ | `"install": "skipped"` | the deployment deliberately runs without the author's dependencies | not a failure, nothing to retry |
247
+ | `"typecheck": "errors"` | the tree already does not compile | do not report those errors as your finding |
248
+ | *no `env.json` at all* | the probe environment was never prepared | mark what you cannot run `unprobed` and say so |
116
249
 
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.
250
+ **do not run `npm`/`pnpm`/`yarn`/`bun install`, and do not run the repo's test suite.** Both are forbidden here whatever `env.json` says.
251
+
252
+ A probe against the repo's own source is the normal case, not the fallback. An absent environment is not permission to reason instead.
120
253
 
121
254
  ## Hard limits
122
255
 
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.
256
+ | do NOT | why |
257
+ |---|---|
258
+ | **Do NOT post a review** — no `github_create_pull_request_review`, no comments | you are not a posting phase |
259
+ | **Do NOT write `.lastlight/pr-review/findings.json`** | a later phase owns it |
260
+ | **Do NOT edit any `hypotheses/*.jsonl` file** | append-only, owned by the passes that wrote them; your verdicts go in their own file |
261
+ | **Do NOT commit anything** | probe files are scratch |
262
+ | **Do NOT fix the bug** | you are measuring, not repairing |
263
+ | **Do NOT reach outside the checkout** — no `find /` or `find ~`, no reading `~/.nvm`, `~/.npm`, `~/.cache` or a global `node_modules`, no `PATH` pointing outside the workspace | only the checkout and `lastlight-facts` are on disk; a dependency that is not in the checkout is `unprobed`, `"reason": "dependency not installed"` |
264
+
265
+ Probe files live under `.lastlight/pr-review/probes/` so they are never part of the diff. **Never modify a tracked file to make a probe run** — copy what you need into the probe file instead.
132
266
 
133
267
  ## Output
134
268
 
@@ -140,16 +274,21 @@ Two things per probed hypothesis.
140
274
  .lastlight/pr-review/probes/<hypothesis-id>.txt
141
275
  ```
142
276
 
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.
277
+ **Include the command line itself as the first line, and make it the same
278
+ string you put in `command`** — that pair is checked by machine, not trusted.
279
+ For a **differential** probe, base and head are two separate commands, so put
280
+ each on its own line, labelled `BASE:` and `HEAD:`, in the order you ran them —
281
+ `BASE:` opens the file. Write `command` as `"BASE: <cmd1> HEAD: <cmd2>"`; the
282
+ gate splits it and checks each half against the line it actually landed on, not
283
+ both against line one. Do not summarise, do not trim to the interesting part:
284
+ the transcript is the evidence, and a later phase reads it rather than your
285
+ description of it.
147
286
 
148
287
  **2. One JSON object per line**, appended to
149
288
  `.lastlight/pr-review/probes/verdicts.jsonl`:
150
289
 
151
290
  ```
152
- { "hypothesis": "contract-001", "verdict": "reproduced|refuted|unprobed",
291
+ { "hypothesis": "contract-001", "verdict": "reproduced|corroborated|refuted|unprobed",
153
292
  "transcript": ".lastlight/pr-review/probes/contract-001.txt" | null,
154
293
  "command": "the command you ran" | null,
155
294
  "differential": true|false,
@@ -163,5 +302,7 @@ collides with another's. A verdict naming a colliding id answers neither.
163
302
 
164
303
  Every hypothesis you were asked to probe needs a line here, including the ones
165
304
  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.
305
+ looked"* different rows instead of the same silence. A `reproduced`,
306
+ `corroborated` or `refuted` line **must** carry a `transcript` path that exists
307
+ **and a `command` that its first line echoes**; an `unprobed` line needs neither
308
+ and always closes the gate.
@@ -36,16 +36,16 @@ attention), rather than dropping it in prose: the surveys may have reached
36
36
  the same fact with the opposite verdict, and a dismissal that exists only in
37
37
  your reasoning is one the adjudicator can never cross-check.
38
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.
39
+ | do NOT | why |
40
+ |---|---|
41
+ | install dependencies, or run the build, the linter or the test suite | CI already answered those (the Context section below) and the falsify pass ran what could be run; this pass reads |
42
+ | re-derive per-hunk analysis | the surveys did that work, at depth, per family |
43
+ | Do **not** read `.lastlight/pr-review/hypotheses/` or `.lastlight/pr-review/obligations/` | your value is that you never saw them — a finding copied from a hypothesis is one the adjudicator can no longer cross-check |
44
+ | defer to them | *"the surveys will have covered it"* is the exact inference an independent pass exists to avoid |
45
+
46
+ No other stage sees the PR the way you do. An APPROVE reasoned from what another stage will probably find is evidence about nothing.
47
+
48
+ An empty `findings` array is a valid outcome — earned when the falsifying looks came up empty, never when the boxes ticked.
49
49
 
50
50
  Still follow the **pr-review** skill for everything procedural that is not the
51
51
  deep review itself — the workspace layout, the stop conditions, the
@@ -7,46 +7,31 @@ Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{bas
7
7
 
8
8
  ## What this pass is, and what it is not
9
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.
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.
14
11
 
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.
12
+ > **Nothing downstream can recover a mechanism you declined to write down.**
18
13
 
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.
14
+ So: **over-produce** — see the `survey-pass` skill for why the precision gate does not fire on you.
23
15
 
24
16
  ## Hard limits on this pass
25
17
 
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.
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. -->
41
29
 
42
30
  ## What you have: the whole checkout
43
31
 
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.**
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.**
50
35
 
51
36
  ## Your family: `contract`
52
37
 
@@ -73,12 +58,15 @@ contract and you must follow it exactly.
73
58
  path you construct for it is a guess about a harness layout that varies by
74
59
  backend, and earlier passes have lost their seed to exactly that guess.
75
60
 
76
- Read the attachment before anything else. It can say three things and they are
77
- three different facts:
61
+ Read the attachment before anything else. It says one of these, and they are different facts:
78
62
 
79
- - **Obligations.** Discharge every one, exactly as its contract says.
80
- - **NOT MEASURED.** Record that and stop — do not substitute a judgement for a measurement.
81
- - **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.
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.
82
70
 
83
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.
84
72
 
@@ -92,19 +80,31 @@ The recurring shape this family keeps missing:
92
80
  the line inside it a caller cannot see and would be surprised by — a retry
93
81
  policy, a timeout, a swallowed error class."
94
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
+
95
103
  ## State the residual risk, not the reassurance
96
104
 
97
- A discharge that concludes "correctly handled", "properly ordered" or
98
- "enforced" is a CLAIM, not a measurement — and its direction is the one thing
99
- no downstream stage can flip. Before you write "correct", name the bar you
100
- graded against: who or what can reach this code WITHOUT the check, and what
101
- happens then. Two invariants can both be true of the same quoted line — "the
102
- check runs before the handler" and "the check runs before any request-derived
103
- value is read" are different bars — and this family's question is always the
104
- strongest bar it cares about, never the weakest true statement. If you cannot
105
- name the bar, record the mechanism with `needsProbe: true` and no verdict: the
106
- probe and the adjudicator can remove a risk you wrote down, but they will never
107
- see the one you graded away as fine.
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
108
 
109
109
  ## Output
110
110