counterparts 0.3.11 → 0.3.13

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 (150) hide show
  1. package/CHANGELOG.md +326 -0
  2. package/docs/QUICKSTART.md +5 -0
  3. package/docs/README.md +2 -2
  4. package/docs/module-map.md +3 -3
  5. package/package.json +1 -1
  6. package/src/adapters/claude-code/CONTRACT.md +36 -10
  7. package/src/adapters/claude-code/INTERFACE-GAPS.md +116 -16
  8. package/src/adapters/claude-code/NOTES.md +182 -0
  9. package/src/adapters/claude-code/bin/hook.ts +46 -12
  10. package/src/adapters/claude-code/bin/runner.ts +7 -1
  11. package/src/adapters/claude-code/doctor.ts +632 -18
  12. package/src/adapters/claude-code/hooks.ts +61 -16
  13. package/src/adapters/claude-code/index.ts +11 -0
  14. package/src/adapters/claude-code/night-run.ts +150 -14
  15. package/src/adapters/claude-code/transcript.ts +268 -1
  16. package/src/adapters/cli/CONTRACT.md +5 -0
  17. package/src/adapters/cli/INTERFACE-GAPS.md +8 -4
  18. package/src/adapters/cli/NOTES.md +111 -0
  19. package/src/adapters/cli/commands.ts +134 -92
  20. package/src/adapters/cli/dream-core.ts +57 -42
  21. package/src/adapters/cli/export.ts +320 -21
  22. package/src/adapters/cli/help.ts +2 -1
  23. package/src/adapters/cli/index.ts +1 -0
  24. package/src/adapters/cli/install.ts +39 -7
  25. package/src/adapters/cli/mechanisms.ts +7 -1
  26. package/src/adapters/cli/uninstall.ts +13 -5
  27. package/src/adapters/cli/wire.ts +189 -63
  28. package/src/adapters/config.ts +2 -0
  29. package/src/adapters/dashboard/INTERFACE-GAPS.md +10 -1
  30. package/src/adapters/dashboard/NOTES.md +79 -0
  31. package/src/adapters/dashboard/registries.ts +34 -2
  32. package/src/adapters/dashboard/web/README.md +19 -14
  33. package/src/adapters/dashboard/web/actions.ts +23 -1
  34. package/src/adapters/dashboard/web/flow.ts +14 -0
  35. package/src/adapters/dashboard/web/lanes.ts +10 -0
  36. package/src/adapters/dashboard/web/narrate.ts +88 -2
  37. package/src/adapters/dashboard/web/pages/flow/sections/fired.js +1 -0
  38. package/src/adapters/dashboard/web/pages/health/sections/checks.js +2 -0
  39. package/src/adapters/dashboard/web/pages/health/sections/wake.js +3 -1
  40. package/src/adapters/dashboard/web/pages/memories/memories.css +17 -4
  41. package/src/adapters/dashboard/web/pages/memories/row.js +37 -21
  42. package/src/adapters/dashboard/web/pages/memories/sections/search.js +279 -60
  43. package/src/adapters/dashboard/web/pages/memories/state.js +2 -1
  44. package/src/adapters/dashboard/web/server.ts +0 -5
  45. package/src/adapters/dashboard/web/shared/memory-marks.css +7 -0
  46. package/src/adapters/dashboard/web/shared/memory-marks.js +33 -0
  47. package/src/adapters/dashboard/web/shared/memory-modal.js +5 -3
  48. package/src/adapters/dashboard/web/views/health.ts +21 -3
  49. package/src/adapters/dashboard/web/views/search.ts +4 -45
  50. package/src/adapters/dashboard/web/views.ts +2 -2
  51. package/src/adapters/fired.ts +430 -28
  52. package/src/adapters/host-wiring.ts +300 -0
  53. package/src/adapters/hosts.ts +11 -0
  54. package/src/adapters/lifecycle.ts +42 -2
  55. package/src/adapters/log/index.ts +9 -0
  56. package/src/adapters/mcp/CONTRACT.md +151 -11
  57. package/src/adapters/mcp/INTERFACE-GAPS.md +24 -2
  58. package/src/adapters/mcp/NOTES.md +313 -1
  59. package/src/adapters/mcp/bin/serve.ts +74 -1
  60. package/src/adapters/mcp/deliberate.ts +169 -651
  61. package/src/adapters/mcp/facts.ts +1094 -0
  62. package/src/adapters/mcp/index.ts +25 -7
  63. package/src/adapters/mcp/meaning.ts +1610 -0
  64. package/src/adapters/mcp/server.ts +835 -150
  65. package/src/adapters/mcp/stdio.ts +3 -1
  66. package/src/adapters/mcp/stood-down.ts +51 -0
  67. package/src/adapters/mcp/tools.ts +167 -41
  68. package/src/adapters/plugin-run.sh +133 -0
  69. package/src/adapters/plugin.ts +329 -0
  70. package/src/adapters/sessions.ts +18 -4
  71. package/src/core/associate/CONTRACT.md +2 -1
  72. package/src/core/associate/INTERFACE-GAPS.md +6 -1
  73. package/src/core/associate/NOTES.md +45 -0
  74. package/src/core/briefing.ts +12 -3
  75. package/src/core/contradictions.ts +184 -0
  76. package/src/core/counterpart.ts +797 -51
  77. package/src/core/dream/CONTRACT.md +36 -4
  78. package/src/core/dream/INTERFACE-GAPS.md +29 -6
  79. package/src/core/dream/NOTES.md +107 -0
  80. package/src/core/dream/feeling-weeks.ts +198 -0
  81. package/src/core/dream/index.ts +109 -18
  82. package/src/core/dream/reflect.ts +346 -87
  83. package/src/core/dream/tunables.ts +24 -4
  84. package/src/core/encode/INTERFACE-GAPS.md +3 -1
  85. package/src/core/encode/NOTES.md +7 -0
  86. package/src/core/encode/words.ts +45 -0
  87. package/src/core/fit/INTERFACE-GAPS.md +8 -2
  88. package/src/core/fit/NOTES.md +39 -1
  89. package/src/core/fit/index.ts +40 -0
  90. package/src/core/handoff/CONTRACT.md +37 -2
  91. package/src/core/handoff/INTERFACE-GAPS.md +10 -0
  92. package/src/core/handoff/NOTES.md +72 -0
  93. package/src/core/handoff/index.ts +214 -12
  94. package/src/core/handoff/last-here.ts +6 -4
  95. package/src/core/mint.ts +12 -2
  96. package/src/core/physics/CONTRACT.md +14 -2
  97. package/src/core/physics/NOTES.md +33 -1
  98. package/src/core/physics/index.ts +28 -5
  99. package/src/core/prospective/CONTRACT.md +45 -6
  100. package/src/core/prospective/INTERFACE-GAPS.md +4 -0
  101. package/src/core/prospective/NOTES.md +138 -0
  102. package/src/core/prospective/derive.ts +33 -5
  103. package/src/core/prospective/index.ts +90 -5
  104. package/src/core/prospective/windows.ts +72 -1
  105. package/src/core/recall/CONTRACT.md +31 -12
  106. package/src/core/recall/INTERFACE-GAPS.md +28 -4
  107. package/src/core/recall/NOTES.md +70 -1
  108. package/src/core/recall/feeling-ask.ts +10 -1
  109. package/src/core/recall/index.ts +3 -1
  110. package/src/core/recall/probe.ts +58 -0
  111. package/src/core/recall/session.ts +46 -2
  112. package/src/core/recall/time-ask.ts +487 -0
  113. package/src/core/remember/CONTRACT.md +4 -1
  114. package/src/core/remember/INTERFACE-GAPS.md +9 -1
  115. package/src/core/remember/NOTES.md +8 -0
  116. package/src/core/remember/proposals.ts +47 -5
  117. package/src/core/revision.ts +18 -1
  118. package/src/core/schemas/CONTRACT.md +21 -1
  119. package/src/core/schemas/INTERFACE-GAPS.md +20 -2
  120. package/src/core/schemas/NOTES.md +144 -0
  121. package/src/core/schemas/aliases.ts +55 -5
  122. package/src/core/schemas/index.ts +93 -1
  123. package/src/core/schemas/types.ts +2 -0
  124. package/src/core/self/CONTRACT.md +32 -5
  125. package/src/core/self/INTERFACE-GAPS.md +7 -2
  126. package/src/core/self/NOTES.md +102 -1
  127. package/src/core/self/behind.ts +43 -3
  128. package/src/core/self/briefing.ts +12 -2
  129. package/src/core/self/chapter-address.ts +254 -0
  130. package/src/core/self/episodes.ts +27 -0
  131. package/src/core/self/index.ts +83 -8
  132. package/src/core/self/page.ts +88 -0
  133. package/src/core/self/tunables.ts +5 -0
  134. package/src/core/self/work.ts +35 -2
  135. package/src/core/self/writer.ts +30 -0
  136. package/src/core/sleep/INTERFACE-GAPS.md +22 -3
  137. package/src/core/sleep/NOTES.md +20 -1
  138. package/src/core/sleep/consolidate.ts +59 -7
  139. package/src/core/sleep/index.ts +3 -0
  140. package/src/core/sleep/prune.ts +6 -2
  141. package/src/core/sleep/types.ts +7 -0
  142. package/src/core/store/CONTRACT.md +16 -0
  143. package/src/core/store/NOTES.md +66 -0
  144. package/src/core/store/feelings.ts +14 -1
  145. package/src/core/store/index.ts +483 -16
  146. package/src/core/store/operational.ts +95 -2
  147. package/src/core/store/owner-op-seam.ts +23 -0
  148. package/src/core/time.ts +152 -0
  149. package/tools/install-loop/run.sh +48 -12
  150. package/src/adapters/dashboard/web/pages/memories/fold.js +0 -53
