agent-recall-core 3.4.42 → 3.4.43

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 (35) hide show
  1. package/dist/host-profile.d.ts +35 -0
  2. package/dist/host-profile.d.ts.map +1 -1
  3. package/dist/host-profile.js +37 -0
  4. package/dist/host-profile.js.map +1 -1
  5. package/dist/index.d.ts +3 -3
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/storage/archive-write.d.ts.map +1 -1
  10. package/dist/storage/archive-write.js +13 -2
  11. package/dist/storage/archive-write.js.map +1 -1
  12. package/dist/storage/consolidation-queue.d.ts.map +1 -1
  13. package/dist/storage/consolidation-queue.js +48 -6
  14. package/dist/storage/consolidation-queue.js.map +1 -1
  15. package/dist/storage/recency-index.d.ts +20 -0
  16. package/dist/storage/recency-index.d.ts.map +1 -1
  17. package/dist/storage/recency-index.js +66 -2
  18. package/dist/storage/recency-index.js.map +1 -1
  19. package/dist/storage/session-card.d.ts +20 -4
  20. package/dist/storage/session-card.d.ts.map +1 -1
  21. package/dist/storage/session-card.js +19 -5
  22. package/dist/storage/session-card.js.map +1 -1
  23. package/dist/storage/working-memory.d.ts +64 -0
  24. package/dist/storage/working-memory.d.ts.map +1 -1
  25. package/dist/storage/working-memory.js +288 -1
  26. package/dist/storage/working-memory.js.map +1 -1
  27. package/dist/tools-logic/session-end.d.ts.map +1 -1
  28. package/dist/tools-logic/session-end.js +118 -15
  29. package/dist/tools-logic/session-end.js.map +1 -1
  30. package/dist/tools-logic/session-start.d.ts.map +1 -1
  31. package/dist/tools-logic/session-start.js +35 -1
  32. package/dist/tools-logic/session-start.js.map +1 -1
  33. package/dist/types.d.ts +1 -1
  34. package/dist/types.js +1 -1
  35. package/package.json +1 -1
@@ -32,9 +32,12 @@ import { getRoot } from "../types.js";
32
32
  import { ensureDir, truncateUtf8Bytes } from "./fs-utils.js";
33
33
  import { isSystemText, parseJsonlLenient } from "./extraction.js";
34
34
  import { recordHookFailure } from "./hook-health.js";
35
- import { sanitizeSlug } from "./paths.js";
35
+ import { sanitizeSlug, projectsRootDir } from "./paths.js";
36
36
  import { isValidProjectSlug, listAllProjects } from "./project.js";
37
37
  import { scrubForCloud } from "./content-guard.js";
38
+ import { generateFrontmatter } from "../palace/obsidian.js";
39
+ import { writeSessionCard } from "./session-card.js";
40
+ import { appendRecentSession, readRecentSessions } from "./recency-index.js";
38
41
  const WM_DIRNAME = "working-memory";
39
42
  const JSONL_EXT = ".jsonl";
40
43
  const COUNT_EXT = ".count";
@@ -325,4 +328,288 @@ export function guessSlugFromWmLines(lines) {
325
328
  }
326
329
  return ranked[0]?.slug ?? null;
327
330
  }
