agent-recall-core 3.4.46 → 3.4.47

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 (95) hide show
  1. package/dist/helpers/handoff.d.ts.map +1 -1
  2. package/dist/helpers/handoff.js +17 -9
  3. package/dist/helpers/handoff.js.map +1 -1
  4. package/dist/helpers/journal-files.d.ts +24 -1
  5. package/dist/helpers/journal-files.d.ts.map +1 -1
  6. package/dist/helpers/journal-files.js +29 -10
  7. package/dist/helpers/journal-files.js.map +1 -1
  8. package/dist/helpers/journal-filter.d.ts +25 -0
  9. package/dist/helpers/journal-filter.d.ts.map +1 -1
  10. package/dist/helpers/journal-filter.js +12 -1
  11. package/dist/helpers/journal-filter.js.map +1 -1
  12. package/dist/index.d.ts +12 -4
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +33 -4
  15. package/dist/index.js.map +1 -1
  16. package/dist/retrieval/candidates.d.ts +314 -0
  17. package/dist/retrieval/candidates.d.ts.map +1 -0
  18. package/dist/retrieval/candidates.js +321 -0
  19. package/dist/retrieval/candidates.js.map +1 -0
  20. package/dist/retrieval/contradiction.d.ts +232 -0
  21. package/dist/retrieval/contradiction.d.ts.map +1 -0
  22. package/dist/retrieval/contradiction.js +320 -0
  23. package/dist/retrieval/contradiction.js.map +1 -0
  24. package/dist/retrieval/query-memory.d.ts +419 -0
  25. package/dist/retrieval/query-memory.d.ts.map +1 -0
  26. package/dist/retrieval/query-memory.js +1068 -0
  27. package/dist/retrieval/query-memory.js.map +1 -0
  28. package/dist/retrieval/scope.d.ts +75 -0
  29. package/dist/retrieval/scope.d.ts.map +1 -0
  30. package/dist/retrieval/scope.js +91 -0
  31. package/dist/retrieval/scope.js.map +1 -0
  32. package/dist/storage/corrections.d.ts +31 -1
  33. package/dist/storage/corrections.d.ts.map +1 -1
  34. package/dist/storage/corrections.js +34 -1
  35. package/dist/storage/corrections.js.map +1 -1
  36. package/dist/storage/lifecycle-telemetry.d.ts +20 -5
  37. package/dist/storage/lifecycle-telemetry.d.ts.map +1 -1
  38. package/dist/storage/lifecycle-telemetry.js +16 -5
  39. package/dist/storage/lifecycle-telemetry.js.map +1 -1
  40. package/dist/storage/session.d.ts +28 -1
  41. package/dist/storage/session.d.ts.map +1 -1
  42. package/dist/storage/session.js +41 -8
  43. package/dist/storage/session.js.map +1 -1
  44. package/dist/supabase/recall-backend.d.ts +25 -2
  45. package/dist/supabase/recall-backend.d.ts.map +1 -1
  46. package/dist/supabase/recall-backend.js +82 -21
  47. package/dist/supabase/recall-backend.js.map +1 -1
  48. package/dist/supabase/sync.d.ts +41 -0
  49. package/dist/supabase/sync.d.ts.map +1 -1
  50. package/dist/supabase/sync.js +46 -0
  51. package/dist/supabase/sync.js.map +1 -1
  52. package/dist/tools-logic/check.d.ts.map +1 -1
  53. package/dist/tools-logic/check.js +62 -36
  54. package/dist/tools-logic/check.js.map +1 -1
  55. package/dist/tools-logic/drill-down.d.ts +24 -0
  56. package/dist/tools-logic/drill-down.d.ts.map +1 -1
  57. package/dist/tools-logic/drill-down.js +36 -0
  58. package/dist/tools-logic/drill-down.js.map +1 -1
  59. package/dist/tools-logic/journal-cold-start.d.ts.map +1 -1
  60. package/dist/tools-logic/journal-cold-start.js +48 -9
  61. package/dist/tools-logic/journal-cold-start.js.map +1 -1
  62. package/dist/tools-logic/journal-list.d.ts +42 -0
  63. package/dist/tools-logic/journal-list.d.ts.map +1 -1
  64. package/dist/tools-logic/journal-list.js +60 -10
  65. package/dist/tools-logic/journal-list.js.map +1 -1
  66. package/dist/tools-logic/journal-read.d.ts.map +1 -1
  67. package/dist/tools-logic/journal-read.js +22 -13
  68. package/dist/tools-logic/journal-read.js.map +1 -1
  69. package/dist/tools-logic/journal-search.d.ts +58 -0
  70. package/dist/tools-logic/journal-search.d.ts.map +1 -1
  71. package/dist/tools-logic/journal-search.js +123 -92
  72. package/dist/tools-logic/journal-search.js.map +1 -1
  73. package/dist/tools-logic/palace-search.d.ts.map +1 -1
  74. package/dist/tools-logic/palace-search.js +30 -11
  75. package/dist/tools-logic/palace-search.js.map +1 -1
  76. package/dist/tools-logic/palace-walk.d.ts +10 -0
  77. package/dist/tools-logic/palace-walk.d.ts.map +1 -1
  78. package/dist/tools-logic/palace-walk.js +25 -16
  79. package/dist/tools-logic/palace-walk.js.map +1 -1
  80. package/dist/tools-logic/recall-insight.d.ts +20 -0
  81. package/dist/tools-logic/recall-insight.d.ts.map +1 -1
  82. package/dist/tools-logic/recall-insight.js +12 -1
  83. package/dist/tools-logic/recall-insight.js.map +1 -1
  84. package/dist/tools-logic/session-end.d.ts.map +1 -1
  85. package/dist/tools-logic/session-end.js +23 -7
  86. package/dist/tools-logic/session-end.js.map +1 -1
  87. package/dist/tools-logic/session-start.d.ts +85 -0
  88. package/dist/tools-logic/session-start.d.ts.map +1 -1
  89. package/dist/tools-logic/session-start.js +245 -108
  90. package/dist/tools-logic/session-start.js.map +1 -1
  91. package/dist/tools-logic/smart-recall.d.ts +87 -62
  92. package/dist/tools-logic/smart-recall.d.ts.map +1 -1
  93. package/dist/tools-logic/smart-recall.js +159 -510
  94. package/dist/tools-logic/smart-recall.js.map +1 -1
  95. package/package.json +1 -1
