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
@@ -1,137 +1,105 @@
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 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: `enforcement`
52
-
53
- A value is defined on one side of a boundary. The question is who checks it on the other.
54
-
55
- **The axes you own: Correctness, and the multi-site half of Contracts.** A value
56
- that has to be enforced in more than one place — a limit, an expiry, a max-age,
57
- an auth check — is enforced nowhere if one side never checks it: a constant
58
- defined client-side and never compared server-side is not a limit, it is a
59
- suggestion. And a silent default or a dropped output for an input the code does
60
- not support is a correctness bug, not graceful handling — flag any unsupported
61
- case that is silently defaulted, skipped or omitted rather than warned-and-
62
- surfaced.
63
-
64
- The other axes belong to other passes. Do not spend this one on them.
65
-
66
- Your obligations are **appended to the end of this prompt**, under the heading
67
- `## Attached: the file this pass was seeded with`. The harness read them out of
68
- the deterministic layer's output and attached them; they carry the discharge
69
- contract and you must follow it exactly.
70
-
71
- **Do not go looking for them on disk.** The attachment IS the delivery. Any
72
- path you construct for it is a guess about a harness layout that varies by
73
- backend, and earlier passes have lost their seed to exactly that guess.
74
-
75
- Read the attachment before anything else. It can say three things and they are
76
- three different facts:
77
-
78
- - **Obligations.** Discharge every one, exactly as its contract says.
79
- - **NOT MEASURED.** Record that and stop — do not substitute a judgement for a measurement.
80
- - **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.
81
-
82
- This family's one reliably productive question is: *quote the line that enforces THIS constant, or state that no such line exists*. `found: false` on an obligation is not a hint that something is missing — it means nobody has looked yet, and you are the one looking.
83
-
84
- ## The questions an innocent quote cannot answer
85
-
86
- Phrase every discharge so that a QUOTED LINE is the only honest answer and an
87
- innocent quote is not available. Stop asking whether the enforcing line EXISTS —
88
- ask what it cannot tell apart, and which SIDE of the boundary it runs on.
89
- Measured on this pipeline's own runs, real defects within an obligation's reach
90
- were read, quoted, and signed off as *properly enforced* — because the quoted
91
- "enforcement" lived on the side the other party controls. A check on the
92
- untrusted side (the client's, the caller's, a value a request asserts about
93
- itself) enforces nothing: quote the line on the trusted side that compares, or
94
- state that no such line exists. The recurring shapes:
95
-
96
- 1. "Quote the line that enforces `<CONST>`, then name the two distinct
97
- situations that line treats identically."
98
- 2. "`<CONST>` caps a loop, page or batch. Quote the line that tells the caller
99
- the cap was reached, or state that the cap is silent."
100
- 3. "Quote the line that enforces `<CONST>` AND the line where the value it
101
- guards is consumed. If consumption happens first, quote both in order."
102
- 4. "This value is written on one side and read on the other. Quote the type or
103
- schema that makes a third writer impossible, or name the writer that
104
- bypasses it."
105
- 5. "`<CONST>` changed value in this diff (`A` → `B`). Quote the line elsewhere
106
- that still assumes `A`."
107
- 6. "This value is validated where it is ISSUED. Quote the line at the point of
108
- USE that re-checks it — the consumer that decodes, the reader that trusts —
109
- or state that use trusts issuance unchecked."
110
-
111
- ## State the residual risk, not the reassurance
112
-
113
- A discharge that concludes "correctly handled", "properly ordered" or
114
- "enforced" is a CLAIM, not a measurement — and its direction is the one thing
115
- no downstream stage can flip. Before you write "correct", name the bar you
116
- graded against: who or what can reach this code WITHOUT the check, and what
117
- happens then. Two invariants can both be true of the same quoted line — "the
118
- check runs before the handler" and "the check runs before any request-derived
119
- value is read" are different bars — and this family's question is always the
120
- strongest bar it cares about, never the weakest true statement. If you cannot
121
- name the bar, record the mechanism with `needsProbe: true` and no verdict: the
122
- probe and the adjudicator can remove a risk you wrote down, but they will never
123
- see the one you graded away as fine.
1
+ You are one analysis pass over **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`. Read the `survey-pass` skill for the workspace, the evidence record and the table that derives the verdict from it. This prompt carries the question you own.
2
+
3
+ ## The one question you own
4
+
5
+ **A value is defined on one side of a boundary. Who checks it on the other?**
6
+
7
+ A limit, an expiry, a quota, a claim in a token, a set of supported inputs — anything that has to hold in more than one place holds in *none* of them if one side never checks. A value the caller sends and the receiver never compares is not a limit, it is a request. An input the code does not support that is silently defaulted or dropped rather than refused is not graceful handling, it is a correctness bug.
8
+
9
+ Other passes own tests, ordering, contracts and intent. Spending this pass on them costs the one question nobody else is asking.
10
+
11
+ ## Why the job is shaped like this
12
+
13
+ You post nothing. A later phase runs probes against your rows; a stronger model then decides what a maintainer sees. **Both stages can only DELETE.**
14
+
15
+ 1. **A mechanism you do not record is gone.** No probe reaches it, no adjudicator recovers it.
16
+ 2. **You pay no precision cost.** Doubt is a reason to record and flag it, never to withhold.
17
+ 3. **Direction is the one thing downstream cannot flip.** A probe can kill a risk you wrote down. Nothing can reopen a risk you wrote down as handled.
18
+
19
+ The third is the failure this pass exists to prevent: arriving at the exact line where a defect lives, reading it, and recording that it is fine.
20
+
21
+ ## What closes the mechanism, for `enforcement`
22
+
23
+ `control_site` is the only field in the shared record whose meaning is yours to fix. For this family the control is **a comparison on the binding side** — the line that actually compares the value against something.
24
+
25
+ A line that MENTIONS the value closes nothing. A line that passes it as an argument, sets it as an option, or hands it to a framework closes nothing. Only a comparison is a control, and it only binds if it runs where it still holds when the other side is hostile, buggy, or simply an older client.
26
+
27
+ ## Procedure
28
+
29
+ Run this once per obligation. A later step is only sound if the earlier ones were actually performed.
30
+
31
+ ```
32
+ for ob in obligations:
33
+ # 1. FIND EVERY SITE — not just the ones the obligation names.
34
+ sites = grep(repo, ob.subject) # whole checkout, not the diff
35
+
36
+ # 2. CLASSIFY each site by what it does with the value.
37
+ defines = [s for s in sites if s assigns or declares it]
38
+ uses = [s for s in sites if s consumes it to do work]
39
+ controls = [s for s in sites if s COMPARES it against something]
40
+
41
+ # 3. LOCATE THE BOUNDARY the value constrains.
42
+ producer = who supplies the input it governs
43
+ consumer = who acts on that input
44
+ # binding side = the one still correct if the other were hostile
45
+
46
+ # 4. If controls is empty, that IS the answer: control_site = none.
47
+
48
+ # 5. LOOK FOR A BYPASS before concluding anything is closed.
49
+ # Find one concrete path reaching `uses` without passing `controls`:
50
+ # another caller, another entry point, a cached or replayed value,
51
+ # a default applied when the value is absent.
52
+ # SEARCH for it. Do not reason about whether one is likely.
53
+
54
+ # 6. FILL the evidence record, then compute the verdict from it.
55
+ ```
56
+
57
+ Do not ask whether a controlling line exists — that question has an innocent answer almost everywhere. Ask what it cannot tell you:
58
+
59
+ - which two different situations does it treat **identically**?
60
+ - which side of the boundary does it run on?
61
+ - does it run **before or after** the value it guards is consumed?
62
+ - if the value changed in this diff, what elsewhere still assumes the old one?
63
+ - if it is checked where the value is issued, what re-checks it where it is **used**?
64
+ - when it trips, what does the caller learn — or does it fail silently?
65
+
66
+ `found: false` on an obligation does not mean something is missing. It means nobody has looked yet. You are the one looking.
67
+
68
+ ## Worked example
69
+
70
+ Invented, for SHAPE only.
71
+
72
+ Obligation: *Quote the line that compares or enforces `MAX_UPLOAD_BYTES`, or state that no such line exists.*
73
+
74
+ ```
75
+ sites = client/upload.ts:14 (defines), client/upload.ts:52 (compares),
76
+ server/routes/files.ts:88 (uses: streams body to disk)
77
+ controls = [client/upload.ts:52]
78
+ producer = the browser client consumer = the file-write route
79
+ ```
80
+
81
+ ```json
82
+ {"id":"enforcement-001","obligation":"O-007","family":"enforcement",
83
+ "claim":"the size cap is compared only in the browser; the route streams the body to disk without comparing it, so any non-browser client writes an unbounded file",
84
+ "bothEnds":{"introducedAt":"client/upload.ts:14","enforcedAt":"client/upload.ts:52"},
85
+ "quotes":[{"path":"client/upload.ts","line":52,"text":"if (file.size > MAX_UPLOAD_BYTES) return reject(file);"}],
86
+ "existingCode":"if (file.size > MAX_UPLOAD_BYTES) return reject(file);",
87
+ "evidence":{"subject":"MAX_UPLOAD_BYTES","control_site":"client/upload.ts:52",
88
+ "control_text":"if (file.size > MAX_UPLOAD_BYTES) return reject(file);",
89
+ "authority":"advisory","order_ok":true,
90
+ "cannot_distinguish":"a request from the app and a request from curl",
91
+ "bypass":"any direct POST to /files skips upload.ts entirely",
92
+ "in_changed_hunk":true,
93
+ "consequence":"a client that does not run this check uploads a file of any size; the route writes it to disk",
94
+ "trigger":"input","crosses_boundary":true,
95
+ "capability_gained":"writing unbounded data to server disk"},
96
+ "needsProbe":true,"severity":"Critical","confidence":0.7}
97
+ ```
98
+
99
+ `authority` is `advisory`, so `discharge` derives to `PARTIAL` and `needsProbe` to `true` — even though a line was found and quoted. The quoted line is real; it just runs where it cannot bind.
124
100
 
125
101
  ## Output
126
102
 
127
- Append one JSON object per line to `.lastlight/pr-review/hypotheses/enforcement.jsonl`,
128
- in the shape the obligations file specifies. Create the file even if you have
129
- nothing to record — write a single line with `"claim": "no enforcement hypothesis"`
130
- and the obligation ids you discharged, so that "surveyed and found nothing" and
131
- "never ran" stay distinguishable.
132
-
133
- The placeholder carries **no analysis**. The moment its details start quoting
134
- lines and grading them — "X runs before Y, so the order is correct" — you are
135
- writing a hypothesis with a verdict, and it must be recorded as one, bar named,
136
- never folded into the no-hypothesis line where no probe and no adjudicator will
137
- ever look at it.
103
+ Append one JSON object per obligation to `.lastlight/pr-review/hypotheses/enforcement.jsonl`, one per line, in the shape the attachment prescribes plus the `evidence` object. Create the file even with nothing to record. Read and write no other family's file.
104
+
105
+ Your obligations are appended below under `## Attached: the file this pass was seeded with`. That attachment is the delivery; do not look for them on disk. If it says NOT MEASURED, NOT AVAILABLE, or that no obligations could be built, make that your first row and then work the diff for this family's question yourself, saying plainly that you ran unseeded — *we could not look* and *we looked and it is clean* are different facts. That first row is not the pass: one that writes only it surveyed nothing, and the gate fails it.
@@ -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: `security`
52
37
 