331
+ /**
332
+ * v3.4.42 working-memory wave — orphan-rescue idempotency guard 1/2: does ANY
333
+ * project already have a session card for this sid? Scans every project's
334
+ * journal/ directory for a `*--card--<sid>.md` file (the exact naming
335
+ * convention `writeSessionCard` uses). Never throws — a missing/unreadable
336
+ * projects dir simply means "no card found".
337
+ *
338
+ * Moved here verbatim from packages/cli/src/index.ts (Train C, C-2, 2026-08-12
339
+ * wave) as part of single-sourcing the orphan-rescue sweep — see
340
+ * `rescueOrphanedWorkingMemory`'s doc comment below for why. NOT quite
341
+ * verbatim, though: the original CLI version built the enumeration root via
342
+ * a raw `path.join(root, "projects")`. This package's own F2 architectural
343
+ * guard (test/projects-literal-bypass-guard.test.mjs) forbids any
344
+ * `packages/core/src/**` file other than storage/paths.ts from inlining the
345
+ * `"projects"` literal — moving this function into core surfaced that guard
346
+ * for the first time. Fixed to use `projectsRootDir()`, the sanctioned
347
+ * enumeration-only helper paths.ts itself documents for exactly this case
348
+ * (joining directly against a slug that came FROM a readdir, not a
349
+ * caller-supplied name that needs the case-fold reuse rule).
350
+ *
351
+ * Rescue-slug-parity fix (Train C, 2026-08-13): returns the FOUND slug (the
352
+ * on-disk directory name the readdir actually matched under) instead of a
353
+ * bare boolean. `distillOneSession` below needs this because, when a card
354
+ * for this sid already exists, THIS slug (not a fresh `guessSlugFromWmLines`
355
+ * re-guess, which could itself have drifted since the card was written) is
356
+ * the only correct value for a not-yet-existing recency-ledger entry — see
357
+ * that function's own comment for the full ledger-vs-disk mismatch this
358
+ * closes. `null` means "no card found for this sid in any project."
359
+ */
360
+ function findCardSlugForSid(sid) {
361
+ try {
362
+ const projectsDir = projectsRootDir();
363
+ if (!fs.existsSync(projectsDir))
364
+ return null;
365
+ for (const slug of fs.readdirSync(projectsDir)) {
366
+ const journalPath = path.join(projectsDir, slug, "journal");
367
+ if (!fs.existsSync(journalPath))
368
+ continue;
369
+ const hit = fs.readdirSync(journalPath).some((f) => f.endsWith(`--card--${sid}.md`));
370
+ if (hit)
371
+ return slug;
372
+ }
373
+ return null;
374
+ }
375
+ catch {
376
+ return null;
377
+ }
378
+ }
379
+ /**
380
+ * C-2 (Train C, 2026-08-12 wave, design doc reports/2026-08-12-trainc-design.md)
381
+ * — the working-memory orphan-rescue sweep, single-sourced.
382
+ *
383
+ * WHY: through the v3.4.42 working-memory wave this sweep lived ONLY inside
384
+ * the CLI's `hook-start` case (packages/cli/src/index.ts) — a session that
385
+ * crashed on a host with no Claude Code hooks (Codex/Cursor/raw MCP) had no
386
+ * path back to a card at all, because nothing but that one CLI command ever
387
+ * ran the sweep. Doctrine (owner, 2026-07-26): the customer's only action is
388
+ * describing intent — the MCP server process itself must carry the memory
389
+ * lifecycle on hook-less hosts. Moved here, byte-for-byte behavior preserved,
390
+ * so BOTH callers — the CLI's `hook-start` case AND core's own `sessionStart()`
391
+ * (tools-logic/session-start.ts, called by the MCP `session_start` tool on
392
+ * every host) — invoke this ONE function. Neither re-implements any part of
393
+ * the sweep; there is exactly one place this logic can drift.
394
+ *
395
+ * Mechanism (unchanged from the original CLI-only version): a working-memory
396
+ * file older than `WM_ORPHAN_WINDOW_MS` with no session card and no
397
+ * recency-index entry yet is presumed to belong to a session that crashed or
398
+ * was `kill -9`'d without ever reaching hook-end (or, on a non-hook host,
399
+ * without the agent ever calling `session_end`). Rescues it into a
400
+ * searchable session card + recency entry, then deletes the WM file.
401
+ * Idempotent (card-exists / recency-exists guards — safe to call on every
402
+ * hook-start AND every session_start, from every open window/process),
403
+ * per-file fault-isolated (one bad orphan can never abort the sweep for its
404
+ * siblings — M1 fix, see the recency-append verification below), and NEVER
405
+ * throws: every failure is reported via `recordHookFailure` instead of
406
+ * propagating, matching every other WM helper's contract in this module.
407
+ *
408
+ * Renamed failure-record hook keys from the CLI original ("hook-start-wm-rescue"
409
+ * -> "wm-orphan-rescue", "hook-start-wm-rescue-recency" -> "wm-orphan-rescue-
410
+ * recency") — cosmetic only, no test or renderer asserts the literal string —
411
+ * because the sweep is no longer CLI-hook-specific; the old names would be
412
+ * actively misleading once an MCP `session_start` call is what triggered a
413
+ * given failure row.
414
+ *
415
+ * The per-file WM→card mechanism itself lives in `distillOneSession` below —
416
+ * factored out so C-3's graceful-exit handler (mcp-server/src/lib/
417
+ * lifecycle-exit.ts, via `distillSessionToCard`) can distill its OWN,
418
+ * still-fresh session immediately (no age gate) through the exact same
419
+ * mechanism this sweep uses for aged orphans, instead of a third
420
+ * reimplementation of "WM lines -> card + recency entry -> delete WM".
421
+ */
422
+ export function rescueOrphanedWorkingMemory() {
423
+ try {
424
+ const now = Date.now();
425
+ const wmFiles = wmList();
426
+ // L1 fix (review, post-build, preserved from the CLI original): hoist the
427
+ // recency-index read OUT of the per-orphan loop. `readRecentSessions(1000)`
428
+ // reads and JSON-parses up to 1000 ledger lines from disk; calling it once
429
+ // PER orphan file made the sweep's total cost scale with orphans ×
430
+ // ledger-size instead of once + an O(1) Set lookup per orphan.
431
+ const recentSids = new Set(readRecentSessions(1000).map((e) => e.sid));
432
+ for (const wmFile of wmFiles) {
433
+ // M1 fix (review, post-build, preserved from the CLI original): per-file
434
+ // try/catch — a thrown error while rescuing ONE orphan must never abort
435
+ // the whole sweep, silently skipping every OTHER orphan file that
436
+ // hadn't been reached yet.
437
+ try {
438
+ if (now - wmFile.mtimeMs <= WM_ORPHAN_WINDOW_MS)
439
+ continue; // still fresh — not orphaned yet
440
+ distillOneSession(wmFile, recentSids);
441
+ }
442
+ catch (e) {
443
+ recordHookFailure("wm-orphan-rescue", e);
444
+ // per-file catch — fall through to the next orphan, sweep continues
445
+ }
446
+ }
447
+ }
448
+ catch (e) {
449
+ recordHookFailure("wm-orphan-rescue", e);
450
+ }
451
+ }
452
+ /**
453
+ * Distill ONE session's working-memory lines into a session card + recency
454
+ * entry, then delete the WM file. No age check here BY DESIGN — that policy
455
+ * decision belongs entirely to the caller: `rescueOrphanedWorkingMemory`
456
+ * only reaches this for files already confirmed older than
457
+ * `WM_ORPHAN_WINDOW_MS`, while `distillSessionToCard` (below, C-3's
458
+ * graceful-exit entry point) calls it immediately for a still-live session.
459
+ * Lets exceptions propagate — both current callers wrap their own call in a
460
+ * try/catch (matching the original inline code's per-item fault isolation),
461
+ * so this extraction changes no failure-handling behavior.
462
+ *
463
+ * Rescue-slug-parity fix (Train C, 2026-08-13): `guessSlugFromWmLines`
464
+ * returns a RAW cwd-captured candidate (e.g. "AgentRecall") that is never
465
+ * itself lowercased/case-folded. `writeSessionCard` → `journalDir` →
466
+ * `resolveProjectDirName` DOES normalize it (lowercases via `sanitizeName`,
467
+ * or reuses whatever casing an existing project dir already has) before the
468
+ * card ever touches disk — so the card can land under `projects/agentrecall/`
469
+ * while the raw guessed value stays "AgentRecall". The recency ledger used
470
+ * to be appended with that same raw, never-normalized value, so a lookup
471
+ * keyed on the ledger's slug (e.g. this file's own
472
+ * `packages/mcp-server/test/kill9-orphan-rescue.test.mjs`, which asserts
473
+ * `recencyLines.some((e) => e.slug === rescuedCard.slug)` against the ACTUAL
474
+ * on-disk directory name) could never find the card it was supposedly
475
+ * pointing at. Fixed by tracking a SEPARATE `ledgerSlug` that is always
476
+ * populated from where the card ACTUALLY is — `writeSessionCard`'s own
477
+ * returned `slug` when this call just wrote it, or `findCardSlugForSid`'s
478
+ * already-resolved slug when the card already existed — never from the raw
479
+ * `guessSlugFromWmLines` guess directly.
480
+ */
481
+ function distillOneSession(wmFile, recentSids) {
482
+ // Idempotency guard: a card and/or recency entry already recorded for this
483
+ // sid means some or all of the rescue already happened (or the session
484
+ // ended normally via hook-end/session_end without WM having been cleaned
485
+ // up yet by some other race). Tracked as two SEPARATE signals (not one
486
+ // OR'd flag) — a card that exists with no matching recency entry must NOT
487
+ // be treated as fully rescued. `existingCardSlug` (not just a boolean) is
488
+ // the ACTUAL on-disk slug of that pre-existing card, needed below.
489
+ const existingCardSlug = findCardSlugForSid(wmFile.sid);
490
+ const hasCard = existingCardSlug !== null;
491
+ const hasRecency = recentSids.has(wmFile.sid);
492
+ if (hasCard && hasRecency) {
493
+ // Both tiers confirmed — nothing left to do but sweep the leftover WM file.
494
+ wmDelete(wmFile.sid);
495
+ return;
496
+ }
497
+ const wmLines = wmRead(wmFile.sid);
498
+ if (wmLines.length === 0) {
499
+ wmDelete(wmFile.sid); // empty/corrupt — nothing to rescue, stop retrying
500
+ return;
501
+ }
502
+ const first = wmLines[0];
503
+ const last = wmLines[wmLines.length - 1];
504
+ const guessedSlug = guessSlugFromWmLines(wmLines) ?? "auto";
505
+ const title = truncateUtf8Bytes(first.prompt, 120);
506
+ const date = new Date(wmFile.mtimeMs).toISOString().slice(0, 10);
507
+ // The slug the RECENCY LEDGER must record — always the card's real on-disk
508
+ // slug, never the raw guess. Defaults to the already-resolved
509
+ // `existingCardSlug` (the hasCard branch below never overwrites it); the
510
+ // !hasCard branch overwrites it with `written.slug` once the card write
511
+ // confirms where it actually landed.
512
+ let ledgerSlug = existingCardSlug ?? guessedSlug;
513
+ // Card-write is attempted ONLY when a card doesn't already exist (hasCard
514
+ // tracks that precisely). When hasCard is already true, the ONLY
515
+ // remaining gap this sweep needs to close is the recency entry.
516
+ let cardOk = hasCard;
517
+ if (!hasCard) {
518
+ const frontmatter = generateFrontmatter({
519
+ sid: wmFile.sid,
520
+ date,
521
+ slug: guessedSlug,
522
+ slug_confidence: 0,
523
+ slug_candidates: [],
524
+ source: "working-memory-rescue",
525
+ });
526
+ const body = [
527
+ `# ${title}`,
528
+ "",
529
+ `- rescued from working memory after ${wmLines.length} recorded prompt${wmLines.length === 1 ? "" : "s"} (no hook-end ever fired for this session)`,
530
+ `- ts range: ${first.ts} → ${last.ts}`,
531
+ "",
532
+ "## First prompt",
533
+ first.prompt,
534
+ "",
535
+ "## Last prompt",
536
+ last.prompt,
537
+ "",
538
+ ].join("\n");
539
+ const written = writeSessionCard({
540
+ markdown: frontmatter + body,
541
+ title,
542
+ artifacts: [],
543
+ linearRefs: [],
544
+ decisions: [],
545
+ nextStep: [],
546
+ sid: wmFile.sid,
547
+ slug: guessedSlug,
548
+ date,
549
+ });
550
+ cardOk = !!written.path;
551
+ if (cardOk)
552
+ ledgerSlug = written.slug || guessedSlug; // the ACTUAL on-disk slug, per WriteSessionCardResult.slug's contract
553
+ }
554
+ if (!cardOk) {
555
+ // The card write itself failed — leave the WM file in place so a future
556
+ // sweep (or the next graceful exit) can retry instead of losing the only
557
+ // remaining record of this session.
558
+ return;
559
+ }
560
+ // M1 fix (preserved from the CLI original): verify the recency append
561
+ // actually landed instead of trusting that it didn't throw.
562
+ // `appendRecentSession` is a DELIBERATELY best-effort, never-throws
563
+ // telemetry ledger — an unwritable root, a full disk, or a permissions
564
+ // error fails SILENTLY inside it. Re-read the ledger after the append and
565
+ // only delete WM once BOTH tiers are confirmed present, so a
566
+ // card-written-but-recency-failed session never becomes permanently
567
+ // invisible to continuity.
568
+ if (!hasRecency) {
569
+ appendRecentSession({
570
+ ts: new Date(wmFile.mtimeMs).toISOString(),
571
+ sid: wmFile.sid,
572
+ slug: ledgerSlug,
573
+ title,
574
+ artifact_count: 0,
575
+ });
576
+ const confirmedRecency = readRecentSessions(1000).some((e) => e.sid === wmFile.sid);
577
+ if (!confirmedRecency) {
578
+ recordHookFailure("wm-orphan-rescue-recency", new Error(`appendRecentSession did not persist for sid=${wmFile.sid}`));
579
+ return; // do NOT delete WM — retry the recency append on the next sweep/exit
580
+ }
581
+ }
582
+ wmDelete(wmFile.sid);
583
+ }
584
+ /**
585
+ * C-3 (Train C, 2026-08-12 wave) — best-effort freshness for a graceful
586
+ * client close. `mcp-server/src/lib/lifecycle-exit.ts` calls this for the
587
+ * CURRENT process's own `sid` (core's `getSessionId()`) on `stdin` "end"/
588
+ * "close" and on SIGTERM/SIGINT, so a graceful disconnect gets a card
589
+ * immediately instead of waiting up to `WM_ORPHAN_WINDOW_MS` for the NEXT
590
+ * session's orphan sweep to find it. Reuses `distillOneSession` — the SAME
591
+ * WM→card mechanism `rescueOrphanedWorkingMemory` uses for aged orphans —
592
+ * with no age gate, since this is called precisely because the session is
593
+ * ending RIGHT NOW, not because it went stale. A `kill -9` bypasses this
594
+ * entirely by construction (no signal, no stdin event ever fires) and falls
595
+ * through to `rescueOrphanedWorkingMemory` on a LATER session_start/hook-start,
596
+ * exactly as the design doc specifies.
597
+ *
598
+ * No-op (silent) when this session has no working-memory file at all — a
599
+ * session that never had a tool call captured (or whose WM was already
600
+ * cleaned up by a normal `session_end`) has nothing to distill. Never
601
+ * throws: reported via `recordHookFailure` like every other WM helper.
602
+ */
603
+ export function distillSessionToCard(sid) {
604
+ try {
605
+ const wmFile = wmList().find((f) => f.sid === sid);
606
+ if (!wmFile)
607
+ return; // nothing captured for this session — silent no-op
608
+ const recentSids = new Set(readRecentSessions(1000).map((e) => e.sid));
609
+ distillOneSession(wmFile, recentSids);
610
+ }
611
+ catch (e) {
612
+ recordHookFailure("wm-session-distill", e);
613
+ }
614
+ }
328
615
  //# sourceMappingURL=working-memory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"working-memory.js","sourceRoot":"","sources":["../../src/storage/working-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AACl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AC,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,eAAe,EAAE,CAAC;IACtC,gBAAgB,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAC3C,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAwBD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAOnE;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,GACpC,qBAAqB,EAAE,CA6CzB;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwvBlF"}
