counterparts 0.3.2 → 0.3.4

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 (153) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/docs/module-map.md +3 -2
  3. package/package.json +1 -1
  4. package/src/adapters/claude-code/NOTES.md +28 -0
  5. package/src/adapters/claude-code/bin/hook.ts +85 -22
  6. package/src/adapters/claude-code/config.ts +7 -0
  7. package/src/adapters/claude-code/doctor.ts +166 -4
  8. package/src/adapters/claude-code/hooks.ts +185 -6
  9. package/src/adapters/claude-code/index.ts +3 -0
  10. package/src/adapters/claude-code/transcript.ts +7 -0
  11. package/src/adapters/cli/CONTRACT.md +11 -0
  12. package/src/adapters/cli/INTERFACE-GAPS.md +16 -0
  13. package/src/adapters/cli/NOTES.md +25 -0
  14. package/src/adapters/cli/commands.ts +184 -4
  15. package/src/adapters/cli/dream-core.ts +126 -0
  16. package/src/adapters/cli/help.ts +17 -0
  17. package/src/adapters/cli/mechanisms.ts +199 -106
  18. package/src/adapters/dashboard/CONTRACT.md +5 -0
  19. package/src/adapters/dashboard/INTERFACE-GAPS.md +12 -0
  20. package/src/adapters/dashboard/NOTES.md +38 -0
  21. package/src/adapters/dashboard/registries.ts +35 -1
  22. package/src/adapters/dashboard/web/README.md +63 -26
  23. package/src/adapters/dashboard/web/app.html +2 -0
  24. package/src/adapters/dashboard/web/flow.ts +14 -0
  25. package/src/adapters/dashboard/web/lanes.ts +141 -0
  26. package/src/adapters/dashboard/web/mechanisms/association/index.js +1 -2
  27. package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +8 -5
  28. package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +7 -7
  29. package/src/adapters/dashboard/web/mechanisms/decay/index.js +1 -2
  30. package/src/adapters/dashboard/web/mechanisms/dreaming/index.js +19 -0
  31. package/src/adapters/dashboard/web/mechanisms/emotional/index.js +9 -6
  32. package/src/adapters/dashboard/web/mechanisms/episodic-semantic/index.js +4 -5
  33. package/src/adapters/dashboard/web/mechanisms/index.js +5 -3
  34. package/src/adapters/dashboard/web/mechanisms/interference/index.js +1 -2
  35. package/src/adapters/dashboard/web/mechanisms/prospective/index.js +7 -5
  36. package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +1 -2
  37. package/src/adapters/dashboard/web/mechanisms/regions.js +1 -1
  38. package/src/adapters/dashboard/web/mechanisms/retrieval/index.js +1 -2
  39. package/src/adapters/dashboard/web/mechanisms/salience/index.js +1 -2
  40. package/src/adapters/dashboard/web/mechanisms/schema/index.js +1 -2
  41. package/src/adapters/dashboard/web/narrate.ts +76 -13
  42. package/src/adapters/dashboard/web/pages/health/sections/checks.js +17 -1
  43. package/src/adapters/dashboard/web/pages/home/home.css +29 -13
  44. package/src/adapters/dashboard/web/pages/home/index.js +2 -0
  45. package/src/adapters/dashboard/web/pages/home/sections/explorer.js +22 -7
  46. package/src/adapters/dashboard/web/pages/home/sections/hero.js +15 -3
  47. package/src/adapters/dashboard/web/pages/home/sections/live-activity.js +15 -9
  48. package/src/adapters/dashboard/web/pages/home/sections/recent-chapters.js +6 -2
  49. package/src/adapters/dashboard/web/pages/home/sections/tiles.js +35 -18
  50. package/src/adapters/dashboard/web/pages/memories/index.js +30 -36
  51. package/src/adapters/dashboard/web/pages/memories/memories.css +97 -72
  52. package/src/adapters/dashboard/web/pages/memories/row.js +51 -0
  53. package/src/adapters/dashboard/web/pages/memories/sections/feel.js +176 -0
  54. package/src/adapters/dashboard/web/pages/memories/sections/hold.js +67 -0
  55. package/src/adapters/dashboard/web/pages/memories/sections/list.js +65 -43
  56. package/src/adapters/dashboard/web/pages/memories/sections/search.js +26 -23
  57. package/src/adapters/dashboard/web/pages/memories/state.js +12 -5
  58. package/src/adapters/dashboard/web/pages/self/index.js +57 -16
  59. package/src/adapters/dashboard/web/pages/self/sections/dreams.js +76 -0
  60. package/src/adapters/dashboard/web/pages/self/sections/journal.js +75 -19
  61. package/src/adapters/dashboard/web/pages/self/sections/page.js +108 -65
  62. package/src/adapters/dashboard/web/pages/self/sections/settling.js +129 -104
  63. package/src/adapters/dashboard/web/pages/self/sections/wake.js +31 -15
  64. package/src/adapters/dashboard/web/pages/self/self.css +122 -59
  65. package/src/adapters/dashboard/web/pages/self/state.js +21 -0
  66. package/src/adapters/dashboard/web/server.ts +9 -0
  67. package/src/adapters/dashboard/web/shared/memory-marks.css +17 -0
  68. package/src/adapters/dashboard/web/shared/memory-marks.js +81 -0
  69. package/src/adapters/dashboard/web/shared/memory-modal.js +240 -53
  70. package/src/adapters/dashboard/web/shared/modal.css +67 -0
  71. package/src/adapters/dashboard/web/shared/tip.js +1 -1
  72. package/src/adapters/dashboard/web/shared/widgets/feed.css +4 -0
  73. package/src/adapters/dashboard/web/shared/widgets/feed.js +56 -14
  74. package/src/adapters/dashboard/web/shared/widgets/light.css +1 -0
  75. package/src/adapters/dashboard/web/shared/widgets/light.js +7 -5
  76. package/src/adapters/dashboard/web/shared/widgets/tips.css +19 -0
  77. package/src/adapters/dashboard/web/shared/widgets/tips.js +56 -0
  78. package/src/adapters/dashboard/web/views/activity.ts +18 -2
  79. package/src/adapters/dashboard/web/views/archive-words.ts +27 -10
  80. package/src/adapters/dashboard/web/views/dreams.ts +199 -0
  81. package/src/adapters/dashboard/web/views/mechanism-panel.ts +116 -35
  82. package/src/adapters/dashboard/web/views/mechanisms.ts +81 -255
  83. package/src/adapters/dashboard/web/views/memories.ts +245 -43
  84. package/src/adapters/dashboard/web/views/memory-words.ts +133 -0
  85. package/src/adapters/dashboard/web/views/memory.ts +226 -4
  86. package/src/adapters/dashboard/web/views/mind.ts +261 -61
  87. package/src/adapters/dashboard/web/views/overview.ts +80 -42
  88. package/src/adapters/dashboard/web/views/search.ts +35 -1
  89. package/src/adapters/dashboard/web/views/shared.ts +14 -0
  90. package/src/adapters/dashboard/web/views.ts +2 -0
  91. package/src/adapters/feelings-line.ts +74 -0
  92. package/src/adapters/fired.ts +163 -23
  93. package/src/adapters/mcp/CONTRACT.md +8 -0
  94. package/src/adapters/mcp/NOTES.md +56 -0
  95. package/src/adapters/mcp/server.ts +254 -6
  96. package/src/adapters/mcp/tools.ts +180 -5
  97. package/src/adapters/mechanism-evidence.ts +465 -0
  98. package/src/core/bridge.ts +21 -16
  99. package/src/core/counterpart.ts +422 -10
  100. package/src/core/dream/CONTRACT.md +143 -0
  101. package/src/core/dream/INTERFACE-GAPS.md +24 -0
  102. package/src/core/dream/NOTES.md +84 -0
  103. package/src/core/dream/index.ts +1067 -0
  104. package/src/core/dream/mark.ts +14 -0
  105. package/src/core/dream/tunables.ts +56 -0
  106. package/src/core/encode/CONTRACT.md +7 -1
  107. package/src/core/feelings-wheel.ts +171 -13
  108. package/src/core/mint.ts +9 -0
  109. package/src/core/physics/CONTRACT.md +132 -21
  110. package/src/core/physics/NOTES.md +233 -0
  111. package/src/core/physics/index.ts +419 -50
  112. package/src/core/prospective/CONTRACT.md +35 -6
  113. package/src/core/prospective/INTERFACE-GAPS.md +10 -5
  114. package/src/core/prospective/NOTES.md +175 -4
  115. package/src/core/prospective/derive.ts +32 -3
  116. package/src/core/prospective/index.ts +362 -39
  117. package/src/core/prospective/tunables.ts +18 -1
  118. package/src/core/prospective/windows.ts +104 -46
  119. package/src/core/recall/CONTRACT.md +28 -0
  120. package/src/core/recall/NOTES.md +55 -0
  121. package/src/core/recall/activate.ts +32 -5
  122. package/src/core/recall/gate.ts +7 -1
  123. package/src/core/recall/index.ts +28 -2
  124. package/src/core/recall/mood.ts +106 -0
  125. package/src/core/recall/tunables.ts +26 -0
  126. package/src/core/remember/CONTRACT.md +5 -0
  127. package/src/core/remember/index.ts +1 -0
  128. package/src/core/remember/proposals.ts +86 -3
  129. package/src/core/remember/spans.ts +11 -1
  130. package/src/core/self/CONTRACT.md +3 -0
  131. package/src/core/self/INTERFACE-GAPS.md +7 -0
  132. package/src/core/self/NOTES.md +30 -0
  133. package/src/core/self/identity.ts +115 -6
  134. package/src/core/self/index.ts +17 -0
  135. package/src/core/self/tunables.ts +17 -0
  136. package/src/core/sleep/CONTRACT.md +17 -1
  137. package/src/core/sleep/INTERFACE-GAPS.md +19 -0
  138. package/src/core/sleep/NOTES.md +36 -0
  139. package/src/core/sleep/consolidate.ts +149 -96
  140. package/src/core/sleep/decay.ts +11 -0
  141. package/src/core/sleep/index.ts +4 -1
  142. package/src/core/sleep/tunables.ts +9 -0
  143. package/src/core/sleep/types.ts +17 -0
  144. package/src/core/sleep/upgrade.ts +168 -0
  145. package/src/core/store/CONTRACT.md +21 -2
  146. package/src/core/store/NOTES.md +68 -0
  147. package/src/core/store/feelings.ts +23 -6
  148. package/src/core/store/index.ts +716 -17
  149. package/src/core/store/operational.ts +329 -4
  150. package/src/core/store/owner-op-seam.ts +79 -1
  151. package/src/core/types.ts +37 -0
  152. package/src/adapters/dashboard/web/pages/memories/sections/constellation.js +0 -178
  153. package/src/adapters/dashboard/web/pages/memories/sections/kinds.js +0 -42