@@ -15,7 +15,7 @@ step, no dependencies. `server.ts` serves them as files (see "Serving" below).
15
15
  | `ask-voice.ts` | `toMyVoice(question, ownerName)`: Ask is the owner talking to me, so `ask` turns his question into my voice before it searches ("do you remember what I said" → "do I remember what Mike said"; his I → "you" when the store knows no name). Pure; the rules are in its header and `test/dashboard-ask-voice.test.ts`. The server reads the name (`sleep#ownerNames`) and hands `actions.ts` the string |
16
16
  | `static.ts` | `resolveStatic()`: which URL paths are static files and where they live (pure; no fs) |
17
17
  | `views.ts` | the index of `views/`: re-exports every view, so callers import from here |
18
- | `views/<name>.ts` | one module per `/api` view: `meta`, `overview` (the home tab's; its "Today" lines are `today`), `memories` (`/api/memories` + `/api/memories/list`), `memory`, `search` (`/api/search` + `/api/chapters`), `mind` (the self tab's; its trait bars are `traits`), `activity`, `flow-view` (`/api/flow` + `/api/node`), `health`, `pulse`, `mechanisms`, `mechanism-panel` (`/api/mechanism?id=`) |
18
+ | `views/<name>.ts` | one module per `/api` view: `meta`, `overview` (the home tab's; its "Today" lines are `today`), `memories` (`/api/memories` + `/api/memories/list`), `memory`, `search` (`/api/search`), `mind` (the self tab's; its trait bars are `traits`), `activity`, `flow-view` (`/api/flow` + `/api/node`), `health`, `pulse`, `mechanisms`, `mechanism-panel` (`/api/mechanism?id=`) |
19
19
  | `views/archive-words.ts` | why a memory was archived, in plain words: one table (`ARCHIVE_WORDS`, a group phrase and a single-row phrase per reason) and one fallback for a reason nobody mapped; health's bar, the memories list and home's archived count read it |