@@ -29,6 +29,7 @@ import { autoClassifySig, autoClassifyTheme } from "../helpers/journal-sig-theme
29
29
  import { pipelineOpen } from "./pipeline-open.js";
30
30
  import { pipelineClose } from "./pipeline-close.js";
31
31
  import { writeHandoff } from "../helpers/handoff.js";
32
+ import { recordHookFailure } from "../storage/hook-health.js";
32
33
  /**
33
34
  * C3 (2026-07-03) — recurrence markers, widened from the pre-C3 set.
34
35
  * "same mistake" retained; added violated/violating/violation, "ignored the rule",
@@ -187,6 +188,16 @@ export async function sessionEnd(input) {
187
188
  }
188
189
  catch (err) {
189
190
  journalWriteError = err instanceof Error ? err.message : String(err);
191
+ // F5 depth (2026-08-12, followups wave): this error is captured into the
192
+ // RETURN VALUE (journal_write_error, below) but sessionEnd() never
193
+ // throws — so a caller that doesn't inspect the result (e.g. the CLI's
194
+ // hook-end case, which fires "Session auto-saved" unconditionally after
195
+ // this call) never sees it, and the OUTER hook catch never fires either.
196
+ // This was the exact "memory not persisted, zero trace" scenario F5
197
+ // exists to catch. recordHookFailure never throws — journalWriteError's
198
+ // existing contract (returned to caller, rendered in the card) is
199
+ // unchanged.
200
+ recordHookFailure("session-end-journal-write", err);
190
201
  }
191
202
  // 1b. C3 (2026-07-03): evidence-grounded verdict classification.
192
203
  // SEMANTIC BREAK from pre-C3: the default outcome is now "unknown", NOT "heeded".
@@ -302,12 +313,22 @@ export async function sessionEnd(input) {
302
313
  }
303
314
  }
304
315
  catch {
305
- // Per-correction errors are swallowed — don't abort the loop
316
+ // Per-correction errors are swallowed — don't abort the loop.
317
+ // F5 depth (2026-08-12, followups wave): intentionally left UNWIRED
318
+ // — `todays` can be dozens of corrections; an occasional malformed
319
+ // one is routine, not a hook failure. The outer catch below already
320
+ // reports "the whole outcome-verdict subsystem broke" at the right
321
+ // granularity — see report.
306
322
  }
307
323
  }
308
324
  }
309
- catch {
325
+ catch (err) {
310
326
  // Outcome tracking must NEVER break session_end — swallow all errors
327
+ // F5 depth (2026-08-12, followups wave): this is the ONE catch in the
328
+ // 1b block worth reporting — a systemic failure (e.g. readOutcomesForToday
329
+ // itself broken) silently meant every correction's heeded/recurred
330
+ // verdict for this session went unrecorded, with zero trace anywhere.
331
+ recordHookFailure("session-end-outcome-verdict", err);
311
332
  }
312
333
  }
313
334
  // 1c. RD-1 (2026-07-14): cross-project failure-class recurrence join —
@@ -365,6 +386,10 @@ export async function sessionEnd(input) {
365
386
  return fs.statSync(path.join(projectsDir, s)).isDirectory();
366
387
  }
367
388
  catch {
389
+ // F5 depth (2026-08-12, followups wave): intentionally left
390
+ // UNWIRED — a single unreadable dir entry (race, permission)
391
+ // degrading to "not a project dir" is benign and expected;
392
+ // see report.
368
393
  return false;
369
394
  }
370
395
  })
@@ -429,18 +454,32 @@ export async function sessionEnd(input) {
429
454
  }
430
455
  catch {
431
456
  // Malformed candidate record → skipped; the join continues.
457
+ // F5 depth (2026-08-12, followups wave): intentionally left
458
+ // UNWIRED — `candidates` spans every active correction in
459
+ // one other project; an occasional malformed record is
460
+ // routine, not a hook failure. See report.
432
461
  }
433
462
  }
434
463
  }
435
- catch {
464
+ catch (err) {
436
465
  // Per-project errors are swallowed — don't abort the join
466
+ // F5 depth (2026-08-12, followups wave): a WHOLE project's
467
+ // cross-project join silently failing (e.g. readActiveCorrections
468
+ // itself broken for that slug) is a more specific, actionable
469
+ // signal than the per-candidate skip above — worth its own trace.
470
+ recordHookFailure("session-end-crossproject-join-project", err);
437
471
  }
438
472
  }
439
473
  }
440
474
  }
441
475
  }
442
- catch {
476
+ catch (err) {
443
477
  // Cross-project join must NEVER break session_end — swallow all errors
478
+ // F5 depth (2026-08-12, followups wave): the whole RD-1 subsystem
479
+ // (seed collection, the outer allSlugs scaffolding) breaking silently
480
+ // meant zero cross-project recurrence detection ran for this session,
481
+ // with zero trace anywhere until this fix.
482
+ recordHookFailure("session-end-crossproject-join", err);
444
483
  }
445
484
  }
446
485
  // 2. Update awareness with insights — confirm-first classification
@@ -483,6 +522,9 @@ export async function sessionEnd(input) {
483
522
  // Reset tallies on error so they don't misreport
484
523
  insightsAdded = 0;
485
524
  insightsConfirmed = 0;
525
+ // F5 depth (2026-08-12, followups wave): same invisible-unless-the-
526
+ // caller-checks-the-result-object class as journalWriteError above.
527
+ recordHookFailure("session-end-awareness", err);
486
528
  }
487
529
  }
488
530
  // 3. Consolidate journal to palace.
@@ -498,8 +540,15 @@ export async function sessionEnd(input) {
498
540
  reason: "session_end deferred (hook-end)",
499
541
  });
500
542
  }
501
- catch {
543
+ catch (err) {
502
544
  // enqueue is fire-and-forget — never affect the result
545
+ // F5 depth (2026-08-12, followups wave): enqueueConsolidation() itself
546
+ // now reports its OWN internal failures (consolidation-enqueue, in
547
+ // storage/consolidation-queue.ts) and never throws by contract — so in
548
+ // practice the only thing this catch can still see is
549
+ // ensurePalaceInitialized(slug) throwing. Reported under a distinct
550
+ // label so the two failure sources stay distinguishable in hook-health.
551
+ recordHookFailure("session-end-consolidation-enqueue", err);
503
552
  }
504
553
  palaceConsolidated = false; // compression happens later, off this turn
505
554
  // L2: the async dreaming queue fails often and is un-cron'd, so the three
@@ -510,8 +559,12 @@ export async function sessionEnd(input) {
510
559
  try {
511
560
  await runSafetyConsolidation(slug, { dryRun: false });
512
561
  }
513
- catch {
562
+ catch (err) {
514
563
  // safety consolidation is best-effort — never affect the result
564
+ // F5 depth (2026-08-12, followups wave): decay/prune/graduate silently
565
+ // failing across many sessions causes store bloat/staleness with zero
566
+ // diagnostic trail — exactly the invisible-swallow class F5 targets.
567
+ recordHookFailure("session-end-safety-consolidation", err);
515
568
  }
516
569
  }
517
570
  else {
@@ -522,6 +575,10 @@ export async function sessionEnd(input) {
522
575
  }
523
576
  catch (err) {
524
577
  palaceError = err instanceof Error ? err.message : String(err);
578
+ // F5 depth (2026-08-12, followups wave): same invisible-unless-the-
579
+ // caller-checks-the-result-object class as journalWriteError/
580
+ // awarenessError above.
581
+ recordHookFailure("session-end-palace-consolidate", err);
525
582
  }
526
583
  // L2: the inline consolidate above covers (a) decay+keystones. Add the other
527
584
  // two safety steps — (b) prune the unbounded raw archive and (c) graduate
@@ -531,8 +588,11 @@ export async function sessionEnd(input) {
531
588
  try {
532
589
  await runSafetyConsolidation(slug, { dryRun: false });
533
590
  }
534
- catch {
591
+ catch (err) {
535
592
  // safety consolidation is best-effort — never affect the result
593
+ // F5 depth (2026-08-12, followups wave): same rationale as the deferred
594
+ // branch's identically-labeled call above.
595
+ recordHookFailure("session-end-safety-consolidation", err);
536
596
  }
537
597
  }
538
598
  // Wave 5: re-derive the Blind-Spots profile as part of the (synchronous, NOT
@@ -543,8 +603,10 @@ export async function sessionEnd(input) {
543
603
  try {
544
604
  recomputeBlindSpots(slug);
545
605
  }
546
- catch {
606
+ catch (err) {
547
607
  // blind-spots derivation is best-effort — swallow all errors
608
+ // F5 depth (2026-08-12, followups wave): was invisible on failure.
609
+ recordHookFailure("session-end-blind-spots", err);
548
610
  }
549
611
  }
550
612
  // 4. Detect similar recent entries — suggest merge if high overlap
@@ -589,7 +651,13 @@ export async function sessionEnd(input) {
589
651
  }
590
652
  }
591
653
  }
592
- catch { /* merge detection is best-effort */ }
654
+ catch {
655
+ /* merge detection is best-effort */
656
+ // F5 depth (2026-08-12, followups wave): intentionally left UNWIRED —
657
+ // purely a cosmetic "consider merging" hint on the printed save card, no
658
+ // data-loss/persistence implication; runs every session so a transient
659
+ // hiccup here would be pure noise in hook-health. See report.
660
+ }
593
661
  // 5. Render save card — server-side, always correct