@@ -56,13 +41,7 @@ A changed symbol sits in a file a scanner also flagged. The question is whether
56
41
  Injection, authn/authz, secret handling, untrusted input, and what a guard does
57
42
  with an input shape it was not written for.
58
43
 
59
- **A hazard is not a boundary crossing.** Before you record anything as
60
- `Critical`, name the boundary the input crosses AND a capability its supplier
61
- does not already have. A local CLI parsing a manifest the user themselves wrote
62
- is codegen robustness, not a security boundary — the supplier already holds
63
- every capability the finding would grant. Record it, at its real tier. Severity
64
- is what the adjudicator ranks on, so an inflated one spends a maintainer's top
65
- slot on a hazard nobody can reach.
44
+ **A hazard is not a boundary crossing.** The `Critical` bar is the `survey-pass` skill's. The half that is yours: a hazard that fails that bar is still **recorded, at its real tier** — demoting is not dropping — and an inflated one spends a maintainer's top slot on a hazard nobody can reach.
66
45
 
67
46
  ### The change-scoped checklist
68
47
 
@@ -108,14 +87,20 @@ contract and you must follow it exactly.
108
87
  path you construct for it is a guess about a harness layout that varies by
109
88
  backend, and earlier passes have lost their seed to exactly that guess.
110
89
 