@@ -0,0 +1,14 @@
1
+ /**
2
+ * THE MARK a dream's words carry (2026-09-26) — spelled once, here, with no
3
+ * imports, because two modules that must not depend on each other both read
4
+ * it: `dream/` writes it (the bundle, the launch prompt, the hand-back) and
5
+ * `remember/spans.ts#enters` refuses any turn that carries it, so a dream can
6
+ * never become a lived memory through the boundary sweep. The Claude Code
7
+ * transcript reader tags such a block `dream` for the same reason.
8
+ */
9
+ export const DREAM_MARK = "⟦counterparts:dream";
10
+
11
+ /** Does this text carry a dream's mark? */
12
+ export function carriesDreamMark(text: string): boolean {
13
+ return text.includes(DREAM_MARK);
14
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Every `dream/` knob, in one visible place. WORKING DEFAULTS from the owner's
3
+ * conversation of 2026-09-26 ("try it, see how it goes, adjust"); CAL = not
4
+ * yet measured against real dreams.
5
+ */
6
+ export const DREAM_TUNABLES = {
7
+ // ── when to ask ───────────────────────────────────────────────────────────
8
+ /** The ask is due only when at least this many memories are new since the
9
+ * last dream — a dream with nothing to replay is not worth his minutes. CAL. */
10
+ MIN_NEW: 3,
11
+ /** A store that has never dreamed looks back this many lived days for "new". */
12
+ FIRST_DREAM_DAYS: 7,
13
+
14
+ // ── the bundle ────────────────────────────────────────────────────────────
15
+ /** Most new memories one dream is shown (newest first). CAL. */
16
+ MAX_NEW: 40,
17
+ /** Nearest OLDER neighbours shown beside each new memory (owner: 5–8). */
18
+ NEIGHBOURS: 6,
19
+ /** Loosely related older memories shown for mixing (the REM half). CAL. */
20
+ MIXING: 5,
21
+ /** The loose band: neighbours ranked this far down are "loosely related". */
22
+ MIXING_FROM_RANK: 12,
23
+ MIXING_TO_RANK: 40,
24
+ /** The look-back: the strongest-feeling memories from about a week back. */
25
+ LOOKBACK_DAYS: 7,
26
+ /** …within this many lived days either side of it. */
27
+ LOOKBACK_SPREAD: 2,
28
+ LOOKBACK_COUNT: 5,
29
+ /** Characters of each memory's words the bundle carries. */
30
+ TEXT_CHARS: 400,
31
+ /** Characters of the self page, the wake and each chapter the bundle carries. */
32
+ PAGE_CHARS: 6_000,
33
+ WAKE_CHARS: 6_000,
34
+ CHAPTER_CHARS: 3_000,
35
+ MAX_CHAPTERS: 6,
36
+
37
+ // ── what one dream may change (owner: "start ~10 merges, 20 links, 3 gists") ─
38
+ LIMITS: {
39
+ merge: 10,
40
+ link: 20,
41
+ gist: 3,
42
+ replayed: 60,
43
+ contradiction: 10,
44
+ "feeling-now": 10,
45
+ "nominate-core": 3,
46
+ },
47
+ /** The weight of a link a dream draws, both ways (about three co-activations). CAL. */
48
+ LINK_WEIGHT: 0.3,
49
+ /** Longest merged or dreamed text, in characters. */
50
+ MAX_TEXT_CHARS: 2_000,
51
+ /** Longest journal entry, in characters. */
52
+ MAX_JOURNAL_CHARS: 12_000,
53
+ } as const;
54
+
55
+ export type DreamAction = keyof typeof DREAM_TUNABLES.LIMITS;
56
+ export const DREAM_ACTIONS = Object.keys(DREAM_TUNABLES.LIMITS) as DreamAction[];
@@ -51,7 +51,13 @@ a credential. It is a deliberate, non-ablatable addition.
51
51
  - **Beliefs and current state render verbatim; identity core renders compressed.** [v1]
52
52
  §8 G7 — "a paraphrase of a belief cannot be honestly confirmed or contradicted."
53
53
  - **Emotion is typed, attributed, and absent-means-null, never neutral. Retro-typing
54
- emotion is forbidden.** [v1] §4.2 G5.
54
+ emotion is forbidden.** [v1] §4.2 G5. *(2026-09-26, emotion part A: the author's
55
+ `emotional` dimension is now read by the battery when it is given ALONE — a missing
56
+ relevance or predictive reads 0, as `mint.ts` has always stored it — so the two
57
+ readings of one note agree. That is the author's own number, not a type inferred here;
58
+ the stated-emotion gate still yields no magnitude. The emotional weight a memory
59
+ carries — its score or its recorded feelings, whichever is stronger — is physics'
60
+ arithmetic, §5.10.)*
55
61
  - **Task-state is not memory**, discriminated at encode time by one question: *would this
56
62
  still be a true memory worth holding after the date passes?* [v1] §4.2 G10.
57
63
 
@@ -22,8 +22,37 @@
22
22
  * **Valence** is +1 or −1 per entry, and 0 for `surprise` itself: surprise's
23
23
  * children take their own (amazed, awe, astonished, excited, energetic, eager
24
24
  * lean positive; startled, shocked, dismayed, confused, perplexed, disillusioned
25
- * lean negative). Nothing reads valence yet — it is here so the emotion build
26
- * that comes later does not have to re-transcribe the poster.
25
+ * lean negative). The one reader so far is the suggestion rule below: a word
26
+ * off the wheel is never nudged toward a word of the opposite sign.
27
+ *
28
+ * **ADDITIONS — NOT THE POSTER'S** (emotion part A, 2026-09-26). Real use
29
+ * showed the poster missing the words a counterpart actually reaches for:
30
+ * session random-53 wrote eight feelings and seven fell off the wheel
31
+ * (grateful, curious, tender, exposed, sheepish, caught, clarified — only
32
+ * "amused" matched). `ADDED` below lists the words added for that, each marked
33
+ * `added: true` on its entry and placed on the middle ring of its best core
34
+ * with no parent — they are not squeezed under a poster word they do not
35
+ * belong to. The poster's entries are unchanged, and `added` is how any reader
36
+ * tells the two apart.
37
+ *
38
+ * **BLENDS carry two cores** with no schema change: an entry may declare
39
+ * `alsoCore`. The stored row keeps the PRIMARY core (`core`); anything that
40
+ * matches by core — mood-matching in recall — reads a blend as both
41
+ * (`coresOfFeeling`), and a writer may name a blend under either of its cores.
42
+ * One poster word gains a second core this way (`vulnerable`, + fear, so
43
+ * "exposed" — its alias — can be written under fear); the word stays the
44
+ * poster's and the entry says the second core is ours (`secondCoreAdded`).
45
+ *
46
+ * **ALIASES** (`ALIASES`): a few everyday words that mean a wheel word read
47
+ * as that word (`exposed` → `vulnerable`, `thankful` → `grateful`). The caller
48
+ * is told what its word was read as.
49
+ *
50
+ * **Suggestions are only offered when genuinely close** (`closestKeys`): a
51
+ * misspelling (edit distance 1, or 2 for a word of six letters or more) of a
52
+ * word under the SAME core, never one of the opposite valence. The first
53
+ * version offered the five nearest keys by raw edit distance, so "tender"
54
+ * under sad was offered bored / despair / lonely — steering a warm word toward
55
+ * its opposite. A word with nothing close is simply kept as the writer's own.
27
56
  *
