agent-recall-core 3.4.46 → 3.4.48

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 (102) 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 +18 -9
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +45 -6
  15. package/dist/index.js.map +1 -1
  16. package/dist/retrieval/candidates.d.ts +339 -0
  17. package/dist/retrieval/candidates.d.ts.map +1 -0
  18. package/dist/retrieval/candidates.js +473 -0
  19. package/dist/retrieval/candidates.js.map +1 -0
  20. package/dist/retrieval/contradiction.d.ts +284 -0
  21. package/dist/retrieval/contradiction.d.ts.map +1 -0
  22. package/dist/retrieval/contradiction.js +343 -0
  23. package/dist/retrieval/contradiction.js.map +1 -0
  24. package/dist/retrieval/query-memory.d.ts +464 -0
  25. package/dist/retrieval/query-memory.d.ts.map +1 -0
  26. package/dist/retrieval/query-memory.js +1189 -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 +163 -2
  33. package/dist/storage/corrections.d.ts.map +1 -1
  34. package/dist/storage/corrections.js +147 -3
  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 +26 -2
  45. package/dist/supabase/recall-backend.d.ts.map +1 -1
  46. package/dist/supabase/recall-backend.js +233 -27
  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 +183 -508
  94. package/dist/tools-logic/smart-recall.js.map +1 -1
  95. package/dist/tools-logic/supersession.d.ts +63 -2
  96. package/dist/tools-logic/supersession.d.ts.map +1 -1
  97. package/dist/tools-logic/supersession.js +153 -48
  98. package/dist/tools-logic/supersession.js.map +1 -1
  99. package/dist/types.d.ts +12 -1
  100. package/dist/types.d.ts.map +1 -1
  101. package/dist/types.js +1 -1
  102. package/package.json +1 -1