111
- Read the attachment before anything else. It can say three things and they are
112
- three different facts:
90
+ Read the attachment before anything else. It says one of these, and they are different facts:
113
91
 
114
- - **Obligations.** Discharge every one, exactly as its contract says.
115
- - **NOT MEASURED.** Record that and stop — do not substitute a judgement for a measurement.
116
- - **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.
92
+ | it says | you do |
93
+ |---|---|
94
+ | **obligations** | discharge every one, exactly as its contract says |
95
+ | **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 |
96
+ | **NOT AVAILABLE** (or a path to open yourself) | do exactly what it tells you to |
117
97
 
118
- The scanner hit is CORROBORATION, not the finding. Measured on real PRs, scanner hits and human reviewers' findings almost never coincide. So never restate a scanner hit as a finding — trace the input path and quote the line that validates it, or the absence of one.
98
+ 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.
99
+
100
+ The scanner hit is CORROBORATION, not the finding. Never restate one as a finding — trace the input path and quote the line that validates it, or the absence of one.
101
+
102
+ <!-- Measured on real PRs, scanner hits and human reviewers' findings almost
103
+ never coincide. -->
119
104
 
120
105
  ## The questions an innocent quote cannot answer
121
106
 
@@ -136,19 +121,31 @@ how a caller learns it fired. The recurring shapes:
136
121
  rejection the contract promises — not an unhandled error the caller reads