28
57
  * A leaf: no imports, so `store/` (which validates against it) and anything
29
58
  * above can read it without a layering question.
@@ -47,6 +76,13 @@ export interface WheelEntry {
47
76
  readonly valence: Valence;
48
77
  /** A middle-ring word the wheel ALSO prints on the outer ring of the same core. */
49
78
  readonly alsoUnder?: string;
79
+ /** True for a word added from real use — NOT on the owner's poster. See
80
+ * ADDITIONS in the header. */
81
+ readonly added?: true;
82
+ /** A blend's second core. The row stores `core`; matching reads both. */
83
+ readonly alsoCore?: CoreEmotion;
84
+ /** True when a POSTER word's `alsoCore` is ours, not the poster's. */
85
+ readonly secondCoreAdded?: true;
50
86
  }
51
87
 
52
88
  /** The one emotion key that is not on the wheel: the person's own word is kept beside it. */
@@ -107,6 +143,45 @@ const TREE: Record<CoreEmotion, readonly Branch[]> = {
107
143
 
108
144
  const SURPRISE_POSITIVE = new Set(["excited", "energetic", "eager", "amazed", "awe", "astonished"]);
109
145
 
146
+ /**
147
+ * THE ADDITIONS — words a counterpart actually has that the poster does not
148
+ * (session random-53, 2026-09-26). Each sits on the middle ring of its best
149
+ * core, marked `added`. A blend names its second core; its valence is stated
150
+ * rather than derived, because a blend's sign is not its primary core's.
151
+ * WORKING DEFAULTS: the placements are judgment, and the owner may move any.
152
+ */
153
+ const ADDED: readonly { word: string; core: CoreEmotion; alsoCore?: CoreEmotion; valence: Valence }[] = [
154
+ { word: "grateful", core: "happy", valence: 1 },
155
+ { word: "curious", core: "happy", valence: 1 },
156
+ { word: "intrigued", core: "happy", valence: 1 },
157
+ { word: "fond", core: "happy", valence: 1 },
158
+ { word: "relieved", core: "happy", valence: 1 },
159
+ { word: "moved", core: "happy", valence: 1 },
160
+ // Blends: the row keeps the first core, matching reads both.
161
+ { word: "bittersweet", core: "happy", alsoCore: "sad", valence: 0 },
162
+ { word: "tender", core: "sad", alsoCore: "happy", valence: 1 },
163
+ { word: "wistful", core: "sad", alsoCore: "happy", valence: -1 },
164
+ { word: "sheepish", core: "fear", alsoCore: "sad", valence: -1 },
165
+ ];
166
+
167
+ /** A second core given to a POSTER word — itself an addition, marked on the entry. */
168
+ const ADDED_SECOND_CORE: Readonly<Record<string, CoreEmotion>> = {
169
+ // Vulnerable is printed under sad (despair); being exposed is as much fear.
170
+ vulnerable: "fear",
171
+ };
172
+
173
+ /**
174
+ * Everyday words that MEAN a wheel word, read as it. Small on purpose: an
175
+ * alias decides for the writer, so each one must be a synonym, not a cousin.
176
+ */
177
+ export const ALIASES: Readonly<Record<string, string>> = {
178
+ exposed: "vulnerable",
179
+ thankful: "grateful",
180
+ touched: "moved",
181
+ nostalgic: "wistful",
182
+ inquiring: "curious",
183
+ };
184
+
110
185
  function valenceOf(core: CoreEmotion, word: string, ring: WheelRing): Valence {
111
186
  if (core === "happy") return 1;
112
187
  if (core !== "surprise") return -1;
@@ -156,8 +231,28 @@ function build(): WheelEntry[] {
156
231
  seen.add(key);
157
232
  }
158
233
  }
234
+ // The additions, after the poster's own words for this core.
235
+ for (const a of ADDED) {
236
+ if (a.core !== core) continue;
237
+ if (seen.has(a.word) || coresOf.has(a.word)) throw new Error(`feelings wheel: addition "${a.word}" is already on the poster`);
238
+ out.push({
239
+ key: a.word,
240
+ word: a.word,
241
+ core,
242
+ ring: "middle",
243
+ parent: null,
244
+ valence: a.valence,
245
+ added: true,
246
+ ...(a.alsoCore === undefined ? {} : { alsoCore: a.alsoCore }),
247
+ });
248
+ seen.add(a.word);
249
+ }
159
250
  }
