agent-recall-core 3.4.47 → 3.4.49
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 +25 -0
- package/dist/digest/store.d.ts +15 -6
- package/dist/digest/store.d.ts.map +1 -1
- package/dist/digest/store.js +33 -20
- package/dist/digest/store.js.map +1 -1
- package/dist/embeddings/chunker.d.ts +102 -0
- package/dist/embeddings/chunker.d.ts.map +1 -0
- package/dist/embeddings/chunker.js +260 -0
- package/dist/embeddings/chunker.js.map +1 -0
- package/dist/embeddings/config.d.ts +93 -0
- package/dist/embeddings/config.d.ts.map +1 -0
- package/dist/embeddings/config.js +174 -0
- package/dist/embeddings/config.js.map +1 -0
- package/dist/embeddings/index-store.d.ts +61 -0
- package/dist/embeddings/index-store.d.ts.map +1 -0
- package/dist/embeddings/index-store.js +158 -0
- package/dist/embeddings/index-store.js.map +1 -0
- package/dist/embeddings/indexer.d.ts +75 -0
- package/dist/embeddings/indexer.d.ts.map +1 -0
- package/dist/embeddings/indexer.js +196 -0
- package/dist/embeddings/indexer.js.map +1 -0
- package/dist/embeddings/runtime.d.ts +66 -0
- package/dist/embeddings/runtime.d.ts.map +1 -0
- package/dist/embeddings/runtime.js +197 -0
- package/dist/embeddings/runtime.js.map +1 -0
- package/dist/helpers/associative-link.d.ts.map +1 -1
- package/dist/helpers/associative-link.js +26 -1
- package/dist/helpers/associative-link.js.map +1 -1
- package/dist/helpers/tokenize.d.ts +1 -0
- package/dist/helpers/tokenize.d.ts.map +1 -1
- package/dist/helpers/tokenize.js +18 -0
- package/dist/helpers/tokenize.js.map +1 -1
- package/dist/index.d.ts +27 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -6
- package/dist/index.js.map +1 -1
- package/dist/palace/awareness.d.ts +34 -10
- package/dist/palace/awareness.d.ts.map +1 -1
- package/dist/palace/awareness.js +249 -180
- package/dist/palace/awareness.js.map +1 -1
- package/dist/palace/consolidate.d.ts +1 -1
- package/dist/palace/consolidate.d.ts.map +1 -1
- package/dist/palace/consolidate.js +9 -9
- package/dist/palace/consolidate.js.map +1 -1
- package/dist/palace/decay-pass.d.ts +1 -1
- package/dist/palace/decay-pass.d.ts.map +1 -1
- package/dist/palace/decay-pass.js +2 -2
- package/dist/palace/decay-pass.js.map +1 -1
- package/dist/palace/fan-out.d.ts +1 -1
- package/dist/palace/fan-out.d.ts.map +1 -1
- package/dist/palace/fan-out.js +5 -5
- package/dist/palace/fan-out.js.map +1 -1
- package/dist/palace/index-manager.d.ts +1 -1
- package/dist/palace/index-manager.d.ts.map +1 -1
- package/dist/palace/index-manager.js +1 -1
- package/dist/palace/index-manager.js.map +1 -1
- package/dist/palace/insights-index.d.ts +19 -6
- package/dist/palace/insights-index.d.ts.map +1 -1
- package/dist/palace/insights-index.js +36 -13
- package/dist/palace/insights-index.js.map +1 -1
- package/dist/palace/keystone.d.ts +1 -1
- package/dist/palace/keystone.d.ts.map +1 -1
- package/dist/palace/keystone.js +2 -2
- package/dist/palace/keystone.js.map +1 -1
- package/dist/palace/rooms.d.ts +3 -3
- package/dist/palace/rooms.d.ts.map +1 -1
- package/dist/palace/rooms.js +34 -6
- package/dist/palace/rooms.js.map +1 -1
- package/dist/retrieval/candidates.d.ts +27 -2
- package/dist/retrieval/candidates.d.ts.map +1 -1
- package/dist/retrieval/candidates.js +170 -3
- package/dist/retrieval/candidates.js.map +1 -1
- package/dist/retrieval/contradiction.d.ts +65 -13
- package/dist/retrieval/contradiction.d.ts.map +1 -1
- package/dist/retrieval/contradiction.js +40 -17
- package/dist/retrieval/contradiction.js.map +1 -1
- package/dist/retrieval/query-memory.d.ts +112 -9
- package/dist/retrieval/query-memory.d.ts.map +1 -1
- package/dist/retrieval/query-memory.js +623 -62
- package/dist/retrieval/query-memory.js.map +1 -1
- package/dist/retrieval/semantic-leg.d.ts +74 -0
- package/dist/retrieval/semantic-leg.d.ts.map +1 -0
- package/dist/retrieval/semantic-leg.js +180 -0
- package/dist/retrieval/semantic-leg.js.map +1 -0
- package/dist/storage/archive-write.d.ts.map +1 -1
- package/dist/storage/archive-write.js +29 -8
- package/dist/storage/archive-write.js.map +1 -1
- package/dist/storage/capture-router.d.ts +1 -1
- package/dist/storage/capture-router.d.ts.map +1 -1
- package/dist/storage/capture-router.js +26 -9
- package/dist/storage/capture-router.js.map +1 -1
- package/dist/storage/consolidation-queue.d.ts +11 -2
- package/dist/storage/consolidation-queue.d.ts.map +1 -1
- package/dist/storage/consolidation-queue.js +45 -16
- package/dist/storage/consolidation-queue.js.map +1 -1
- package/dist/storage/corrections.d.ts +185 -6
- package/dist/storage/corrections.d.ts.map +1 -1
- package/dist/storage/corrections.js +525 -126
- package/dist/storage/corrections.js.map +1 -1
- package/dist/storage/durable-intent.d.ts.map +1 -1
- package/dist/storage/durable-intent.js +24 -1
- package/dist/storage/durable-intent.js.map +1 -1
- package/dist/storage/filelock.d.ts +84 -12
- package/dist/storage/filelock.d.ts.map +1 -1
- package/dist/storage/filelock.js +309 -47
- package/dist/storage/filelock.js.map +1 -1
- package/dist/storage/fs-utils.d.ts +20 -0
- package/dist/storage/fs-utils.d.ts.map +1 -1
- package/dist/storage/fs-utils.js +27 -0
- package/dist/storage/fs-utils.js.map +1 -1
- package/dist/storage/paths.d.ts +34 -0
- package/dist/storage/paths.d.ts.map +1 -1
- package/dist/storage/paths.js +71 -0
- package/dist/storage/paths.js.map +1 -1
- package/dist/storage/pending.d.ts +154 -0
- package/dist/storage/pending.d.ts.map +1 -0
- package/dist/storage/pending.js +454 -0
- package/dist/storage/pending.js.map +1 -0
- package/dist/storage/project.d.ts.map +1 -1
- package/dist/storage/project.js +68 -16
- package/dist/storage/project.js.map +1 -1
- package/dist/storage/session-card.d.ts +13 -0
- package/dist/storage/session-card.d.ts.map +1 -1
- package/dist/storage/session-card.js +34 -3
- package/dist/storage/session-card.js.map +1 -1
- package/dist/storage/unclaimed.d.ts +165 -0
- package/dist/storage/unclaimed.d.ts.map +1 -0
- package/dist/storage/unclaimed.js +442 -0
- package/dist/storage/unclaimed.js.map +1 -0
- package/dist/storage/working-memory.d.ts.map +1 -1
- package/dist/storage/working-memory.js +19 -1
- package/dist/storage/working-memory.js.map +1 -1
- package/dist/supabase/recall-backend.d.ts +29 -2
- package/dist/supabase/recall-backend.d.ts.map +1 -1
- package/dist/supabase/recall-backend.js +231 -29
- package/dist/supabase/recall-backend.js.map +1 -1
- package/dist/supabase/sync.d.ts.map +1 -1
- package/dist/supabase/sync.js +13 -0
- package/dist/supabase/sync.js.map +1 -1
- package/dist/tools-logic/alignment-check.js +1 -1
- package/dist/tools-logic/alignment-check.js.map +1 -1
- package/dist/tools-logic/awareness-update.d.ts.map +1 -1
- package/dist/tools-logic/awareness-update.js +25 -16
- package/dist/tools-logic/awareness-update.js.map +1 -1
- package/dist/tools-logic/check-action.js +1 -1
- package/dist/tools-logic/check-action.js.map +1 -1
- package/dist/tools-logic/check.d.ts +55 -1
- package/dist/tools-logic/check.d.ts.map +1 -1
- package/dist/tools-logic/check.js +230 -57
- package/dist/tools-logic/check.js.map +1 -1
- package/dist/tools-logic/confidence.d.ts +11 -6
- package/dist/tools-logic/confidence.d.ts.map +1 -1
- package/dist/tools-logic/confidence.js +11 -6
- package/dist/tools-logic/confidence.js.map +1 -1
- package/dist/tools-logic/context-synthesize.js +2 -2
- package/dist/tools-logic/context-synthesize.js.map +1 -1
- package/dist/tools-logic/digest-read.js +2 -2
- package/dist/tools-logic/digest-read.js.map +1 -1
- package/dist/tools-logic/digest-recall.js +1 -1
- package/dist/tools-logic/digest-recall.js.map +1 -1
- package/dist/tools-logic/insight-promotion.d.ts +1 -1
- package/dist/tools-logic/insight-promotion.d.ts.map +1 -1
- package/dist/tools-logic/insight-promotion.js +17 -6
- package/dist/tools-logic/insight-promotion.js.map +1 -1
- package/dist/tools-logic/journal-capture.js +3 -3
- package/dist/tools-logic/journal-capture.js.map +1 -1
- package/dist/tools-logic/journal-write.js +3 -3
- package/dist/tools-logic/journal-write.js.map +1 -1
- package/dist/tools-logic/knowledge-write.js +2 -2
- package/dist/tools-logic/knowledge-write.js.map +1 -1
- package/dist/tools-logic/palace-lint.js +1 -1
- package/dist/tools-logic/palace-lint.js.map +1 -1
- package/dist/tools-logic/palace-read.js +1 -1
- package/dist/tools-logic/palace-read.js.map +1 -1
- package/dist/tools-logic/palace-search.js +1 -1
- package/dist/tools-logic/palace-search.js.map +1 -1
- package/dist/tools-logic/palace-walk.js +3 -3
- package/dist/tools-logic/palace-walk.js.map +1 -1
- package/dist/tools-logic/palace-write.js +4 -4
- package/dist/tools-logic/palace-write.js.map +1 -1
- package/dist/tools-logic/predict-correction.js +1 -1
- package/dist/tools-logic/predict-correction.js.map +1 -1
- package/dist/tools-logic/recall-backend.d.ts +11 -2
- package/dist/tools-logic/recall-backend.d.ts.map +1 -1
- package/dist/tools-logic/recall-backend.js +2 -2
- package/dist/tools-logic/recall-backend.js.map +1 -1
- package/dist/tools-logic/resurrect.d.ts.map +1 -1
- package/dist/tools-logic/resurrect.js +9 -1
- package/dist/tools-logic/resurrect.js.map +1 -1
- package/dist/tools-logic/safety-consolidation.d.ts.map +1 -1
- package/dist/tools-logic/safety-consolidation.js +32 -30
- package/dist/tools-logic/safety-consolidation.js.map +1 -1
- package/dist/tools-logic/session-end.d.ts +8 -0
- package/dist/tools-logic/session-end.d.ts.map +1 -1
- package/dist/tools-logic/session-end.js +51 -13
- package/dist/tools-logic/session-end.js.map +1 -1
- package/dist/tools-logic/session-start.d.ts +23 -0
- package/dist/tools-logic/session-start.d.ts.map +1 -1
- package/dist/tools-logic/session-start.js +44 -1
- package/dist/tools-logic/session-start.js.map +1 -1
- package/dist/tools-logic/smart-recall.d.ts +185 -10
- package/dist/tools-logic/smart-recall.d.ts.map +1 -1
- package/dist/tools-logic/smart-recall.js +364 -60
- package/dist/tools-logic/smart-recall.js.map +1 -1
- package/dist/tools-logic/store-doctor.d.ts.map +1 -1
- package/dist/tools-logic/store-doctor.js +7 -4
- package/dist/tools-logic/store-doctor.js.map +1 -1
- package/dist/tools-logic/store-repair.js +1 -1
- package/dist/tools-logic/store-repair.js.map +1 -1
- package/dist/tools-logic/supersession.d.ts +64 -3
- package/dist/tools-logic/supersession.d.ts.map +1 -1
- package/dist/tools-logic/supersession.js +155 -50
- package/dist/tools-logic/supersession.js.map +1 -1
- package/dist/types.d.ts +12 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/vector/embedding.d.ts +8 -0
- package/dist/vector/embedding.d.ts.map +1 -1
- package/dist/vector/embedding.js +8 -0
- package/dist/vector/embedding.js.map +1 -1
- package/package.json +1 -1
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
* zero). `extractStatusTokens`/`extractKVTokens` remain exported from
|
|
48
48
|
* `helpers/conflict-scan.ts` and are UNCHANGED there — `conflict-scan.ts`'s
|
|
49
49
|
* own `scanForConflicts` (the separate smart-remember pre-save warning flow)
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
50
|
+
* still uses all three extractors; this restriction applies ONLY to this
|
|
51
|
+
* module's pairwise same-tier retrieval-time comparison (see the v4
|
|
52
|
+
* PRE-SHIP GATE FIX addendum below for why `tools-logic/supersession.ts`'s
|
|
53
|
+
* `compareForConflicts` — previously also a three-extractor consumer —
|
|
54
|
+
* no longer is one).
|
|
55
55
|
*
|
|
56
56
|
* WHY THIS IS ITS OWN MODULE, not a function inside query-memory.ts: mirrors
|
|
57
57
|
* `retrieval/scope.ts`'s own precedent — a small, dependency-light, pure
|
|
@@ -134,19 +134,39 @@
|
|
|
134
134
|
* positive fires AT ALL, so even the harmless annotation is rare and
|
|
135
135
|
* meaningful rather than routinely wrong.
|
|
136
136
|
*
|
|
137
|
-
* `extractHighPrecisionVersionTokens` below is a
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* smart-remember pre-save warning flow
|
|
143
|
-
*
|
|
144
|
-
* structurally distinct
|
|
137
|
+
* `extractHighPrecisionVersionTokens` below is a module-scoped extractor — a
|
|
138
|
+
* modified copy of `extractVersionTokens`'s regex, NOT an edit to the shared
|
|
139
|
+
* `helpers/conflict-scan.ts` export. `extractVersionTokens` itself is
|
|
140
|
+
* UNCHANGED and remains exactly as permissive as before for its one
|
|
141
|
+
* remaining loose-grammar caller (`conflict-scan.ts`'s own `scanForConflicts`
|
|
142
|
+
* — the smart-remember pre-save warning flow, a soft non-mutating notice
|
|
143
|
+
* shown at save time, not a supersession/retraction surface), which is a
|
|
144
|
+
* structurally distinct consumer this fix's scope (the retrieval area) does
|
|
145
145
|
* not touch and whose own false-positive tolerance was never in question
|
|
146
146
|
* here (see this file's original header, "FIX (this file)", for why
|
|
147
147
|
* `contradiction.ts` choosing a narrower grammar than `conflict-scan.ts`
|
|
148
148
|
* offers was already the file's own precedent).
|
|
149
149
|
*
|
|
150
|
+
* v4 PRE-SHIP GATE FIX (2026-09-08, reports/2026-09-08-v4-gatefix-report.md)
|
|
151
|
+
* — `extractHighPrecisionVersionTokens` is now EXPORTED (it previously was
|
|
152
|
+
* not) and imported directly by `tools-logic/supersession.ts`'s
|
|
153
|
+
* `compareForConflicts`. That module's OWN plain `extractVersionTokens` use
|
|
154
|
+
* (the "`ar correct` CorrectionRecord flow" this section originally named as
|
|
155
|
+
* a second, still-loose caller) was retired by that same gate fix — a
|
|
156
|
+
* correctness red-team reproduced the identical generic-key false-positive
|
|
157
|
+
* class described above (e.g. two topically-unrelated corrections that both
|
|
158
|
+
* say "deployed 1.2.3"/"deployed 5.6.7" with no explicit version marker) on
|
|
159
|
+
* `listCorrectionConflicts`/`ar corrections conflicts`, the NEW human-facing
|
|
160
|
+
* surface v4 W5 added on top of `compareForConflicts`. Rather than fork a
|
|
161
|
+
* THIRD copy of this regex into `supersession.ts` (or re-derive a laxer one
|
|
162
|
+
* there), that module now imports and calls this exact function — see
|
|
163
|
+
* `supersession.ts`'s own header for the full status/kv removal rationale
|
|
164
|
+
* (citing 79fc3e2, the same precedent this file's own W5a-salvage section
|
|
165
|
+
* above documents) and its test suite for the FP-pair proofs. This module
|
|
166
|
+
* has zero imports of its own (see this file's header, "WHY THIS IS ITS OWN
|
|
167
|
+
* MODULE"), so `supersession.ts` (tools-logic/) importing FROM it here
|
|
168
|
+
* creates no import cycle.
|
|
169
|
+
*
|
|
150
170
|
* THE TIGHTENING: require an explicit version marker (`v`, `@`, `ver`,
|
|
151
171
|
* `version`, or `#`) IMMEDIATELY adjacent to the digits, AND reject a
|
|
152
172
|
* trailing 4th dot-group (`(?!\.\d)`, an IPv4-shape defense-in-depth layered
|
|
@@ -213,11 +233,14 @@ function grammarConflict(a, b) {
|
|
|
213
233
|
return false;
|
|
214
234
|
}
|
|
215
235
|
/**
|
|
216
|
-
* High-precision version-token extractor — a NARROWER
|
|
217
|
-
*
|
|
236
|
+
* High-precision version-token extractor — a NARROWER variant of
|
|
237
|
+
* `helpers/conflict-scan.ts`'s `extractVersionTokens` (see this file's
|
|
218
238
|
* header, "HIGH-PRECISION GRAMMAR", for the full false-positive analysis
|
|
219
239
|
* this exists to close; that shared export is intentionally left UNCHANGED
|
|
220
|
-
* for its
|
|
240
|
+
* for its one remaining loose-grammar caller). EXPORTED (v4 pre-ship gate
|
|
241
|
+
* fix, 2026-09-08, see this file's header addendum) so
|
|
242
|
+
* `tools-logic/supersession.ts` can import this exact implementation
|
|
243
|
+
* instead of forking a third copy — not, itself, a change in behavior.
|
|
221
244
|
*
|
|
222
245
|
* Differences from the plain extractor:
|
|
223
246
|
* 1. The version MARKER (`v`, `@`, `ver`, `version`, or `#`) is now
|
|
@@ -240,7 +263,7 @@ function grammarConflict(a, b) {
|
|
|
240
263
|
* `[a-z0-9_-]` by the caller (matching `grammarConflict`'s own usage
|
|
241
264
|
* pattern, ported verbatim from the plain extractor's callers).
|
|
242
265
|
*/
|
|
243
|
-
function extractHighPrecisionVersionTokens(text) {
|
|
266
|
+
export function extractHighPrecisionVersionTokens(text) {
|
|
244
267
|
const result = new Map();
|
|
245
268
|
const pattern = /(\w[\w.-]{0,30}?)\s*(?:v(?=\d)|@\s*|\bver\b\.?\s*|\bversion\b\.?\s*|#\s*)(\d+\.\d+\.\d+)(?!\.\d)/gi;
|
|
246
269
|
let m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contradiction.js","sourceRoot":"","sources":["../../src/retrieval/contradiction.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"contradiction.js","sourceRoot":"","sources":["../../src/retrieval/contradiction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiMG;AA4DH,8EAA8E;AAC9E,4EAA4E;AAC5E,gEAAgE;AAChE,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAS,eAAe,CAAC,CAAoB,EAAE,CAAoB;IACjE,MAAM,EAAE,GAAG,iCAAiC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACrD,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAChC,MAAM,EAAE,GAAG,iCAAiC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACrD,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,IAAI,IAAI,IAAI,KAAK,GAAG;YAAE,OAAO,IAAI,CAAC;IACxC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;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Q,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,MAAM,UAAU,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAE7C,MAAM,kBAAkB,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACtD,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;gBACrC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACN,oEAAoE;gBACpE,sEAAsE;gBACtE,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;gBAC9E,IAAI,MAAM,KAAK,SAAS;oBAAE,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -34,9 +34,12 @@
|
|
|
34
34
|
* change on day one." The five formulas smart-recall.ts documents (RRF k=60,
|
|
35
35
|
* Ebbinghaus, hot-window recency, betaUtility feedback, two-stage fusion) are
|
|
36
36
|
* split by WHERE they belong in a genuinely reusable pipeline, not merged:
|
|
37
|
-
* - RRF (two-stage: applyRRF + fuseCanonical)
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* - RRF (two-stage: applyRRF + fuseCanonical): pipeline-owned (RANK/FUSE
|
|
38
|
+
* stage below) — generic to any multi-tier candidate set, not
|
|
39
|
+
* smart_recall-specific. The hot-window recency boost that used to run
|
|
40
|
+
* here was REMOVED from default ranking by fix4b (2026-09-12) — it
|
|
41
|
+
* survives only behind the explicit `freshnessBias` opt-in; see
|
|
42
|
+
* applyLegacyHotWindowBoost's doc block for the measurements.
|
|
40
43
|
* - Ebbinghaus decay, palace salience/IDF blend, insight confirmation blend:
|
|
41
44
|
* pipeline-owned (TOKENIZE+SCORE stage, per-tier) — these ARE the
|
|
42
45
|
* per-tier strategies the review names.
|
|
@@ -171,7 +174,10 @@
|
|
|
171
174
|
* grammar to find, within one tier's own already-scored candidate list,
|
|
172
175
|
* pairs that assert the same fact-key with a different semver value. A
|
|
173
176
|
* candidate detected as the STALE side of such a pair is DOWN-RANKED
|
|
174
|
-
* (multiplicative score penalty
|
|
177
|
+
* (multiplicative score penalty; historically mirrored `applyHotWindowBoost`'s
|
|
178
|
+
* pattern — fix4b, 2026-09-12, removed that boost from default ranking
|
|
179
|
+
* [legacy opt-in only, see applyLegacyHotWindowBoost]; the contradiction
|
|
180
|
+
* penalty here is unchanged)
|
|
175
181
|
* and ANNOTATED (`supersededBy`) — it is NEVER removed from the set. This
|
|
176
182
|
* closes part of the reconciliation gap `reports/2026-08-18-eval-redteam.md`'s
|
|
177
183
|
* HIGH-2 finding named (0% of grammar-detectable contradictions were
|
|
@@ -227,8 +233,24 @@
|
|
|
227
233
|
* just for `smart_recall`). See `./contradiction.ts`'s own header for
|
|
228
234
|
* the grammar fix's full false-positive-by-false-positive proof.
|
|
229
235
|
*/
|
|
230
|
-
|
|
231
|
-
|
|
236
|
+
import { type Confidence, type DecayClass } from "../types.js";
|
|
237
|
+
import type { SemanticLegNote } from "./semantic-leg.js";
|
|
238
|
+
/**
|
|
239
|
+
* The tiers that compete inside the shared RRF fusion.
|
|
240
|
+
*
|
|
241
|
+
* v4 W3 (2026-09-08, reports/2026-09-08-v4-w3-corrections-tier-report.md,
|
|
242
|
+
* design authority reports/2026-09-08-v4-claims-design-memo.md Wave 3):
|
|
243
|
+
* `"corrections"` added — a real, RRF-fusing tier, matching every prior
|
|
244
|
+
* tier's own shape (a `TIER_SCORERS` row below), NOT a `queryMemory()`-
|
|
245
|
+
* internal parallel block. This follows the memo's own literal instruction
|
|
246
|
+
* ("a real tier ... matching the existing journal/palace-room reader
|
|
247
|
+
* shape") — no hard conflict was found between that instruction and how
|
|
248
|
+
* `insight` (the closest precedent) already competes in the SAME RANK/FUSE
|
|
249
|
+
* stage as journal/palace (see `queryMemory()`'s `for (const tier of
|
|
250
|
+
* input.tiers) { ... applyRRF(items, rrfMap); }` loop below — every
|
|
251
|
+
* requested tier, `insight` included, is fused identically).
|
|
252
|
+
*/
|
|
253
|
+
export type QueryMemoryTier = "journal" | "palace" | "insight" | "corrections";
|
|
232
254
|
/** Every source label a `QueryMemoryItem` can carry, including the
|
|
233
255
|
* non-competing archive fallback (see `queryArchiveFallback`). */
|
|
234
256
|
export type QueryMemorySource = QueryMemoryTier | "archive";
|
|
@@ -324,6 +346,41 @@ export interface QueryMemoryItem {
|
|
|
324
346
|
* avoid, not merely to relocate).
|
|
325
347
|
*/
|
|
326
348
|
conflictsWith?: string[];
|
|
349
|
+
/**
|
|
350
|
+
* corrections tier only (v4 W3, 2026-09-08) — the assertion-time belief
|
|
351
|
+
* confidence (`CorrectionRecord.confidence`, always resolved by
|
|
352
|
+
* `applyCorrectionDefaults` by the time it reaches here, including for
|
|
353
|
+
* legacy pre-v4 records — see `readCorrectionCandidates`'s own doc
|
|
354
|
+
* comment). ANNOTATION ONLY, per the design memo's own repeated finding
|
|
355
|
+
* (rejected twice independently — the July 2 proposal's Option 2, and
|
|
356
|
+
* W5fix's removal of `CONTRADICTION_PENALTY`, both for the identical
|
|
357
|
+
* reason: blending confidence/staleness into a ranking score hides WHY an
|
|
358
|
+
* item dropped and risks silent rank inversion). `scoreCorrectionsTier`
|
|
359
|
+
* below NEVER reads this field when computing `internalScore` — verify
|
|
360
|
+
* that invariant holds before extending this tier's scoring formula.
|
|
361
|
+
* Absent on every non-corrections item.
|
|
362
|
+
*/
|
|
363
|
+
confidence?: Confidence;
|
|
364
|
+
/**
|
|
365
|
+
* corrections tier only (v4 W3, 2026-09-08) — the computed decay class
|
|
366
|
+
* (`decayClassOf(record)`, corrections.ts) — `"slow"` for every
|
|
367
|
+
* corrections item this wave (corrections carry no `MemoryCategory`, so
|
|
368
|
+
* the class default is always `"slow"` unless the rare
|
|
369
|
+
* `decay_class_override` escape hatch is set — see `decayClassOf`'s own
|
|
370
|
+
* doc comment). ANNOTATION ONLY, same invariant as `confidence` above —
|
|
371
|
+
* never fed into `internalScore`. Absent on every non-corrections item.
|
|
372
|
+
*/
|
|
373
|
+
decayClass?: DecayClass;
|
|
374
|
+
/**
|
|
375
|
+
* fix7 (2026-09-12, opt-in embeddings) — set `true` ONLY on an item
|
|
376
|
+
* ORIGINATED by the semantic leg (retrieval/semantic-leg.ts). A lexical
|
|
377
|
+
* item whose RRF entry a semantic contribution merely folded INTO (same
|
|
378
|
+
* `id` — applyRRF keeps the first-inserted item's fields) does NOT carry
|
|
379
|
+
* it: the flag marks semantic-only discoveries, mirroring how
|
|
380
|
+
* `foundInRemote` (smart-recall.ts) marks the cross-BACKEND case.
|
|
381
|
+
* Structurally absent whenever the AGENT_RECALL_EMBEDDINGS flag is off.
|
|
382
|
+
*/
|
|
383
|
+
semantic?: true;
|
|
327
384
|
}
|
|
328
385
|
export interface QueryMemoryInput {
|
|
329
386
|
query: string;
|
|
@@ -348,6 +405,15 @@ export interface QueryMemoryInput {
|
|
|
348
405
|
journal?: {
|
|
349
406
|
includeRollupArchive?: boolean;
|
|
350
407
|
perTierLimit?: number;
|
|
408
|
+
/** fix4 S4-completion (2026-09-11): on the cross-tier COMPETITIVE
|
|
409
|
+
* surface (smart_recall's RRF fusion), one journal (date, section)
|
|
410
|
+
* contributes at most ONE result slot — its best-scoring line — so a
|
|
411
|
+
* verbose section can't flood the top-5 with near-duplicate rows (the
|
|
412
|
+
* same one-doc-one-vote class as the palace tier's fix, at the
|
|
413
|
+
* journal's own semantic granularity). DEFAULT FALSE: journalSearch's
|
|
414
|
+
* per-line grep contract (W3b's deliberate per-hit-unique-id decision)
|
|
415
|
+
* is preserved byte-identically for every caller that doesn't opt in. */
|
|
416
|
+
perSectionDedupe?: boolean;
|
|
351
417
|
};
|
|
352
418
|
palace?: {
|
|
353
419
|
room?: string;
|
|
@@ -357,11 +423,38 @@ export interface QueryMemoryInput {
|
|
|
357
423
|
perTierLimit?: number;
|
|
358
424
|
includeAwareness?: boolean;
|
|
359
425
|
};
|
|
426
|
+
/** corrections tier only (v4 W3, 2026-09-08) — matches every sibling
|
|
427
|
+
* tier's own per-tier options shape. */
|
|
428
|
+
corrections?: {
|
|
429
|
+
perTierLimit?: number;
|
|
430
|
+
};
|
|
431
|
+
/** fix4b (2026-09-12) — LEGACY multiplicative hot-window boost, explicit
|
|
432
|
+
* opt-in, default OFF. When true, fused RRF scores are multiplied
|
|
433
|
+
* ×3.0/×2.0/×1.3 for items dated <6h/<24h/<72h (the exact pre-fix4b
|
|
434
|
+
* behavior, including its known defects: score-scale distortion, palace
|
|
435
|
+
* scraped-date trust, cross-band vaulting).
|
|
436
|
+
*
|
|
437
|
+
* Exists for exactly ONE audited caller class: surfaces whose own
|
|
438
|
+
* downstream score thresholds were calibrated against BOOSTED score
|
|
439
|
+
* magnitudes and whose product semantics depend on fresh single-source
|
|
440
|
+
* items clearing them (the CLI ambient-injection floor `score >= 0.03`
|
|
441
|
+
* — a lone tier-rank-1 match is 1/61 ≈ 0.0164 raw and only ever passed
|
|
442
|
+
* that floor via the ×2/×3 windows; see cli/src/index.ts hook-ambient).
|
|
443
|
+
* Every default surface (smart_recall/recall MCP tools, SDK recall,
|
|
444
|
+
* journal_search, the golden eval) gets the honest un-multiplied
|
|
445
|
+
* ranking, with no post-fusion freshness signal — a deliberate, measured
|
|
446
|
+
* product-behavior change (55%→75% golden hit-rate; see
|
|
447
|
+
* applyLegacyHotWindowBoost's doc block). Do NOT reach for this flag to
|
|
448
|
+
* "prefer recent" on an agent-facing surface without re-measuring. */
|
|
449
|
+
freshnessBias?: boolean;
|
|
360
450
|
}
|
|
361
451
|
export interface QueryMemoryResult {
|
|
362
|
-
/** Fused + ranked (RRF, two-stage canonical fusion
|
|
363
|
-
*
|
|
364
|
-
*
|
|
452
|
+
/** Fused + ranked (RRF, two-stage canonical fusion; `score` is the raw
|
|
453
|
+
* fused RRF sum — since fix4b, 2026-09-12, NOTHING multiplies it by
|
|
454
|
+
* default and no post-fusion freshness signal exists; exact ties resolve
|
|
455
|
+
* by the authority/insertion order. Exception: the legacy `freshnessBias`
|
|
456
|
+
* opt-in, see QueryMemoryInput) — UNCUT, UNFENCED. Caller applies its own
|
|
457
|
+
* limit/labeling/feedback adjustments. */
|
|
365
458
|
items: QueryMemoryItem[];
|
|
366
459
|
/** Raw pre-fusion candidate counts per competing tier (Fix 4/5 semantics —
|
|
367
460
|
* BEFORE cross-source fusion collapses same-excerpt duplicates). */
|
|
@@ -370,6 +463,16 @@ export interface QueryMemoryResult {
|
|
|
370
463
|
* of hit count — matches smart-recall.ts's original `sourcesQueried`
|
|
371
464
|
* semantics exactly. */
|
|
372
465
|
sourcesQueried: QueryMemoryTier[];
|
|
466
|
+
/**
|
|
467
|
+
* fix7 (2026-09-12) — semantic-leg diagnostics. Present IF AND ONLY IF
|
|
468
|
+
* the AGENT_RECALL_EMBEDDINGS opt-in was ON for this call (the flag-off
|
|
469
|
+
* result object is byte-identical to fix4b — a hard equivalence
|
|
470
|
+
* invariant, tested). `status !== "ok"` is the "degrade silently and
|
|
471
|
+
* safely" contract made diagnosable: the lexical results are unaffected
|
|
472
|
+
* and the reason (missing model/index, corruption) is carried here
|
|
473
|
+
* instead of thrown.
|
|
474
|
+
*/
|
|
475
|
+
semanticLeg?: SemanticLegNote;
|
|
373
476
|
/**
|
|
374
477
|
* FENCE stage (pipeline stage 6) — the pipeline's OWN canonical
|
|
375
478
|
* "wrap retrieved content before it reaches an agent" implementation, for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-memory.d.ts","sourceRoot":"","sources":["../../src/retrieval/query-memory.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"query-memory.d.ts","sourceRoot":"","sources":["../../src/ret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