agent-recall-core 3.4.40 → 3.4.42

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 (72) hide show
  1. package/dist/helpers/auto-name.d.ts +2 -1
  2. package/dist/helpers/auto-name.d.ts.map +1 -1
  3. package/dist/helpers/auto-name.js +45 -6
  4. package/dist/helpers/auto-name.js.map +1 -1
  5. package/dist/helpers/journal-sig-theme.d.ts +18 -0
  6. package/dist/helpers/journal-sig-theme.d.ts.map +1 -1
  7. package/dist/helpers/journal-sig-theme.js +6 -1
  8. package/dist/helpers/journal-sig-theme.js.map +1 -1
  9. package/dist/index.d.ts +11 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +12 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/storage/extraction.d.ts +136 -0
  14. package/dist/storage/extraction.d.ts.map +1 -0
  15. package/dist/storage/extraction.js +368 -0
  16. package/dist/storage/extraction.js.map +1 -0
  17. package/dist/storage/fs-utils.d.ts +21 -0
  18. package/dist/storage/fs-utils.d.ts.map +1 -1
  19. package/dist/storage/fs-utils.js +86 -0
  20. package/dist/storage/fs-utils.js.map +1 -1
  21. package/dist/storage/hook-health.d.ts +50 -0
  22. package/dist/storage/hook-health.d.ts.map +1 -0
  23. package/dist/storage/hook-health.js +183 -0
  24. package/dist/storage/hook-health.js.map +1 -0
  25. package/dist/storage/paths.d.ts +23 -4
  26. package/dist/storage/paths.d.ts.map +1 -1
  27. package/dist/storage/paths.js +26 -9
  28. package/dist/storage/paths.js.map +1 -1
  29. package/dist/storage/recency-index.d.ts +79 -0
  30. package/dist/storage/recency-index.d.ts.map +1 -0
  31. package/dist/storage/recency-index.js +204 -0
  32. package/dist/storage/recency-index.js.map +1 -0
  33. package/dist/storage/session-card.d.ts +74 -0
  34. package/dist/storage/session-card.d.ts.map +1 -0
  35. package/dist/storage/session-card.js +219 -0
  36. package/dist/storage/session-card.js.map +1 -0
  37. package/dist/storage/working-memory.d.ts +193 -0
  38. package/dist/storage/working-memory.d.ts.map +1 -0
  39. package/dist/storage/working-memory.js +328 -0
  40. package/dist/storage/working-memory.js.map +1 -0
  41. package/dist/supabase/recall-backend.d.ts +1 -1
  42. package/dist/supabase/recall-backend.d.ts.map +1 -1
  43. package/dist/supabase/recall-backend.js.map +1 -1
  44. package/dist/supabase/sync.d.ts.map +1 -1
  45. package/dist/supabase/sync.js +13 -2
  46. package/dist/supabase/sync.js.map +1 -1
  47. package/dist/tools-logic/drill-down.d.ts +9 -2
  48. package/dist/tools-logic/drill-down.d.ts.map +1 -1
  49. package/dist/tools-logic/drill-down.js +32 -1
  50. package/dist/tools-logic/drill-down.js.map +1 -1
  51. package/dist/tools-logic/journal-search.d.ts.map +1 -1
  52. package/dist/tools-logic/journal-search.js +7 -1
  53. package/dist/tools-logic/journal-search.js.map +1 -1
  54. package/dist/tools-logic/resurrect.d.ts +113 -0
  55. package/dist/tools-logic/resurrect.d.ts.map +1 -0
  56. package/dist/tools-logic/resurrect.js +602 -0
  57. package/dist/tools-logic/resurrect.js.map +1 -0
  58. package/dist/tools-logic/session-start-lite.d.ts +6 -0
  59. package/dist/tools-logic/session-start-lite.d.ts.map +1 -1
  60. package/dist/tools-logic/session-start-lite.js +15 -0
  61. package/dist/tools-logic/session-start-lite.js.map +1 -1
  62. package/dist/tools-logic/session-start.d.ts +29 -0
  63. package/dist/tools-logic/session-start.d.ts.map +1 -1
  64. package/dist/tools-logic/session-start.js +97 -2
  65. package/dist/tools-logic/session-start.js.map +1 -1
  66. package/dist/tools-logic/smart-recall.d.ts +9 -4
  67. package/dist/tools-logic/smart-recall.d.ts.map +1 -1
  68. package/dist/tools-logic/smart-recall.js +170 -4
  69. package/dist/tools-logic/smart-recall.js.map +1 -1
  70. package/dist/types.d.ts +1 -1
  71. package/dist/types.js +1 -1
  72. package/package.json +1 -1