160
- return out;
251
+ // A second core on a poster word is an addition too, and says so.
252
+ return out.map((e) => {
253
+ const second = ADDED_SECOND_CORE[e.key];
254
+ return second === undefined ? e : { ...e, alsoCore: second, secondCoreAdded: true as const };
255
+ });
161
256
  }
162
257
 
163
258
  /** Every entry on the wheel, cores first within each core's block. */
@@ -173,34 +268,97 @@ export function wheelEntry(key: string): WheelEntry | undefined {
173
268
  return BY_KEY.get(key);
174
269
  }
175
270
 
271
+ /**
272
+ * Every core a recorded feeling counts under: its own, plus a blend's second
273
+ * core. An `other` (or a key the wheel does not know) counts under the core it
274
+ * was recorded with, and nothing else.
275
+ */
276
+ export function coresOfFeeling(core: string, emotion: string): CoreEmotion[] {
277
+ const entry = BY_KEY.get(emotion);
278
+ const out: CoreEmotion[] = isCoreEmotion(core) ? [core] : [];
279
+ if (entry !== undefined) {
280
+ if (!out.includes(entry.core)) out.push(entry.core);
281
+ if (entry.alsoCore !== undefined && !out.includes(entry.alsoCore)) out.push(entry.alsoCore);
282
+ }
283
+ return out;
284
+ }
285
+
286
+ /** A blend may be named under either of its cores. */
287
+ function underCore(e: WheelEntry, core: CoreEmotion): boolean {
288
+ return e.core === core || e.alsoCore === core;
289
+ }
290
+
176
291
  /** How an emotion as given reads against the wheel, under the core it was given with. */