594
662
  const root = getRoot();
595
663
  const date = todayISO();
@@ -603,23 +671,52 @@ export async function sessionEnd(input) {
603
671
  const awareness = readAwarenessState();
604
672
  totalInsights = awareness?.topInsights?.length ?? 0;
605
673
  }
606
- catch { /* non-blocking */ }
674
+ catch {
675
+ /* non-blocking */
676
+ // F5 depth (2026-08-12, followups wave): intentionally left UNWIRED —
677
+ // read-only display counter for the printed card ("N total"); the actual
678
+ // awareness WRITE path is already covered above (session-end-awareness).
679
+ // See report.
680
+ }
607
681
  // Get updated rooms
608
682
  let roomNames = [];
609
683
  try {
610
684
  const rooms = listRooms(slug);
611
685
  roomNames = rooms.slice(0, 3).map(r => r.name);
612
686
  }
613
- catch { /* non-blocking */ }
687
+ catch {
688
+ /* non-blocking */
689
+ // F5 depth (2026-08-12, followups wave): intentionally left UNWIRED —
690
+ // read-only display list for the printed card; the actual palace
691
+ // consolidation WRITE path is already covered above
692
+ // (session-end-palace-consolidate). See report.
693
+ }
614
694
  // Count corrections for this project
615
695
  let correctionCount = 0;