@@ -0,0 +1,232 @@
1
+ /**
2
+ * retrieval/contradiction.ts — the CONTRADICTION pipeline stage (Wave 5a,
3
+ * 2026-08-31, reports/2026-08-31-pipe-w5a-contradiction-report.md).
4
+ *
5
+ * ── W5a SALVAGE (2026-08-31, same date, "## W5a salvage" section of the same
6
+ * report) ── An INDEPENDENT review (separate from — and after — the W5a
7
+ * code-reviewer pass named below) passed the mechanism (down-rank+annotate+
8
+ * never-drop, the re-sort→RRF propagation) but found the token grammar's
9
+ * status/kv branches were false-positive-PRONE in a way that actively
10
+ * defeats the stage's own safety intent, not merely "wider than ideal":
11
+ * - HIGH-1 (safeguard defeat): the status branch extracts categories via
12
+ * `extractStatusTokens`, which maps "blocked"/"stuck" to the SAME
13
+ * category (both → "blocked") — so category-EQUIVALENT common phrasing
14
+ * ("status: blocked" vs "status: stuck", genuinely the same fact) should
15
+ * never conflict. It didn't, by that safeguard's own design — but the
16
+ * status branch is un-keyed (see below) and the KV branch's own separate
17
+ * "key: value" extraction treats "status" as a literal KV KEY with
18
+ * "blocked"/"stuck" as different raw VALUES, flagging a conflict the
19
+ * status-category-equivalence check was specifically built to prevent.
20
+ * Two branches reusing overlapping vocabulary defeated each other.
21
+ * - HIGH-2 (generic-key false positive): both the kv branch and (to a
22
+ * narrower degree) the version branch key off whatever single word
23
+ * immediately precedes the value — "priority: high" (a marketing
24
+ * decision) vs "priority: low" (an unrelated cleanup task) share the
25
+ * generic key `priority` and got flagged conflicting despite being
26
+ * about entirely different topics; "key match" gave no topical
27
+ * protection at all for common one-word keys.
28
+ * - HIGH-3 (invisible annotation): `supersededBy`/`conflictsWith` never
29
+ * reached `SmartRecallResultItem`/`JournalSearchResult.results` — fixed
30
+ * separately, see smart-recall.ts's `localRecallSearch` and
31
+ * journal-search.ts's `journalSearch` field-list maps.
32
+ *
33
+ * FIX (this file): restrict `grammarConflict` to `extractVersionTokens`
34
+ * ONLY — status and kv detection are REMOVED from this module entirely
35
+ * (not just gated/pre-filtered). Semver (`\d+\.\d+\.\d+`) is a much
36
+ * narrower, more self-describing pattern than a bare "word: word" or
37
+ * status-category match — a shared key + differing semver value is a
38
+ * strong, low-false-positive signal of a genuine version supersession, and
39
+ * removing the other two branches removes HIGH-1 (the category-vs-KV
40
+ * cross-branch defeat cannot happen when the KV branch does not exist) and
41
+ * the dominant real-world instance of HIGH-2 (KV keys off ANY generic
42
+ * one-word label — "priority", "status", "mode", "env" — a pattern that
43
+ * recurs constantly in prose; a version-shaped `\d+\.\d+\.\d+` collision
44
+ * between two topically-unrelated candidates is comparatively rare, though
45
+ * not literally impossible — e.g. a shared generic key like "step 1.2.3" vs
46
+ * "step 5.6.7" — an acknowledged, narrower residual risk, not claimed to be
47
+ * zero). `extractStatusTokens`/`extractKVTokens` remain exported from
48
+ * `helpers/conflict-scan.ts` and are UNCHANGED there — `conflict-scan.ts`'s
49
+ * own `scanForConflicts` (the separate smart-remember pre-save warning flow)
50
+ * and `tools-logic/supersession.ts`'s `compareForConflicts` (the separate
51
+ * `ar correct` CorrectionRecord flow) both still use all three extractors;
52
+ * this restriction applies ONLY to this module's pairwise same-tier
53
+ * retrieval-time comparison, not to those other two, structurally distinct
54
+ * consumers.
55
+ *
56
+ * WHY THIS IS ITS OWN MODULE, not a function inside query-memory.ts: mirrors
57
+ * `retrieval/scope.ts`'s own precedent — a small, dependency-light, pure
58
+ * comparator that query-memory.ts (this wave) consumes, and that a later
59
+ * wave's caller (e.g. a future `recallInsight()`-style direct consumer) can
60
+ * import without creating an import cycle back into query-memory.ts (which
61
+ * already imports FROM tools-logic — see scope.ts's header for the exact
62
+ * cycle this pattern avoids).
63
+ *
64
+ * WHAT THIS DOES NOT DO (scope, read the eval fixtures before extending):
65
+ * this comparator reuses ONLY `helpers/conflict-scan.ts`'s `extractVersionTokens`
66
+ * semver extractor (post-salvage — see above; status/kv were removed, not
67
+ * merely descoped from the start). It does NOT detect arbitrary
68
+ * semantic-prose contradictions ("we fully migrated OFF Postgres to
69
+ * CockroachDB" vs "we use Postgres") — confirmed empirically against the
70
+ * redteam eval fixture (reports/2026-08-18-eval-redteam.md HIGH-2) while
71
+ * resolving this wave's pre-loaded Challenge A: the version extractor
72
+ * produces no matching key with differing values for that pair at all (no
73
+ * version numbers appear in either sentence). Prose-semantic contradiction
74
+ * detection is a genuinely harder, separate problem (conflict-scan.ts's own
75
+ * header already says so) and is explicitly OUT of this wave's scope — see
76
+ * the wave report's "prose-semantic gap" follow-up section, not silently
77
+ * absorbed into this grammar.
78
+ *
79
+ * ALGORITHM: pairwise, O(n²) over one tier's already-scored item list (n is
80
+ * a per-tier result count, bounded by `perTierLimit`, never the full corpus).
81
+ * For every pair (i, j):
82
+ * 1. GRAMMAR CHECK — same key across version tokens, different semver
83
+ * value → conflict. Symmetric (order of i/j does not matter for
84
+ * whether a conflict exists, only for which side is stale — see 2).
85
+ * 2. DIRECTION — decide which side is stale, if determinable at all:
86
+ * - both items carry a `date` and the dates differ → the OLDER
87
+ * `date` is superseded by the newer one (journal's own authored-
88
+ * date semantics; this only requires "the two dates differ", so it
89
+ * applies to any date-bearing tier, not journal-specifically —
90
+ * journal simply always has a `date`, so this branch always fires
91
+ * for it unless two journal hits share the exact SAME date).
92
+ * - dates are equal, or one/both undefined, AND both items carry an
93
+ * `order` that differs → the LOWER `order` is superseded by the
94
+ * HIGHER `order` (append-order tie-break: palace's same-day-tie
95
+ * policy, per this wave's Challenge B — `order` is populated from
96
+ * the room file's LINE NUMBER for palace items only; journal items
97
+ * are deliberately NOT given an `order` value by this wave's
98
+ * query-memory.ts wiring, so a same-date journal tie falls through
99
+ * to the next bullet instead of guessing off line position, per
100
+ * the wave brief's literal instruction).
101
+ * - neither resolves → AMBIGUOUS: both sides are annotated as
102
+ * conflicting with each other, NEITHER is marked superseded, and
103
+ * (by construction, see query-memory.ts's stage) neither is
104
+ * penalized. Never guess which side to demote from no signal.
105
+ *
106
+ * NEVER DROPS: this module only classifies relations between items already
107
+ * present in the input array — it never removes, reorders, or mutates the
108
+ * input array itself (that is query-memory.ts's stage's job, immediately
109
+ * downstream). A caller that ignores this module's output entirely gets
110
+ * back the exact same candidate set it passed in.
111
+ *
112
+ * ── HIGH-PRECISION GRAMMAR (pre-ship red-team fix, STEP 4b, 2026-09-01,
113
+ * wave/pipe-w5fix — correctness red-team, reports/2026-09-01-pipe-w5fix-
114
+ * report.md) ──
115
+ * The W5a-salvage grammar above (line ~45-46) already NAMED "step 1.2.3 vs
116
+ * step 5.6.7" as "an acknowledged, narrower residual risk, not claimed to be
117
+ * zero" — a second, independent (correctness, not security) red-team then
118
+ * PROVED that risk is much wider and actively harmful, not narrow: the
119
+ * plain `helpers/conflict-scan.ts` `extractVersionTokens` extractor's
120
+ * `(?:v|@|version\s+)?` marker is OPTIONAL, so ANY bare `N.N.N`-shaped
121
+ * digit run gets treated as a version — which false-positives on:
122
+ * - IP addresses: "at 10.0.0.1" / "at 10.0.1.5" (the first 3 octets of a
123
+ * dotted-quad ARE a valid `\d+\.\d+\.\d+` match on their own).
124
+ * - dot-formatted dates: "08.15.2026" / "08.16.2026" (MM.DD.YYYY is
125
+ * structurally IDENTICAL to a semver's `\d+\.\d+\.\d+` shape — nothing
126
+ * about the digits themselves can distinguish a date from a version).
127
+ * - dotted step/section numbers: "step 1.2.3" / "step 5.6.7".
128
+ * Combined with the ORIGINAL (pre-STEP-4a) down-rank+re-sort mechanism, a
129
+ * false-positive match like this didn't just add noise — it actively
130
+ * INVERTED ranking, demoting a correct, unrelated fact below a weaker match.
131
+ * STEP 4a (query-memory.ts's `applyContradictionStage`) already made a false
132
+ * positive here harmless (annotate-only, never reorders/rescores) — this
133
+ * fix is the SECOND, independent layer: shrink how often the false
134
+ * positive fires AT ALL, so even the harmless annotation is rare and
135
+ * meaningful rather than routinely wrong.
136
+ *
137
+ * `extractHighPrecisionVersionTokens` below is a LOCAL, module-scoped
138
+ * extractor — a modified copy of `extractVersionTokens`'s regex, NOT an
139
+ * edit to the shared `helpers/conflict-scan.ts` export. `extractVersionTokens`
140
+ * itself is UNCHANGED and remains exactly as permissive as before for its
141
+ * OTHER two callers (`conflict-scan.ts`'s own `scanForConflicts` — the
142
+ * smart-remember pre-save warning flow — and `tools-logic/supersession.ts`'s
143
+ * `compareForConflicts` — the `ar correct` CorrectionRecord flow), which are
144
+ * structurally distinct consumers this fix's scope (the retrieval area) does
145
+ * not touch and whose own false-positive tolerance was never in question
146
+ * here (see this file's original header, "FIX (this file)", for why
147
+ * `contradiction.ts` choosing a narrower grammar than `conflict-scan.ts`
148
+ * offers was already the file's own precedent).
149
+ *
150
+ * THE TIGHTENING: require an explicit version marker (`v`, `@`, `ver`,
151
+ * `version`, or `#`) IMMEDIATELY adjacent to the digits, AND reject a
152
+ * trailing 4th dot-group (`(?!\.\d)`, an IPv4-shape defense-in-depth layered
153
+ * on top of the marker requirement, in case a marker-adjacent IP ever
154
+ * occurs, e.g. "v10.0.0.1"). Neither an IP address, a plain date, nor a
155
+ * bare "step N.N.N" carries any of these markers in ordinary prose, so all
156
+ * three false-positive classes above no longer extract a token at all —
157
+ * verified empirically (node REPL, this wave's own report) against every
158
+ * named case. The real L1-C1 case ("AgentRecall version 3.5.0" / "AgentRecall
159
+ * version 3.4.41") keeps working: the word "version" IS the marker. See the
160
+ * PART E test suite (`query-memory-pipeline.test.mjs`) for the fixture-level
161
+ * proof of both the false-positive exclusions and the still-detected real
162
+ * case.
163
+ *
164
+ * ACCEPTED RECALL LOSS (code-review LOW note, 2026-09-01, not a regression —
165
+ * precision over recall is this fix's explicit brief): the `(?!\.\d)`
166
+ * IPv4-shape guard also excludes a genuine 4-COMPONENT version string (e.g.
167
+ * a Windows-style "3.5.0.1" vs "3.5.0.2") — the same lookahead cannot tell
168
+ * "this is a 4-octet IP" from "this is a 4-part semver" any more than the
169
+ * plain extractor's digits alone could tell a date from a version. AgentRecall's
170
+ * own versioning (and this stage's own worked example) is 3-part, so this is
171
+ * a narrow, acceptable trade — a missed 4-component version conflict decays
172
+ * away naturally (recency still favors the newer mention); a false-positive
173
+ * IP match would not have.
174
+ */
175
+ /**
176
+ * The minimal shape this comparator needs from a candidate — deliberately
177
+ * NOT `QueryMemoryItem` itself, so this module has zero dependency on
178
+ * query-memory.ts (avoiding the import-cycle query-memory.ts's own header
179
+ * already worries about for scope.ts, and keeping this module trivially
180
+ * unit-testable without any pipeline machinery).
181
+ */
182
+ export interface ContradictionItem {
183
+ /** Text the grammar extractors scan — callers typically pass `${title} ${excerpt}`. */
184
+ text: string;
185
+ /** Best-effort ISO date (YYYY-MM-DD). Absent/unparseable dates never
186
+ * resolve a direction on their own — see DIRECTION above. */
187
+ date?: string;
188
+ /** Append-order signal (e.g. a room file's line number). Only meaningful
189
+ * as a same-tier, same-day tie-break — see DIRECTION above. A caller that
190
+ * never wants order-based tie-breaking (this wave's journal wiring) simply
191
+ * omits it. */
192
+ order?: number;
193
+ }
194
+ export interface ContradictionResult {
195
+ /**
196
+ * index -> the OTHER indices this index's item conflicts with (grammar
197
+ * match found), REGARDLESS of whether a direction could be resolved.
198
+ * Symmetric: if `conflictsWith.get(i)` contains `j`, `conflictsWith.get(j)`
199
+ * contains `i`. This is the full annotation set — a caller uses this for
200
+ * the additive `conflictsWith` field even when no `supersededBy` could be
201
+ * determined (the ambiguous, down-rank-neither case).
202
+ */
203
+ conflictsWith: Map<number, number[]>;
204
+ /**
205
+ * index of the STALE item -> index of the item that supersedes it. Only
206
+ * populated for pairs where a direction was confidently resolved (see
207
+ * DIRECTION above). An index present here is a candidate for down-
208
+ * ranking; an index present ONLY in `conflictsWith` (never as a key here)
209
+ * must be annotated but NOT penalized — the ambiguous-tie safety
210
+ * guarantee this stage exists to prove.
211
+ *
212
+ * If more than one sibling supersedes the same stale item (3+ conflicting
213
+ * items in one tier), this keeps the MOST CURRENT superseder found (the
214
+ * one that would itself win a direct pairwise comparison against any
215
+ * earlier candidate), not simply the last one processed.
216
+ */
217
+ supersededBy: Map<number, number>;
218
+ }
219
+ /**
220
+ * Pairwise contradiction scan over one tier's candidate list. O(n²) — the
221
+ * caller (query-memory.ts) is expected to run this AFTER tokenize+score
222
+ * (so `items.length` is already bounded by `perTierLimit`, not the full
223
+ * on-disk corpus) and to skip tiers with fewer than 2 items (nothing to
224
+ * compare) or with no date signal at all (this wave: the insight tier).
225
+ *
226
+ * Never drops, never reorders, never mutates `items` — returns relations
227
+ * ONLY. The caller decides what to do with them (annotate + down-rank,
228
+ * per this wave's brief; a future caller could choose differently without
229
+ * this module changing).
230
+ */
231
+ export declare function detectContradictions(items: ContradictionItem[]): ContradictionResult;
232
+ //# sourceMappingURL=contradiction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contradiction.d.ts","sourceRoot":"","sources":["../../src/retrieval/contradiction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6KG;AAcH;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;IACb;kEAC8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;oBAGgB;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;;;;OAOG;IACH,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACrC;;;;;;;;;;;;OAYG;IACH,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AA4GD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,mBAAmB,CAmCpF"}
@@ -0,0 +1,320 @@
1
+ /**
2
+ * retrieval/contradiction.ts — the CONTRADICTION pipeline stage (Wave 5a,
3
+ * 2026-08-31, reports/2026-08-31-pipe-w5a-contradiction-report.md).
4
+ *
5
+ * ── W5a SALVAGE (2026-08-31, same date, "## W5a salvage" section of the same
6
+ * report) ── An INDEPENDENT review (separate from — and after — the W5a
7
+ * code-reviewer pass named below) passed the mechanism (down-rank+annotate+
8
+ * never-drop, the re-sort→RRF propagation) but found the token grammar's
9
+ * status/kv branches were false-positive-PRONE in a way that actively
10
+ * defeats the stage's own safety intent, not merely "wider than ideal":
11
+ * - HIGH-1 (safeguard defeat): the status branch extracts categories via
12
+ * `extractStatusTokens`, which maps "blocked"/"stuck" to the SAME
13
+ * category (both → "blocked") — so category-EQUIVALENT common phrasing
14
+ * ("status: blocked" vs "status: stuck", genuinely the same fact) should
15
+ * never conflict. It didn't, by that safeguard's own design — but the
16
+ * status branch is un-keyed (see below) and the KV branch's own separate
17
+ * "key: value" extraction treats "status" as a literal KV KEY with
18
+ * "blocked"/"stuck" as different raw VALUES, flagging a conflict the
19
+ * status-category-equivalence check was specifically built to prevent.
20
+ * Two branches reusing overlapping vocabulary defeated each other.
21
+ * - HIGH-2 (generic-key false positive): both the kv branch and (to a
22
+ * narrower degree) the version branch key off whatever single word
23
+ * immediately precedes the value — "priority: high" (a marketing
24
+ * decision) vs "priority: low" (an unrelated cleanup task) share the
25
+ * generic key `priority` and got flagged conflicting despite being
26
+ * about entirely different topics; "key match" gave no topical
27
+ * protection at all for common one-word keys.
28
+ * - HIGH-3 (invisible annotation): `supersededBy`/`conflictsWith` never
29
+ * reached `SmartRecallResultItem`/`JournalSearchResult.results` — fixed
30
+ * separately, see smart-recall.ts's `localRecallSearch` and
31
+ * journal-search.ts's `journalSearch` field-list maps.
32
+ *
33
+ * FIX (this file): restrict `grammarConflict` to `extractVersionTokens`
34
+ * ONLY — status and kv detection are REMOVED from this module entirely
35
+ * (not just gated/pre-filtered). Semver (`\d+\.\d+\.\d+`) is a much
36
+ * narrower, more self-describing pattern than a bare "word: word" or
37
+ * status-category match — a shared key + differing semver value is a
38
+ * strong, low-false-positive signal of a genuine version supersession, and
39
+ * removing the other two branches removes HIGH-1 (the category-vs-KV
40
+ * cross-branch defeat cannot happen when the KV branch does not exist) and
41
+ * the dominant real-world instance of HIGH-2 (KV keys off ANY generic
42
+ * one-word label — "priority", "status", "mode", "env" — a pattern that
43
+ * recurs constantly in prose; a version-shaped `\d+\.\d+\.\d+` collision
44
+ * between two topically-unrelated candidates is comparatively rare, though
45
+ * not literally impossible — e.g. a shared generic key like "step 1.2.3" vs
46
+ * "step 5.6.7" — an acknowledged, narrower residual risk, not claimed to be
47
+ * zero). `extractStatusTokens`/`extractKVTokens` remain exported from
48
+ * `helpers/conflict-scan.ts` and are UNCHANGED there — `conflict-scan.ts`'s
49
+ * own `scanForConflicts` (the separate smart-remember pre-save warning flow)
50
+ * and `tools-logic/supersession.ts`'s `compareForConflicts` (the separate
51
+ * `ar correct` CorrectionRecord flow) both still use all three extractors;
52
+ * this restriction applies ONLY to this module's pairwise same-tier
53
+ * retrieval-time comparison, not to those other two, structurally distinct
54
+ * consumers.
55
+ *
56
+ * WHY THIS IS ITS OWN MODULE, not a function inside query-memory.ts: mirrors
57
+ * `retrieval/scope.ts`'s own precedent — a small, dependency-light, pure
58
+ * comparator that query-memory.ts (this wave) consumes, and that a later
59
+ * wave's caller (e.g. a future `recallInsight()`-style direct consumer) can
60
+ * import without creating an import cycle back into query-memory.ts (which
61
+ * already imports FROM tools-logic — see scope.ts's header for the exact
62
+ * cycle this pattern avoids).
63
+ *
64
+ * WHAT THIS DOES NOT DO (scope, read the eval fixtures before extending):
65
+ * this comparator reuses ONLY `helpers/conflict-scan.ts`'s `extractVersionTokens`
66
+ * semver extractor (post-salvage — see above; status/kv were removed, not
67
+ * merely descoped from the start). It does NOT detect arbitrary
68
+ * semantic-prose contradictions ("we fully migrated OFF Postgres to
69
+ * CockroachDB" vs "we use Postgres") — confirmed empirically against the
70
+ * redteam eval fixture (reports/2026-08-18-eval-redteam.md HIGH-2) while
71
+ * resolving this wave's pre-loaded Challenge A: the version extractor
72
+ * produces no matching key with differing values for that pair at all (no
73
+ * version numbers appear in either sentence). Prose-semantic contradiction
74
+ * detection is a genuinely harder, separate problem (conflict-scan.ts's own
75
+ * header already says so) and is explicitly OUT of this wave's scope — see
76
+ * the wave report's "prose-semantic gap" follow-up section, not silently
77
+ * absorbed into this grammar.
78
+ *
79
+ * ALGORITHM: pairwise, O(n²) over one tier's already-scored item list (n is
80
+ * a per-tier result count, bounded by `perTierLimit`, never the full corpus).
81
+ * For every pair (i, j):
82
+ * 1. GRAMMAR CHECK — same key across version tokens, different semver
83
+ * value → conflict. Symmetric (order of i/j does not matter for
84
+ * whether a conflict exists, only for which side is stale — see 2).
85
+ * 2. DIRECTION — decide which side is stale, if determinable at all:
86
+ * - both items carry a `date` and the dates differ → the OLDER
87
+ * `date` is superseded by the newer one (journal's own authored-
88
+ * date semantics; this only requires "the two dates differ", so it
89
+ * applies to any date-bearing tier, not journal-specifically —
90
+ * journal simply always has a `date`, so this branch always fires
91
+ * for it unless two journal hits share the exact SAME date).
92
+ * - dates are equal, or one/both undefined, AND both items carry an
93
+ * `order` that differs → the LOWER `order` is superseded by the
94
+ * HIGHER `order` (append-order tie-break: palace's same-day-tie
95
+ * policy, per this wave's Challenge B — `order` is populated from
96
+ * the room file's LINE NUMBER for palace items only; journal items
97
+ * are deliberately NOT given an `order` value by this wave's
98
+ * query-memory.ts wiring, so a same-date journal tie falls through
99
+ * to the next bullet instead of guessing off line position, per
100
+ * the wave brief's literal instruction).
101
+ * - neither resolves → AMBIGUOUS: both sides are annotated as
102
+ * conflicting with each other, NEITHER is marked superseded, and
103
+ * (by construction, see query-memory.ts's stage) neither is
104
+ * penalized. Never guess which side to demote from no signal.
105
+ *
106
+ * NEVER DROPS: this module only classifies relations between items already
107
+ * present in the input array — it never removes, reorders, or mutates the
108
+ * input array itself (that is query-memory.ts's stage's job, immediately
109
+ * downstream). A caller that ignores this module's output entirely gets
110
+ * back the exact same candidate set it passed in.
111
+ *
112
+ * ── HIGH-PRECISION GRAMMAR (pre-ship red-team fix, STEP 4b, 2026-09-01,
113
+ * wave/pipe-w5fix — correctness red-team, reports/2026-09-01-pipe-w5fix-
114
+ * report.md) ──
115
+ * The W5a-salvage grammar above (line ~45-46) already NAMED "step 1.2.3 vs
116
+ * step 5.6.7" as "an acknowledged, narrower residual risk, not claimed to be
117
+ * zero" — a second, independent (correctness, not security) red-team then
118
+ * PROVED that risk is much wider and actively harmful, not narrow: the
119
+ * plain `helpers/conflict-scan.ts` `extractVersionTokens` extractor's
120
+ * `(?:v|@|version\s+)?` marker is OPTIONAL, so ANY bare `N.N.N`-shaped
121
+ * digit run gets treated as a version — which false-positives on:
122
+ * - IP addresses: "at 10.0.0.1" / "at 10.0.1.5" (the first 3 octets of a
123
+ * dotted-quad ARE a valid `\d+\.\d+\.\d+` match on their own).
124
+ * - dot-formatted dates: "08.15.2026" / "08.16.2026" (MM.DD.YYYY is
125
+ * structurally IDENTICAL to a semver's `\d+\.\d+\.\d+` shape — nothing
126
+ * about the digits themselves can distinguish a date from a version).
127
+ * - dotted step/section numbers: "step 1.2.3" / "step 5.6.7".
128
+ * Combined with the ORIGINAL (pre-STEP-4a) down-rank+re-sort mechanism, a
129
+ * false-positive match like this didn't just add noise — it actively
130
+ * INVERTED ranking, demoting a correct, unrelated fact below a weaker match.
131
+ * STEP 4a (query-memory.ts's `applyContradictionStage`) already made a false
132
+ * positive here harmless (annotate-only, never reorders/rescores) — this
133
+ * fix is the SECOND, independent layer: shrink how often the false
134
+ * positive fires AT ALL, so even the harmless annotation is rare and
135
+ * meaningful rather than routinely wrong.
136
+ *
137
+ * `extractHighPrecisionVersionTokens` below is a LOCAL, module-scoped
138
+ * extractor — a modified copy of `extractVersionTokens`'s regex, NOT an
139
+ * edit to the shared `helpers/conflict-scan.ts` export. `extractVersionTokens`
140
+ * itself is UNCHANGED and remains exactly as permissive as before for its
141
+ * OTHER two callers (`conflict-scan.ts`'s own `scanForConflicts` — the
142
+ * smart-remember pre-save warning flow — and `tools-logic/supersession.ts`'s
143
+ * `compareForConflicts` — the `ar correct` CorrectionRecord flow), which are
144
+ * structurally distinct consumers this fix's scope (the retrieval area) does
145
+ * not touch and whose own false-positive tolerance was never in question
146
+ * here (see this file's original header, "FIX (this file)", for why
147
+ * `contradiction.ts` choosing a narrower grammar than `conflict-scan.ts`
148
+ * offers was already the file's own precedent).
149
+ *
150
+ * THE TIGHTENING: require an explicit version marker (`v`, `@`, `ver`,
151
+ * `version`, or `#`) IMMEDIATELY adjacent to the digits, AND reject a
152
+ * trailing 4th dot-group (`(?!\.\d)`, an IPv4-shape defense-in-depth layered
153
+ * on top of the marker requirement, in case a marker-adjacent IP ever
154
+ * occurs, e.g. "v10.0.0.1"). Neither an IP address, a plain date, nor a
155
+ * bare "step N.N.N" carries any of these markers in ordinary prose, so all
156
+ * three false-positive classes above no longer extract a token at all —
157
+ * verified empirically (node REPL, this wave's own report) against every
158
+ * named case. The real L1-C1 case ("AgentRecall version 3.5.0" / "AgentRecall
159
+ * version 3.4.41") keeps working: the word "version" IS the marker. See the
160
+ * PART E test suite (`query-memory-pipeline.test.mjs`) for the fixture-level
161
+ * proof of both the false-positive exclusions and the still-detected real
162
+ * case.
163
+ *
164
+ * ACCEPTED RECALL LOSS (code-review LOW note, 2026-09-01, not a regression —
165
+ * precision over recall is this fix's explicit brief): the `(?!\.\d)`
166
+ * IPv4-shape guard also excludes a genuine 4-COMPONENT version string (e.g.
167
+ * a Windows-style "3.5.0.1" vs "3.5.0.2") — the same lookahead cannot tell
168
+ * "this is a 4-octet IP" from "this is a 4-part semver" any more than the
169
+ * plain extractor's digits alone could tell a date from a version. AgentRecall's
170
+ * own versioning (and this stage's own worked example) is 3-part, so this is
171
+ * a narrow, acceptable trade — a missed 4-component version conflict decays
172
+ * away naturally (recency still favors the newer mention); a false-positive
173
+ * IP match would not have.
174
+ */
175
+ // ---------------------------------------------------------------------------
176
+ // Grammar check — reuses conflict-scan.ts's token extractors verbatim; does
177
+ // not fork or reimplement the grammar (see this file's header).
178
+ // ---------------------------------------------------------------------------
179
+ /**
180
+ * True iff `a` and `b` share a version-extracted key with a differing semver
181
+ * value. Symmetric.
182
+ *
183
+ * W5a SALVAGE (2026-08-31): this function previously also checked
184
+ * status-category tokens and generic key-value tokens (`extractStatusTokens`/
185
+ * `extractKVTokens`) — REMOVED per an independent review's HIGH-1/HIGH-2
186
+ * findings (see this file's header for the full reasoning): the status
187
+ * branch's un-keyed, both-directions category comparison could be defeated
188
+ * by the KV branch treating the SAME words ("status: blocked" vs "status:
189
+ * stuck") as differing raw values even though the status branch's own
190
+ * category map treats them as equivalent (HIGH-1); and the KV branch's
191
+ * generic single-word key ("priority", "mode", "env", ...) gave no topical
192
+ * protection at all, flagging topically-unrelated candidates that merely
193
+ * happened to share a common label (HIGH-2). Neither branch is reinstated
194
+ * with a topical pre-filter this wave — that would be new, unscoped grammar
195
+ * behavior; the fix is to not run the two branches at all, not to patch them.
196
+ *
197
+ * STEP 4b (2026-09-01): now backed by `extractHighPrecisionVersionTokens`
198
+ * (this file, below) instead of `helpers/conflict-scan.ts`'s plain
199
+ * `extractVersionTokens` — see this file's header, "HIGH-PRECISION GRAMMAR",
200
+ * for the false-positive classes (IP addresses, dot-dates, dotted step
201
+ * numbers) this closes and why the real L1-C1 version case is unaffected.
202
+ */
203
+ function grammarConflict(a, b) {
204
+ const av = extractHighPrecisionVersionTokens(a.text);
205
+ if (av.size === 0)
206
+ return false;
207
+ const bv = extractHighPrecisionVersionTokens(b.text);
208
+ for (const [key, val] of av) {
209
+ const bval = bv.get(key);
210
+ if (bval && bval !== val)
211
+ return true;
212
+ }
213
+ return false;
214
+ }
215
+ /**
216
+ * High-precision version-token extractor — a NARROWER, module-local variant
217
+ * of `helpers/conflict-scan.ts`'s `extractVersionTokens` (see this file's
218
+ * header, "HIGH-PRECISION GRAMMAR", for the full false-positive analysis
219
+ * this exists to close; that shared export is intentionally left UNCHANGED
220
+ * for its other two callers).
221
+ *
222
+ * Differences from the plain extractor:
223
+ * 1. The version MARKER (`v`, `@`, `ver`, `version`, or `#`) is now
224
+ * MANDATORY, not optional — a bare `\d+\.\d+\.\d+` run with no marker
225
+ * immediately before it (an IP address, a MM.DD.YYYY date, a "step
226
+ * N.N.N" reference) extracts NOTHING. `v` and `#` attach directly to
227
+ * the digits (e.g. "v3.5.0", "#3.5.0"); `@` optionally allows
228
+ * whitespace (e.g. "pkg@3.5.0" or "pkg @ 3.5.0"); `ver`/`version` are
229
+ * whole-word-bounded (so "versioning" never matches as "ver" + "sion")
230
+ * and allow an optional trailing "." plus whitespace before the digits
231
+ * ("version 3.5.0", "ver. 3.5.0").
232
+ * 2. `(?!\.\d)` rejects a match immediately followed by a 4th
233
+ * dot-digit-group — an IPv4 defense-in-depth layered on top of (1), in
234
+ * case a marker ever directly precedes an IP-shaped run (e.g.
235
+ * "v10.0.0.1"), which (1) alone would not catch since the marker IS
236
+ * present there.
237
+ * The captured KEY (group 1: the word/token immediately preceding the
238
+ * marker) is unchanged in spirit from the plain extractor — still "whatever
239
+ * word sits before the version mention", lowercased and stripped to
240
+ * `[a-z0-9_-]` by the caller (matching `grammarConflict`'s own usage
241
+ * pattern, ported verbatim from the plain extractor's callers).
242
+ */
243
+ function extractHighPrecisionVersionTokens(text) {
244
+ const result = new Map();
245
+ const pattern = /(\w[\w.-]{0,30}?)\s*(?:v(?=\d)|@\s*|\bver\b\.?\s*|\bversion\b\.?\s*|#\s*)(\d+\.\d+\.\d+)(?!\.\d)/gi;
246
+ let m;
247
+ while ((m = pattern.exec(text)) !== null) {
248
+ const key = m[1].toLowerCase().replace(/[^a-z0-9_-]/g, "");
249
+ if (key.length > 0) {
250
+ result.set(key, m[2]);
251
+ }
252
+ }
253
+ return result;
254
+ }
255
+ function resolveDirection(a, b) {
256
+ if (a.date && b.date) {
257
+ const da = Date.parse(a.date);
258
+ const db = Date.parse(b.date);
259
+ if (!isNaN(da) && !isNaN(db) && da !== db) {
260
+ return da > db ? "a-newer" : "b-newer";
261
+ }
262
+ // dates equal (same day) or unparseable — fall through to order.
263
+ }
264
+ if (a.order !== undefined && b.order !== undefined && a.order !== b.order) {
265
+ return a.order > b.order ? "a-newer" : "b-newer";
266
+ }
267
+ return "tie";
268
+ }
269
+ // ---------------------------------------------------------------------------
270
+ // Main
271
+ // ---------------------------------------------------------------------------
272
+ /**
273
+ * Pairwise contradiction scan over one tier's candidate list. O(n²) — the
274
+ * caller (query-memory.ts) is expected to run this AFTER tokenize+score
275
+ * (so `items.length` is already bounded by `perTierLimit`, not the full
276
+ * on-disk corpus) and to skip tiers with fewer than 2 items (nothing to
277
+ * compare) or with no date signal at all (this wave: the insight tier).
278
+ *
279
+ * Never drops, never reorders, never mutates `items` — returns relations
280
+ * ONLY. The caller decides what to do with them (annotate + down-rank,
281
+ * per this wave's brief; a future caller could choose differently without
282
+ * this module changing).
283
+ */
284
+ export function detectContradictions(items) {
285
+ const conflictsWith = new Map();
286
+ const supersededBy = new Map();
287
+ const addConflict = (i, j) => {
288
+ const existing = conflictsWith.get(i);
289
+ if (existing)
290
+ existing.push(j);
291
+ else
292
+ conflictsWith.set(i, [j]);
293
+ };
294
+ for (let i = 0; i < items.length; i++) {
295
+ for (let j = i + 1; j < items.length; j++) {
296
+ if (!grammarConflict(items[i], items[j]))
297
+ continue;
298
+ addConflict(i, j);
299
+ addConflict(j, i);
300
+ const dir = resolveDirection(items[i], items[j]);
301
+ if (dir === "tie")
302
+ continue; // annotate-only, never guess a direction
303
+ const staleIdx = dir === "a-newer" ? j : i;
304
+ const currentIdx = dir === "a-newer" ? i : j;
305
+ const existingSuperseder = supersededBy.get(staleIdx);
306
+ if (existingSuperseder === undefined) {
307
+ supersededBy.set(staleIdx, currentIdx);
308
+ }
309
+ else {
310
+ // Keep whichever superseder is itself more current, so a stale item
311
+ // conflicting with 3+ siblings always points at the most-current one.
312
+ const better = resolveDirection(items[currentIdx], items[existingSuperseder]);
313
+ if (better === "a-newer")
314
+ supersededBy.set(staleIdx, currentIdx);
315
+ }
316
+ }
317
+ }
318
+ return { conflictsWith, supersededBy };
319
+ }
320
+ //# sourceMappingURL=contradiction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contradiction.js","sourceRoot":"","sources":["../../src/retrieval/contradiction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6KG;AA4DH,8EAA8E;AAC9E,4EAA4E;AAC5E,gEAAgE;AAChE,8EAA8E;AAE9E;;;;;;;;;;;;;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