177
292
  export type EmotionResolution =
178
- | { readonly kind: "wheel"; readonly entry: WheelEntry }
293
+ /** On the wheel. `alias` is the writer's word when it was read AS this entry
294
+ * (`exposed` → `vulnerable`); absent when the word was the entry itself. */
295
+ | { readonly kind: "wheel"; readonly entry: WheelEntry; readonly alias?: string }
179
296
  | { readonly kind: "wrong-core"; readonly entry: WheelEntry }
180
297
  | { readonly kind: "other"; readonly word: string; readonly closest: readonly string[] };
181
298
 
182
299
  /**
183
300
  * Read `emotion` (a key or a bare word, any case) under `core`. A bare word the
184
- * wheel prints under two cores is qualified by `core`; a word that is on the
301
+ * wheel prints under two cores is qualified by `core`; a blend reads under
302
+ * either of its cores; an alias reads as its wheel word; a word that is on the
185
303
  * wheel under a DIFFERENT core only is `wrong-core`; anything else is `other`,
186
- * with the closest keys under `core` for the caller to rewrite with.
304
+ * with a suggestion only when one is genuinely close (`closestKeys`).
187
305
  */
188
306
  export function resolveEmotion(core: CoreEmotion, emotion: string): EmotionResolution {
189
307
  const raw = emotion.trim().toLowerCase();
190
308
  const direct = BY_KEY.get(raw) ?? BY_KEY.get(`${core}.${raw}`);
191
- if (direct !== undefined) return direct.core === core ? { kind: "wheel", entry: direct } : { kind: "wrong-core", entry: direct };
309
+ if (direct !== undefined) return underCore(direct, core) ? { kind: "wheel", entry: direct } : { kind: "wrong-core", entry: direct };
310
+ const aliased = Object.hasOwn(ALIASES, raw) ? BY_KEY.get(ALIASES[raw] as string) : undefined;
311
+ if (aliased !== undefined) {
312
+ return underCore(aliased, core) ? { kind: "wheel", entry: aliased, alias: emotion.trim() } : { kind: "wrong-core", entry: aliased };
313
+ }
192
314
  const elsewhere = FEELINGS_WHEEL.find((e) => e.word === raw);
193
315
  if (elsewhere !== undefined) return { kind: "wrong-core", entry: elsewhere };
194
316
  return { kind: "other", word: emotion.trim(), closest: closestKeys(core, raw) };
195
317
  }
196
318
 