20
20
  | `views/mechanisms.ts` | `/api/mechanisms`: each mechanism's light (grey = not built, green = fired in the last 7 lived days, waiting = built and not due — a scheduled run ahead, or nothing to act on — amber = built and quiet), its `build` (built / partly / not: the pill's "partly built" tag), one evidence line, the newest backing event `seq`s. Which rows count as a firing is `adapters/mechanism-evidence.ts` — ONE judgement shared with `counterparts mechanisms` (`cli/mechanisms.ts`), which keeps its own words and its calendar window; this file owns the lived-day window and the dashboard's words |
21
21
  | `views/shared.ts` | the census and small counters every view leans on |
@@ -178,19 +178,24 @@ which Home draws too; an axis clicked filters the list), `list.js` (every
178
178
  memory, newest or oldest first, twenty a page, two rows of chips with a few
179
179
  words each on hover, paged on the server by `/api/memories/list` in
180
180
  `views/memories.ts`, which also groups several put-away versions of one memory
181
- into one row), `search.js` (ONE box with a "by word | by meaning" switch
182
- beside it, `state.js#find.mode`, 2026-09-30: by word finds as you type,
183
- `/api/search`, and Enter only runs it at once; by meaning asks on Enter via
184
- `act("ask", {json:true})`; the switch never flips by itself; when the words
185
- find fewer than `CLOSE_BELOW`, `views/search.ts#closeMatches` adds "close
186
- matches", a typo or two away over titles and words, the dashboard's own pass
187
- with `store.search` untouched; the answers take the
188
- list's place and "×" gives it back; the search's words are marked where they
189
- appear in an answer (`row.js#marked`, whole words as the word index splits
190
- them, escaped first; for Ask, the question's longer words); a journal chapter and the memory drawn from
191
- it are folded into one answer by `fold.js`, with a "from chapter …" link, from
192
- `/api/chapters` in `views/search.ts`; the question is turned into my voice
193
- server side by `ask-voice.ts`), and `tools.js` (add a memory, and the
181
+ into one row), `search.js` (ONE box with a "by word | facts | by meaning" switch
182
+ beside it, `state.js#find.mode`, 2026-09-30, three ways since 2026-10-09: by
183
+ word finds as you type, `/api/search`, and Enter only runs it at once; facts
184
+ and by meaning ask on Enter via `act("ask", {json:true, mode, page})`, the
185
+ console's `ask --json --mode`, and draw the answer it returned — facts every
186
+ match, counted and paged, with who said it, when and what it was before; by
187
+ meaning the arc, chapters in time order with their moments and feelings —
188
+ through pure functions (`factsRows`, `meaningRows`, …) that
189
+ `test/dashboard-ask-answers.test.ts` feeds real answers; the switch never flips
190
+ by itself; when the words find fewer than `CLOSE_BELOW`,
191
+ `views/search.ts#closeMatches` adds "close matches", a typo or two away over
192
+ titles and words, the dashboard's own pass with `store.search` untouched; the
193
+ answers take the list's place and "×" gives it back; the search's words are
194
+ marked where they appear in an answer (`row.js#marked`, whole words as the
195
+ word index splits them, escaped first; for Ask, the question's longer words),
196
+ and a memory id written in a row's words is a small link to it
197
+ (`memory-marks.js#idMark`); the question is turned into my voice server side
198
+ by `ask-voice.ts`), and `tools.js` (add a memory, and the
194
199
  back-up/export folder dialog). `views/memory-words.ts` says how a row's words
195
200
  are shown (a date at their front lifted off, a journal chapter's heading lifted
196
201
  off, feelings in words); archive reasons come from `views/archive-words.ts`.
@@ -353,13 +353,35 @@ function argvFor(name: ActionName, body: Body, ctx: ActionContext): Built {
353
353
  // The answers as data, so the page can list them and open each one.
354
354
  if (flag(body, "json")) argv.push("--json");
355
355
  if (id !== undefined) return { argv: [...argv, "--id", id] };
356
+ // THE MODE (2026-10-09): facts is the console's default and adds
357
+ // nothing; meaning is asked for by name. And which page of the answer.
358
+ const mode = body["mode"];
359
+ if (mode !== undefined && mode !== null && mode !== "facts" && mode !== "meaning") {
360
+ throw new Invalid("mode is facts or meaning");
361
+ }
362
+ if (mode === "meaning") argv.push("--mode", "meaning");
363
+ const page = body["page"];
364
+ if (page !== undefined && page !== null) {
365
+ if (typeof page !== "number" || !Number.isInteger(page) || page < 1 || page > 10_000) {
366
+ throw new Invalid("page is a whole number from 1");
367
+ }
368
+ argv.push("--page", String(page));
369
+ }
356
370
  // THE OWNER'S VOICE, TURNED INTO MINE (memories round 3b): "what have you
357
371
  // learned about yourself?" searches as "what have I learned about
358
372
  // myself?". The page shows what was searched and can ask again with
359
373
  // `exact: true`. The CLI's own `ask` is untouched.
360
374
  const typed = words(question as string, "question");
361
375
  const exact = flag(body, "exact");
362
- const voiced = exact ? { text: typed, changed: false } : toMyVoice(typed, ctx.ownerName ?? null);
376
+ // In MEANING mode his "I" becomes "you", never his name (review of #333):
377
+ // meaning then took the card with the most memories as its subject, so
378
+ // "what has Ilya been to me" turned into "… to Rosalind" answered about
379
+ // Rosalind. Since 2026-10-09 meaning picks the card the question is
380
+ // about (`meaning.ts#subjectOf`), and in my voice (`--voiced`) "you" is
381
+ // the owner to it: his feelings stay his, and "what have you been like"
382
+ // is his own card.
383
+ const owner = mode === "meaning" ? null : ctx.ownerName ?? null;
384
+ const voiced = exact ? { text: typed, changed: false } : toMyVoice(typed, owner);
363
385
  // In MY voice, "I" is me: a question about feeling asks about the
364
386
  // counterpart's own feelings (`--voiced`, U13). `exact` keeps the owner's
365
387
  // words, and his "I".
@@ -385,6 +385,13 @@ export const EVENT_NODE = {
385
385
  "handoff.refused": "wake",
386
386
  "handoff.cleared": "wake",
387
387
  "handoff.lasthere.noroom": "wake",
388
+ // The wake's "Work here" lines, and what an envelope could not carry
389
+ // (2026-10-02): all of it is the wake's delivery.
390
+ "self.work.overflow": "wake",
391
+ "adapter.envelope.overcap": "wake",
392
+ "adapter.notice.dropped": "wake",
393
+ "adapter.envelope.gave-way": "wake",
394
+ "adapter.injection.overbudget": "wake",
388
395
  // Reference resolution: the boundary's credit decision (recall §9.2).
389
396
  "recall.credit": "recall",
390
397
  // The wiring that follows that decision: what the reply used together got
@@ -423,6 +430,12 @@ export const EVENT_NODE = {
423
430
  "adapter.spawn.started": "sweep",
424
431
  // The deliberate look is a retrieval, so it lands where the ambient one does.
425
432
  "mcp.recall": "recall",
433
+ // A bundle part is the night's reading; an oversize cut is the server's
434
+ // answer to it (2026-10-02) — both land where the dream does; so does a
435
+ // result the host cut after the server answered (2026-10-09).
436
+ "mcp.part": "sleep",
437
+ "mcp.result.oversize": "sleep",
438
+ "mcp.result.spilled": "sleep",
426
439
  // A reminder arriving is a CUE offered into the turn (§12: arrival is a cue,
427
440
  // not a command), so both rows land on the prospective node.
428
441
  "prospective.fire": "prospective",
@@ -472,6 +485,7 @@ export const EVENT_NODE = {
472
485
  "contradiction.flagged": "schemas",
473
486
  "contradiction.settled": "schemas",
474
487
  "contradiction.undone": "schemas",
488
+ "contradiction.held": "schemas",
475
489
  } as const satisfies Record<DurableEventName, NodeKey>;
476
490
 
477
491
  export function nodeOf(name: string): NodeKey | null {
@@ -69,6 +69,8 @@ export const LANES = {
69
69
  "contradiction.settled": "home",
70
70
  "contradiction.flagged": "flow",
71
71
  "contradiction.undone": "flow",
72
+ // A held `updates` (2026-10-09) moved nothing: housekeeping.
73
+ "contradiction.held": "flow",
72
74
  // A session end that strengthened nothing is housekeeping — unless the credit
73
75
  // itself failed, which is a real problem about memories and stays home.
74
76
  "recall.credit": (p) =>
@@ -114,8 +116,16 @@ export const LANES = {
114
116
  "associate.flush": "flow",
115
117
  "handoff.refused": "flow",
116
118
  "handoff.lasthere.noroom": "flow",
119
+ "self.work.overflow": "flow",
120
+ "adapter.envelope.overcap": "flow",
121
+ "adapter.notice.dropped": "flow",
122
+ "adapter.envelope.gave-way": "flow",
123
+ "adapter.injection.overbudget": "flow",
117
124
  "handoff.shown": "flow",
118
125
  "mcp.recall": "flow",
126
+ "mcp.part": "flow",
127
+ "mcp.result.oversize": "flow",
128
+ "mcp.result.spilled": "flow",
119
129
  "prospective.fire.refused": "flow",
120
130
  "recall.decision": "flow",
121
131
  "remember.prune": "flow",
@@ -714,6 +714,32 @@ export const NARRATORS = {
714
714
  );
715
715
  },
716
716
 
717
+ "self.work.overflow": (t) => {
718
+ const found = n(t, "found") ?? 0;
719
+ const shown = n(t, "shown") ?? 0;
720
+ if (t.p["cause"] === "room") {
721
+ return calm(
722
+ shown === 0
723
+ ? `There was no room in this wake for the "Work here" lines (${num(found, 0)} of them), so they were left off.`
724
+ : `This wake had room for ${num(shown, 0)} of ${num(found, 0)} "Work here" lines.`,
725
+ );
726
+ }
727
+ return calm(`This directory has more work than one wake shows: ${num(shown, 0)} of ${num(found, 0)} "Work here" lines shown, and the rest take turns.`);
728
+ },
729
+
730
+ // ── what a delivery could not carry (durable since 2026-10-02) ─────────────
731
+ "adapter.envelope.overcap": (t) =>
732
+ amber(`A hook's output came to ${num(n(t, "chars") ?? 0, 0)} characters, past the host's cap of ${num(n(t, "limitChars") ?? 0, 0)}, so the host showed only a preview of it.`),
733
+ "adapter.notice.dropped": (t) =>
734
+ calm(`A notice for you (${num(n(t, "noticeChars") ?? 0, 0)} characters) was left off a session start so the wake stayed under the host's cap.`),
735
+ "adapter.envelope.gave-way": (t) => {
736
+ const part = typeof t.p["part"] === "string" ? t.p["part"] : "a part";
737
+ const hook = typeof t.p["hook"] === "string" ? t.p["hook"] : "a delivery";
738
+ return calm(`At ${hook}, the ${part} waited for want of room.`);
739
+ },
740
+ "adapter.injection.overbudget": (t) =>
741
+ amber(`A session start sent ${num(n(t, "bytes") ?? 0, 0)} bytes, more than the ${num(n(t, "budget") ?? 0, 0)} the host reported it takes.`),
742
+
717
743
  // ── retrieval ──────────────────────────────────────────────────────────────
718
744
  "recall.decision": (t) => {
719
745
  const surfaced = idsIn(t, "surfaced");
@@ -765,7 +791,7 @@ export const NARRATORS = {
765
791
  notable(`I handed the host who I have been — ${n(t, "bytes") ?? 0} bytes of briefing, at the start of a session.`),
766
792
  "adapter.wake.delivered": (t) => {
767
793
  const seen = t.p["seen"] === true || t.p["sentinelSeen"] === true || t.p["ok"] === true;
768
- if (seen) return calm(`I checked the next turn and my briefing had arrived intact.`);
794
+ if (seen) return calm(`I checked the session's transcript and my briefing had arrived intact.`);
769
795
  // The check says WHY since 2026-09-17, and one of its answers is not a problem:
770
796
  // a session that was owed no briefing (nothing was printed at its start).
771
797
  const outcome = s(t, "outcome");
@@ -783,7 +809,20 @@ export const NARRATORS = {
783
809
  if (outcome === "mismatch") {
784
810
  return amber(`A briefing arrived, but not the one I composed for this session — most likely a resumed session showing an earlier run's.`);
785
811
  }
786
- return amber(`I checked the next turn and could not confirm my briefing arrived. A wake nobody read is a day I started as a stranger.`);
812
+ // WHAT THE CHECK COULD READ (2026-10-08), as doctor's Wake line splits it.
813
+ // No file at the first prompt is the host writing it later, not a lost
814
+ // wake: the rows from before the check learned to wait for the Stop.
815
+ const transcript = s(t, "transcript");
816
+ if (transcript === "absent" && s(t, "checkedAt") !== "stop") {
817
+ return calm(`I could not check whether my briefing arrived: the session had not written its transcript yet when I looked. That is not a sign it went missing.`);
818
+ }
819
+ if (transcript === "absent") {
820
+ return amber(`By the end of the first turn this session still had no transcript, so I could not check that my briefing arrived.`);
821
+ }
822
+ if (transcript === "unreadable") {
823
+ return amber(`The session's transcript was there and I could not read it, so I could not check that my briefing arrived.`);
824
+ }
825
+ return amber(`I read the session's transcript and could not find my briefing in it. A wake nobody read is a day I started as a stranger.`);
787
826
  },
788
827
 
789
828
  // ── the host's session ─────────────────────────────────────────────────────
@@ -835,6 +874,36 @@ export const NARRATORS = {
835
874
  );
836
875
  },
837
876
 
877
+ // ── what reached the model (2026-10-02) ─────────────────────────────────────
878
+ // HANDED, not read (review of #315): the row says the server gave the part
879
+ // out, not that anyone read it.
880
+ "mcp.part": (t) => {
881
+ const which = t.p["mechanism"] === "reflection" ? "reflection" : "dream";
882
+ const of = n(t, "of") ?? 1;
883
+ return calm(
884
+ of <= 1
885
+ ? `The ${which}'s bundle was handed over in one part.`
886
+ : `Part ${String(n(t, "part") ?? "?")} of ${String(of)} of the ${which}'s bundle was handed over.`,
887
+ );
888
+ },
889
+ "mcp.result.oversize": (t) => {
890
+ const tool = typeof t.p["tool"] === "string" ? t.p["tool"] : "a tool";
891
+ const phase = typeof t.p["phase"] === "string" ? ` (${t.p["phase"]})` : "";
892
+ const said = `An answer from ${tool}${phase} came to ${String(n(t, "chars") ?? "?")} characters, more than one answer can carry`;
893
+ return amber(
894
+ t.p["cut"] === true
895
+ ? `${said}; it was cut to ${String(n(t, "cutTo") ?? "?")}, with a note saying so.`
896
+ : `${said}; it went out whole, as nothing in it was one long text to cut.`,
897
+ );
898
+ },
899
+ // The host's cut, read from the night run's own transcript (2026-10-09).
900
+ "mcp.result.spilled": (t) => {
901
+ const tool = typeof t.p["tool"] === "string" ? t.p["tool"].replace(/^mcp__counterparts__/, "") : "a tool";
902
+ const phase = typeof t.p["phase"] === "string" ? ` (${t.p["phase"]})` : "";
903
+ const size = typeof t.p["said"] === "string" ? `, at ${t.p["said"]},` : "";
904
+ return amber(`Claude Code showed the nightly run's answer from ${tool}${phase}${size} only as a short preview — the run read part of it.`);
905
+ },
906
+
838
907
  // ── going looking on purpose ───────────────────────────────────────────────
839
908
  "mcp.recall": (t) => {
840
909
  const { total, named } = topBlocked(t);
@@ -1011,6 +1080,11 @@ export const NARRATORS = {
1011
1080
  : notable(`${who} settled a contradiction as ${how}: ${s(t, "holds") ?? "one"} holds over ${s(t, "over") ?? "the other"}.`);
1012
1081
  },
1013
1082
  "contradiction.undone": (t) => calm(`A settle was undone (${s(t, "pair") ?? "a pair"}); the pair is unsettled again.`),
1083
+ "contradiction.held": (t) =>
1084
+ calm(
1085
+ `A new memory said it ${s(t, "how") === "corrected" ? "corrected" : "changed"} ${s(t, "over") ?? "another"}, which looked unrelated to it` +
1086
+ `${s(t, "by") === "meaning" ? " in meaning" : " in its words"}, so that one was left as it was and the two were not linked.`,
1087
+ ),
1014
1088
 
1015
1089
  // ── what is not written up (2026-09-30) ─────────────────────────────────
1016
1090
  "coverage.owed": (t) =>
@@ -1098,6 +1172,16 @@ export const REF_KIND = {
1098
1172
  // The deliberate look carries counts and verdicts and deliberately no ids —
1099
1173
  // a durable pairing of memories with the moment somebody asked for them.
1100
1174
  "mcp.recall": "none",
1175
+ // A part's run id (a dream's or a reflection's) is in its payload, not a memory.
1176
+ "mcp.part": "none",
1177
+ "mcp.result.oversize": "none",
1178
+ "mcp.result.spilled": "none",
1179
+ "adapter.envelope.overcap": "none",
1180
+ "adapter.notice.dropped": "none",
1181
+ "adapter.envelope.gave-way": "none",
1182
+ "adapter.injection.overbudget": "none",
1183
+ // A directory's work lines are counted; the row names no memory.
1184
+ "self.work.overflow": "none",
1101
1185
  // Both prospective rows point at the MEMORY whose window it is: the window
1102
1186
  // key is a derived address on that row, not an entity of its own.
1103
1187
  "prospective.fire": "memory",
@@ -1183,6 +1267,8 @@ export const REF_KIND = {
1183
1267
  "contradiction.flagged": "none",
1184
1268
  "contradiction.settled": "none",
1185
1269
  "contradiction.undone": "none",
1270
+ // A held `updates` points at the NEW memory (2026-10-09).
1271
+ "contradiction.held": "memory",
1186
1272
  // A coverage row names a session in its payload; a written row's ref is the
1187
1273
  // claim (a proposal id, or `nothing-new:` / `chapter:` / `writeup:` and an id).
1188
1274
  "coverage.owed": "none",
@@ -34,6 +34,7 @@ export async function render() {
34
34
  rows.join("") + "</tbody></table>";
35
35
  $("h-fired-foot").textContent =
36
36
  d.from + "→" + d.today + " (UTC), against " + d.previousFrom + "→" + d.previousTo + ". " +
37
+ (d.missedOccasion && d.missedOccasion.length ? "Its occasion came this week and it did not fire: " + d.missedOccasion.join("; ") + ". " : "") +
37
38
  (d.wentQuiet.length ? "Fired last week and not once this week: " + d.wentQuiet.join("; ") + ". "
38
39
  : "Nothing that fired last week has fallen silent this week. ") +
39
40
  (d.truncated ? "The event read hit its ceiling, so every count is a floor. " : "") +
@@ -45,6 +45,8 @@ const NAMES = {
45
45
  budget: "Time budget",
46
46
  retired: "Old settings",
47
47
  lookups: "Looked up in dreams and reflections",
48
+ results: "What reached the model",
49
+ wake: "Wake arrived whole",
48
50
  };
49
51
 
50
52
  /**
@@ -23,7 +23,8 @@ export const FULL_SHARE = 0.03;
23
23
  /**
24
24
  * What being full COST, in words — the view's `costs` (`views/health.ts#
25
25
  * wakeCosts`): the self page cut or left out, handoffs and "Last here" lines
26
- * a session start had no room for, the page writer held back for lack of room.
26
+ * a session start had no room for, "Work here" lines that did not all fit, the
27
+ * page writer held back for lack of room.
27
28
  * Empty when nothing.
28
29
  */
29
30
  export function costWords(c) {
@@ -36,6 +37,7 @@ export function costWords(c) {
36
37
  }
37
38
  if (c.handoffs > 0) out.push(c.handoffs + (c.handoffs === 1 ? " handoff" : " handoffs") + " had no room at a session start");
38
39
  if (c.lastHere > 0) out.push(c.lastHere + (c.lastHere === 1 ? " \"Last here\" line" : " \"Last here\" lines") + " had no room at a session start");
40
+ if (c.work > 0) out.push("\"Work here\" lines did not all fit at a session start, in " + c.work + (c.work === 1 ? " directory" : " directories"));
39
41
  if (c.writerHeld) out.push("the page writer held back for lack of room");
40
42
  return out;
41
43
  }
@@ -43,6 +43,9 @@
43
43
  .find-x:hover,.find-x:focus-visible{color:var(--cyan);outline:none}
44
44
  .find-head{color:var(--dim);font-size:12.5px;margin:8px 0 0}
45
45
  .find-hint{color:var(--faint)}
46
+ /* An answer's quieter notes, on their own line under its head (what it is
47
+ about, a time it named, what it left out and why). */
48
+ .find-note{display:block;color:var(--faint);font-size:12px;margin-top:2px}
46
49
 
47
50
  /* ── the two small pictures: how well I remember, how it feels ── */
48
51
  .glance2{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,24rem),1fr));gap:0 20px;align-items:stretch}
@@ -133,14 +136,24 @@
133
136
  -webkit-box-orient:vertical;overflow-wrap:anywhere;margin-top:1px}
134
137
  .mtext.solo{color:var(--t);font-size:13.5px;margin-top:0}
135
138
  .mwhy{color:var(--amber);font-size:12px;margin-top:3px}
136
- .mchapter{display:inline-block;max-width:100%;margin-top:3px;padding:0;background:none;border:none;color:var(--cyan);
137
- font:inherit;font-size:12px;text-align:left;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
138
- .mchapter:hover,.mchapter:focus-visible{text-decoration:underline;outline:none}
139
+ /* Under an Ask answer's words: who said it, when, which chapter, what it was
140
+ before; under a chapter of an arc, its moments, each a link (2026-10-09). */
141
+ .mfacts{color:var(--faint);font-size:12px;line-height:1.5;margin-top:3px;overflow-wrap:anywhere}
142
+ .mearlier{color:var(--faint)}
143
+ .mmoments{display:flex;flex-direction:column;align-items:flex-start;gap:1px;margin-top:4px}
144
+ .mmoment{max-width:100%;padding:0;background:none;border:none;color:var(--cyan);font:inherit;font-size:12px;text-align:left;
145
+ cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
146
+ .mmoment:hover,.mmoment:focus-visible{text-decoration:underline;outline:none}
147
+ .mmore{color:var(--faint);font-size:12px}
148
+ /* A stretch of an arc this page does not show, and what recurs across it. */
149
+ .mfold{padding:7px 15px;border-bottom:1px solid var(--border);color:var(--faint);font-size:12.5px}
150
+ /* A row that opens nothing (a session's moments with no chapter). */
151
+ .mrow:not(.click){cursor:default}
152
+ .mrow:not(.click):hover{background:none}
139
153
  .mside{display:flex;flex-direction:column;align-items:flex-end;gap:4px;min-width:0;padding-top:2px}
140
154
  .mline{display:inline-flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end;min-height:18px}
141
155
  .mdate{color:var(--faint);font-size:12px;white-space:nowrap}
142
156
  .mkind{display:inline-flex;align-items:center;gap:5px;color:var(--faint);font-size:12px;white-space:nowrap}
143
- .mtier{color:var(--faint);font-size:11.5px;white-space:nowrap}
144
157
  .mfading{color:var(--amber);font-size:12px;white-space:nowrap}
145
158
  /* The close matches' heading, under the exact ones (M4). */
146
159
  .mclose-h{padding:9px 15px 7px;border-bottom:1px solid var(--border);color:var(--ink);font-size:12.5px;font-weight:600;background:rgba(255,255,255,.02)}
@@ -3,17 +3,18 @@
3
3
  date, the kind and the marks on the right. Every row is drawn at the same
4
4
  brightness (round 4, 2026-09-28): how well it is remembered shows only when
5
5
  it is not the usual — the one word "fading". A plain fact carries no kind
6
- tag (the quiet default); a journal chapter is titled by its day. */
6
+ tag (the quiet default); a journal chapter is titled by its day. An id
7
+ written inside the words is a small link to that memory (2026-10-09). */
7
8
  import { esc } from "../../shared/dom.js";
8
9
  import { dateOr, dateWords } from "../../shared/dates.js";
9
- import { badges, feelingDots, kindMark, kindOf } from "../../shared/memory-marks.js";
10
+ import { ID_IN_WORDS, badges, feelingDots, idMark, kindMark, kindOf } from "../../shared/memory-marks.js";
10
11
  import { openMemory } from "../../shared/memory-modal.js";
11
12
 
12
13
  /** Rows under `container` open their memory on a click or Enter (one listener
13
14
  * for every row it will ever hold, so a repaint needs no rewiring). */
14
15
  export function wireRows(container) {
15
16
  const open = (e) => {
16
- // A link inside a row (a found memory's "from chapter …") opens what it names, not the row.
17
+ // A link inside a row (an id in its words, a moment under a chapter) opens what it names, not the row.
17
18
  const link = e.target.closest("[data-open]");
18
19
  if (link && container.contains(link)) { openMemory(link.dataset.open); return; }
19
20
  const row = e.target.closest(".mrow[data-id]");
@@ -24,7 +25,13 @@ export function wireRows(container) {
24
25
  container.addEventListener("keydown", (e) => { if (e.key === "Enter" && !e.target.closest("button")) open(e); });
25
26
  }
26
27
 
27
- const DATE_WORDS = { text: "the date written in the memory", chapter: "the day its journal chapter names", recorded: "the day it was recorded" };
28
+ const DATE_WORDS = {
29
+ text: "the date written in the memory",
30
+ chapter: "the day its journal chapter names",
31
+ recorded: "the day it was recorded",
32
+ happened: "the day it happened",
33
+ learned: "the day I learned it",
34
+ };
28
35
 
29
36
  /** A journal chapter's title: "Journal · Sun, Sep 27th", or "Journal" with no day. */
30
37
  export function journalTitle(date) {
@@ -38,15 +45,25 @@ export function searchWords(q) {
38
45
  return String(q || "").toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length >= 2);
39
46
  }
40
47
 
48
+ const ID_SPLIT = new RegExp("(" + ID_IN_WORDS.source + ")");
49
+
41
50
  /**
42
51
  * `text` with every whole word that is one of `words` (any case) in a
43
- * `<mark>` (M5, 2026-09-30). Escaped piece by piece BEFORE marking, so nothing
44
- * unescaped reaches the page and no mark lands inside an entity.
52
+ * `<mark>` (M5, 2026-09-30), and every memory id in it drawn as a link to that
53
+ * memory (`memory-marks.js#idMark`, 2026-10-09; `quiet`: drawn, not linked).
54
+ * Escaped piece by piece BEFORE marking, so nothing unescaped reaches the page
55
+ * and no mark lands inside an entity or an id.
45
56
  */
46
- export function marked(text, words) {
57
+ export function marked(text, words, quiet) {
47
58
  const want = new Set((words || []).map((w) => String(w).toLowerCase()));
48
- if (want.size === 0) return esc(text || "");
49
- return String(text || "").split(/([A-Za-z0-9]+)/)
59
+ return String(text || "").split(ID_SPLIT)
60
+ .map((piece, j) => (j % 2 === 1 ? idMark(piece, quiet) : markWords(piece, want)))
61
+ .join("");
62
+ }
63
+
64
+ function markWords(text, want) {
65
+ if (want.size === 0) return esc(text);
66
+ return text.split(/([A-Za-z0-9]+)/)
50
67
  .map((part, i) => (i % 2 === 1 && want.has(part.toLowerCase()) ? "<mark>" + esc(part) + "</mark>" : esc(part)))
51
68
  .join("");
52
69
  }
@@ -71,10 +88,12 @@ export function withoutRowDate(title, text, date) {
71
88
 
72
89
  /**
73
90
  * `r`: { id, title, text, confidential, kind, date, dateFrom, core, protected,
74
- * journal, feelings, archived, hold, versions, schemaRole }. `opts.tier` adds a
75
- * small match word ("strong match"); `opts.from` ({ id, words }) adds a small
76
- * link under the words to the journal chapter the memory was drawn from;
77
- * `opts.mark` (words) marks where a search's words appear.
91
+ * journal, feelings, archived, hold, versions, schemaRole }. With no `id` the
92
+ * row opens nothing (a session's moments in an Ask by meaning); with no
93
+ * `kind` it carries no kind tag (an answer that does not say). `opts.under`
94
+ * is markup, already escaped, drawn under the words (an Ask answer's who said
95
+ * it, when, and what it was before); `opts.mark` (words) marks where a
96
+ * search's words appear.
78
97
  */
79
98
  export function memRow(r, opts = {}) {
80
99
  // The date on the right is not said again in the words beside it.
@@ -87,19 +106,16 @@ export function memRow(r, opts = {}) {
87
106
  const k = kindOf(r.kind);
88
107
  const kindWords = k.label + (r.schemaRole ? " · " + r.schemaRole : "");
89
108
  // A plain fact is the quiet default: no tag. A journal chapter says so in its title.
90
- const kindTag = (r.kind === "fact" && !r.schemaRole) || r.journal ? ""
109
+ const kindTag = !r.kind || (r.kind === "fact" && !r.schemaRole) || r.journal ? ""
91
110
  : '<span class="mkind" title="' + esc(kindWords) + '">' + kindMark(r.kind, false) + '<span class="klabel">' + esc(kindWords) + "</span></span>";
92
- const held = opts.tier ? '<span class="mtier">' + esc(opts.tier) + "</span>"
93
- : r.hold === "fading" ? '<span class="mfading" title="unless it is used, I may put it away within my next two weeks of use">fading</span>' : "";
111
+ const held = r.hold === "fading" ? '<span class="mfading" title="unless it is used, I may put it away within my next two weeks of use">fading</span>' : "";
94
112
  const date = r.date && !r.journal
95
113
  ? '<span class="mdate" title="' + esc(DATE_WORDS[r.dateFrom] || "") + '">' + esc(dateOr(r.date)) + "</span>" : "";
96
114
  const put = r.archived
97
115
  ? '<div class="mwhy">put away: ' + esc(r.archived) + (r.versions > 1 ? " · " + r.versions + " versions" : "") + "</div>" : "";
98
- const id = esc(r.id);
99
- return '<div class="mrow click' + (r.archived ? " arch" : "") + '" role="button" tabindex="0" data-id="' + id + '">' +
100
- '<div class="mmain">' + main +
101
- (opts.from ? '<button type="button" class="mchapter" data-open="' + esc(opts.from.id) + '">' + esc(opts.from.words) + "</button>" : "") +
102
- put + "</div>" +
116
+ const open = r.id ? ' click" role="button" tabindex="0" data-id="' + esc(r.id) + '"' : '"';
117
+ return '<div class="mrow' + (r.archived ? " arch" : "") + open + ">" +
118
+ '<div class="mmain">' + main + (opts.under || "") + put + "</div>" +
103
119
  '<div class="mside">' +
104
120
  '<span class="mline">' + held + date + "</span>" +
105
121
  '<span class="mline">' + badges({ ...r, journal: false }) + feelingDots(r.feelings, true) + kindTag + "</span>" +