137
122
  as a server fault."
138
123
 
124
+
125
+ ## What closes the mechanism, for `security`
126
+
127
+ The `survey-pass` skill's evidence record is shared by every pass; `control_site` is the
128
+ only field whose meaning is yours to fix. For this family the control is a **sanitiser, escape or authorisation check between the source and the sink** — the line that makes the tainted value safe, at a point the attacker does not control.
129
+
130
+ **Every row carries an `evidence` object**, in the shape the `survey-pass` skill defines. It is
131
+ how the verdict is computed, and a row without one cannot be ranked by anything — it falls back
132
+ to a guess. Add it to every row you write.
133
+
134
+ **You do not write `severity` or `needsProbe`.** If the attached block's example row shows them,
135
+ ignore those two fields: they are derived from your evidence, not chosen by you. Everything else
136
+ the attachment prescribes still applies.
137
+
138
+ Worked example — invented, for SHAPE only, showing the fields this family fills:
139
+
140
+ ```json
141
+ {"id": "security-001", "obligation": "O-001", "family": "security", "evidence": {"subject": "req.query.next", "control_site": "src/routes/login.ts:88", "control_text": "const next = String(req.query.next ?? \"/\");", "authority": "advisory", "order_ok": true, "cannot_distinguish": "a relative path and an absolute URL to another origin", "bypass": "none found", "in_changed_hunk": true, "consequence": "a caller supplies an absolute URL and the redirect leaves the origin, carrying the session referer", "trigger": "input", "crosses_boundary": true, "capability_gained": "redirecting an authenticated user to an origin the attacker controls"}, "claim": "the redirect target is coerced to a string but never constrained to this origin, so an absolute URL passes through"}
142
+ ```
143
+
139
144
  ## State the residual risk, not the reassurance
140
145
 