197
- /** Up to `n` keys under `core`, nearest first by edit distance to `word`. */
198
- export function closestKeys(core: CoreEmotion, word: string, n = 5): string[] {
199
- return FEELINGS_WHEEL.filter((e) => e.core === core && e.ring !== "core")
200
- .map((e) => ({ key: e.key, d: editDistance(word, e.word) }))
201
- .sort((a, b) => a.d - b.d || (a.key < b.key ? -1 : 1))
319
+ /** The sign a core leans: happy up, surprise either way, the other four down. */
320
+ function coreSign(core: CoreEmotion): Valence {
321
+ return core === "happy" ? 1 : core === "surprise" ? 0 : -1;
322
+ }
323
+
324
+ /**
325
+ * At most `n` wheel keys that `word` is GENUINELY close to under `core` — and
326
+ * usually none. Close means a misspelling: edit distance 1, or 2 for a word of
327
+ * six letters or more, against a wheel word or an alias. Only words that can be
328
+ * written under `core` (its own, and blends that include it) are offered, and
329
+ * never one whose valence opposes the core's — a writer who chose `sad` is not
330
+ * steered to a happy word, nor the reverse. Nothing close: an empty list, and
331
+ * the writer's own word stands.
332
+ *
333
+ * Replaced 2026-09-26 the "five nearest keys by raw edit distance", which
334
+ * offered "tender" (under sad) bored, despair and lonely.
335
+ */
336
+ export function closestKeys(core: CoreEmotion, word: string, n = 3): string[] {
337
+ const w = word.trim().toLowerCase();
338
+ if (w.length === 0) return [];
339
+ const limit = w.length >= 6 ? 2 : 1;
340
+ const sign = coreSign(core);
341
+ const fits = (e: WheelEntry): boolean =>
342
+ e.ring !== "core" &&
343
+ underCore(e, core) &&
344
+ // A blend belongs to this core by definition; any other word must lean
345
+ // the core's way (surprise, sign 0, leans either).
346
+ (e.alsoCore !== undefined || sign === 0 || e.valence === 0 || e.valence === sign);
347
+ const best = new Map<string, number>();
348
+ const offer = (key: string, d: number): void => {
349
+ if (d > limit) return;
350
+ const had = best.get(key);
351
+ if (had === undefined || d < had) best.set(key, d);
352
+ };
353
+ for (const e of FEELINGS_WHEEL) if (fits(e)) offer(e.key, editDistance(w, e.word));
354
+ for (const [alias, key] of Object.entries(ALIASES)) {
355
+ const e = BY_KEY.get(key);
356
+ if (e !== undefined && fits(e)) offer(key, editDistance(w, alias));
357
+ }
358
+ return [...best.entries()]
359
+ .sort((a, b) => a[1] - b[1] || (a[0] < b[0] ? -1 : 1))
202
360
  .slice(0, n)
203
- .map((x) => x.key);
361
+ .map(([key]) => key);
204
362
  }
205
363
 
206
364
  function editDistance(a: string, b: string): number {
package/src/core/mint.ts CHANGED
@@ -49,6 +49,7 @@
49
49
  * resolution, upstream, and this file does not write a second one.
50
50
  */
51
51
  import { TUNABLES as PHYSICS, clampSalienceAtSeam } from "./physics/index.js";
52
+ import { CUE_MODE_META, DATE_FROM_META } from "./prospective/index.js";
52
53
  import type { Proposal } from "./remember/index.js";
53
54
  import { localDate } from "./time.js";
54
55
  import type { Store } from "./store/index.js";
@@ -182,6 +183,12 @@ export function mintProposal(store: Store, proposal: Proposal, opts: MintOptions
182
183
  // Durable, because the event ring is not: prose is canonical, so the flag on
183
184
  // the document is what makes "defaulted vs claimed" countable tomorrow.
184
185
  if (clamp.defaulted) meta[CLAIMED_DEFAULT_META_KEY] = true;
186
+ // PLAIN OR QUIET rides the meta bag beside its date (2026-09-26, no schema
187
+ // bump), under the key its one reader owns.
188
+ if (proposal.eventDate !== null && proposal.remind !== null) meta[CUE_MODE_META] = proposal.remind;
189
+ // The memory a revision took its reminder from (`Counterpart#carryReminder`):
190
+ // an id, so what was already said for the same window still counts.
191
+ if (proposal.reminderFrom !== undefined) meta[DATE_FROM_META] = proposal.reminderFrom;
185
192
 
186
193
  // THE PROPOSAL'S OWN INSTANT, not the write's (§I7). `proposal.at` is the
187
194
  // span buffer's injected clock read at the moment the author deposited; the
@@ -203,6 +210,8 @@ export function mintProposal(store: Store, proposal: Proposal, opts: MintOptions
203
210
  body: proposal.content,
204
211
  learnedOn,
205
212
  ...(proposal.title === null ? {} : { title: proposal.title }),
213
+ // The reminder date, as the author wrote it (schema v7's `event_date`).
214
+ ...(proposal.eventDate === null ? {} : { eventDate: proposal.eventDate }),
206
215
  meta,
207
216
  band: opts.band ?? "episodic",
208
217
  ...(opts.model === undefined ? {} : { model: opts.model }),
@@ -13,14 +13,30 @@ disuse, consolidation moving a trace from episodic to semantic. **Named deviatio
13
13
  *do* fade in humans, here they do not [v1 §11 G5]; (b) traces never blend — generalization
14
14
  is only an explicit, provenance-carrying revision, so there is no substrate confabulation
15
15
  [v1 §4.2 G9]; (c) only a retrieval the assistant actually *used* resets the curve, where in
16
- humans every retrieval reconsolidates [v1 §10 G1].
16
+ humans every retrieval reconsolidates [v1 §10 G1]; (d) a DREAM's replay counts as a
17
+ return worth half an awake one and toward no core lane (§5.11) — sleep replay does
18
+ strengthen human memory, but here a dream is the model's own pass, so it is discounted and
19
+ kept out of the door to identity.
20
+
21
+ **Since 2026-09-26 (owner decisions, dreaming + consolidation)** the analog is sharper:
22
+ durability comes from SPACED RETRIEVAL — Ebbinghaus's savings (1885), the spacing effect
23
+ (Cepeda et al. 2006), Bjork & Bjork's storage strength (1992: each retrieval makes the
24
+ trace harder to lose, more so after a gap) — rather than from a one-time bonus; and the
25
+ identity band is systems consolidation for memories about me or about us, by two lanes: a
26
+ strongly felt one that comes back (the amygdala's stamp plus one reactivation), or one
27
+ that keeps coming back over weeks.
17
28
 
18
29
  ## 3. Keeps
19
30
 
20
31
  - **The strength formula's shape — encoding salience, repetition with a cap, a
21
32
  consolidation bonus, a decay term.** [v0] `clamp01( mean(salience) + min(accessCount ×
22
33
  0.12, 0.5) + (consolidated ? 0.2 : 0) − 0.015 × age_days )`, kept with the decay term
23
- upgraded (§5.4).
34
+ upgraded (§5.4). **The consolidation bonus is LEGACY since 2026-09-26**: kept, exactly,
35
+ for memories born before schema v8, and closed to everything made since (§5.2, §5.11).
36
+ - **Durability from spaced returns** (§5.11, 2026-09-26). [Ebbinghaus; Bjork & Bjork 1992;
37
+ the held #238's spacing curve, harvested with its penalty dropped] — each counted return
38
+ lengthens stability, with diminishing returns; close-together returns count less, never
39
+ against.
24
40
  - **Four-dimensional salience {novelty, relevance, emotional, predictive}, 0–1 each, scored
25
41
  once at encoding** and never re-scored. [v0]
26
42
  - **Novelty is prediction error against schema expectations, computed.** [v0 dimension,
@@ -32,9 +48,9 @@ humans every retrieval reconsolidates [v1 §10 G1].
32
48
  §4.3] — the single most reusable piece of v1 calibration.
33
49
  - **The active-day clock.** [engram E8, re-earned v1 §11] One lived-day function, every
34
50
  site routes through it, rollover at a local boundary hour rather than UTC.
35
- - **Repetition is structurally capped below identity.** [v1 §10 G11] — free here: v0's own
36
- `0.5` repetition cap plus its `0.2` consolidation bonus sum to `0.70`, already below the
37
- identity threshold.
51
+ - **Repetition alone never makes identity** [v1 §10 G11] — since 2026-09-26 a rule of the
52
+ core lanes rather than a threshold: only a memory about me or about us can become core at
53
+ all, so a fact, a skill or a place never does however often it returns (§5.3).
38
54
  - **Graded retrospective reinforcement; the ignorable tier does not train.** [v1 §10 G1]
39
55
  - **The `updates: <memory-id>` field, declared by the writer.** [v0] — the revision channel
40
56
  v0 already had, which v1 rebuilt as the ledger and the owner has now returned to v0's
@@ -104,16 +120,16 @@ explicit claim — however low — is never overridden. See NOTES.md item 16.
104
120
 
105
121
  ```
106
122
  rep(m) = min( 0.12 × uses(m), 0.5 ) # v0, verbatim; TUNABLE
107
- cons(m) = 0.2 if consolidated(m) else 0 # v0, verbatim; TUNABLE
123
+ cons(m) = 0.2 if consolidated(m) else 0 # v0; LEGACY rows only (§5.11)
108
124
  base(m) = max( ω_sal(k) × sal(m), ω_rep(k) × rep(m) ) + cons(m) # MAX, not product
109
125
  strength(m, d) = clamp01( base(m) × D(m, d) )
110
126
  ```
111
127
 
112
- `base` is monotone non-decreasing (salience is fixed, `uses` only rises). The repetition arm
113
- alone tops out at `0.5 + 0.2 = 0.70`, below `Θ_id = 0.85` [v1 §10 G11] — and after review
114
- finding 2, the salience arm cannot walk in either: **identity is reached only through §5.3's
115
- explicit promotion (≥ N distinct lived days) or declared revision — never at birth, by
116
- either arm.**
128
+ `base` is monotone non-decreasing (salience is fixed, `uses` only rises). **Identity is
129
+ reached only through §5.3's explicit promotion by a core lane, or declared revision —
130
+ never at birth, by either arm, and never by `base`.** `consolidated` can be set only on a
131
+ LEGACY row (born before schema v8): the upgrade kept that path open for exactly those rows,
132
+ and every memory made since earns its durability from returns (§5.11) instead.
117
133
 
118
134
  Per-kind constants. `ω` reads v1 §4.3's *gradient driver* column; **TUNABLE,
119
135
  calibration-required** — v1 recorded which arm drives, not a weight, so the non-driving arm's
@@ -142,12 +158,23 @@ band(m, d) = identity if promoted(m) # explicit cr
142
158
  episodic otherwise
143
159
  ```
144
160
 
145
- - **Nothing is born into identity** (owner ruling, N = 3). At birth, band ≤ semantic
146
- regardless of claimed salience. Identity is entered only by: (a) a declared revision
147
- landing on an existing identity element — the successor inherits membership — or (b)
148
- **promotion at consolidation** after `base ≥ Θ_id = 0.85` (TUNABLE) *and* reinforcement
149
- on **≥ N = 3 distinct lived days**. The same number, with the same ancestry, as the
150
- slow-kind revision pace — one rationale, used twice (Amendment 15).
161
+ - **Nothing is born into identity.** At birth, band ≤ semantic regardless of claimed
162
+ salience. Identity is entered only by: (a) a declared revision landing on an existing
163
+ identity element — the successor inherits membership — or (b) **promotion at
164
+ consolidation by a CORE LANE** (rewritten 2026-09-26, owner decisions; working defaults):
165
+
166
+ ```
167
+ about me(m) = kind(m) = self, or kind(m) = person and m names the owner # decided by sleep/
168
+ FAST lane = I(m) ≥ 0.6 and an awake return ≥ 2 lived days after birth
169
+ SLOW lane = awake returns on ≥ 5 distinct lived days spanning ≥ 21 lived days
170
+ promote ⇔ about me(m) ∧ (FAST ∨ SLOW) ∧ not demoted by the owner
171
+ ```
172
+
173
+ Emotion counts toward the core ON PURPOSE, through the fast lane (the `promotionBase`
174
+ stopgap of #244 is retired); repetition counts through the slow lane, and only for
175
+ memories about me or about us. A dream's replays count toward neither lane: a dream may
176
+ NOMINATE, only a lane promotes. `sleep/` caps the crossings at three a night, strongest
177
+ first; the owner's demotion (`counterparts core --demote`) is sticky.
151
178
  - **Promotion is an explicit, counted crossing event** — a distinct record, never an
152
179
  emergent side effect (scar §2.4) — and **identity-band membership is enumerable on
153
180
  demand** beside the protected list: permanence and inspectability scale together
@@ -165,8 +192,10 @@ band(m, d) = identity if promoted(m) # explicit cr
165
192
  ```
166
193
  D(m, d) = 1 if band(m) == identity # named deviation
167
194
  = exp( −( d − last_used_day(m) ) / S(m) ) otherwise
168
- S(m) = S_base × (1 + β × ln(1 + uses(m))) / κ(k) # stability, lived days
195
+ S(m) = S_base × (1 + β × ln(1 + uses(m))) × E(m) × R(m) / κ(k) # stability, lived days
169
196
  S_base = 60 β = 0.5 # both TUNABLE
197
+ E(m) = 1 + EMO_SLOPE × I(m) # §5.10
198
+ R(m) = 1 + RETURN_GAIN × ln(1 + returns(m)) # §5.11; 1 at no returns
170
199
  ```
171
200
 
172
201
  - **The active-day clock is the only clock** [E8]: `d` counts days lived, rolling at
@@ -193,7 +222,8 @@ uses(m) += w ; last_used_day(m) := d (only when w > 0)
193
222
 
194
223
  At most one credited occasion per memory per lived day, and never on its birth day [v1 §10
195
224
  G9]. Credit is retrospective, resolved at the boundary when the reply is known [v1 §10 G1].
196
- The ignorable tier never trains.
225
+ The ignorable tier never trains. A credited use is ALSO asked, beside this and without
226
+ changing it, whether it is a RETURN (§5.11).
197
227
 
198
228
  ### 5.6 Revision — declared, pressure-accumulated, no second object
199
229
 
@@ -289,8 +319,9 @@ low-strength memory is still present and still retrievable by a strong enough cu
289
319
  recorded as a default, not as a lift — and no default can reach `THETA_SEM` on its own.
290
320
  3. **[M]** `base` is monotone non-decreasing: reinforcement re-lifts what decay eroded;
291
321
  nothing demotes what salience earned.
292
- 4. **[M]** Repetition never reaches the identity band — structurally, from the cap
293
- arithmetic, not from a removable check.
322
+ 4. **[M]** Repetition alone never reaches the identity band: only a memory about me or
323
+ about us can be promoted at all (the `not-about-me` refusal), so however often a fact,
324
+ a skill or a place returns it never crosses (2026-09-26; before, the cap arithmetic).
294
325
  5. **[M]** Exactly-once decay, by being a pure function of the clock rather than a step.
295
326
  6. **[M]** One lived-day function, with a totality test over its call sites (scar §2.4).
296
327
  7. **[M]** Revision requires a declared `updates:` target. There is no inferred-revision
@@ -307,6 +338,86 @@ low-strength memory is still present and still retrievable by a strong enough cu
307
338
  calibration and a fixture-bounded window, or disabled (scar §2.8).
308
339
  12. **[M]** Up-moves and down-moves are counted separately, per kind, with a stated expected
309
340
  ratio — the symmetry counter that made v1's one-way ratchet visible (scar §2.10).
341
+ 13. **[M]** Emotion (§5.10) lifts only the SALIENCE arm and lengthens only stability:
342
+ `sal()` is unchanged (recall's turn gate and revision force read it without the
343
+ lift), the repetition arm gets no lift (guarantee 4 stands), and a silent note with
344
+ the strongest possible feeling is below `THETA_SEM` at birth and below `THETA_ID`
345
+ even consolidated. The recorded feeling is never rewritten; softening is a read.
346
+ **Emotion counts toward identity through the core's fast lane and nowhere else**
347
+ (owner decisions 2026-09-26; `promotionBase`, the interim stopgap, is retired). The
348
+ lift itself stays height only.
349
+ 14. **[M]** Returns (§5.11) only ever LENGTHEN stability: the factor is exactly 1 at zero
350
+ returns, so a memory that has never returned fades as it always did, and nothing a
351
+ return does lowers strength. The v8 upgrade moves no memory down a band and makes
352
+ none prune sooner — measured on every row by the first sleep after it
353
+ (`sleep/upgrade.ts`, `physics.v8.census`), not asserted.
354
+
355
+ ### 5.10 Emotion — height, slope, and the feeling that softens
356
+
357
+ *(Added 2026-09-26, emotion part A — owner decisions of 2026-09-25/26. Working defaults,
358
+ not rulings: the three constants are CAL and unmeasured. NOTES "Emotion, part A" has the
359
+ simulation and the reasons.)*
360
+
361
+ ```
362
+ I(m) = max( emotional(m), max strength of the feelings recorded on m ) # his or mine
363
+ salArm(m) = clamp01( sal(m) + EMO_LIFT × I(m) ) EMO_LIFT = 0.15 # TUNABLE
364
+ base(m) = max( ω_sal(k) × salArm(m), ω_rep(k) × rep(m) ) + cons(m) # §5.2, arm lifted
365
+ S(m) = §5.4's S × (1 + EMO_SLOPE × I(m)) EMO_SLOPE = 0.5 # TUNABLE
366
+ feeling now = strength × exp( −(d − birth_day(m)) / S_FEELING ) S_FEELING = 20 # read only
367
+ ```
368
+
369
+ - **Height ADDS.** Before this, a lone `emotional: 0.9` on a note read as a mean of 0.3
370
+ under a claimed floor of 0.25 — the feeling averaged away. Now intensity adds on top of
371
+ whatever the mean-with-floor is. `sal()` itself is v0's verbatim mean and stays that way.
372
+ - **The strongest feeling decides**, whoever's it is: `I` is a MAX over the numeric score
373
+ and every recorded feeling on the memory (the owner's and the self's), read beside the
374
+ row by `store.row()` as `feelingPeak`. A MAX, like `base`, so quieter feelings never
375
+ average a strong one down.
376
+ - **Slope follows the same number.** "How long a memory lasts follows the strongest
377
+ feeling on it." It changes decay on EXISTING stores — every row with an `emotional`
378
+ score or a recorded feeling — which is why the multiplier is modest (×1.45 at I = 0.9).
379
+ - **The feeling softens faster than the fact.** A feeling's strength as it reads now is
380
+ the recorded strength softened over the lived days since its MEMORY was born.
381
+ `S_FEELING = 20 < S_BASE = 60`. The table keeps the strength as recorded; nothing
382
+ writes the softened value back. Height and slope use the RECORDED peak (affect stamps a
383
+ trace at encoding); the softened value is what mood-matching (recall G18) and the
384
+ displays read. **Approximation, named:** a feeling's age is counted from its memory's
385
+ birth day, because the lived-day clock cannot map a feeling's wall-clock `created_at`
386
+ back to a lived day. Today every feeling is written in the same call that mints its
387
+ memory, so the two agree; a feeling added to an old memory later (`addFeelings` is
388
+ public) would read as already softened.
389
+
390
+ ### 5.11 Returns — durability from coming back
391
+
392
+ *(Added 2026-09-26 — owner decisions, dreaming + consolidation. Working defaults, CAL.
393
+ NOTES "Returns, core lanes and the v8 upgrade" has the simulations and the reasons.)*
394
+
395
+ ```
396
+ return = a credited, REFERENCED use on a lived day after the memory's previous
397
+ counted return (either kind) or its birth — NOT while the memory was
398
+ showing in the wake's hints lane, unless recall surfaced it on the turn's
399
+ own cue (the SAME turn) — or a DREAM replay (at most once per dream per
400
+ memory, and once per RETURN_SPACING_DAYS)
401
+ weight = w × (1 − exp(−gap / RETURN_SPACING_DAYS)) RETURN_SPACING_DAYS = 7
402
+ w = 1 awake, DREAM_RETURN_WEIGHT dream DREAM_RETURN_WEIGHT = 0.5
403
+ returns(m) += weight # the history is a table
404
+ R(m) = 1 + RETURN_GAIN × ln(1 + returns(m)) RETURN_GAIN = 1.0
405
+ ```
406
+
407
+ - **Never against the memory.** A return is computed BESIDE `creditUse`, which is
408
+ unchanged: `uses`, `lastUsedDay` and the rep arm credit exactly as before, and a close
409
+ return only adds less. The held #238 scaled `uses` down for consecutive-day use; that
410
+ penalty is dropped.
411
+ - **The loop, broken.** A use while the memory was on display in the hints lane may have
412
+ been prompted by the display — the rich-get-richer loop (#238) — so it is not a return.
413
+ `self/` ranks that lane on ORGANIC strength and habituation for the same reason.
414
+ - **Awake returns feed the core lanes** (`returnDays`, `first/lastReturnDay`); a dream's
415
+ do not — and a dream's replay earlier the same lived day does not take the lane day of
416
+ an organic return: the awake return still counts, at the weight its (zero) gap from the
417
+ replay gives it (review of #251).
418
+ - **The legacy path.** `consolidated` / `+CONS_BONUS` stays exactly as it was for rows
419
+ born before schema v8 and is closed to every row made since. At zero returns, R = 1:
420
+ the upgrade changes no memory's arithmetic.
310
421
 
311
422
  ## 6. Scars honored
312
423