opencode-self-improvement 0.19.0 → 0.21.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.
package/README.md CHANGED
@@ -67,10 +67,12 @@ Zero configuration is the default. To tune, use the object form of the plugin en
67
67
  | --- | --- | --- |
68
68
  | `injectBudget` | `1200` | Character cap on the injected relevance block and each contextual pull; trimmed at whole-memory boundaries. Env fallback: `OPENCODE_MEMORY_INJECT_BUDGET`. |
69
69
  | `frontierBudget` | `3 × injectBudget` | Character cap on the session-start open-threads block. A thread longer than the budget is not injected and is reported as omitted. Env fallback: `OPENCODE_MEMORY_FRONTIER_BUDGET`. |
70
+ | `contradictionSurface` | `true` | Experimental: compare guided constant claims with bounded source reads and render a class-specific CONFLICT verdict. Set `false` to skip code checks and retain plain guidance. See [Contradiction authority policy](#contradiction-authority-policy-experimental-349--351). |
70
71
  | `autoCapture` | `false` | Master switch for auto-capture, which is **experimental and has never fired on a verified live store** — see [Auto-capture is experimental](#auto-capture-is-experimental). Off by default, so the install stays zero-token. |
71
72
  | `captureModel` | — | `"provider/id"` model used for auto-capture. Required when `autoCapture` is on; missing or invalid disables capture with a startup warning. |
72
73
  | `captureMax` | `3` | Maximum candidates proposed per capture pass. |
73
74
  | `captureOnCompact` | `true` | When `autoCapture` is on, also mine the transcript at compaction, before the summarizer replaces it. Its 5-minute cooldown is separate from the turn-end one, so the two triggers' hit-rates stay measurable. Setting it while `autoCapture` is off does nothing and reports a startup warning. |
75
+ | `captureGuidedRules` | `false` | POC: deterministic guided-candidate pre-pass. The user's own lines decide which stated values or rules are guided (numbers, rates, currency, explicit rule assertions) and attach the verbatim quote; the capture model may phrase such a row but cannot clear the flag or the quote, and a guided quote the user never wrote is refused at the write boundary instead of silently stripped. Fires alongside the model pass only — no extra model calls. |
74
76
  | `notifyBlocked` | `true` | Terminal (TUI) only: toast when a write gate blocks a write. Blocks are always in `memory_evidence` either way. |
75
77
 
76
78
  ### Environment variables
@@ -98,6 +100,8 @@ What is established, from tests and fixtures (no live store involved):
98
100
  - **The path runs under simulated host traffic** — unit tests hand the plugin the recorded envelopes and assert a candidate lands through the write gate, including conservation (a near-duplicate collapses at the gate instead of writing a second row): `test/capture.test.ts`, `test/capture-compaction.test.ts`. No terminal e2e scenario covers the trigger, so the simulated envelope is the strongest evidence that exists — and fabricating the envelope is exactly what passed while this feature was dead.
99
101
  - **Identity triggers have their own recording check.** `test/event-fidelity.test.ts` checks `IDENTITY_EVENT_TYPES` against the original 2.1.4 recording plus `test/fixtures/host-session-move.json`, a normalized one-frame extract from a separate 2.2.2 move capture. The extract must declare nonempty provenance and its retained envelopes must round-trip through the lockfile-pinned `@opencode/schema` 2.0.32 decoder. These checks reject missing metadata and malformed envelopes; they do not authenticate the capture. The identity replay uses the plugin subscription, but live plugin rebinding remains unverified. The recording version is distinct from the CI host pin (2.0.26).
100
102
 
103
+ - **Teardown stops work that is still in flight.** `generate.text` does not take the abort signal, so a capture parked mid-model-call used to wake up after the host disposed the plugin and run the whole write gate against a store its caller had already removed. Cleanup now aborts the subscription, every pass re-checks the signal after the model call and between candidates (a gate already mutating is never cut in half), and cleanup drains the tracked passes under a one-second bound — teardown never waits on the model. `test/capture-dispose-drain.test.ts` parks a capture, disposes, releases, and asserts that no row and no evidence line carries a timestamp after disposal (#211).
104
+
101
105
  What is not established:
102
106
 
103
107
  - That a live host emits those events in the shape the subscription reads, end to end. No `auto_capture_*` line and no `capture_lag` line exists anywhere in the maintainer's evidence history (checked 2026-10-26 through 2026-10-29); a live trial armed on 2026-10-26 was stood down on 2026-10-29 without ever firing, so it answered nothing.
@@ -118,6 +122,20 @@ Four gates run before anything is stored, and each emits an ordered evidence lin
118
122
 
119
123
  Nothing is deleted: `memory_update` supersedes the previous row, `memory_forget` records a retirement, and `memory_undo` restores a snapshot. `memory_update` takes a `query` that picks the row — its id, a clock fragment such as `00:11:22.123`, or a unique substring of its text. Omit it to update the newest entry of that scope and type. A `query` that matches nothing, or several rows, writes nothing and says so. A prose edit carries over ordinary tags, issue link, retrieval keywords, open/settled standing, and repository to the new row, while capture-only guidance provenance is removed — updating a `global` row from one machine keeps it global for every other. Naming a row an earlier update already superseded reports the duplicate when the live successor already holds that exact content; when only the metadata you name differs, the update runs against the successor instead of dead-ending. And a failure after the new row is durable is reported as `PARTIAL` — the message names what failed, the replacement stands on disk, and `memory_undo` (merge or force) brings the old row back.
120
124
 
125
+ ### Contradiction authority policy (experimental, #349 / #351)
126
+
127
+ `contradictionSurface` defaults to `true`; set it to `false` to keep plain guidance without code checks. Guided capture can attach a declared constant's `ref`, the user's value as `claim`, and an authority `klass`:
128
+
129
+ | Captured statement | Class | Verdict on a detected conflict |
130
+ | --- | --- | --- |
131
+ | User states the required value for a declared constant | `spec` | The user is the authority; change the constant to the stated requirement. |
132
+ | User describes how working code behaves | `behavior` | Code is the authority; keep the constant and raise the mismatch with the user. |
133
+ | Authority is unclear | Omit `klass` | Keep plain guidance and its staleness caveat; emit no CONFLICT verdict. |
134
+
135
+ The code check accepts a unique top-level `const` with a literal value. Comments, string examples, local declarations and computed expressions cannot establish an authority verdict. The scan is limited to 300 source files, 256 KiB per file and depth 3, preferring `src/`; it does not follow source links or resolve imports. Ambiguous declarations, unreadable/invalid source, exhausted budgets or an undecidable claim keep the plain guidance and staleness caveat. The JavaScript/TypeScript parser loads only when a row needs a code check; explicit opt-out never loads it. Use attribution keeps the stored row's identity and prose while coverage counts only references present in the delivered text.
136
+
137
+ Accepted residual: a user-stated **wrong spec** still classifies as `spec`. Its verdict follows that stated requirement even if it breaks the current tests. The plugin does not infer hidden-suite authority or silently override the user's requirement. Asking an oracle or inventing an extra authority class is outside this contract. Capture classification can be wrong; a code comparison verifies a value mismatch, not the user's intent. Per the [maintainer's rollout decision](https://github.com/abogartz/opencode-self-improvement/pull/363#pullrequestreview-5819556342), the default is ON for full benchmarking after merge and can be revisited. The seat-model and merged-main confidence runs in #350–#352 remain outstanding; enabling the feature is not a claim that those benchmarks passed.
138
+
121
139
  ## Repo scoping
122
140
 
123
141
  Rows are stamped with your git origin (an id that survives re-clones and moves between machines) or, without an origin, a hash of the normalized directory path. `repoPath` keeps the human-readable path, so rows written before hashing keep matching.
@@ -264,7 +282,7 @@ Review the full row in the memory viewer's **quarantined** filter. **Release qua
264
282
 
265
283
  This is a heuristic review queue, not a complete prompt-injection detector: legitimate documentation or quoted code can match. Markdown-bold role headers and download-then-`&&`-execute forms are recognized, but alternate role delimiters such as `[INST]` / `<<SYS>>`, base64-to-shell pipelines, paraphrased instructions, and indirect execution can evade it. Direct `memory_remember` and human viewer edits are explicit writes and are not automatically scanned: a session with that tool still has a prose channel, mitigated by the existing framing and provenance rather than quarantine. Those defenses still apply to released rows.
266
284
 
267
- Always-ride guidance priority is reserved to auto-capture provenance. `memory_remember`, `memory_update` replacements, and JSONL imports silently remove `user-guided` (including comma-delimited tag entries) before the write gate; their field allowlists also exclude `ref`, `claim`, and `klass`. Ordinary tags and prose can still promote normally, but a portable file, even with an export header, cannot attest that the local user stated it. The capture path owns guidance metadata; this boundary protection does not authenticate a directly edited store or guarantee that a capture model classified a statement correctly. This reservation is in place before the opt-in hint/contradiction channel lands (#342, #349).
285
+ Always-ride guidance priority is reserved to auto-capture provenance. `memory_remember`, `memory_update` replacements, and JSONL imports silently remove `user-guided` (including comma-delimited tag entries) before the write gate; their field allowlists also exclude `ref`, `claim`, and `klass`. Ordinary tags and prose can still promote normally, but a portable file, even with an export header, cannot attest that the local user stated it. The capture path owns guidance metadata; this boundary protection does not authenticate a directly edited store or guarantee that a capture model classified a statement correctly. The reservation applies to guidance priority and contradiction verdicts (#342, #349).
268
286
 
269
287
  The viewer is a trusted admin editor: its edits and deleted-entry restores do not run the model-facing grounding or deduplication gates, but they honor the same exact and near-match value rejections. Rejected edits leave the original row, snapshots and edit audit unchanged; rejected restores append nothing. The refusal names the rejection hash so you can explicitly lift it under **Rejections → un-reject** before retrying. Corrected numeric values and polarity changes retain the rejection check's existing exceptions. This check does not change whole-snapshot rollback policy.
270
288
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-self-improvement",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "Durable memory for opencode: remember facts, decisions, and commands across sessions, plus a one-command per-repo setup (/repo-init).",
5
5
  "main": "index.ts",
6
6
  "exports": {
@@ -75,6 +75,7 @@
75
75
  "lint": "biome lint && bun run format:check"
76
76
  },
77
77
  "dependencies": {
78
+ "@babel/parser": "7.29.9",
78
79
  "zod": "4.6.7"
79
80
  }
80
81
  }
@@ -92,13 +92,49 @@ export function parseCandidates(raw: string, max: number): CaptureCandidate[] {
92
92
  o.status === "open" || o.status === "settled" ? o.status : undefined;
93
93
  // A bad kw list costs the row its keywords, never the row itself.
94
94
  const kw = cleanKeywords(o.kw);
95
+ // Hint channel (#335): only a literal true counts; junk yields an
96
+ // untagged row, the same shape an agent-derived fact has.
95
97
  const guided = o.guided === true;
98
+ // Contradiction surface (POC): ref/claim/klass ride guided rows only.
99
+ // Local checks keep this module store-free; appendMemory normalises
100
+ // again, so this only has to stay junk-proof.
101
+ const conflict =
102
+ guided && o && typeof o === "object"
103
+ ? {
104
+ ...(typeof o.ref === "string" &&
105
+ /^[A-Za-z_][A-Za-z0-9_]{1,63}$/.test(o.ref)
106
+ ? { ref: o.ref }
107
+ : {}),
108
+ ...(typeof o.claim === "string" &&
109
+ o.claim.trim() &&
110
+ o.claim.trim().length <= 32 &&
111
+ flattenMemoryText(o.claim.trim()) === o.claim.trim()
112
+ ? { claim: o.claim.trim() }
113
+ : {}),
114
+ ...(o.klass === "spec" || o.klass === "behavior"
115
+ ? { klass: o.klass as "spec" | "behavior" }
116
+ : {}),
117
+ }
118
+ : {};
119
+ // Verbatim user utterance: shape-checked here, substring-verified by the
120
+ // runtime against the transcript the model saw. A failed verification
121
+ // drops the field, never the row.
122
+ const original =
123
+ guided && typeof o.original === "string"
124
+ ? (() => {
125
+ const s = o.original.trim();
126
+ return s && s.length <= 300 && flattenMemoryText(s) === s
127
+ ? s
128
+ : undefined;
129
+ })()
130
+ : undefined;
96
131
  out.push({
97
132
  ...(status
98
133
  ? { type, scope, content, status }
99
134
  : { type, scope, content }),
100
135
  ...(kw ? { kw } : {}),
101
- ...(guided ? { guided: true } : {}),
136
+ ...(guided ? { guided: true, ...conflict } : {}),
137
+ ...(original ? { original } : {}),
102
138
  });
103
139
  }
104
140
  return out;
@@ -0,0 +1,198 @@
1
+ // guided-rules — deterministic guided-candidate pre-pass (POC, FINDINGS
2
+ // 2026-11-08 §4). Plugin option `captureGuidedRules`, default OFF.
3
+ //
4
+ // Mystery 2's last stochastic link is capture EMISSION: the capture model
5
+ // flagged the user-stated fact guided in 5 of 7 runs (attr + ARM F). The
6
+ // field's convergent fix is "LLM proposes, rules dispose" (arXiv 2604.27906
7
+ // schema-grounded memory; neuro-symbolic extraction, Nat. Comm. Med. 2025;
8
+ // MEDIQA-SYNUR 2026 exact-evidence grounding): decide WHAT must be guided
9
+ // deterministically from the user's own lines, let the model only PHRASE it,
10
+ // and validate the quote on the write path so a miss becomes a retriable
11
+ // event, not a silent omission.
12
+ //
13
+ // Contract:
14
+ // - findGuidedQuotes scans user text (the REQUESTS prose plus transcript
15
+ // user: lines) sentence by sentence; a sentence stating a value or a rule
16
+ // yields its VERBATIM text (whitespace-normalised, capped).
17
+ // - mergeGuidedCandidates lets the model phrase a pre-pass quote (matched by
18
+ // its own verbatim original or by numeric overlap) but never clear the
19
+ // guided flag or drop the quote: an unmatched quote gets a deterministic
20
+ // fallback row.
21
+ // - All functions are TOTAL like the rest of capture: junk input yields
22
+ // []/passthrough, never a throw.
23
+ import type { CaptureCandidate } from "./prompt.ts";
24
+
25
+ /** Same normalisation the runtime quote check uses. */
26
+ export function normWs(s: string): string {
27
+ return s.replace(/\s+/g, " ").trim();
28
+ }
29
+
30
+ /** Cap mirrors the store's original field; a quote is a substring, so a
31
+ * truncation at a space boundary stays verbatim. */
32
+ export const GUIDED_QUOTE_CHARS = 300;
33
+
34
+ // Decidable stated-fact shapes (the class the bench's guidance lives in):
35
+ // a number/rate/currency, or an explicit rule assertion. Deliberately
36
+ // narrow — the guided lane is capped and budgeted, but a rule that flags
37
+ // ordinary prose would still be noise by construction.
38
+ const VALUE_RE = /\d+(?:[.,]\d+)?\s*%|\d+\.\d+|[$€£]\s*\d/;
39
+ const RULE_RE =
40
+ /\b(must be|must equal|must include|has to be|is set to|is exactly|the correct\b|is inclusive|not only\b|always|never|the rule is)\b/i;
41
+
42
+ /**
43
+ * Verbatim sentences from the user's own text that state a value or a rule.
44
+ * `userText` is the REQUESTS prose plus the transcript's user: lines — never
45
+ * assistant output, so a stored quote can only be what the user said.
46
+ */
47
+ export function findGuidedQuotes(userText: string): string[] {
48
+ const out: string[] = [];
49
+ for (const raw of userText.split(/(?<=[.!?])\s+|\n/)) {
50
+ const s = normWs(raw.replace(/^\s*user:\s*/i, ""));
51
+ if (s.length < 12 || s.length > 2000) continue;
52
+ if (!VALUE_RE.test(s) && !RULE_RE.test(s)) continue;
53
+ // Imperatives scoping THIS job are instructions, not stated facts
54
+ // ("do not create tests"); the capture contract expires them with the task.
55
+ if (/^(do|don't|dont|never create|only touch)\b/i.test(s)) continue;
56
+ const quote =
57
+ s.length > GUIDED_QUOTE_CHARS
58
+ ? normWs(s.slice(0, GUIDED_QUOTE_CHARS).replace(/\s\S*$/, ""))
59
+ : s;
60
+ if (quote.length >= 12 && !out.includes(quote)) out.push(quote);
61
+ // Bound the lane the way injection bounds it (GUIDED_INJECT_CAP): a user
62
+ // message that states five facts is a fixture, not a session.
63
+ if (out.length === 3) break;
64
+ }
65
+ return out;
66
+ }
67
+
68
+ const NUMBERS_RE = /\d+(?:[.,]\d+)?/g;
69
+
70
+ function numbers(s: string): Set<string> {
71
+ return new Set(s.match(NUMBERS_RE) ?? []);
72
+ }
73
+
74
+ // The connective prose a guidance sentence is full of. Kept small on purpose:
75
+ // the point is only to stop a sentence's grammar from counting as topical
76
+ // overlap with everything else in the store.
77
+ const WORD_STOP = new Set([
78
+ "the",
79
+ "and",
80
+ "for",
81
+ "with",
82
+ "that",
83
+ "this",
84
+ "from",
85
+ "have",
86
+ "has",
87
+ "was",
88
+ "were",
89
+ "are",
90
+ "not",
91
+ "only",
92
+ "must",
93
+ "should",
94
+ "would",
95
+ "could",
96
+ "will",
97
+ "shall",
98
+ "then",
99
+ "than",
100
+ "per",
101
+ "via",
102
+ "its",
103
+ ]);
104
+
105
+ /** Content words (length >= 3, letter-initial, so "5.0" never qualifies). */
106
+ function topicWords(s: string): Set<string> {
107
+ return new Set(
108
+ (s.toLowerCase().match(/[a-z][a-z0-9_-]{2,}/g) ?? []).filter(
109
+ (w) => !WORD_STOP.has(w),
110
+ ),
111
+ );
112
+ }
113
+
114
+ function sharesTopic(a: Set<string>, b: Set<string>): boolean {
115
+ for (const w of a) if (b.has(w)) return true;
116
+ return false;
117
+ }
118
+
119
+ /**
120
+ * One row per pre-pass quote. A model candidate that already carries the
121
+ * verbatim quote keeps its phrasing; one that states the same numbers keeps
122
+ * its phrasing and gains the quote + the guided flag EVEN IF the model left
123
+ * the flag off — clearing guidance by omission is exactly the measured miss
124
+ * mode. An unmatched quote becomes a deterministic fallback row, so the
125
+ * emission the model skipped still lands.
126
+ */
127
+ export function mergeGuidedCandidates(
128
+ quotes: string[],
129
+ candidates: CaptureCandidate[],
130
+ ): CaptureCandidate[] {
131
+ const out = [...candidates];
132
+ for (const quote of quotes) {
133
+ const nums = numbers(quote);
134
+ const topics = topicWords(quote);
135
+ // Two boundaries the first version lacked (#364 review):
136
+ // - ONE quote per candidate. Re-matching a candidate that already carries a
137
+ // quote overwrote the first fact, so three user sentences all stating
138
+ // 10.0 stored a single row.
139
+ // - a shared number plus a shared CONTENT word. A number alone matches a
140
+ // version label as happily as a measurement, which marked an unrelated
141
+ // "Release 5.0" row with a refill-threshold quote.
142
+ // The cost is deliberate: a model phrasing that shares no word with the
143
+ // user's sentence now yields an extra fallback row instead of a merge. The
144
+ // fact survives either way; a merge that quotes the wrong fact does not.
145
+ const match = out.find((c) => {
146
+ if (c.original !== undefined) return normWs(c.original) === quote;
147
+ if (normWs(c.content) === quote) return true;
148
+ return (
149
+ nums.size > 0 &&
150
+ [...numbers(c.content)].some((n) => nums.has(n)) &&
151
+ sharesTopic(topicWords(c.content), topics)
152
+ );
153
+ });
154
+ if (match) {
155
+ match.guided = true;
156
+ match.original = quote;
157
+ continue;
158
+ }
159
+ const content = `User-stated guidance: "${quote}"`.slice(0, 600);
160
+ out.push({
161
+ type: "context",
162
+ scope: "user-guidance",
163
+ content,
164
+ guided: true,
165
+ original: quote,
166
+ });
167
+ }
168
+ return out;
169
+ }
170
+
171
+ /**
172
+ * The write-path validator (design §4.3): a guided candidate carrying a
173
+ * quote the user never wrote is refused, not silently stripped — the
174
+ * deterministic pre-pass re-offers the fact with the true quote on the same
175
+ * pass, which makes the miss a retriable event. A guided candidate with NO
176
+ * quote is the model's own judgment and passes (unchanged behavior).
177
+ * Returns the survivors plus the refused quotes for evidence.
178
+ */
179
+ export function validateGuidedQuotes(
180
+ candidates: CaptureCandidate[],
181
+ userText: string,
182
+ ): { kept: CaptureCandidate[]; refused: string[] } {
183
+ const hay = normWs(userText);
184
+ const kept: CaptureCandidate[] = [];
185
+ const refused: string[] = [];
186
+ for (const c of candidates) {
187
+ if (c.guided === true && c.original !== undefined) {
188
+ const q = normWs(c.original);
189
+ if (!hay.includes(q)) {
190
+ refused.push(q);
191
+ continue;
192
+ }
193
+ c.original = q;
194
+ }
195
+ kept.push(c);
196
+ }
197
+ return { kept, refused };
198
+ }
@@ -9,7 +9,17 @@ export function lagSince(messages: unknown, now = Date.now()): number | null {
9
9
  let newest = 0;
10
10
  for (const raw of Array.isArray(messages) ? messages : []) {
11
11
  const m = raw as Record<string, any>;
12
- const at = m?.time?.updated ?? m?.createdAt ?? m?.created ?? m?.timestamp;
12
+ // The real 2.2.x session context carries time.created/time.completed
13
+ // (fixtures/host-session-context-2.2.5.json); time.updated was the only
14
+ // time.* field read, so every live capture_lag line recorded no lag at
15
+ // all. Read the whole family; the legacy flat names stay for old shapes.
16
+ const at =
17
+ m?.time?.updated ??
18
+ m?.time?.completed ??
19
+ m?.time?.created ??
20
+ m?.createdAt ??
21
+ m?.created ??
22
+ m?.timestamp;
13
23
  const ms =
14
24
  typeof at === "number"
15
25
  ? at
@@ -17,6 +17,18 @@ export interface CaptureCandidate {
17
17
  kw?: string[];
18
18
  /** Literal true only when the user stated the fact, not agent inference. */
19
19
  guided?: boolean;
20
+ /** Optional literal comparison metadata, retained only for guided rows. */
21
+ ref?: string;
22
+ claim?: string;
23
+ klass?: "spec" | "behavior";
24
+ /**
25
+ * Verbatim user utterance behind a guided row (bench mystery 2, candidate
26
+ * 4): the capture model's paraphrase of a hint made the bench's exact-text
27
+ * needle miss a row that actually rode. The runtime verifies this against
28
+ * the transcript the model saw — a quote that is not a substring is dropped,
29
+ * so a stored original is the user's own words.
30
+ */
31
+ original?: string;
20
32
  }
21
33
 
22
34
  // Keywords are the vocabulary bridge for the strict-paraphrase wall, mined from
@@ -56,7 +68,18 @@ export function buildCapturePrompt(
56
68
  "- content: one self-contained fact, 20-600 characters, useful in a NEW session.",
57
69
  "- kw: 3-5 search keywords for how a DIFFERENT session would ask for this — synonyms and alternate names, other verb forms, the literal command or file name. They are indexed for retrieval and never shown to a model. Omit (or []) when the content already uses those words.",
58
70
  "- guided: true ONLY when the user STATED this fact in their own words — a value, rate, number, rule or correction that appears in a user: line or the REQUESTS block. Omit guided for anything the agent discovered by itself.",
71
+ '- When guided AND the value names a declared code symbol, also output "ref": that symbol exactly as declared (e.g. "TAX_RATE"), "claim": the user\'s value alone (e.g. "0.0825", at most 32 characters), and "klass": "spec" when the user is the authority on the value (a rate, a requirement) or "behavior" when the row describes how working code behaves. Omit all three when no single declared constant is involved.',
72
+ '- If it is unclear whether the user is specifying a requirement or describing working code, omit "klass". Never guess authority; an unclassified row remains plain guidance without a conflict verdict.',
73
+ '- Worked example (only when the user actually states this requirement): user says "The constant TAX_RATE in src/pricing.ts must be 0.0825." Emit:',
74
+ '{"type":"context","scope":"pricing","content":"The constant TAX_RATE in src/pricing.ts must be 0.0825.","kw":["TAX_RATE","sales tax"],"guided":true,"ref":"TAX_RATE","claim":"0.0825","klass":"spec"}',
59
75
  "- A guided row states the user's value or rule and NOTHING more: never claim what hidden tests, graders or suites 'encode' — you cannot see them, and the claim makes the row impossible to check.",
76
+ // Mystery 2 (FINDINGS §3): the guided hint reached pass 2 on the wire in
77
+ // 3 of 4 t3 runs, and the miss could not be attributed — capture may have
78
+ // paraphrased the hint, so the bench's exact-text needle missed a row that
79
+ // actually rode. Storing the user's verbatim words makes the needle match
80
+ // deterministic; the runtime drops any quote that is not a transcript
81
+ // substring, so this field can only ever carry what the user actually said.
82
+ '- When guided, also output "original": the user\'s own words for this fact, copied VERBATIM from a user: line or the REQUESTS block — no paraphrase, no reordering, at most 300 characters. Omit original when no single user line states the fact.',
60
83
  "- Keep: decisions made, working commands, user preferences, blockers hit, durable context, conventions.",
61
84
  "- Skip: anything derivable from the code or git history, small talk, and details that only mattered inside this conversation.",
62
85
  ...(knownList