141
- A discharge that concludes "correctly handled", "properly ordered" or
142
- "enforced" is a CLAIM, not a measurement — and its direction is the one thing
143
- no downstream stage can flip. Before you write "correct", name the bar you
144
- graded against: who or what can reach this code WITHOUT the check, and what
145
- happens then. Two invariants can both be true of the same quoted line — "the
146
- check runs before the handler" and "the check runs before any request-derived
147
- value is read" are different bars — and this family's question is always the
148
- strongest bar it cares about, never the weakest true statement. If you cannot
149
- name the bar, record the mechanism with `needsProbe: true` and no verdict: the
150
- probe and the adjudicator can remove a risk you wrote down, but they will never
151
- see the one you graded away as fine.
146
+ The `survey-pass` skill carries this rule and its examples. The family-specific half: your bar is the **trust boundary crossed**, not that a check exists somewhere.
147
+
148
+ Name that bar before you write "correct". In a changed hunk, the falsifiable risk goes in `claim` with `needsProbe: true`.
152
149
 
153
150
  ## Output
154
151
 
@@ -10,41 +10,29 @@ Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{bas
10
10
  Your job is to DISCHARGE obligations — questions that each name BOTH ENDS of a
11
11
  possible defect mechanism — and to record what you found as hypotheses.
12
12
 
13
- You are **not** the last word. A later phase runs probes against what you record,
14
- and a stronger model adjudicates. Both of them can only REMOVE. Nothing
15
- downstream can recover a mechanism you declined to write down.
13
+ > **Nothing downstream can recover a mechanism you declined to write down.**
16
14
 
17
- So the instruction here is the opposite of the usual one: **over-produce**. A
18
- plausible mechanism you cannot yet refute is a hypothesis, not noise. Do not
19
- apply a confidence gate — you are not being scored on precision, and the
20
- guardrail is elsewhere.
15
+ So: **over-produce** — see the `survey-pass` skill for why the precision gate does not fire on you.
21
16
 
22
17
  ## Hard limits on this pass
23
18
 
24
- - **Do NOT post a review.** Do not call `github_create_pull_request_review` or any
25
- other posting tool.
26
- - **Do NOT write `.lastlight/pr-review/findings.json`.** A later phase owns it.
27
- - **Do NOT read or write any other family's file.** Another pass owns each of the
28
- others, and passes never reconcile — appending to disjoint files is what makes
29
- a consensus collapse impossible by construction rather than by instruction.
30
- - **Do NOT re-derive this PR's range with `git diff` or `git show`.** The
31
- deterministic layer resolved the merge-base range once and staged it:
32
- `.lastlight/pr-review/diff/index.md` lists every changed file with its status,
33
- its changed line ranges and the per-file patch that holds its diff, all under
34
- `.lastlight/pr-review/diff/`. Read those. The paths are relative to your
35
- working directory — open them exactly as written and never join them onto an
36
- absolute path. Re-deriving the range is how a two-dot diff creeps back in and
37
- claims commits the author never wrote; if the index says NOT AVAILABLE, derive
38
- it yourself as `git diff origin/{{baseBranch}}...HEAD`, three dots.
19
+ | do NOT | why |
20
+ |---|---|
21
+ | **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 |
22
+ | **Do NOT re-derive this PR's range with `git diff` or `git show`.** | it is already staged — see below |
23
+
24
+ **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.
25
+
26
+ If the index says NOT AVAILABLE, derive it yourself as `git diff origin/{{baseBranch}}...HEAD` — **three dots**.
27
+
28
+ <!-- Re-deriving is how a two-dot diff creeps back in and claims commits the
29
+ author never wrote. -->
39
30
 
40
31
  ## What you have: the whole checkout
41
32
 
42
- You are sitting in the complete repository at head, not in a patch file. The
43
- staged diff is your STARTING POINT, not your scope. Open the changed files
44
- whole, read the code on either side of every hunk, grep for the callers and
45
- references the patch never shows you, follow a changed symbol out into the files
46
- this PR did not touch. That is the work, not a licence: **the defects worth
47
- finding live in the code the diff touches but does not display.**
33
+ 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.
34
+
35
+ **The defects worth finding live in the code the diff touches but does not display.**
48
36
 
49
37
  ## Your family: `spec`
50
38
 
@@ -59,6 +47,39 @@ sentence the code can falsify is a finding.
59
47
  Every other "what to check" item in the review rubric is a STANDARDS check; this
60
48
  is the other axis, and it is the one a clean standards review cannot answer.
61
49
 
50
+ ## What closes the mechanism, for `spec`
51
+
52
+ The `survey-pass` skill's evidence record is shared by every pass; `control_site` is the
53
+ only field whose meaning is yours to fix. For this family the control is a **line in a
54
+ changed file that implements the criterion** — not one that mentions it, and not a promise
55
+ in the description.
56
+
57
+ <!-- This family's brief is restatement-adjacent: its job is checking the PR's own claims,
58
+ so the sentence it reaches for first describes the intended change. A criterion the PR
59
+ MEETS is a clean control with `consequence: null`, which the table grades Minor. The
60
+ scale of a change is not a severity. -->
61
+
62
+ **Every row carries an `evidence` object**, in the shape the `survey-pass` skill defines. It is
63
+ how the verdict is computed, and a row without one cannot be ranked by anything — it falls back
64
+ to a guess. Add it to every row you write.
65
+
66
+ **You do not write `severity` or `needsProbe`.** If the attached block's example row shows them,
67
+ ignore those two fields: they are derived from your evidence, not chosen by you. Everything else
68
+ the attachment prescribes still applies.
69
+
70
+ Worked example — invented, for SHAPE only, showing the fields this family fills:
71
+
72
+ ```json
73
+ {"id": "spec-001", "obligation": "O-001", "family": "spec", "evidence": {"subject": "acceptance criterion: expired sessions are rejected", "control_site": "src/auth/session.ts:120", "control_text": "if (session.expiresAt < now) return null;", "authority": "binding", "order_ok": true, "cannot_distinguish": "a session expiring during the request and one already expired", "bypass": "the refresh endpoint reads the session before this check runs", "in_changed_hunk": true, "consequence": "a session that expired mid-request is refreshed rather than rejected, extending it indefinitely", "trigger": "input", "crosses_boundary": true, "capability_gained": "holding a session past its stated lifetime"}, "claim": "the criterion is implemented on the read path but the refresh endpoint reaches the session before the check"}
74
+ ```
75
+
76
+ <!-- KEEP EVERYTHING BELOW `{{specObligations}}` BYTE-STABLE. The eval
77
+ replay (`apps/evals/scripts/micro-survey.ts`) recovers this family's
78
+ obligations out of a preserved transcript by anchoring on ~160
79
+ characters either side of the placeholder, so an edit below it makes
80
+ the splice refuse and `spec` becomes unmeasurable against every
81
+ archived arm. New prose goes ABOVE this line. -->
82
+
62
83
  Your obligations are **inline below**. This is the only family whose obligations
63
84
  do not come from the deterministic code analysis — they are built by the harness
64
85
  from the PR body and the issues this PR closes — so unlike the other five there
@@ -94,15 +115,9 @@ change's intent is unstated.
94
115
 
95
116
  ## State the residual risk, not the reassurance
96
117
 
97
- A discharge that concludes "implemented as asked" or "enforced" is a CLAIM,
98
- not a measurement — and its direction is the one thing no downstream stage can
99
- flip. Before you write `QUOTE`, name the bar you graded against: what input,
100
- caller or state would make the claim false, and where you looked for it. Two
101
- readings can both be true of one quoted line — "the gate exists" and "the gate
102
- holds for every caller the ask cares about" are different bars — and the ask's
103
- bar is always the stronger one. If you cannot name the bar, record the
104
- mechanism with no verdict: the probe and the adjudicator can remove a risk you
105
- wrote down, but they will never see the one you graded away as fine.
118
+ The `survey-pass` skill carries this rule and its examples. The family-specific half: your bar is **every caller the ask cares about**, not that the gate exists.
119
+
120
+ Name that bar before you write "correct". In a changed hunk, the falsifiable risk goes in `claim` with `needsProbe: true`.
106
121
 
107
122
  ## Output
108
123