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
@@ -124,6 +124,10 @@ Neither is urgent: losing this costs analytics, never a brake.
124
124
 
125
125
  ## 6. The observer predicate lives in `store/`
126
126
 
127
+ **Closed 2026-08-25 (noted 2026-10-09)** — the predicate lives in `src/core/observer.ts`
128
+ (hoisted in the wave-3 seam pass, `d88f957`); the store uses it, and this module still
129
+ reads `store.observer`, as below. Associate §8 closed the same way.
130
+
127
131
  Not a defect, and recorded so nobody "fixes" it: `Prospective.observer` reads
128
132
  `store.observer` and never re-derives the predicate (`docs/observer-mode.md` G7, and
129
133
  `recall/`'s INTERFACE-GAPS #4 says the same). If the predicate moves to
@@ -126,6 +126,8 @@ because the memory was actually USED is the best exit there is, and folding it i
126
126
 
127
127
  ## 9. Recurrence stays absent, and so does anything that could grow into it
128
128
 
129
+ **Was true until 2026-10-09** — the owner lifted it; §15 is what replaced it.
130
+
129
131
  No re-arm, no next-occurrence, no "annual" flag, no date arithmetic that produces a date
130
132
  the author never stated. The recorded punt (CONTRACT §4) is not a to-do: annual re-arm is
131
133
  scheduling physics, and scheduling physics is where task-queue behavior creeps back in.
@@ -344,3 +346,139 @@ session that day) keeps its grace week in the lane.
344
346
  Named, not proved through the lane: month and range items take no wake line at all
345
347
  (tune question c), so the `last-day` half of the rule has no visible effect today. It is
346
348
  written for both precisions so the two cannot drift if that changes.