616
696
  // F2 fix (independent review, 2026-07-20): was a raw template-literal path
617
697
  // (bypassed resolveProjectDirName entirely, not just path.join call sites) —
618
698
  // routes through paths.ts now, so the count matches what correctionsDir()
619
699
  // actually reads/writes for this project.
620
- const corrDir = projectSubPath(slug, "corrections");
621
- if (fs.existsSync(corrDir)) {
622
- correctionCount = fs.readdirSync(corrDir).filter(f => f.endsWith(".json")).length;
700
+ //
701
+ // F5 depth (2026-08-12, followups wave): this block had NO try/catch at
702
+ // all — unlike every other display-value read in this section
703
+ // (totalInsights, roomNames above), a corrections/ path that is not a
704
+ // directory (corruption, or the exact ENOTDIR this wave's own tests force
705
+ // to exercise the 1b/1c wires above, which share this same directory)
706
+ // threw UNCAUGHT here, escaping sessionEnd() ENTIRELY — discarding the
707
+ // already-successful journal/awareness/palace work above and defeating
708
+ // every other best-effort guard in this function. Found empirically: the
709
+ // session-end-outcome-verdict / session-end-crossproject-join tests
710
+ // (session-end-hook-health.test.mjs) could not pass without this fix,
711
+ // since they force exactly this condition on the same directory.
712
+ try {
713
+ const corrDir = projectSubPath(slug, "corrections");
714
+ if (fs.existsSync(corrDir)) {
715
+ correctionCount = fs.readdirSync(corrDir).filter(f => f.endsWith(".json")).length;
716
+ }
717
+ }
718
+ catch (err) {
719
+ recordHookFailure("session-end-correction-count", err);
623
720
  }
624
721
  const line = "──────────────────────────────────────────────────────────────";
625
722
  const cardLines = [
@@ -700,7 +797,13 @@ export async function sessionEnd(input) {
700
797
  const h = writeHandoff(slug);
701
798
  handoffPath = h.path;
702
799
  }
703
- catch { /* swallow — handoff is best-effort */ }
800
+ catch (err) {
801
+ // swallow — handoff is best-effort
802
+ // F5 depth (2026-08-12, followups wave): a real disk-write failure on
803
+ // the hook-end-adjacent path, previously invisible (no result field,
804
+ // unlike journal/awareness/palace above).
805
+ recordHookFailure("session-end-handoff", err);
806
+ }
704
807
  }
705
808
  const result = {
706
809
  success: journalWritten || awarenessUpdated,