@@ -0,0 +1,602 @@
1
+ /**
2
+ * resurrect.ts — F6, read-only cross-slug dead-session finder (continuity
3
+ * wave, 2026-07-31).
4
+ *
5
+ * WHY: this encodes the incident-recovery forensics from
6
+ * reports/2026-07-31-continuity-fixture.md as a function. A session that hit
7
+ * F4's gap (no `ar capture` that day → only journal/archive/raw/ + a no-op
8
+ * consolidation job) is otherwise unrecoverable except by hand-grepping raw
9
+ * dumps and cross-checking the palace/insight graph, exactly as that fixture
10
+ * had to do. `resurrect()` scans every project's raw archive + session cards
11
+ * + the cross-project recency index and ranks candidates by recency and
12
+ * (when a query is given) keyword match, so a "how much can you recall on
13
+ * X?" moment can be answered mechanically instead of by manual forensics.
14
+ *
15
+ * Sources (read-only — this module never writes to the store):
16
+ * - <root>/recent-sessions.jsonl (F2, optional — may not exist yet)
17
+ * - <root>/projects/<slug>/journal/archive/raw/*.md (lossless verbatim tier)
18
+ * - <root>/projects/<slug>/journal/*--card--*.md (F3 mechanical session card)
19
+ * - <root>/working-memory/*.jsonl (v3.4.42 working-memory wave — LIVE,
20
+ * not-yet-ended sessions; the FRESHEST possible source, since a file
21
+ * here means the session is still running, or crashed with no hook-end
22
+ * at all yet, RIGHT NOW)
23
+ * All four are merged by (slug, sid) — the SAME session recorded via
24
+ * multiple tiers becomes ONE ContinuityBrief with fields backfilled from
25
+ * whichever source has them, cards preferred over raw for title/goal since
26
+ * they are the higher-fidelity, already-distilled tier. A live WM entry's
27
+ * `provenance` carries the literal marker `[working-memory · live]` instead
28
+ * of a file path, so a caller can tell at a glance that a brief is backed by
29
+ * an in-progress session rather than a completed one.
30
+ *
31
+ * Precision note (fixture report §2): naive path/Linear-ID regexes over raw
32
+ * transcript text are exactly what misled the incident's own forensics —
33
+ * hook-injected boilerplate (folder-lint warnings, orchestrator briefs) can
34
+ * contain plausible-looking file paths and ticket IDs unrelated to the
35
+ * session's real content.
36
+ *
37
+ * fix2 (2026-07-31 — root-cause consolidation): artifact/Linear-ref/
38
+ * next-step extraction used to be a SEPARATE, lower-rigor reimplementation
39
+ * of the logic already fixed (M9's tool_result exclusion) in
40
+ * storage/session-card.ts — so that fix, and a markdown-heading exclusion,
41
+ * never reached this module's copies (verifier-report V3 + "additional
42
+ * findings" #3/#5). Extraction now lives in ONE place,
43
+ * `../storage/extraction.js`, consumed by BOTH this module and
44
+ * session-card.ts:
45
+ * - Source 2 (raw archive bodies) embeds near-verbatim JSONL transcript
46
+ * lines after a frontmatter block — exactly session-card.ts's rawHead/
47
+ * rawTail shape — so it is parsed via `parseJsonlLenient` and scanned
48
+ * with the SAME record-based, M9-protected extractors session-card.ts
49
+ * uses (`extractArtifactPathsFromRecords` / `extractLinearRefsFromRecords`).
50
+ * A tool_result-embedded ref genuinely cannot leak here anymore.
51
+ * - Source 3 (session-card markdown bodies) has no record structure to
52
+ * recover — it is the ALREADY-RENDERED OUTPUT of session-card.ts's own
53
+ * M9-protected extractors, so a raw tool_result JSON blob never appears
54
+ * in it to begin with; the text-level `extractArtifactPathsFromText` /
55
+ * `extractLinearRefsFromText` helpers are the right (and only sensible)
56
+ * tool there. This module still does NOT import session-card.ts's
57
+ * renderer itself (`buildSessionCard`/`writeSessionCard`) — cards are
58
+ * parsed generically via the documented on-disk shape (frontmatter keys
59
+ * `sid`/`date`/`slug`/`slug_confidence`/`source` per design §F3) so this
60
+ * stays buildable independent of W1's parallel work; only the shared
61
+ * extraction PRIMITIVES are imported, not the card build/write path.
62
+ *
63
+ * fix3 (2026-07-31 — round 2 of the same root-cause consolidation): fix2
64
+ * covered artifacts/Linear-refs/next-step-line-cosmetics; a real-store
65
+ * read-only acceptance run then found title/goalExcerpt AND the actual
66
+ * next-step VALUES for Source 2 were still derived by flat TEXT-level
67
+ * scanning of the raw JSONL body (a global `"text":"..."` regex for the
68
+ * goal; a per-line `NEXT_STEP_LINE_RE` grep over the whole raw body for
69
+ * next-steps) — the exact same class of bug fix2 fixed for artifacts/refs,
70
+ * just not yet extended to these two fields. Both now go through the SAME
71
+ * shared, record-based reduction session-card.ts uses for its own title
72
+ * fallback and finalAssistantText: `extractFirstUserTextFromRecords` (goal)
73
+ * and `extractLinesMatching` over `extractFinalRecordText(..., "assistant")`
74
+ * (next-steps) — see the Source 2 loop below for the full rationale and the
75
+ * "empty beats garbage" fallback rule this closes.
76
+ */
77
+ import * as fs from "node:fs";
78
+ import * as path from "node:path";
79
+ import { getRoot } from "../types.js";
80
+ import { archiveRawDir, journalDir, projectsRootDir } from "../storage/paths.js";
81
+ import { parseMemoryFile } from "../supabase/sync.js";
82
+ import { truncateUtf8Bytes } from "../storage/fs-utils.js";
83
+ import { wmList, wmRead, guessSlugFromWmLines } from "../storage/working-memory.js";
84
+ import { NEXT_STEP_LINE_RE, parseJsonlLenient, extractArtifactPathsFromRecords, extractLinearRefsFromRecords, extractArtifactPathsFromText, extractLinearRefsFromText, extractLinesMatching, extractFirstUserTextFromRecords, extractFinalRecordText, unescapeJsonString, } from "../storage/extraction.js";
85
+ // ---------------------------------------------------------------------------
86
+ // Tuning constants
87
+ // ---------------------------------------------------------------------------
88
+ const DEFAULT_DAYS = 14;
89
+ const DEFAULT_LIMIT = 20;
90
+ const MAX_ARTIFACTS = 20;
91
+ const MAX_LINEAR_REFS = 20;
92
+ const MAX_NEXT_STEPS = 3;
93
+ const MIN_PROSE_LEN = 20; // shorter "text" blocks are almost never real content
94
+ const MAX_PROSE_LEN = 1500; // longer blocks are almost always a hook/system dump
95
+ const DAY_MS = 24 * 60 * 60 * 1000;
96
+ /**
97
+ * fix3 (2026-07-31): title/goal byte caps for Source 2's record-aware
98
+ * extraction (first real user-authored text) — UTF-8-safe via the shared
99
+ * `truncateUtf8Bytes` helper, never a raw `.slice()` on JS char count, which
100
+ * can split a surrogate pair. RAW_TITLE_BYTE_CAP matches
101
+ * `extractTitleAndGoal`'s pre-existing markdown-heading title cap (160) for
102
+ * continuity across sources.
103
+ */
104
+ const RAW_GOAL_BYTE_CAP = 200;
105
+ const RAW_TITLE_BYTE_CAP = 160;
106
+ const BOILERPLATE_MARKERS = [
107
+ "system-reminder",
108
+ "sessionstart:startup",
109
+ "folder-lint",
110
+ "hook success",
111
+ "memory-stale-check",
112
+ "plywood protocol",
113
+ ];
114
+ const HIGH_CONFIDENCE_KEYWORD_WEIGHT = 10;
115
+ const LOW_CONFIDENCE_KEYWORD_WEIGHT = 3;
116
+ function keyOf(slug, sid) {
117
+ return `${slug}::${sid}`;
118
+ }
119
+ function getOrCreate(map, slug, sid) {
120
+ const key = keyOf(slug, sid);
121
+ let entry = map.get(key);
122
+ if (!entry) {
123
+ entry = {
124
+ slug,
125
+ sid,
126
+ date: "",
127
+ ts: 0,
128
+ artifacts: new Set(),
129
+ linearRefs: new Set(),
130
+ nextSteps: [],
131
+ provenance: new Set(),
132
+ rawBodies: [],
133
+ };
134
+ map.set(key, entry);
135
+ }
136
+ return entry;
137
+ }
138
+ function dedupPush(arr, item, cap) {
139
+ const trimmed = item.trim();
140
+ if (!trimmed || arr.includes(trimmed) || arr.length >= cap)
141
+ return arr;
142
+ return [...arr, trimmed];
143
+ }
144
+ function dedupPushAll(arr, items, cap) {
145
+ let out = arr;
146
+ for (const item of items)
147
+ out = dedupPush(out, item, cap);
148
+ return out;
149
+ }
150
+ // ---------------------------------------------------------------------------
151
+ // Filesystem enumeration
152
+ // ---------------------------------------------------------------------------
153
+ /** All project slugs on disk under <root>/projects/. Never throws — [] on any fs error. */
154
+ function enumerateProjectSlugs() {
155
+ try {
156
+ return fs
157
+ .readdirSync(projectsRootDir(), { withFileTypes: true })
158
+ .filter((e) => e.isDirectory())
159
+ .map((e) => e.name);
160
+ }
161
+ catch {
162
+ return [];
163
+ }
164
+ }
165
+ /**
166
+ * Read <root>/recent-sessions.jsonl (F2's format, per design §F2 — this
167
+ * module depends ONLY on the documented shape, not on W2's implementation).
168
+ * Optional: an absent file is simply zero entries, never an error.
169
+ */
170
+ function readRecentSessions() {
171
+ const p = path.join(getRoot(), "recent-sessions.jsonl");
172
+ let content;
173
+ try {
174
+ content = fs.readFileSync(p, "utf-8");
175
+ }
176
+ catch {
177
+ return [];
178
+ }
179
+ const out = [];
180
+ for (const line of content.split("\n")) {
181
+ const trimmed = line.trim();
182
+ if (!trimmed)
183
+ continue;
184
+ try {
185
+ const row = JSON.parse(trimmed);
186
+ if (row && typeof row.ts === "string" && typeof row.sid === "string" && typeof row.slug === "string") {
187
+ out.push({ ts: row.ts, sid: row.sid, slug: row.slug, title: row.title, next_step: row.next_step });
188
+ }
189
+ }
190
+ catch {
191
+ // skip malformed line
192
+ }
193
+ }
194
+ return out;
195
+ }
196
+ // ---------------------------------------------------------------------------
197
+ // Text extraction (shared by raw archive bodies and session-card bodies)
198
+ // ---------------------------------------------------------------------------
199
+ // unescapeJsonString is also used below, imported from ../storage/extraction.js
200
+ // (fix2, 2026-07-31) — single source, not a second local copy.
201
+ function looksLikeBoilerplate(text) {
202
+ if (text.length > MAX_PROSE_LEN)
203
+ return true;
204
+ const lower = text.toLowerCase();
205
+ return BOILERPLATE_MARKERS.some((marker) => lower.includes(marker));
206
+ }
207
+ /**
208
+ * Best-effort extraction of the first real prose "text" JSON field out of a
209
+ * raw (non-markdown) transcript body. Raw archive bodies are near-JSONL, not
210
+ * valid line-delimited JSON (fixture report §1) — this deliberately does NOT
211
+ * attempt a full JSON parse; it regex-scans for `"text":"..."` values, skips
212
+ * ones too short to be content or that match a known hook-boilerplate
213
+ * marker, and returns the first survivor. Returns null if nothing qualifies.
214
+ */
215
+ function extractFirstProseTextBlock(body) {
216
+ const re = /"text"\s*:\s*"((?:\\.|[^"\\])*)"/g;
217
+ let match;
218
+ while ((match = re.exec(body)) !== null) {
219
+ const text = unescapeJsonString(match[1]);
220
+ if (text.length < MIN_PROSE_LEN)
221
+ continue;
222
+ if (looksLikeBoilerplate(text))
223
+ continue;
224
+ return text;
225
+ }
226
+ return null;
227
+ }
228
+ /**
229
+ * Derive {title, goalExcerpt} from a body of text. Markdown bodies (session
230
+ * cards) have a leading heading — use it, plus the first paragraph after it
231
+ * as the goal excerpt. Non-markdown bodies (raw transcript dumps) fall back
232
+ * to the first qualifying prose "text" block; if even that fails, fall back
233
+ * to a trimmed slice of the body itself so a title is never empty.
234
+ */
235
+ function extractTitleAndGoal(body) {
236
+ const heading = body.match(/^#{1,3}\s+(.+)$/m);
237
+ if (heading && heading.index !== undefined) {
238
+ const title = heading[1].trim().slice(0, 160);
239
+ const afterHeading = body.slice(heading.index + heading[0].length);
240
+ const paragraph = afterHeading
241
+ .split(/\n\s*\n/)
242
+ .map((p) => p.trim())
243
+ .find((p) => p.length > 0);
244
+ const goalExcerpt = (paragraph ?? title).replace(/\s+/g, " ").slice(0, 240);
245
+ return { title, goalExcerpt };
246
+ }
247
+ const prose = extractFirstProseTextBlock(body);
248
+ if (prose) {
249
+ const clipped = prose.replace(/\s+/g, " ").trim();
250
+ return { title: clipped.slice(0, 160), goalExcerpt: clipped.slice(0, 240) };
251
+ }
252
+ const fallback = body.replace(/\s+/g, " ").trim().slice(0, 160);
253
+ return { title: fallback || "(untitled session)", goalExcerpt: fallback };
254
+ }
255
+ // Artifact-path / Linear-ref / next-step-line extraction (record-based for
256
+ // Source 2's embedded JSONL, text-based for Source 3's card markdown) now
257
+ // live in ../storage/extraction.ts — imported above. Single source shared
258
+ // with storage/session-card.ts (fix2, 2026-07-31); see the file header for
259
+ // which variant each source uses and why.
260
+ // ---------------------------------------------------------------------------
261
+ // Ranking
262
+ // ---------------------------------------------------------------------------
263
+ function queryTermsOf(query) {
264
+ const trimmed = (query ?? "").trim();
265
+ if (!trimmed)
266
+ return [];
267
+ return trimmed
268
+ .toLowerCase()
269
+ .split(/\s+/)
270
+ .filter((t) => t.length >= 2);
271
+ }
272
+ /**
273
+ * recency × keyword ranking. Pure recency when no query terms are given.
274
+ *
275
+ * Date logic vs TODAY (Worker Done-Definition #4): `ageDays` is clamped to
276
+ * >= 0 — a future-dated entry (clock skew, malformed fixture, hostile input)
277
+ * must not compute a NEGATIVE age, which would otherwise inflate
278
+ * recencyScore above 1 and let a bogus future timestamp silently out-rank
279
+ * every genuine "just happened" entry. Clamping treats it as "as fresh as
280
+ * right now" (score 1), never "the future" (score > 1).
281
+ */
282
+ function computeScore(entry, queryTerms, now, days) {
283
+ const rawAgeDays = (now - entry.ts) / 86_400_000; // negative when entry.ts is in the future
284
+ const isFuture = rawAgeDays < 0;
285
+ const ageDays = Math.max(0, rawAgeDays);
286
+ let recencyScore = Math.max(0, 1 - ageDays / Math.max(1, days));
287
+ // A future timestamp is clamped to the SAME age as "right now" above, which
288
+ // would otherwise let it TIE (or, by floating-point luck, nose ahead of) a
289
+ // genuinely-current entry scored a few milliseconds later than its own
290
+ // creation timestamp. Apply a small deliberate penalty so a clock-skew /
291
+ // malformed future entry always ranks strictly BELOW a real "now" entry,
292
+ // while still landing comfortably above any older genuine entry — this is
293
+ // the "consumer filters" half of Worker Done-Definition #4: a future date
294
+ // must never win the recency race, only ever be treated as suspect-fresh.
295
+ if (isFuture)
296
+ recencyScore *= 0.99;
297
+ if (queryTerms.length === 0)
298
+ return recencyScore;
299
+ const highText = [entry.title ?? "", entry.goalExcerpt ?? "", ...entry.linearRefs, ...entry.artifacts]
300
+ .join(" ")
301
+ .toLowerCase();
302
+ const lowText = entry.rawBodies.join(" ").toLowerCase();
303
+ let keywordScore = 0;
304
+ for (const term of queryTerms) {
305
+ if (highText.includes(term))
306
+ keywordScore += HIGH_CONFIDENCE_KEYWORD_WEIGHT;
307
+ else if (lowText.includes(term))
308
+ keywordScore += LOW_CONFIDENCE_KEYWORD_WEIGHT;
309
+ }
310
+ return keywordScore + recencyScore;
311
+ }
312
+ // ---------------------------------------------------------------------------
313
+ // Main entry point
314
+ // ---------------------------------------------------------------------------
315
+ /**
316
+ * Read-only cross-slug dead-session finder. Never throws: any per-file or
317
+ * per-project read failure is skipped, and an empty/missing store simply
318
+ * yields an empty array (never a crash — Worker Done-Definition error path).
319
+ */
320
+ export function resurrect(input = {}) {
321
+ const days = Number.isFinite(input.days) && input.days > 0 ? input.days : DEFAULT_DAYS;
322
+ const limit = Number.isFinite(input.limit) && input.limit > 0 ? input.limit : DEFAULT_LIMIT;
323
+ const queryTerms = queryTermsOf(input.query);
324
+ const now = Date.now();
325
+ const windowMs = days * 24 * 60 * 60 * 1000;
326
+ const cutoff = now - windowMs;
327
+ const merged = new Map();
328
+ // ---- Source 1: recent-sessions.jsonl (cross-project recency index, F2) ----
329
+ for (const row of readRecentSessions()) {
330
+ const ts = Date.parse(row.ts);
331
+ if (!Number.isFinite(ts) || ts > now || ts < cutoff)
332
+ continue;
333
+ const entry = getOrCreate(merged, row.slug, row.sid);
334
+ if (!entry.date)
335
+ entry.date = row.ts.slice(0, 10);
336
+ entry.ts = Math.max(entry.ts, ts);
337
+ if (!entry.title && row.title)
338
+ entry.title = row.title;
339
+ if (row.next_step)
340
+ entry.nextSteps = dedupPush(entry.nextSteps, row.next_step, MAX_NEXT_STEPS);
341
+ entry.provenance.add(path.join(getRoot(), "recent-sessions.jsonl"));
342
+ }
343
+ const slugs = enumerateProjectSlugs();
344
+ // ---- Source 2: journal/archive/raw/*.md (lossless verbatim tier) ----
345
+ for (const slug of slugs) {
346
+ const dir = archiveRawDir(slug);
347
+ let files;
348
+ try {
349
+ files = fs.readdirSync(dir).filter((f) => f.endsWith(".md"));
350
+ }
351
+ catch {
352
+ continue;
353
+ }
354
+ for (const file of files) {
355
+ const nameMatch = file.match(/^(\d{4}-\d{2}-\d{2})--(.+)\.md$/);
356
+ if (!nameMatch)
357
+ continue;
358
+ const [, fileDate, sid] = nameMatch;
359
+ const fileTs = Date.parse(`${fileDate}T00:00:00.000Z`);
360
+ if (!Number.isFinite(fileTs) || fileTs < cutoff)
361
+ continue;
362
+ const filePath = path.join(dir, file);
363
+ let content;
364
+ try {
365
+ content = fs.readFileSync(filePath, "utf-8");
366
+ }
367
+ catch {
368
+ continue;
369
+ }
370
+ const entry = getOrCreate(merged, slug, sid);
371
+ if (!entry.date)
372
+ entry.date = fileDate;
373
+ entry.ts = Math.max(entry.ts, fileTs);
374
+ // Raw archive bodies embed near-verbatim JSONL transcript lines after
375
+ // a frontmatter block — the SAME shape session-card.ts's rawHead/
376
+ // rawTail parses — so title/goal/artifacts/linearRefs/next-steps ALL
377
+ // use the shared RECORD-based extractors (M9-protected: a
378
+ // tool_result-embedded ref/echo cannot leak into any of them). Parsed
379
+ // ONCE and reused below — no separate per-field re-parse.
380
+ //
381
+ // fix3 (2026-07-31 — root-cause consolidation, round 2): title/goal
382
+ // and next-steps used to be derived by TEXT-level scanning of `content`
383
+ // itself (a flat `"text":"..."` regex scan for the goal, a per-line
384
+ // `NEXT_STEP_LINE_RE` grep over the raw JSONL for next-steps) — neither
385
+ // is record-aware, so (a) a `tool_result` block's nested text (e.g. a
386
+ // `remember()` call's own "Saved → ... Find again: recall(...)" echo)
387
+ // could win the flat regex scan and be reported AS the session's goal,
388
+ // and (b) a whole raw JSONL LINE containing the substring "next"/"待"
389
+ // anywhere inside an embedded JSON blob (attachment record, tool_use
390
+ // input, tool_result echo, system-reminder text, ...) was pushed
391
+ // VERBATIM as a "next step" (real-store acceptance run: rendered
392
+ // briefs showed raw `{"parentUuid":...}` records in this field). Both
393
+ // are now derived the SAME way session-card.ts derives its own
394
+ // title-fallback / finalAssistantText: `extractFirstUserTextFromRecords`
395
+ // (first real user-authored text; a `tool_result` block never
396
+ // qualifies — see that function's doc) for the goal, and
397
+ // `extractLinesMatching` run over ONLY `extractFinalRecordText(...,
398
+ // "assistant")`'s real text — never over raw `content` — for next
399
+ // steps, so a next-step line can only ever be something the assistant
400
+ // itself actually said.
401
+ //
402
+ // "Empty beats garbage" (Worker Done-Definition-adjacent rule stated
403
+ // explicitly for this fix): when nothing real parses at all — every
404
+ // line boilerplate/system-text/tool_result-only, or truncated
405
+ // mid-JSON (see the PRE-EXISTING recall-cost tradeoff note below) —
406
+ // `extractFirstUserTextFromRecords` returns null and title/goalExcerpt
407
+ // are left UNSET for this source (never a fallback slice of the raw
408
+ // frontmatter+JSONL body, which is exactly the garbage this fix
409
+ // removes). The per-project fallback to "(untitled session)" /
410
+ // goalExcerpt:"" at brief-build time (below) already handles an
411
+ // entirely-unset field.
412
+ //
413
+ // Known, PRE-EXISTING recall-cost tradeoff (not introduced by this
414
+ // fix, only extended to this call site): archive-write.ts writes the
415
+ // verbatim rawTranscript as-is, but that transcript is itself a
416
+ // byte-offset head/tail SAMPLE (transcript-reader.ts's readHeadTail),
417
+ // not a line-boundary-safe one — the last head line / first tail line
418
+ // can be truncated mid-JSON-object. `parseJsonlLenient` requires a
419
+ // whole line to `JSON.parse` and silently drops one that doesn't, so
420
+ // a `file_path`/Linear-ref/goal/next-step sitting in exactly that
421
+ // truncated boundary line is missed here, whereas the OLD flat-regex
422
+ // scan (which pattern-matched substrings, not whole records) could
423
+ // sometimes still catch it — at the cost of the garbage this fix
424
+ // removes. session-card.ts's own rawHead/rawTail parsing already
425
+ // accepted this exact tradeoff; this fix keeps resurrect.ts consistent
426
+ // with it rather than introducing a new one.
427
+ const records = parseJsonlLenient(content);
428
+ const firstUserText = extractFirstUserTextFromRecords(records);
429
+ if (firstUserText) {
430
+ const clipped = firstUserText.replace(/\s+/g, " ").trim();
431
+ if (!entry.title)
432
+ entry.title = truncateUtf8Bytes(clipped, RAW_TITLE_BYTE_CAP);
433
+ if (!entry.goalExcerpt)
434
+ entry.goalExcerpt = truncateUtf8Bytes(clipped, RAW_GOAL_BYTE_CAP);
435
+ }
436
+ for (const a of extractArtifactPathsFromRecords(records, MAX_ARTIFACTS))
437
+ entry.artifacts.add(a);
438
+ for (const r of extractLinearRefsFromRecords(records, MAX_LINEAR_REFS))
439
+ entry.linearRefs.add(r);
440
+ const finalAssistantText = extractFinalRecordText(records, "assistant") ?? "";
441
+ entry.nextSteps = dedupPushAll(entry.nextSteps, extractLinesMatching(finalAssistantText, NEXT_STEP_LINE_RE, MAX_NEXT_STEPS), MAX_NEXT_STEPS);
442
+ entry.provenance.add(filePath);
443
+ entry.rawBodies.push(content);
444
+ }
445
+ }
446
+ // ---- Source 3: journal/*--card--*.md (F3 mechanical session card) ----
447
+ for (const slug of slugs) {
448
+ const dir = journalDir(slug);
449
+ let files;
450
+ try {
451
+ files = fs.readdirSync(dir).filter((f) => f.endsWith(".md"));
452
+ }
453
+ catch {
454
+ continue;
455
+ }
456
+ for (const file of files) {
457
+ const nameMatch = file.match(/^(\d{4}-\d{2}-\d{2})--card--(.+)\.md$/);
458
+ if (!nameMatch)
459
+ continue;
460
+ const [, fileDateFromName, sidFromName] = nameMatch;
461
+ // M6 fix (review, 2026-07-31): coarse pre-filter on the FILENAME date
462
+ // BEFORE opening/parsing the file — mirrors Source 2's raw-archive
463
+ // loop above, which already rejects out-of-window files by filename
464
+ // alone. Without this, resurrect() read+parsed EVERY card file ever
465
+ // written across every project on every call, scaling with
466
+ // total-cards-ever-written instead of with the requested window. ±1
467
+ // day padding because a card's FRONTMATTER date (which wins below,
468
+ // unchanged) can legitimately differ from its filename date by up to
469
+ // a day (e.g. a session that crossed local-midnight) — this coarse
470
+ // filter must never be stricter than the precise post-parse check
471
+ // that follows it.
472
+ const fileNameTs = Date.parse(`${fileDateFromName}T00:00:00.000Z`);
473
+ if (Number.isFinite(fileNameTs) && fileNameTs < cutoff - DAY_MS)
474
+ continue;
475
+ const filePath = path.join(dir, file);
476
+ let content;
477
+ try {
478
+ content = fs.readFileSync(filePath, "utf-8");
479
+ }
480
+ catch {
481
+ continue;
482
+ }
483
+ const parsed = parseMemoryFile(content);
484
+ const sid = typeof parsed.metadata.sid === "string" && parsed.metadata.sid ? parsed.metadata.sid : sidFromName;
485
+ const cardSlug = typeof parsed.metadata.slug === "string" && parsed.metadata.slug ? parsed.metadata.slug : slug;
486
+ const cardDate = typeof parsed.metadata.date === "string" && parsed.metadata.date ? parsed.metadata.date : fileDateFromName;
487
+ const cardTs = Date.parse(`${cardDate}T00:00:00.000Z`);
488
+ if (!Number.isFinite(cardTs) || cardTs < cutoff)
489
+ continue;
490
+ const entry = getOrCreate(merged, cardSlug, sid);
491
+ entry.date = cardDate;
492
+ entry.ts = Math.max(entry.ts, cardTs);
493
+ // Card fields are the higher-confidence, already-distilled tier —
494
+ // they win outright for title/goal rather than only filling gaps.
495
+ const { goalExcerpt: bodyGoal } = extractTitleAndGoal(parsed.body);
496
+ entry.title = parsed.title || entry.title || "(untitled session)";
497
+ entry.goalExcerpt = bodyGoal || entry.goalExcerpt || "";
498
+ // Card bodies are already-rendered markdown (session-card.ts's OWN
499
+ // output, itself built from the M9-protected record extractors) — no
500
+ // record structure survives to recover, and no raw tool_result JSON
501
+ // blob is ever present to exclude, so the TEXT-based shared
502
+ // extractors are the right (and only sensible) tool here.
503
+ for (const a of extractArtifactPathsFromText(parsed.body, MAX_ARTIFACTS))
504
+ entry.artifacts.add(a);
505
+ for (const r of extractLinearRefsFromText(parsed.body, MAX_LINEAR_REFS))
506
+ entry.linearRefs.add(r);
507
+ const cardNextSteps = extractLinesMatching(parsed.body, NEXT_STEP_LINE_RE, MAX_NEXT_STEPS);
508
+ if (cardNextSteps.length > 0)
509
+ entry.nextSteps = cardNextSteps.slice(0, MAX_NEXT_STEPS);
510
+ entry.provenance.add(filePath);
511
+ }
512
+ }
513
+ // ---- Source 4: working-memory/*.jsonl (LIVE, not-yet-ended sessions) ----
514
+ // v3.4.42 working-memory wave — WM is the FRESHEST possible source: a file
515
+ // here means the session is still running (or crashed with no hook-end at
516
+ // all yet) RIGHT NOW, so its natural recency score (via `ts` = file mtime)
517
+ // already outranks every other tier through the EXISTING scoring formula
518
+ // below — no special-case scoring needed. Slug is guessed via
519
+ // `guessSlugFromWmLines`'s cwd-majority heuristic (see that function's doc
520
+ // comment in working-memory.ts for why this module cannot call the CLI
521
+ // package's stronger `resolveSessionProject` directly — a core→cli import
522
+ // would invert the package dependency direction). Falls back to "auto"
523
+ // (session-card.ts's existing convention for an unresolved slug) when no
524
+ // cwd signal is available at all. Respects the SAME `cutoff` window as
525
+ // every other source, so a WM file that somehow never got rescued (orphan
526
+ // rescue never ran) does not surface as "live" forever.
527
+ for (const wmFile of wmList()) {
528
+ if (wmFile.mtimeMs < cutoff)
529
+ continue;
530
+ const wmLines = wmRead(wmFile.sid);
531
+ if (wmLines.length === 0)
532
+ continue;
533
+ const slug = guessSlugFromWmLines(wmLines) ?? "auto";
534
+ const entry = getOrCreate(merged, slug, wmFile.sid);
535
+ entry.ts = Math.max(entry.ts, wmFile.mtimeMs);
536
+ if (!entry.date)
537
+ entry.date = new Date(wmFile.mtimeMs).toISOString().slice(0, 10);
538
+ const first = wmLines[0].prompt.replace(/\s+/g, " ").trim();
539
+ if (!entry.title)
540
+ entry.title = truncateUtf8Bytes(first, RAW_TITLE_BYTE_CAP);
541
+ if (!entry.goalExcerpt)
542
+ entry.goalExcerpt = truncateUtf8Bytes(first, RAW_GOAL_BYTE_CAP);
543
+ entry.rawBodies.push(wmLines.map((l) => l.prompt).join(" "));
544
+ entry.provenance.add("[working-memory · live]");
545
+ }
546
+ // ---- Score + build briefs ----
547
+ const briefs = [];
548
+ for (const entry of merged.values()) {
549
+ briefs.push({
550
+ slug: entry.slug,
551
+ sid: entry.sid,
552
+ date: entry.date || "unknown",
553
+ title: entry.title || "(untitled session)",
554
+ goalExcerpt: entry.goalExcerpt || "",
555
+ artifacts: [...entry.artifacts].slice(0, MAX_ARTIFACTS),
556
+ linearRefs: [...entry.linearRefs].slice(0, MAX_LINEAR_REFS),
557
+ nextSteps: entry.nextSteps.slice(0, MAX_NEXT_STEPS),
558
+ provenance: [...entry.provenance],
559
+ score: computeScore(entry, queryTerms, now, days),
560
+ });
561
+ }
562
+ briefs.sort((a, b) => b.score - a.score);
563
+ return briefs.slice(0, limit);
564
+ }
565
+ /**
566
+ * Markdown renderer for a list of ContinuityBriefs (CLI command wiring for
567
+ * `ar resurrect` is Wave-2's job — this is just the render function it will
568
+ * call). Never returns an empty string: an empty result set still renders a
569
+ * one-line "nothing found" message so a caller always has something to print.
570
+ */
571
+ export function renderResurrectMarkdown(briefs) {
572
+ if (briefs.length === 0) {
573
+ return "No dead sessions found in the requested window.\n";
574
+ }
575
+ const lines = [];
576
+ for (const brief of briefs) {
577
+ lines.push(`## ${brief.title}`);
578
+ lines.push(`- slug: ${brief.slug}`);
579
+ lines.push(`- sid: ${brief.sid}`);
580
+ lines.push(`- date: ${brief.date}`);
581
+ if (brief.goalExcerpt)
582
+ lines.push(`- goal: ${brief.goalExcerpt}`);
583
+ if (brief.linearRefs.length > 0)
584
+ lines.push(`- linear: ${brief.linearRefs.join(", ")}`);
585
+ if (brief.artifacts.length > 0) {
586
+ lines.push("- artifacts:");
587
+ for (const artifact of brief.artifacts)
588
+ lines.push(` - ${artifact}`);
589
+ }
590
+ if (brief.nextSteps.length > 0) {
591
+ lines.push("- next steps:");
592
+ for (const step of brief.nextSteps)
593
+ lines.push(` - ${step}`);
594
+ }
595
+ lines.push("- provenance:");
596
+ for (const source of brief.provenance)
597
+ lines.push(` - ${source}`);
598
+ lines.push("");
599
+ }
600
+ return lines.join("\n").trimEnd() + "\n";
601
+ }
602
+ //# sourceMappingURL=resurrect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resurrect.js","sourceRoot":"","sources":["../../src/tools-logic/resurrect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpF,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,+BAA+B,EAC/B,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,E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@ -22,6 +22,12 @@ export interface SessionStartLiteResult {
22
22
  total_skills: number;
23
23
  /** Store-integrity one-liner; null (and silent) when the store is healthy. */
24
24
  store_doctor: string | null;
25
+ /**
26
+ * F2 (continuity wave 2026-07-31) — single-line cross-project recency
27
+ * pointer: the most recent entry across ANY project's recency ledger,
28
+ * rendered as one line. Null (and silent) when the ledger is empty.
29
+ */
30
+ continuity: string | null;
25
31
  hint: string;
26
32
  }
27
33
  export declare function sessionStartLite(input: SessionStartLiteInput): Promise<SessionStartLiteResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"session-start-lite.d.ts","sourceRoot":"","sources":["../../src/tools-logic/session-start-lite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,yBAAyB,EAAE,MAAM,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA2CpG"}
1
+ {"version":3,"file":"session-start-lite.d.ts","sourceRoot":"","sources":["../../src/tools-logic/session-start-lite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAA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