349
+
350
+ ## 15. A date that repeats (2026-10-09, the owner's design, held lightly)
351
+
352
+ `recurring: daily | weekly | monthly | yearly` on a `note` or `session_end` entry, beside
353
+ `eventDate` and `remind`, anchored on the event date. What the build chose:
354
+
355
+ - **Where it lives: `meta.recurring`, beside `meta.remind`** (`store`'s `RECURRING_META`).
356
+ No schema bump: the owner wanted it in 0.3.13 without a store-format change, and a
357
+ build that never heard of it (0.3.12) reads the same file and sees a one-off date that
358
+ has passed — inert, never wrong in the loud direction. The anchor stays on
359
+ `event_date`, as stated, so `datedMemories` keeps its meaning ("the date as stated
360
+ reaches this span"); `Store.recurringMemories()` is the other half — live rows with a
361
+ day `event_date` and the word in meta, a loose text match on the meta (as
362
+ `planCandidates` does for `unresolved`) that the parsed meta confirms. `arrivals()` and
363
+ `plainDue()` union the two; `time.ts#occurrenceBetween` decides which repeats reach the
364
+ span.
365
+ - **Prospectivity is still derived.** `contentDates` carries the rule to `derive`, which
366
+ asks `windows.ts#recurringWindowAt` for the ONE occurrence window open on `at` — or the
367
+ next, pending. Nothing is re-armed and nothing is stored per occurrence until it fires,
368
+ exactly as a one-off date. A repeating date therefore never reads `window-passed`.
369
+ - **The key is the occurrence's date** (`d:2027-05-14`). That one choice makes every
370
+ per-window brake per occurrence without a line of its own: `FIRES_PER_WINDOW`, once per
371
+ lived day, the plain latch per beat, referenced-stop, `told-plainly-today`. And it is
372
+ what keeps a revision from telling or firing the same occurrence twice: `lineage`
373
+ (§13) counts what was spent "for the SAME window key" on the memories a reminder moved
374
+ through, and an occurrence's key does not change when the words do. A revision that
375
+ moves the anchor to another day of the year starts fresh, like a reschedule.
376
+ - **Two occurrences are never open together.** Lead (3) and grace (7) make a window
377
+ eleven days wide, so a weekly date would have two open and a daily one eleven, each with
378
+ its own fire budget — a task queue by arithmetic. So each occurrence's window opens no
379
+ earlier than the day after the previous occurrence and closes the day before the next
380
+ one opens: the coming lead wins over the last grace. Daily: the day. Weekly: Friday to
381
+ Thursday around a Monday. Monthly and yearly: untouched.
382
+ - **Only a day repeats.** A month, a range or a year beside `recurring` is refused at the
383
+ door (`recurring-needs-day`, `RECURRING_NEEDS_DAY`); a revision that moves a repeating
384
+ date to a month drops the repeat and says so. "Every October" is an owner question
385
+ (CONTRACT §7.5), not a gap.
386
+ - **The calendar is `time.ts`'s**, counted from the anchor every time: monthly on the
387
+ 29th–31st falls on the last day of a shorter month; yearly on Feb 29 falls on Feb 28 in
388
+ a common year; never an occurrence before the anchor. `readableRecurrence` gives the
389
+ words ("every May 14", "every Monday", "every month on the 31st", "every day"), from the
390
+ anchor so a February occurrence of the 31st still reads as the 31st. Words live there,
391
+ not here: this module still exports nothing that produces text.
392
+ - **Carried field by field on `updates`** (`Counterpart#carryReminder`): sent wins,
393
+ `null` stops the repeat (the date stays, once), left out comes from the memory being
394
+ revised. The old row keeps its `meta.recurring` when its date is cleared — inert with no
395
+ date, and kept in its version either way.
396
+
397
+ Named, not fixed: `exitReport` (§5 G12, "every dated memory names its exit") sees a
398
+ repeating memory's CURRENT or next occurrence, plus any past occurrence that left a firing
399
+ row. A past occurrence nobody fired — a quiet birthday in a week with no sessions, or a
400
+ plain one told only through the plain latch, which writes an event and no firing row —
401
+ exits nowhere, so G12 is narrower for repeats than for one-off dates. And a past
402
+ occurrence's row is re-derived with `windowFor`, which does not know the clipping, so its
403
+ phase can read a few days long. Both only colour the exit count. The dream's
404
+ "coming up" list and the dashboard's "ahead" list read `datedMemories` alone, so they do
405
+ not show a repeating date's next occurrence yet.
406
+
407
+ Review of #339 (2026-10-09), measured through the hooks with an evening boundary each
408
+ simulated day:
409
+
410
+ - **A daily repeat takes no wake line** (`horizon()`). The wake is rendered at the
411
+ boundary with `at` = that evening's day (`runner.ts`) and read the next morning, so a
412
+ quiet daily read "due <yesterday>, every day" at every first wake, and kept one of the
413
+ two lines for good. A one-off's date is fixed, so a day-old render of it stays true. A
414
+ plain daily is still said outright each day; a quiet one still cues recall each turn
415
+ (one fire a day). A weekly one keeps its line; rendered on the Thursday it closes, it
416
+ reads last Monday at Friday's wake — one day in seven, like a one-off's grace.
417
+ - **A quiet weekly spends both fires in its lead** when it is surfaced every day: Friday
418
+ and Saturday, and nothing on the Monday itself. That is the one-off rule (a day window
419
+ holds no fire back for its day); a repeat just shows it every week.
420
+ - **Decay still holds, and a repeat has to outlive it** (named here; the owner's answer
421
+ is the next section). A memory noted at the default salience fades below `FADED_STRENGTH` and becomes
422
+ prunable at about 152 lived days unless it is used: `derive` then refuses it as
423
+ `faded`, and once prune archives it `recurringMemories()` no longer finds it, so even a
424
+ plain repeat stops. A one-off dated that far out has the same fate; a birthday or a
425
+ daily pill is meant to last for good.
426
+
427
+ ## 16. A repeat is kept alive by coming round (2026-10-09, the owner's decision, held lightly)
428
+
429
+ The answer to §15's last bullet. **Each occurrence that is actually delivered counts as a
430
+ use of the memory**, the way rehearsal keeps a memory alive, and the prune refuses a live
431
+ repeat by name. What the build chose:
432
+
433
+ - **Delivered, not computed.** The two points where an occurrence certainly reached
434
+ someone: a quiet fire (`fire()`, which `Counterpart#spendArrivals` calls only for an
435
+ arrival the gate put in the turn's surfaced or footnoted set) and a plain line the
436
+ host claimed (`claimPlain()`, which the hooks call only for a line their envelope
437
+ carries). The wake's horizon lane is not one: it is rendered at the boundary and read
438
+ later, and a weekly or longer repeat in it also cues recall, which fires.
439
+ - **Credited by the composition root, not here.** `Counterpart#creditOccurrence` calls
440
+ `store.reinforce(id, day, "surfaced")` — the seam recall's credit ends in, so physics'
441
+ own refusals (birth day, already credited today) hold. This module only answers the
442
+ read `occurrenceUndelivered(memoryId, windowKey)`, asked BEFORE the fire or the claim:
443
+ the memory still repeats (`recurrenceOf`, read now) and nothing has delivered this key
444
+ yet — no fire row with a fire spent, no plain beat told, on the memory or one its
445
+ reminder moved from (`firingRowsFor`, `plainTold`). Firing state stays firing state; no
446
+ new durable row and no new event name, because the two latches already there are the
447
+ record of a delivery.
448
+ - **Once per occurrence.** A quiet weekly fired on two lived days is credited on the
449
+ first; a plain weekly fired quietly in its lead and told on its Monday is one
450
+ occurrence, credited at the lead fire. A daily one is credited each day it is said.
451
+ - **`surfaced`, not `referenced`.** It was shown; nothing says the reply used it. And a
452
+ surfaced credit earns no return (`creditReturn` refuses `not-referenced`), so a daily
453
+ reminder about myself cannot reach the core's slow lane on the calendar alone.
454
+ - **Not a one-off, and not a dropped repeat.** `recurrenceOf` is read at the moment of
455
+ credit, so a one-off date (its key `d:2027-05-14` looks the same) is never credited,
456
+ and a repeat revised with `recurring: null` stops being credited from that revision on.
457
+ - **The prune's sixth gate** (physics NOTES, 2026-10-09). One credit a year does not
458
+ carry a yearly repeat across 365 lived days at the default salience; measured through
459
+ the hooks, the test's birthday was let go 263 lived days after its first May 14
460
+ without the gate. `pruneVerdict` refuses `recurring`, as it refuses `protected` — but
461
+ only where the floor would otherwise have let it go (review of #341): a repeat above
462
+ the floor is held by `above-floor` alone. Named on every live repeat every night, it
463
+ read in the fired view as a refusal and turned the prune row BLOCKED on any store with
464
+ a pill reminder and nothing pruned that week.
465
+
466
+ **A live repeat is not refused `faded`** (review of #341, 2026-10-09). The build first
467
+ kept the `faded` refusal and named the gap: between its dates a default-salience yearly
468
+ falls under `FADED_STRENGTH`, so `derive` refused a QUIET one at its next occurrence —
469
+ alive, unpruned, and silent that year, which is not "so they stay alive". So `derive`
470
+ skips `faded` for a memory whose date still repeats (`DerivableMemory.recurring`, set by
471
+ `load` from `recurrenceOf`, read now), the one carve-out from G10; the occurrence is
472
+ delivered by its own remind rules and credited as above. Fading itself is unchanged: the
473
+ strength recall and the views read still decays between dates, and an arrival's
474
+ `strength` still orders it among the day's arrivals. A one-off date, or a repeat whose
475
+ `recurring` was dropped, is refused `faded` as before. Measured through the hooks: a
476
+ quiet yearly `fact` at the default salience, under `PHI_PRUNE` before its 2nd and 3rd
477
+ dates, fires on both and is credited each time (`test/recurring-reinforce.test.ts`).
478
+
479
+ Named, not fixed — **the same-day stronger credit.** If the reply also quotes a repeat
480
+ that recall surfaced loud on the turn its occurrence fired, the boundary's `referenced`
481
+ credit for it is refused `already-credited-today` (physics' one credit a lived day): that
482
+ day counts at 0.25 instead of 1, with no return. Only a repeat, only on the day its
483
+ occurrence is first delivered, and only when it was loud; a temporal cue alone is
484
+ footnoted and earns no boundary credit anyway.
@@ -10,7 +10,8 @@
10
10
  * - there is no second source of truth to drift from the memory;
11
11
  * - decay has nothing to special-case (§12 G10: no decay exemption before
12
12
  * arrival — a future-dated memory that faded before its window was an
13
- * occasion that didn't matter).
13
+ * occasion that didn't matter) — save one carve-out: a date that still
14
+ * REPEATS is not refused `faded` (review of #341, 2026-10-09).
14
15
  *
15
16
  * The dates come from the CALLER. This module does no NLP: it reads the shape of
16
17
  * a date string and nothing else (`windows.ts`). Whoever extracted "September"
@@ -24,8 +25,9 @@
24
25
  */
25
26
  import type { Kind, Salience } from "../types.js";
26
27
  import { sal } from "../physics/index.js";
28
+ import type { Recurrence } from "../time.js";
27
29
  import type { ProspectiveTunables } from "./tunables.js";
28
- import { phaseOf, precisionOf, windowFor } from "./windows.js";
30
+ import { phaseOf, precisionOf, recurringWindowAt, windowFor } from "./windows.js";
29
31
  import type { Phase, Window } from "./windows.js";
30
32
 
31
33
  export type DeriveReason =
@@ -51,7 +53,9 @@ export type DeriveReason =
51
53
  | "below-salience-floor"
52
54
  /** Decayed to physics' prune floor (`FADED_STRENGTH`) — §12 G10, no decay
53
55
  * exemption before arrival: an occasion that faded before its window did
54
- * not matter. Holds for an explicitly dated memory too (2026-09-26). */
56
+ * not matter. Holds for an explicitly dated memory too (2026-09-26), but
57
+ * not for one whose date still REPEATS (`DerivableMemory.recurring`, review
58
+ * of #341, 2026-10-09). */
55
59
  | "faded"
56
60
  /** Every derived window is behind us — the property expiring by itself. */
57
61
  | "window-passed";
@@ -109,11 +113,27 @@ export interface DerivableMemory {
109
113
  * pure predicate. Absent: not checked.
110
114
  */
111
115
  readonly faded?: boolean;
116
+ /**
117
+ * Its reminder date still REPEATS (`meta.recurring` on a day `event_date`,
118
+ * `index.ts#recurrenceOf`). Such a memory is exempt from the `faded`
119
+ * refusal (owner decision 2026-10-09, review of #341): "so they stay
120
+ * alive" means each occurrence is delivered by its own remind rules, and a
121
+ * quiet yearly at the default salience has faded by its second date. Its
122
+ * strength still decays for recall and display; only this refusal is
123
+ * waived. Absent or false: `faded` refuses as before.
124
+ */
125
+ readonly recurring?: boolean;
112
126
  }
113
127
 
114
128
  /** A content-date the CALLER extracted. Its precision is its own shape (§12 G4). */
115
129
  export interface ExtractedDate {
116
130
  readonly date: string;
131
+ /**
132
+ * How often the date comes round (2026-10-09, `meta.recurring`), anchored on
133
+ * it. Read only on a DAY: the window derived is the one occurrence open on
134
+ * `at`, or the next (`windows.ts#recurringWindowAt`). Absent: once, as stated.
135
+ */
136
+ readonly recurring?: Recurrence;
117
137
  }
118
138
 
119
139
  export interface DerivedWindow extends Window {
@@ -168,7 +188,9 @@ export function derive(
168
188
  if (memory.journal) blockedBy.push("journal");
169
189
  if (EXCLUDED_KINDS.includes(memory.kind)) blockedBy.push("excluded-kind");
170
190
  if (!encodeDateOk(memory.learnedOn)) blockedBy.push("missing-encode-date");
171
- if (memory.faded === true) blockedBy.push("faded");
191
+ // A live repeat is exempt (review of #341): its occurrence is a new arrival
192
+ // of something the author asked to come round, not a decayed occasion.
193
+ if (memory.faded === true && memory.recurring !== true) blockedBy.push("faded");
172
194
  // The floor gates UNASKED surfacing of a date somebody else read out of the
173
195
  // memory. An explicit `eventDate` was asked for, so it is exempt (owner
174
196
  // decision 2026-09-26); decay (`faded`, above) and archival still hold.
@@ -188,7 +210,13 @@ export function derive(
188
210
  continue;
189
211
  }
190
212
  // The memory id salts a month's stagger (tune question a) and nothing else.
191
- const w = windowFor(d.date, precision, t, memory.id);
213
+ // A recurring day derives ONE window: the occurrence open on `at`, or the
214
+ // next one — so the property still expires by itself, one occurrence at a
215
+ // time, and a repeating date never reads as `window-passed`.
216
+ const w =
217
+ d.recurring !== undefined && precision === "day"
218
+ ? recurringWindowAt(d.date, d.recurring, at, t, memory.id)
219
+ : windowFor(d.date, precision, t, memory.id);
192
220
  if (w === null) {
193
221
  rejectedDates.push({ date: d.date, reason: "malformed-date" });
194
222
  continue;
@@ -34,7 +34,9 @@ import type { Kind } from "../types.js";
34
34
  import { strength } from "../physics/index.js";
35
35
  import type { UseTier } from "../physics/index.js";
36
36
  import type { ProseDoc, ProspectiveInput, ProspectiveRow, Store } from "../store/index.js";
37
- import { addDays, isDay } from "../time.js";
37
+ import { RECURRING_META } from "../store/index.js";
38
+ import { addDays, isDay, isRecurrence, occurrenceBetween } from "../time.js";
39
+ import type { Recurrence } from "../time.js";
38
40
  import { derive } from "./derive.js";
39
41
  import type { DerivableMemory, DeriveReason, ExtractedDate, Prospectivity } from "./derive.js";
40
42
  import { TEMPORAL_MAX_TIER, withTunables } from "./tunables.js";
@@ -108,6 +110,22 @@ export function cueModeOf(doc: Pick<ProseDoc, "meta">): CueMode {
108
110
  return doc.meta[CUE_MODE_META] === "plain" ? "plain" : "quiet";
109
111
  }
110
112
 
113
+ /**
114
+ * HOW OFTEN IT COMES ROUND (2026-10-09, the owner's design, held lightly):
115
+ * `daily | weekly | monthly | yearly`, in the meta bag beside `remind`
116
+ * (`store`'s `RECURRING_META` — no schema bump), anchored on the event date.
117
+ * Only a DAY repeats: on a month, a range or a year, and with no date at all,
118
+ * this reads null and the date is once, as stated. A repeating date arrives
119
+ * once per OCCURRENCE (`windows.ts#recurringWindowAt`) — each occurrence its
120
+ * own window key, so every per-window brake is per occurrence.
121
+ */
122
+ export { RECURRING_META };
123
+
124
+ export function recurrenceOf(doc: Pick<ProseDoc, "eventDate"> & { readonly meta?: ProseDoc["meta"] }): Recurrence | null {
125
+ const rule = doc.meta?.[RECURRING_META];
126
+ return isRecurrence(rule) && isDay(doc.eventDate) ? rule : null;
127
+ }
128
+
111
129
  /**
112
130
  * A REMINDER THAT MOVED (review of #247, 2026-09-26). When a revision takes a
113
131
  * dated memory's reminder over (`Counterpart#carryReminder`), the two memories
@@ -238,11 +256,17 @@ export interface Arrival {
238
256
  readonly lastFiredDay: number | null;
239
257
  /** Decayed strength on `day`, for ORDERING only. No decay exemption before
240
258
  * arrival (§12 G10): a future-dated memory that faded before its window was
241
- * an occasion that didn't matter. */
259
+ * an occasion that didn't matter — save a live repeat, which arrives faded
260
+ * or not (review of #341, `derive.ts`). */
242
261
  readonly strength: number;
243
262
  /** Plain or quiet, as the author said (`CUE_MODE_META`). Carried so the fire
244
263
  * row can count the two apart; it changes nothing about the cue itself. */
245
264
  readonly mode: CueMode;
265
+ /** A repeating date (2026-10-09): `eventDate` is this occurrence; these say
266
+ * the day it repeats from and how often, so a host can say "every May 14".
267
+ * Absent on a date that does not repeat. */
268
+ readonly anchor?: string;
269
+ readonly recurring?: Recurrence;
246
270
  }
247
271
 
248
272
  /** Which moment of a plain item's window it is being told on. */
@@ -404,9 +428,21 @@ export interface ExitReport {
404
428
  * meant a second enumeration (a scan of every memory) to find what the index
405
429
  * now answers. Caller-extracted dates still arrive through `extraDates`.
406
430
  */
407
- export function contentDates(doc: Pick<ProseDoc, "eventDate">): ExtractedDate[] {
431
+ export function contentDates(doc: Pick<ProseDoc, "eventDate"> & { readonly meta?: ProseDoc["meta"] }): ExtractedDate[] {
408
432
  const v = doc.eventDate;
409
- return typeof v === "string" && v !== "" ? [{ date: v }] : [];
433
+ if (typeof v !== "string" || v === "") return [];
434
+ // A repeating day carries its rule to `derive`, which finds the occurrence.
435
+ const rule = recurrenceOf(doc);
436
+ return [rule === null ? { date: v } : { date: v, recurring: rule }];
437
+ }
438
+
439
+ /** Ids of live memories whose repeating date has an occurrence from `from` to
440
+ * `to` — what `Store.datedMemories` cannot see, since it reads the anchor. */
441
+ function recurringIn(store: Store, from: string, to: string): string[] {
442
+ return store
443
+ .recurringMemories()
444
+ .filter((r) => occurrenceBetween(r.eventDate, r.recurring, from, to) !== null)
445
+ .map((r) => r.id);
410
446
  }
411
447
 
412
448
  /** Every memory whose stated date could have an OPEN window on `at`: the span
@@ -507,6 +543,8 @@ export class Prospective {
507
543
  const ids = new Set<string>(
508
544
  span === null ? [] : this.store.datedMemories(span.from, span.to).map((d) => d.id),
509
545
  );
546
+ // A repeating date is found by an occurrence in the span, not by its anchor.
547
+ if (span !== null) for (const id of recurringIn(this.store, span.from, span.to)) ids.add(id);
510
548
  for (const id of input.extraDates?.keys() ?? []) ids.add(id);
511
549
  let considered = 0;
512
550
  const order = new Map<string, readonly [number, number]>();
@@ -563,6 +601,7 @@ export class Prospective {
563
601
  lastFiredDay: stateRow?.last_fired_day ?? null,
564
602
  strength: loaded.strength,
565
603
  mode,
604
+ ...(w.anchor === undefined || w.recurring === undefined ? {} : { anchor: w.anchor, recurring: w.recurring }),
566
605
  });
567
606
  order.set(`${id} ${w.key}`, imminence(w, input.at));
568
607
  }
@@ -641,8 +680,18 @@ export class Prospective {
641
680
  // written for both so the two cannot drift if that changes). Only the lane:
642
681
  // `arrivals()` is untouched, so recall's cue path still finds it, and a
643
682
  // quiet item is unchanged.
683
+ //
684
+ // A DAILY repeat takes no wake line either (review of #339, 2026-10-09). It
685
+ // is never "arriving" — it is every day — and the lane cannot say it right:
686
+ // the wake is rendered at the evening boundary (`runner.ts`, `at` = that
687
+ // day) and read the next morning, so a quiet daily read "due <yesterday>,
688
+ // every day" at every first wake, measured through the hooks, and held one
689
+ // of the two lines for good. A one-off's date is fixed, so a day-old render
690
+ // of it is still true. A plain daily is still said outright each day
691
+ // (`plainDue`), and a quiet one still cues recall on every turn.
644
692
  const items = considered.arrivals
645
693
  .filter((a) => a.precision === "day")
694
+ .filter((a) => a.recurring !== "daily")
646
695
  .filter((a) => !this.toldForGood(a))
647
696
  .slice(0, this.tunables.HORIZON_ITEMS);
648
697
  const reason: HorizonReason = items.length === 0 ? "nothing-arrived" : "selected";
@@ -689,7 +738,18 @@ export class Prospective {
689
738
  const at = input.at;
690
739
  const denied = new Set(this.store.deniedIds());
691
740
  const out: PlainDue[] = [];
692
- for (const dated of this.store.datedMemories(at, at)) {
741
+ // A REPEATING date is due on each occurrence (2026-10-09): the occurrence
742
+ // that falls on `at` stands in for the date, so its window key — and with
743
+ // it the latch per beat — is that occurrence's own.
744
+ const due: { id: string; eventDate: string }[] = [];
745
+ const repeating = new Set<string>();
746
+ for (const r of this.store.recurringMemories()) {
747
+ repeating.add(r.id);
748
+ const occurrence = occurrenceBetween(r.eventDate, r.recurring, at, at);
749
+ if (occurrence !== null) due.push({ id: r.id, eventDate: occurrence });
750
+ }
751
+ for (const d of this.store.datedMemories(at, at)) if (!repeating.has(d.id)) due.push(d);
752
+ for (const dated of due) {
693
753
  const id = dated.id;
694
754
  if (denied.has(id)) continue;
695
755
  const row = this.store.row(id);
@@ -749,6 +809,29 @@ export class Prospective {
749
809
  }
750
810
  }
751
811
 
812
+ /**
813
+ * IS THIS THE FIRST TIME THIS OCCURRENCE REACHES ANYONE? (2026-10-09.) True
814
+ * only for a memory whose date still REPEATS (`recurrenceOf`, read now — a
815
+ * one-off, or a repeat whose `recurring` was dropped, is always false) and
816
+ * whose `windowKey` nothing has delivered yet: no quiet fire spent on it and
817
+ * no plain beat told, on this memory or one its reminder moved from (the
818
+ * rows the brakes read, so a revision does not count the same occurrence
819
+ * twice). The caller asks BEFORE its `fire` or `claimPlain`, and counts the
820
+ * occurrence as a use of the memory only when that delivery lands
821
+ * (`Counterpart#creditOccurrence`). A read; firing state stays what it is,
822
+ * not canonical memory, and the physics write is the caller's.
823
+ */
824
+ occurrenceUndelivered(memoryId: string, windowKey: string): boolean {
825
+ if (this.observer) return false;
826
+ try {
827
+ if (recurrenceOf(this.store.read(memoryId).doc) === null) return false;
828
+ if ((this.firingRowsFor(memoryId).get(windowKey)?.fires ?? 0) > 0) return false;
829
+ return !this.plainTold(memoryId, windowKey, "day");
830
+ } catch {
831
+ return false;
832
+ }
833
+ }
834
+
752
835
  /** A PLAIN arrival whose window's LAST beat has been told: `day` for a day
753
836
  * item, `last-day` for a month or a range (`plainDue`'s beats). A quiet
754
837
  * arrival never is. A read. */
@@ -1271,6 +1354,8 @@ export class Prospective {
1271
1354
  // importance signal, so it skips the salience floor — never decay.
1272
1355
  explicitDate: explicit.length > 0,
1273
1356
  faded: s <= this.tunables.FADED_STRENGTH,
1357
+ // A live repeat is exempt from `faded` (review of #341, `derive.ts`).
1358
+ recurring: recurrenceOf(read.doc) !== null,
1274
1359
  },
1275
1360
  doc: read.doc,
1276
1361
  dates: dates.filter((d) => (seen.has(d.date) ? false : (seen.add(d.date), true))),
@@ -20,7 +20,8 @@
20
20
  * Pure: no ambient clock read anywhere in this file. The caller supplies `at`.
21
21
  * Every date is read by `core/time.ts#parseCalendarDate` (docs/time.md rule 1).
22
22
  */
23
- import { addDays, daysBetween, monthBounds, parseCalendarDate } from "../time.js";
23
+ import { addDays, daysBetween, isDay, monthBounds, occurrenceOf, occurrenceOnOrAfter, parseCalendarDate } from "../time.js";
24
+ import type { Recurrence } from "../time.js";
24
25
  import type { ProspectiveTunables } from "./tunables.js";
25
26
 
26
27
  /** As stated. `2026` / `2026-08` / `2026-08-25` / `2026-10-20..2026-10-31` —
@@ -55,6 +56,14 @@ export interface Window {
55
56
  readonly lastDay: string;
56
57
  /** Last calendar day the window is open (grace included). */
57
58
  readonly closesOn: string;
59
+ /**
60
+ * A RECURRING date's window (2026-10-09) is one occurrence of it: `eventDate`
61
+ * is that occurrence, and these two say what it is an occurrence OF — the
62
+ * day as stated and how often it comes round. Absent on a date that does
63
+ * not repeat.
64
+ */
65
+ readonly anchor?: string;
66
+ readonly recurring?: Recurrence;
58
67
  }
59
68
 
60
69
  /**
@@ -164,6 +173,68 @@ export function windowFor(
164
173
  };
165
174
  }
166
175
 
176
+ /**
177
+ * THE ONE WINDOW A RECURRING DATE HAS OPEN ON `at` (2026-10-09, the owner's
178
+ * design, held lightly) — or, when none is open, the next one, pending.
179
+ *
180
+ * Each occurrence is its own day window, keyed by its own date (`d:2027-05-14`),
181
+ * so every brake that is per window — the fire cap, once per lived day, the
182
+ * plain latch per beat, referenced-stop, and what a revision carries through
183
+ * `lineage` — is per OCCURRENCE without a line of its own: the birthday is
184
+ * told once each May 14, never once ever and never twice.
185
+ *
186
+ * **Two occurrences are never open together.** Lead and grace are a week and
187
+ * a half wide; a weekly or a daily date would otherwise have two to eleven
188
+ * windows open at once, each with its own fire budget. So an occurrence's
189
+ * window is cut where its neighbours' begin: it opens no earlier than the day
190
+ * after the previous occurrence, and closes the day before the next one opens
191
+ * — the coming one's lead wins over the last one's grace. A daily date's
192
+ * window is its day; a weekly one opens three days before and keeps three days
193
+ * of grace; monthly and yearly are untouched.
194
+ *
195
+ * Only a DAY repeats (`time.ts#occurrenceOf`). Anything else is null, and the
196
+ * caller treats the date as stated, once.
197
+ */
198
+ export function recurringWindowAt(
199
+ anchor: string,
200
+ rule: Recurrence,
201
+ at: string,
202
+ t: ProspectiveTunables,
203
+ salt = "",
204
+ ): Window | null {
205
+ if (!isDay(anchor) || !isDay(at)) return null;
206
+ const occ = (k: number): string | null => (k < 0 ? null : occurrenceOf(anchor, rule, k));
207
+ const opensOf = (k: number): string => {
208
+ const o = occ(k) as string;
209
+ const lead = addDays(o, -t.LEAD_DAYS);
210
+ const prev = occ(k - 1);
211
+ if (prev === null) return lead;
212
+ const after = addDays(prev, 1);
213
+ return lead > after ? lead : after;
214
+ };
215
+ const windowOf = (k: number): Window | null => {
216
+ const o = occ(k);
217
+ if (o === null) return null;
218
+ const w = windowFor(o, "day", t, salt);
219
+ if (w === null) return null;
220
+ const grace = addDays(o, t.GRACE_DAYS);
221
+ const nextOpens = addDays(opensOf(k + 1), -1);
222
+ return {
223
+ ...w,
224
+ opensOn: opensOf(k),
225
+ closesOn: grace < nextOpens ? grace : nextOpens,
226
+ anchor,
227
+ recurring: rule,
228
+ };
229
+ };
230
+ const next = occurrenceOnOrAfter(anchor, rule, at);
231
+ if (next === null) return null;
232
+ // Still in the last occurrence's grace, and the next one's lead not begun.
233
+ const last = windowOf(next.k - 1);
234
+ if (last !== null && at <= last.closesOn) return last;
235
+ return windowOf(next.k);
236
+ }
237
+
167
238
  /** ISO day keys sort lexically, so the comparisons below are the calendar order. */
168
239
  export function phaseOf(w: Window, at: string): Phase {
169
240
  if (at < w.opensOn) return "pending";
@@ -94,11 +94,13 @@ reply actually used reconsolidates, where in humans every retrieval does.
94
94
  [v1 §9 G14–G15]
95
95
  - **Hard caps on volume, and the tiers are disjoint** — a memory is "came to mind" *or*
96
96
  "quietly available", never both. [v1 §9 G16]
97
- - **Deliberate recall is a deeper effort with different thresholds, on purpose** — the ambient
98
- seed floor is the right bar for surfacing uninvited and the wrong bar for a question someone
99
- asked (measured: five on-point traces, best similarity 0.366, zero surfaced). It adds a
100
- **labeled** lower-confidence tier and returns footnote-tier items as bodies. **Ranking is
101
- not recording**: it trains nothing and deposits nothing. [v1 §9.1]
97
+ - **Deliberate recall is not this module's ranking any more** (2026-10-03, Release B): a
98
+ question asked on purpose is answered by `mcp/facts.ts` or `mcp/meaning.ts`, each its own
99
+ path, and neither calls `build()`. The reason the old rule gave still stands — the ambient
100
+ seed floor is the right bar for surfacing uninvited and the wrong bar for a question
101
+ someone asked (measured: five on-point traces, best similarity 0.366, zero surfaced) — so
102
+ the answer is now every match, not the ambient pool re-tiered. **A search is not
103
+ recording**: it trains nothing; opening or quoting credits at the boundary. [v1 §9.1]
102
104
  - **A candidate count must not become an undercount** — a top-K tuned for surfacing is wrong
103
105
  for an aggregation question. [v1 §9.1 G3]
104
106
  - **Reference resolution reads the assistant's turns only, uses no model and no file reads,
@@ -112,7 +114,10 @@ reply actually used reconsolidates, where in humans every retrieval does.
112
114
  model nothing but a title). Never for being named, surfaced, footnoted, or rendered in a
113
115
  wake; the `surfaced` and `footnoted` use tiers stay unused by this consumer. Agreement is
114
116
  not judged: a memory expanded and then argued with is credited. One durable row per
115
- boundary, `recall.credit`, with a `reason` readers split on.**
117
+ boundary, `recall.credit`, with a `reason` readers split on.** *Since 2026-10-09 that row
118
+ also scores what ambient recall showed since the session's last scored boundary: by
119
+ lane, how many a reply expanded or quoted and which it did not (NOTES §28). Measurement
120
+ only; nothing trains on a miss.*
116
121
  - **Framing is load-bearing and part of the spec** — footnotes are pointers, and the "quietly
117
122
  available / ignorable" phrasing is a deliberate probe question, at step 1 since 2026-09-14
118
123
  (§7 OQ4). [v1 §9 G17]
@@ -230,7 +235,11 @@ credit at the boundary; reinforcement deltas handed to `physics/`.
230
235
  `LINK_POINTERS_MAX`, beside `MAX_FOOTNOTES`; 2026-09-28.)*
231
236
  7. **[M]** Ambiguous handles fire at reduced weight AND train nothing — both halves, with a
232
237
  test that greps for the consumer, not the comment (scar §2.6).
233
- 8. **[M]** Deliberate recall trains nothing and deposits nothing.
238
+ 8. **[M]** A deliberate SEARCH trains nothing and deposits no memory (2026-10-03: stated
239
+ as the owner's rule of 09-16 — exposure never strengthens, retrieval does). Opening a
240
+ memory by id or title, or quoting the words a deliberate answer showed (`asked` gate
241
+ records, read by `Counterpart#creditReferences`; never by the ambient gate), is credited
242
+ at the boundary like any use.
234
243
  9. **[M]** Confidentiality is enforced at the boundary of the ask — sensitive material returns
235
244
  only in the owner's own session; withholding is *stated* for a direct lookup and silent in
236
245
  a list.
@@ -302,7 +311,10 @@ credit at the boundary; reinforcement deltas handed to `physics/`.
302
311
  unfelt. The affect flag's "charged" test reads the same intensity.
303
312
  19. **[M]** **A deliberate question about feeling is answered from the stamps** (U13,
304
313
  2026-09-30, revised after the review of #293 — working default; `feeling-ask.ts`,
305
- `activate.ts`). Only when the turn carries a `feeling` ask, which only the deliberate
314
+ `activate.ts`). *2026-10-03: the deliberate caller that set `feeling` was the old
315
+ question path, retired in Release B; facts mode reads no feeling lane, and feeling
316
+ questions are meaning mode's (`mcp/meaning.ts`). The lane below is unchanged in the
317
+ core.* Only when the turn carries a `feeling` ask, which only a deliberate
306
318
  path sets: the ambient turn, its affect gate (G10/G11) and mood-matching (G18) are
307
319
  unchanged. A stamp answers to its emotion word (an `other` whose own word is on the
308
320
  wheel reads as that word), its group's word, the aliases pointing at it, its wheel
@@ -344,7 +356,12 @@ credit at the boundary; reinforcement deltas handed to `physics/`.
344
356
  numbers only reach `BuildOutput.feeling`; no feeling's word reaches the decision
345
357
  record. Tests: `recall-feelings.test.ts`.
346
358
 
347
- 20. **[M]** **A deliberate question about time leads with the session it means**
359
+ 20. **RETIRED 2026-10-03 (Release B).** Facts mode reads time as a FILTER instead
360
+ (`recall/time-ask.ts`, `mcp/facts.ts`; mcp CONTRACT §6f): a window the question names
361
+ keeps only what is inside it, and "the last session" is resolved to the session the
362
+ wake's "Last here" names, whose rows lead. `recency-ask.ts` stays, read by
363
+ `time-ask.ts` for days and clock times. What this guarantee said, for the record:
364
+ **A deliberate question about time leads with the session it means**
348
365
  (2026-09-30, the continuity test; revised after the review of #302 — working default;
349
366
  `recency-ask.ts`, `mcp/deliberate.ts#recentRows`). Only on the deliberate path, only
350
367
  when the caller names the asking session's directory (the MCP `recall`; not the
@@ -416,8 +433,9 @@ nothing about what is recallable or ranked moves. Episodes record their director
416
433
  checkpoints rather than a race, so an overrun aborts the turn instead of degrading the
417
434
  channel, and every hook is a fresh process already spending 700-1000 ms cold against
418
435
  1200 ms. The cue is computed by the detached worker after a turn and used on the next
419
- one (§5 G17). The deliberate ask is the exception and embeds in line, under its own
420
- budget (`mcp/deliberate.ts`, `DELIBERATE_BUDGET_MS`).
436
+ one (§5 G17). The deliberate ask is the exception and embeds in line
437
+ (`mcp/deliberate.ts#embedQuestion`; since 2026-10-03 it ranks in its own mode, not
438
+ through `build()`).
421
439
  3. **Does `associate/` fold in here** (traversal), with its arithmetic going to `physics/`?
422
440
  The module map's standing check-in question; owned by `associate/`.
423
441
  4. **Is the "quietly available / ignorable" framing actually ignorable to a model?** v1
@@ -427,7 +445,8 @@ nothing about what is recallable or ranked moves. Episodes record their director
427
445
  citing one", after the model was measured asserting counts and characterizations of
428
446
  five footnoted memories from their titles without expanding any (IMPROVEMENTS U5). The
429
447
  measurement is `probe.ts` / `counterparts probe-oq4`: per calendar date, footnotes
430
- delivered (`recall.decision`) vs. later expanded by id (`recall.credit.expandedIds`).
448
+ delivered (`recall.decision`) vs. later expanded by id (`recall.credit.expandedIds`),
449
+ and since 2026-10-09 a hit rate by lane from the credit row's own score (NOTES §28).
431
450
  Reversible by one string; the owner rules on the reading, not this file.
432
451
  5. ~~**The absolute floors have never fired in v2, and the loud tier needs them.**~~
433
452
  **ANSWERED 2026-09-04. The floors are in cue units now, and the "cue-count half" was