@@ -0,0 +1,473 @@
1
+ /**
2
+ * retrieval/candidates.ts — Wave 1 of the shared retrieval pipeline
3
+ * (reports/2026-08-21-architecture-review.md §4, reports/2026-08-29-kickoff-plan.md §2,
4
+ * plywood SOP 58053587).
5
+ *
6
+ * THE PROBLEM THIS FILE FIXES: the journal and palace-room storage tiers each
7
+ * have MANY independent `readdir`+`readFileSync` scanners (9+ for journal,
8
+ * ~10 for palace-room content — see this file's own header comment sections
9
+ * below for the enumerated class), each deciding filtering/trust/scoping
10
+ * independently. Per the architecture review: "a directory-scanning,
11
+ * tokenizing, trust-tagging, or scoping boundary decided independently, once
12
+ * per surface, with no single place that decision has to be made correctly
13
+ * exactly once" is the actual root cause behind the L1/L2/redteam findings.
14
+ *
15
+ * THIS WAVE (1 of ~4-5): build ONE typed candidate reader per tier, with
16
+ * identity-trust tagging baked in at read time (not deferred to a caller
17
+ * that might forget it, per CRITICAL-1's "3 prior waves each missed
18
+ * same-class members" lesson). `tier` is an ENUMERATED table entry
19
+ * (`TIER_READERS` below) — adding a future tier (e.g. `"palace-pipeline"`,
20
+ * see the CHALLENGE note below) is a new ROW, never a new branch.
21
+ *
22
+ * WAVE 1 SCOPE, EXPLICIT: this module is purely ADDITIVE. Zero existing call
23
+ * site (`journalSearch`, `smartRecall`, `palaceSearch`, `resurrect`,
24
+ * `sessionStart`, etc.) is touched or imports from here yet — that migration
25
+ * is Wave 2+ (`retrieval/pipeline.ts`'s `queryMemory()`). This file only adds
26
+ * a new, unused-by-anyone-yet reader, so it carries zero behavior-change
27
+ * risk for any live surface.
28
+ *
29
+ * ── CHALLENGE outcome: does `tier` need a 3rd value for palace/pipeline? ──
30
+ * The kickoff plan invited this challenge explicitly. Verdict: NO, not this
31
+ * wave — `palace/pipeline/` (numbered `NNNN-slug.md` milestone files with
32
+ * `phase`/`order`/`status`/`opened`/`closed` frontmatter, read via
33
+ * `palace/pipeline.ts`'s `listMilestones()`/`parseMilestoneFile()`) is
34
+ * structurally a DIFFERENT shape from `palace/rooms/<slug>/*.md` (no
35
+ * `_room.json`, no `listRooms()` entry point, no salience/access-count
36
+ * metadata, a different frontmatter schema entirely) — forcing it through
37
+ * the SAME `"palace-room"` reader would be lossy, not a clean fit. It is a
38
+ * genuine sibling tier and deserves its own `"palace-pipeline"` table row in
39
+ * a later wave (architecture review P10 names this explicitly: "CONFIRM
40
+ * this explicitly, don't assume" — confirmed here: it does NOT ride in for
41
+ * free, a dedicated reader is still needed). Tier stays exactly
42
+ * `"journal" | "palace-room"` for Wave 1, matching the task's literal scope.
43
+ *
44
+ * ── W2 INDEPENDENT-REVIEW FIX (2026-08-30): the leaf-utility-vs-pipeline-
45
+ * stage anti-pattern, moved one level down ──
46
+ * `readTierCandidates` is exported (this file's header above literally tells
47
+ * a future surface to call it), but Wave 2's `queryMemory()` pipeline is the
48
+ * ONLY thing that historically applied a trust filter to its output — a
49
+ * naive caller of this function directly got raw, unfiltered rescue-tagged
50
+ * content back, reopening CRITICAL-2. Fixed by making this reader SAFE BY
51
+ * DEFAULT (`ReadTierCandidatesOpts.includeUntrusted`, default `false`, drops
52
+ * `untrusted === true` before returning) and promoting the trust predicate
53
+ * itself (`filterTrusted`, below) to a public, canonical export — the SAME
54
+ * implementation `queryMemory()`'s own trust-filter stage now delegates to,
55
+ * not a forked second copy. See retrieval/query-memory.ts's header for how
56
+ * the pipeline's own stage stays intact around this change.
57
+ */
58
+ import * as fs from "node:fs";
59
+ import * as path from "node:path";
60
+ import { journalDir, archiveRawDir, palaceDir, projectSubPath } from "../storage/paths.js";
61
+ import { listJournalFiles } from "../helpers/journal-files.js";
62
+ import { isRescueSourcedContent, extractFrontmatterSource } from "../helpers/journal-filter.js";
63
+ import { listRooms } from "../palace/rooms.js";
64
+ import { readActiveCorrections, decayClassOf } from "../storage/corrections.js";
65
+ /**
66
+ * Canonical trust-filter: drops every candidate whose `untrusted` flag is
67
+ * exactly `true`. A candidate with `untrusted === undefined` (never actually
68
+ * produced by `readTierCandidates`'s own readers today, which always set a
69
+ * boolean, but defensive for any future non-reader-produced MemoryCandidate)
70
+ * is treated as trusted and kept — only a literal `true` drops.
71
+ *
72
+ * THE single implementation both `readTierCandidates`'s own safe-by-default
73
+ * filtering AND `queryMemory()`'s mandatory TRUST-FILTER pipeline stage
74
+ * delegate to (independent review fix, W2, 2026-08-30) — do not fork a
75
+ * second copy of this predicate.
76
+ */
77
+ export function filterTrusted(candidates) {
78
+ return candidates.filter((c) => c.untrusted !== true);
79
+ }
80
+ /**
81
+ * Read every candidate for one tier, reduced to the quarantine-safe
82
+ * `CandidateStub` shape: existence (date/file/sourcePath) is preserved for
83
+ * EVERY candidate, trusted or not, but `content` is stripped for any
84
+ * candidate whose `untrusted` flag is `true`. See `CandidateStub`'s own doc
85
+ * comment for the full rationale (FIX 1, P0 independent-review fix,
86
+ * 2026-08-30).
87
+ *
88
+ * Ordering is preserved from the underlying tier reader (the SAME ordering
89
+ * `readTierCandidates` itself would return for the same `tier`/`opts`) — a
90
+ * caller that needs a `limit`-bounded window must slice AFTER mapping this
91
+ * function's full output, never before, so a quarantined row's real
92
+ * position is never silently skipped past (see journal-list.ts's own
93
+ * header comment for the "silent backfill" bug this ordering guarantee
94
+ * closes).
95
+ */
96
+ export function listCandidateStubs(tier, project, opts = {}) {
97
+ const candidates = TIER_READERS[tier](project, opts);
98
+ return candidates.map((c) => {
99
+ const trusted = c.untrusted !== true;
100
+ return {
101
+ date: c.date,
102
+ file: c.file,
103
+ sourcePath: c.sourcePath,
104
+ trusted,
105
+ content: trusted ? c.content : undefined,
106
+ };
107
+ });
108
+ }
109
+ function safeReadFile(p) {
110
+ try {
111
+ return fs.readFileSync(p, "utf-8");
112
+ }
113
+ catch {
114
+ return null; // unreadable/missing file — never throw, caller skips it
115
+ }
116
+ }
117
+ /**
118
+ * journal tier — consolidates the ~5 independent journal-archive-raw
119
+ * scanners (resurrect.ts Source 2, smart-recall.ts's archiveSearch,
120
+ * session-end-reflect.ts's collectRawUnconsumed, store-doctor.ts ×2
121
+ * filename-only scans) with `helpers/journal-files.ts`'s existing
122
+ * `listJournalFiles()` as the live/rollup-archive half (per the kickoff
123
+ * plan's "fold in listJournalFiles() as the live-file half"). See this
124
+ * module's own PR report for the full scanner enumeration table.
125
+ */
126
+ function readJournalCandidates(project, opts) {
127
+ const out = [];
128
+ const primaryDir = journalDir(project);
129
+ // ---- live half (delegates to the existing shared reader) ----
130
+ // Deliberately called with includeArchive=false here — see the rollup-
131
+ // archive half below for why archive/ is scanned independently rather
132
+ // than via listJournalFiles(project, true).
133
+ const entries = listJournalFiles(project, false);
134
+ for (const entry of entries) {
135
+ const sourcePath = path.join(entry.dir, entry.file);
136
+ const content = safeReadFile(sourcePath);
137
+ if (content === null)
138
+ continue;
139
+ out.push({
140
+ content,
141
+ tier: "journal",
142
+ project,
143
+ date: entry.date,
144
+ sourcePath,
145
+ file: entry.file,
146
+ sourceKind: "journal-live",
147
+ untrusted: isRescueSourcedContent(content),
148
+ sourceTag: extractFrontmatterSource(content),
149
+ });
150
+ }
151
+ // ---- opt-in rollup-archive half ----
152
+ // NOT delegated to listJournalFiles(project, true): that path requires a
153
+ // leading YYYY-MM-DD date match on every filename (its `dateMatch` guard),
154
+ // which silently drops a week-summary-shaped file (`YYYY-Wnn.md`) living
155
+ // in archive/ — exactly the shape journal-search.test.mjs's own fixture
156
+ // uses and journal-search.ts's independent raw scan (readdirSync +
157
+ // f.endsWith(".md"), NO date-match requirement) correctly picks up. This
158
+ // divergence was found empirically while proving behavioral equivalence
159
+ // (retrieval-candidates.test.mjs) — listJournalFiles() and journal-search.ts
160
+ // are NOT strictly equivalent for archive/ content today. Scanning archive/
161
+ // independently here, matching journal-search.ts's broader (no-date-match)
162
+ // filter, is what makes this reader an honest superset of BOTH existing
163
+ // scanners rather than silently inheriting the narrower one's gap.
164
+ if (opts.includeRollupArchive) {
165
+ const archiveDir = path.join(primaryDir, "archive");
166
+ let archiveFiles = [];
167
+ try {
168
+ archiveFiles = fs.readdirSync(archiveDir).filter((f) => f.endsWith(".md"));
169
+ }
170
+ catch {
171
+ archiveFiles = []; // missing/unreadable archive dir — treat as empty, never throw
172
+ }
173
+ // Independent review fix (MEDIUM-1, W2, 2026-08-30): build this half into
174
+ // its own array and sort it date-descending BEFORE appending to `out` —
175
+ // same pattern the live half above already gets for free from
176
+ // `listJournalFiles()`'s own `entries.sort((a,b) => b.date.localeCompare(a.date))`.
177
+ // Without this, `archiveFiles` is in raw `readdirSync` enumeration order
178
+ // (filesystem-dependent, not date order), so a downstream consumer that
179
+ // truncates before fully consuming this half (e.g. query-memory.ts's
180
+ // `scoreJournalTier` perTierLimit break) would keep an arbitrary
181
+ // enumeration-order subset instead of the newest archived entries — the
182
+ // exact "sort-before-truncate" bug class this fix closes for the archive
183
+ // half, matching what the live half already had.
184
+ const archiveCandidates = [];
185
+ for (const file of archiveFiles) {
186
+ const sourcePath = path.join(archiveDir, file);
187
+ const content = safeReadFile(sourcePath);
188
+ if (content === null)
189
+ continue;
190
+ const dateMatch = file.match(/^(\d{4}-\d{2}-\d{2})/);
191
+ archiveCandidates.push({
192
+ content,
193
+ tier: "journal",
194
+ project,
195
+ date: dateMatch ? dateMatch[1] : "",
196
+ sourcePath,
197
+ file,
198
+ sourceKind: "journal-rollup-archive",
199
+ untrusted: isRescueSourcedContent(content),
200
+ sourceTag: extractFrontmatterSource(content),
201
+ });
202
+ }
203
+ archiveCandidates.sort((a, b) => b.date.localeCompare(a.date));
204
+ out.push(...archiveCandidates);
205
+ }
206
+ // ---- opt-in raw-archive half (the previously-unconsolidated 5 scanners) ----
207
+ if (opts.includeRawArchive) {
208
+ const dir = archiveRawDir(project);
209
+ let files = [];
210
+ try {
211
+ files = fs.readdirSync(dir).filter((f) => f.endsWith(".md") && f !== "index.md");
212
+ }
213
+ catch {
214
+ files = []; // missing/unreadable raw-archive dir — treat as empty, never throw
215
+ }
216
+ for (const file of files) {
217
+ const sourcePath = path.join(dir, file);
218
+ const content = safeReadFile(sourcePath);
219
+ if (content === null)
220
+ continue;
221
+ const dateMatch = file.match(/^(\d{4}-\d{2}-\d{2})/);
222
+ out.push({
223
+ content,
224
+ tier: "journal",
225
+ project,
226
+ date: dateMatch ? dateMatch[1] : "",
227
+ sourcePath,
228
+ file,
229
+ sourceKind: "journal-archive-raw",
230
+ untrusted: isRescueSourcedContent(content),
231
+ sourceTag: extractFrontmatterSource(content),
232
+ });
233
+ }
234
+ }
235
+ return out;
236
+ }
237
+ /**
238
+ * palace-room tier — net-new; no existing function to copy (`palace/rooms.ts`
239
+ * exports metadata only: `listRooms`/`getRoomMeta`/`countRoomEntries`, no
240
+ * content reader). Matches the INCLUSIVE behavior most existing scanners
241
+ * agree on (README.md counts as real room content — countRoomEntries's own
242
+ * doc comment: "both README.md's '## Memories' section and any topic
243
+ * files"): palace-search.ts, palace-walk.ts's readRoomContent,
244
+ * journal-search.ts's include_palace branch, and session-start.ts's
245
+ * autoBackfill all include README.md. A minority (palace-lint.ts, check.ts's
246
+ * alignment-room scanner, palace/fan-out.ts's auto-link keyword scan)
247
+ * exclude README.md/_room.json for their own narrower, non-retrieval
248
+ * purposes (linting the topic files only; keyword-linking heuristics) — see
249
+ * this module's own PR report for the full scanner enumeration table and
250
+ * why those are narrower special-purpose scans, not full content readers.
251
+ */
252
+ function readPalaceRoomCandidates(project, opts) {
253
+ const out = [];
254
+ const pd = palaceDir(project);
255
+ const allRooms = listRooms(project);
256
+ const rooms = opts.room ? allRooms.filter((r) => r.slug === opts.room) : allRooms;
257
+ for (const roomMeta of rooms) {
258
+ const roomPath = path.join(pd, "rooms", roomMeta.slug);
259
+ let files = [];
260
+ try {
261
+ if (!fs.existsSync(roomPath))
262
+ continue;
263
+ files = fs.readdirSync(roomPath).filter((f) => f.endsWith(".md"));
264
+ }
265
+ catch {
266
+ continue; // unreadable room dir — skip, never throw
267
+ }
268
+ for (const file of files) {
269
+ const sourcePath = path.join(roomPath, file);
270
+ const content = safeReadFile(sourcePath);
271
+ if (content === null)
272
+ continue;
273
+ let date = "";
274
+ try {
275
+ date = fs.statSync(sourcePath).mtime.toISOString().slice(0, 10);
276
+ }
277
+ catch {
278
+ date = (roomMeta.updated ?? "").slice(0, 10);
279
+ }
280
+ out.push({
281
+ content,
282
+ tier: "palace-room",
283
+ project,
284
+ date,
285
+ sourcePath,
286
+ file,
287
+ sourceKind: "palace-room",
288
+ untrusted: isRescueSourcedContent(content),
289
+ sourceTag: extractFrontmatterSource(content),
290
+ room: roomMeta.slug,
291
+ });
292
+ }
293
+ }
294
+ return out;
295
+ }
296
+ /**
297
+ * corrections tier (v4 W3, 2026-09-08, reports/2026-09-08-v4-w3-corrections-
298
+ * tier-report.md — design authority reports/2026-09-08-v4-claims-design-
299
+ * memo.md Wave 3). Consumes storage/corrections.ts's EXISTING exports only
300
+ * (`readActiveCorrections`, `decayClassOf`) — this reader never touches
301
+ * corrections.ts's private `correctionsDir`/`slugify`/directory-scan
302
+ * internals, matching the FILE OWNERSHIP boundary this wave was built under.
303
+ *
304
+ * TRUST (`untrusted`) — `false` BY CONSTRUCTION, same documented decision as
305
+ * query-memory.ts's insight tier ("every insight item is `untrusted: false`
306
+ * by construction... not an oversight"), reached here by TRACING THE WRITE
307
+ * PATH rather than assumed: `writeCorrection()` (corrections.ts) takes a
308
+ * caller-supplied `CorrectionRecord` directly — `rule`/`context` are MCP
309
+ * tool-call arguments (`check()`'s `human_correction` field, or the `ar
310
+ * correct` CLI's own flags), never raw journal/palace file content scanned
311
+ * off disk. `isRescueSourcedContent`/`extractFrontmatterSource` (the choke
312
+ * every OTHER MemoryCandidate reader in this file calls) exist to quarantine
313
+ * a rescue-tagged **file** an attacker planted in a directory this package
314
+ * globs — the WRITE path traced above has no such glob-and-trust-whatever-
315
+ * is-there step; it is an explicit, single-record tool call, and that half
316
+ * of the claim is traced-true. A hijacked working-memory-rescue session
317
+ * could in principle CALL `check()` itself with attacker-controlled
318
+ * `human_correction` text, but that is a fundamentally different threat (an
319
+ * attacker who can invoke MCP tools directly, not a passive file-glob
320
+ * injection) than the CRITICAL-2 rescue-quarantine class this file's trust
321
+ * machinery defends against, and is out of this wave's scope.
322
+ *
323
+ * v4 PRE-SHIP GATE FIX (2026-09-08, reports/2026-09-08-v4-gatefix-report.md,
324
+ * security must-fix #1 — honesty): the paragraph above previously overclaimed
325
+ * the READ side too — it said "corrections has no such glob-and-trust-
326
+ * whatever-is-there step AT ALL," which is false. This reader's
327
+ * `untrusted: false` is only as trustworthy as the primitive it calls:
328
+ * `readActiveCorrections()` -> `readCorrections()` (storage/corrections.ts)
329
+ * does `fs.readdirSync(correctionsDir)` and `JSON.parse`s EVERY `*.json`
330
+ * file it finds there, with NO signature, authorship, or write-path-
331
+ * provenance check at read time. A raw `.json` file an attacker (or a buggy
332
+ * script) plants directly in a project's `corrections/` directory —
333
+ * bypassing `writeCorrection()` entirely — is indistinguishable at read
334
+ * time from a genuine tool-written record, and surfaces here as
335
+ * `untrusted: false` exactly like one. This is a RESIDUAL, not a gap this
336
+ * reader introduces or widens: the same unauthenticated directory-scan
337
+ * primitive already backs `session-start.ts`'s P0-corrections surfacing
338
+ * (`readCorrections(slug)`, called on every session start) TODAY, so it was
339
+ * already live in production before `readCorrectionCandidates` existed —
340
+ * this reader inherits it rather than closing it, and this comment
341
+ * previously implied (wrongly) that it had been closed. Mirrors the
342
+ * honest-residual style of this wave's `supabase/recall-backend.ts` FIX 2
343
+ * comment ("VERIFIED, not applied") rather than asserting a guarantee this
344
+ * reader cannot make. FOLLOW-UP (out of this gate fix's scope, a future
345
+ * wave's work): closing this needs provenance STAMPING at write time (e.g.
346
+ * an HMAC/signature field `writeCorrection()` sets, checked here at read
347
+ * time, with an unsigned/failing record dropped or flagged) — a
348
+ * `CorrectionRecord` schema change plus a new verification step in this
349
+ * reader, not a one-line fix. See `retrieval-candidates.test.mjs`'s
350
+ * planted-file characterization test (v4 gate fix, 2026-09-08) for the
351
+ * machine-recorded proof of TODAY's behavior — a future provenance wave
352
+ * should intentionally FLIP that test, not find it silently stale.
353
+ *
354
+ * `sourceTag` is `undefined` for the same reason `untrusted` is
355
+ * unconditionally `false`: corrections.ts records are JSON, not
356
+ * frontmatter-tagged markdown, so there is no `source:` field to extract —
357
+ * the same "absent tag" case journal/palace already treat as trusted (see
358
+ * `MemoryCandidate.sourceTag`'s own doc comment).
359
+ *
360
+ * VISIBILITY — sources from `readActiveCorrections(project)`, NOT
361
+ * `readCorrections(project)`: retracted/superseded records (`active:false`)
362
+ * are filtered at the FETCH stage, before a `MemoryCandidate` for them ever
363
+ * exists — the strongest place to enforce "a retracted correction never
364
+ * surfaces" (destination-proof, not a downstream filter a future caller
365
+ * could accidentally bypass). `readActiveCorrections` already runs every
366
+ * record through `applyCorrectionDefaults` (via `readCorrections`), so
367
+ * `confidence`/`decay_class_override`/`severity`/`authoritative` are always
368
+ * resolved here, including for pre-v4 legacy records with none of those
369
+ * fields on disk.
370
+ *
371
+ * PROVENANCE (`sourcePath`/`file`) — DIRECTORY-level, not per-record.
372
+ * `readActiveCorrections`/`readCorrections` never expose which on-disk
373
+ * `*.json` file backs a given record (only `writeCorrection`'s own PRIVATE
374
+ * `findExistingCorrectionFile`/`slugify` can resolve that, and neither is
375
+ * exported). Re-implementing a second, independently-maintained
376
+ * corrections-directory scan here — just to recover a filename — would be
377
+ * exactly the "duplicate scanner deciding the same thing twice" anti-pattern
378
+ * this whole module exists to eliminate (see this file's own header), for a
379
+ * field no test or caller in this wave needs to be file-accurate. So:
380
+ * `sourcePath` is the corrections DIRECTORY itself (genuinely where
381
+ * `readActiveCorrections` read from — true, just not file-granular), and
382
+ * `file` is an id-derived label (`${record.id}.json`), NOT a verified
383
+ * on-disk filename — a caller must never open `candidate.sourcePath` as a
384
+ * single-record file. The record's real, stable,
385
+ * backlink-safe identity is `meta.correction_id` (`=== record.id`) — the
386
+ * SAME id corrections.ts's own `retractCorrection`/`recordOutcome` API keys
387
+ * off — and `query-memory.ts`'s corrections scorer reuses it AS the
388
+ * returned `QueryMemoryItem.id` (see that file's `scoreCorrectionsTier`),
389
+ * not a `stableId()` hash like every other tier mints.
390
+ *
391
+ * CONTENT / META — `content` is the rule text (`CorrectionRecord.rule`) —
392
+ * short by construction (the type's own doc comment: "the rule in one
393
+ * sentence"). The fuller `context` text, plus every other read-time-
394
+ * derivable annotation this wave's GOAL asks for (confidence, decay_class,
395
+ * P0-ness, the record's own id, and the raw authoritative flag for a
396
+ * possible future wave), lives in `meta` — the SAME forward-compat
397
+ * `Record<string,string>` bag `MemoryCandidate.meta`'s own doc comment
398
+ * describes as "somewhere [a field] can land without re-opening this type."
399
+ * `decayClassOf(record)` is called HERE, at fetch time, never persisted —
400
+ * exactly what that function's own doc comment requires ("call this at
401
+ * read/response time, not persist its return value").
402
+ */
403
+ function readCorrectionCandidates(project, _opts) {
404
+ // No option is corrections-specific this wave (no room-restriction, no
405
+ // rollup/raw-archive variant axis exists for this tier) — `_opts` is
406
+ // accepted only to match every sibling reader's `TIER_READERS` signature.
407
+ const dir = projectSubPath(project, "corrections");
408
+ const records = readActiveCorrections(project);
409
+ const out = records.map((record) => {
410
+ const rule = (record.rule ?? "").trim();
411
+ const context = (record.context ?? "").trim();
412
+ return {
413
+ content: rule || context || "(no rule text)",
414
+ tier: "corrections",
415
+ project,
416
+ date: record.date ?? "",
417
+ sourcePath: dir,
418
+ file: `${record.id}.json`,
419
+ sourceKind: "corrections",
420
+ untrusted: false,
421
+ sourceTag: undefined,
422
+ meta: {
423
+ correction_id: record.id,
424
+ context,
425
+ // Already resolved by applyCorrectionDefaults inside
426
+ // readCorrections() — the `??` fallback is defensive-only (every
427
+ // record reaching this point has gone through that defaulting), not
428
+ // a second, independent default definition.
429
+ confidence: record.confidence ?? "medium",
430
+ decay_class: decayClassOf(record),
431
+ severity: record.severity ?? "p1",
432
+ authoritative: String(record.authoritative ?? false),
433
+ },
434
+ };
435
+ });
436
+ // Sort-before-truncate (matches this file's own rollup-archive half and
437
+ // query-memory.ts's readLegacyJournalCandidates precedent): readCorrections()
438
+ // sorts by FILENAME descending, which tracks `date` closely but is not
439
+ // identical (two same-day corrections' relative filename order depends on
440
+ // slug text, not assertion time) — re-sort explicitly by the
441
+ // MemoryCandidate's own `date` field so any future perTierLimit
442
+ // truncation has a documented, date-true ordering to rely on.
443
+ out.sort((a, b) => b.date.localeCompare(a.date));
444
+ return out;
445
+ }
446
+ /**
447
+ * Class-not-instance table: one row per enumerated tier. Extending coverage
448
+ * (a future `"palace-pipeline"` tier, see this file's header CHALLENGE note)
449
+ * is a new row here, never a new branch in `readTierCandidates` itself.
450
+ */
451
+ const TIER_READERS = {
452
+ journal: readJournalCandidates,
453
+ "palace-room": readPalaceRoomCandidates,
454
+ corrections: readCorrectionCandidates,
455
+ };
456
+ /**
457
+ * Read every candidate for one tier of one project, with identity-trust
458
+ * tagging (`untrusted`) already computed. This is the SOLE function future
459
+ * retrieval surfaces should call instead of touching `journalDirs()`/
460
+ * `listRooms()`/raw `readdirSync` directly (Wave 2+ migration).
461
+ *
462
+ * SAFE BY DEFAULT (independent review fix, W2, 2026-08-30): unless
463
+ * `opts.includeUntrusted` is `true`, every `untrusted === true` candidate is
464
+ * dropped here, before returning — see `ReadTierCandidatesOpts.includeUntrusted`'s
465
+ * own doc comment for the full reasoning. A direct caller that never learns
466
+ * about `untrusted` at all still gets trusted-only content, closing the
467
+ * public escape hatch around `queryMemory()`'s own trust-filter stage.
468
+ */
469
+ export function readTierCandidates(tier, project, opts = {}) {
470
+ const candidates = TIER_READERS[tier](project, opts);
471
+ return opts.includeUntrusted ? candidates : filterTrusted(candidates);
472
+ }
473
+ //# sourceMappingURL=candidates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"candidates.js","sourceRoot":"","sources":["../../src/retrieval/candidates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,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