counterparts 0.3.35 → 0.3.36

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 (60) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/package.json +1 -1
  3. package/src/adapters/cli/dream-core.ts +22 -6
  4. package/src/adapters/cli/removal.ts +20 -2
  5. package/src/adapters/dashboard/web/narrate.ts +11 -1
  6. package/src/adapters/dashboard/web/pages/self/sections/settling.js +1 -1
  7. package/src/adapters/dashboard/web/shared/memory-card-words.js +13 -0
  8. package/src/adapters/dashboard/web/views/memory.ts +7 -3
  9. package/src/adapters/dashboard/web/views/mind.ts +3 -3
  10. package/src/adapters/mcp/server-words.ts +1 -1
  11. package/src/adapters/mcp/server.ts +13 -4
  12. package/src/adapters/mechanism-evidence.ts +3 -3
  13. package/src/core/associate/CONTRACT.md +24 -3
  14. package/src/core/associate/NOTES.md +21 -1
  15. package/src/core/associate/buffer.ts +41 -1
  16. package/src/core/associate/edges.ts +103 -0
  17. package/src/core/associate/index.ts +198 -4
  18. package/src/core/associate/pending.ts +60 -4
  19. package/src/core/associate/tunables.ts +40 -4
  20. package/src/core/counterpart-events.ts +21 -0
  21. package/src/core/counterpart-types.ts +2 -0
  22. package/src/core/counterpart.ts +341 -16
  23. package/src/core/dream/CONTRACT.md +9 -2
  24. package/src/core/dream/NOTES.md +21 -0
  25. package/src/core/dream/index.ts +1 -1
  26. package/src/core/dream/reflect.ts +38 -4
  27. package/src/core/handoff/CONTRACT.md +24 -2
  28. package/src/core/handoff/last-here.ts +176 -18
  29. package/src/core/physics/CONTRACT.md +112 -16
  30. package/src/core/physics/NOTES.md +86 -0
  31. package/src/core/physics/index.ts +284 -11
  32. package/src/core/recall/CONTRACT.md +25 -2
  33. package/src/core/recall/NOTES.md +108 -0
  34. package/src/core/recall/activate.ts +87 -0
  35. package/src/core/recall/gate.ts +43 -3
  36. package/src/core/recall/index.ts +233 -12
  37. package/src/core/recall/session.ts +148 -4
  38. package/src/core/recall/standing.ts +82 -1
  39. package/src/core/recall/tunables.ts +98 -0
  40. package/src/core/retrieval.ts +9 -0
  41. package/src/core/schemas/CONTRACT.md +7 -2
  42. package/src/core/schemas/NOTES.md +21 -0
  43. package/src/core/schemas/index.ts +6 -1
  44. package/src/core/schemas/tunables.ts +11 -0
  45. package/src/core/schemas/types.ts +6 -0
  46. package/src/core/self/CONTRACT.md +14 -3
  47. package/src/core/self/briefing-room.ts +21 -1
  48. package/src/core/self/briefing.ts +101 -4
  49. package/src/core/self/index.ts +6 -1
  50. package/src/core/self/tunables.ts +24 -0
  51. package/src/core/sleep/CONTRACT.md +34 -4
  52. package/src/core/sleep/NOTES.md +37 -0
  53. package/src/core/sleep/consolidate.ts +334 -47
  54. package/src/core/sleep/index.ts +5 -0
  55. package/src/core/sleep/tunables.ts +6 -5
  56. package/src/core/store/NOTES.md +10 -0
  57. package/src/core/store/index.ts +65 -1
  58. package/src/core/store/operational.ts +39 -3
  59. package/src/core/store/owner-op-seam.ts +12 -0
  60. package/src/core/store/wave2.ts +104 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,58 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.36 — 2026-10-25
4
+
5
+ A session opened mid-day now sees what this folder did earlier today (a "Today so far here" line), and the Yesterday line opens with day's end's own summary of yesterday when everything it rests on may be shown in this folder; on a tight day, "Still open" keeps its items before "Today so far" keeps its summaries. When you write the newer state of a recent memory without linking it, a turn that brings back both shows the newer one first and labels the older one "may be out of date". A word that brought a memory back, which the session then used, is wired to it, so next time the word alone can bring it back. The core is decided every night instead of every third (still at most three a night), and a belief you repeat awake counts as support for the one that already says it. A new way of deciding the core, by how much real use has backed a memory, runs **in shadow only**: it records each night what it would have let in or kept out, and nothing changes yet. **This release changes the store's format (v14 to v15, one new table), so after installing, quit the dashboard and every open Claude Code session, then start them again**: one left running from before the update keeps the old code against the upgraded store and stops working on it until it is restarted. The first open saves a copy of your store before upgrading it. **0.3.35 and older refuse the upgraded store**, so going back to 0.3.35 is `counterparts rollback` first, while 0.3.36 is still installed (it puts that pre-upgrade copy back; anything remembered since is set aside, not deleted), then 0.3.35's install and `counterparts connect` as it prints. Cache v7 unchanged; no wiring change, so `counterparts connect` is not needed after upgrading.
6
+
7
+ - **The core is decided every night, not every third night.** A memory that has earned its
8
+ place in who I am joins at the next sleep instead of waiting up to two more days. Still at
9
+ most three a night.
10
+ - **Practising a cue makes its answer come back faster.** When a word in what you typed brings a
11
+ memory back and the session then uses it (opens it, quotes it, draws on it, or rates it 2–3),
12
+ that word is wired to the memory, and next time the word alone can bring it back. A memory
13
+ rated 0 for a word drops for that word only. Only words some memory already holds are ever
14
+ kept, and a turn's words leave with the conversation after 14 days. Store format 15 (one new
15
+ table); the upgrade copies the store first, and an older build refuses the upgraded store.
16
+ Switch: `physics.CUE_LEARNING`.
17
+ - **A session opened mid-day sees what this folder did earlier today.** A "Today so far here"
18
+ line under the Yesterday line names today's earlier chapters in this folder, each with its
19
+ time, title, id and the first sentence of its summary. It gives up room before anything
20
+ else under the framing.
21
+ - **Yesterday reads as day's end told it.** When day's end left a summary of yesterday, the
22
+ Yesterday line opens with it, word for word, and lists the chapters after it. It does this
23
+ only when everything the summary rests on may be shown in this folder, and otherwise lists
24
+ the chapters as before.
25
+ - **A belief you repeat awake now counts for the one that already says it.** When a session
26
+ writes a belief that an existing belief already says, it is still turned away with that
27
+ belief's id, and the memory now counts as support for it, once per session, instead of
28
+ waiting for the night's reflection.
29
+ - **A change you didn't link wins a close race right away.** When you write something that reads
30
+ as the newer state of a recent memory without saying so ("the car is a Rivian now"), the two
31
+ are marked as a pair for the night to confirm. Until then, a turn that brings back both now
32
+ shows the newer one first; the older one still shows, labelled "may be out of date", whenever
33
+ there is room, and on its own it shows as before. Nothing is changed in the store. Switch:
34
+ `recall.UNSETTLED_COMPETES`.
35
+ - **The nightly reflection is offered its unmarked memories again, and says so.** On a busy night
36
+ the room was full before the offer of memories nobody had marked was fitted, so from 10-10 the
37
+ reflection was offered none and its record said nothing. Now it is offered up to 24 a night
38
+ whatever the room, and every reflection records how many it was offered and how many it marked,
39
+ 0 included.
40
+ - **On a tight day, "Still open" keeps its items before "Today so far" keeps its summaries.**
41
+ The chapter summaries in the "Today so far here" line step down to titles before any "Still
42
+ open" item is dropped, since a summary can still be opened by its chapter's id. The titles
43
+ keep their place.
44
+ - **A memory joins the core when life has backed it enough, by one measure instead of two
45
+ lanes.** Real uses of a memory about me or us (opened, quoted, drawn on, rated useful)
46
+ from separate moments and lived days add up, the way a belief's support does; feeling
47
+ makes each count more, so a strongly felt memory that comes back once, a couple of days
48
+ or more after it was made, is in, and an ordinary one needs to come back on another day.
49
+ The day after a memory is made counts as the same occasion as its making. Being shown counts nothing, and a
50
+ reflection citing a memory counts only once a later use echoes it, never on its own.
51
+ Each new core memory's record lists what backed it. **For now it runs in shadow:** the two
52
+ lanes still decide what becomes core, and each night this measure records, beside them, which
53
+ memories it would have let in or kept out, so a week of real nights can decide.
54
+ Switch: `physics.CORE_DOOR_SUPPORT` (`"shadow"` by default, `"on"`, `"off"`).
55
+
3
56
  ## 0.3.35 — 2026-10-24
4
57
 
5
58
  The morning reflection reads a shorter list of the memories that may become core: at most 30 a night, the 20 strongest and 10 taking turns through the rest, with the others counted in one line (on a copy of the author's store, 132 candidates → 30 shown and "+102 more", the reflection's reading 85k characters in 4 parts → 74k in 3; a tail of about 100 comes round in about 10 nights). Day's end's known misread from 0.3.34 is fixed: a night that tells the day and then writes the page reads as a page revised. A memory written in one session now counts as used the first time another session draws on it, the same day. No store-format change (store v14, cache v7), no wiring change: `counterparts connect` is not needed after upgrading. Restart the dashboard and every Claude Code session afterwards so the long-running memory server and dashboard load the new version.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.35",
3
+ "version": "0.3.36",
4
4
  "license": "MIT",
5
5
  "description": "Memory that turns AI tools into counterparts - a local-first, human-memory-modeled memory layer for AI.",
6
6
  "repository": {
@@ -11,6 +11,7 @@
11
11
  import type { Counterpart } from "../../core/counterpart.js";
12
12
  import { dreamSkippedOf, nightPartsWords, nightRunWords, nightTokensWords } from "../../core/dream/index.js";
13
13
  import type { DreamingSetting, NightRun } from "../../core/dream/index.js";
14
+ import { coreDoorMode } from "../../core/physics/index.js";
14
15
  import { acceptsReflectedFeeling, reconsiderWords } from "../../core/sleep/index.js";
15
16
  import { coreSupport } from "../../core/self/measures.js";
16
17
  import { daySummaries } from "../../core/self/writer.js";
@@ -254,6 +255,8 @@ export function dreamShowLines(counterpart: Counterpart, id: string): string[] |
254
255
  /** `counterparts core --list`: the core with lanes, then nominations and demotions. */
255
256
  export function coreListLines(counterpart: Counterpart): string[] {
256
257
  const { core, nominated, demoted, reconsidering } = counterpart.coreList();
258
+ // The support door decides only at "on" (2026-10-24, E2); "shadow" and "off" are the two lanes.
259
+ const supportDoor = coreDoorMode() === "on";
257
260
  const out = [
258
261
  core.length === 0
259
262
  ? "The core is empty: nothing has become part of who I am yet."
@@ -279,12 +282,25 @@ export function coreListLines(counterpart: Counterpart): string[] {
279
282
  "",
280
283
  "Only a memory about me or about us becomes core — what it is about is marked by meaning, by the",
281
284
  "writer or by a reflection (owner, work and world are not candidates, nor a fact, a skill or a plan).",
282
- "Then: strongly felt and back after a gap (fast lane), or it and its earlier and later states kept",
283
- "coming back — on several days, in several sessions, over a week or more inside a month (slow lane).",
284
- "A reflection that cites a memory counts as it coming back. At most a few a night.",
285
- acceptsReflectedFeeling(counterpart.store)
286
- ? "Open to reflection alone: a feeling a reflection records later and a reflection citing a memory count toward the fast lane, and a reflection may re-label either way (counterparts core --reflected-feeling off to close it)."
287
- : "Closed to reflection alone: the fast lane needs a feeling felt at the time and an ordinary use after a gap, and a reflection may only move a memory toward work or world (counterparts core --reflected-feeling on to open it).",
285
+ ...(supportDoor
286
+ ? [
287
+ // The support door (2026-10-24, E2).
288
+ "Then: life has to back it enough — real uses of it (or its earlier and later states) from separate",
289
+ "moments and lived days, feeling making each count more; a glimpse counts nothing, and a reflection",
290
+ "that cites it counts a little until a later use echoes it, never alone. At most a few a night.",
291
+ ]
292
+ : [
293
+ "Then: strongly felt and back after a gap (fast lane), or it and its earlier and later states kept",
294
+ "coming back — on several days, in several sessions, over a week or more inside a month (slow lane).",
295
+ "A reflection that cites a memory counts as it coming back. At most a few a night.",
296
+ ]),
297
+ supportDoor
298
+ ? acceptsReflectedFeeling(counterpart.store)
299
+ ? "Open to later feelings: a feeling a reflection records later makes its memory's uses count more, and a reflection may re-label either way (counterparts core --reflected-feeling off to close it)."
300
+ : "Closed to later feelings: only a feeling felt at the time makes a memory's uses count more, and a reflection may only move a memory toward work or world (counterparts core --reflected-feeling on to open it)."
301
+ : acceptsReflectedFeeling(counterpart.store)
302
+ ? "Open to reflection alone: a feeling a reflection records later and a reflection citing a memory count toward the fast lane, and a reflection may re-label either way (counterparts core --reflected-feeling off to close it)."
303
+ : "Closed to reflection alone: the fast lane needs a feeling felt at the time and an ordinary use after a gap, and a reflection may only move a memory toward work or world (counterparts core --reflected-feeling on to open it).",
288
304
  );
289
305
  if (nominated.length > 0) {
290
306
  out.push("", "Nominated by a dream (a lane still has to promote it):");
@@ -66,7 +66,7 @@ import { strikeSpans } from "../../core/remember/owner-strike-seam.js";
66
66
  // directory belongs to `self/`, and the invariant it keeps ("a file exists
67
67
  // exactly when a live episode row does") is what makes the chase provable.
68
68
  import { journalFilesFor, syncJournalCopy } from "../../core/self/journal-file.js";
69
- import { paths, rowTombstoned } from "../../core/store/index.js";
69
+ import { indexTerms, paths, rowTombstoned } from "../../core/store/index.js";
70
70
  import { isLocked, openDb } from "../../core/store/db.js";
71
71
  import type {
72
72
  OwnerRemovalOutcome,
@@ -905,8 +905,12 @@ export function ownerRemoval(
905
905
  // there is nothing left to match on. It never enters the plan, the report or
906
906
  // any record — the seam receives a FUNCTION, not a string (§16 G15).
907
907
  let doomedBody = "";
908
+ /** Its title, for the cue words' chase after the cache rebuild (R3). Never recorded. */
909
+ let doomedTitle = "";
908
910
  try {
909
- doomedBody = store.readProse(request.targetId).body.trim();
911
+ const doomed = store.readProse(request.targetId);
912
+ doomedBody = doomed.body.trim();
913
+ doomedTitle = doomed.title ?? "";
910
914
  } catch {
911
915
  /* already gone; the hashes are the chase then, or nothing is */
912
916
  }
@@ -1039,6 +1043,20 @@ export function ownerRemoval(
1039
1043
  try {
1040
1044
  store.rebuildCache();
1041
1045
  chased.push("cache");
1046
+ // ITS WORDS AS LEARNED CUES (review of #613, R3 cue learning): a word of
1047
+ // this memory's that no memory holds any more must not live on as a cue
1048
+ // to another memory (`cue_edges` keeps index terms, and only ones the
1049
+ // index held: kept true after the removal). Asked after the rebuild,
1050
+ // which is what says the index no longer holds them.
1051
+ const terms = indexTerms(`${doomedTitle}\n${doomedBody}`);
1052
+ if (terms.length > 0) {
1053
+ try {
1054
+ const gone = store.sweepCueEdges({ staleOnOrBefore: -1, terms }, () => false);
1055
+ if (gone > 0) chased.push(`operational.cue_edges(${gone} more: words no memory holds now)`);
1056
+ } catch {
1057
+ unchased.push("operational.cue_edges (words no memory holds now may still be wired to other memories)");
1058
+ }
1059
+ }
1042
1060
  } catch {
1043
1061
  unchased.push("cache");
1044
1062
  }
@@ -115,6 +115,13 @@ function n(t: Told, key: string): number | null {
115
115
  return typeof v === "number" && Number.isFinite(v) ? v : null;
116
116
  }
117
117
 
118
+ /** A support crossing's lived days (`payload.support.days`, 2026-10-24), else `fallback`. */
119
+ function supportDays(t: Told, fallback: number): number {
120
+ const sup = t.p["support"];
121
+ const v = typeof sup === "object" && sup !== null ? (sup as Record<string, unknown>)["days"] : undefined;
122
+ return typeof v === "number" && Number.isFinite(v) ? v : fallback;
123
+ }
124
+
118
125
  function s(t: Told, key: string): string | null {
119
126
  const v = t.p[key];
120
127
  return typeof v === "string" && v.length > 0 ? v : null;
@@ -187,7 +194,10 @@ export const NARRATORS = {
187
194
  ? `${subject(t)} became core — it was strongly felt, and it came back after a gap.`
188
195
  : lane === "slow"
189
196
  ? `${subject(t)} became core — it kept coming back, on ${days} separate days over weeks.`
190
- : `${subject(t)} crossed into identity — it had been in real use on ${days} separate days.`,
197
+ : lane === "support"
198
+ ? // The support door (2026-10-24, E2): one arc, its lived days on the record.
199
+ `${subject(t)} became core — it kept coming back, from separate moments, on ${supportDays(t, days)} lived ${supportDays(t, days) === 1 ? "day" : "days"}.`
200
+ : `${subject(t)} crossed into identity — it had been in real use on ${days} separate days.`,
191
201
  );
192
202
  },
193
203
  "band.demoted": (t) =>
@@ -150,7 +150,7 @@ export function ruleWords(s) {
150
150
  const r = s.rule;
151
151
  const foot = ["Only a memory about me or about us joins the core, by one of two lanes: strongly felt (" + n2(r.needFeeling) +
152
152
  " or more) and come back at least once, " + r.needGap + " or more days after it was made; or keep coming back — it, or the memories that are its earlier and later states — on " + r.days +
153
- " different days" + (r.sessions ? ", in " + r.sessions + " sessions," : "") + " over " + r.span + (r.window ? ", within the last " + r.window : "") + ", once it has been used itself. That is checked every " + r.everyDays + " days of use, at most " + r.cap + " a night. " +
153
+ " different days" + (r.sessions ? ", in " + r.sessions + " sessions," : "") + " over " + r.span + (r.window ? ", within the last " + r.window : "") + ", once it has been used itself. That is checked " + (r.everyDays === 1 ? "every day of use" : "every " + r.everyDays + " days of use") + ", at most " + r.cap + " a night. " +
154
154
  (r.quietDays ? "A core memory that stops coming back for " + r.quietDays + " days is reconsidered, never dropped without a decision. " : "") +
155
155
  // The map's own words (round 4 of the map, 2026-09-28: three named rings,
156
156
  // no legend) — this sentence described the legend before it.
@@ -18,6 +18,19 @@ export function coreRoadLine(p, promoted) {
18
18
  if (promoted || !p) return "";
19
19
  if (p.eligible && p.lane === "fast") return "Felt strongly and come back to — it has met the core's bar, and a sleep can make it core.";
20
20
  if (p.eligible && p.lane === "slow") return "It has come back on enough separate days — it has met the core's bar, and a sleep can make it core.";
21
+ // The support door (2026-10-24, E2): one arc, so one sentence.
22
+ if (p.eligible && p.lane === "support") return "Life has backed it enough, from separate moments — it has met the core's bar, and a sleep can make it core.";
23
+ // With the support door on, the lanes' day counts are not its road: how far along the one arc it is.
24
+ if (p.support) {
25
+ if (p.blocked === "demoted-by-owner") return "You took it out of the core, so it stays out.";
26
+ if (!p.byUse) return "";
27
+ if (p.oneReturn) {
28
+ return "Felt strongly, so one real use " + p.needGap + (p.needGap === 1 ? " day of use" : " days of use") +
29
+ " or more after it was made makes it core.";
30
+ }
31
+ const pct = Math.max(0, Math.min(99, Math.round((100 * p.support.level) / p.support.need)));
32
+ return "Real uses from separate moments, on separate days, make it core — it is " + pct + "% of the way.";
33
+ }
21
34
  if (p.oneReturn) {
22
35
  return "Felt strongly, so one real return makes it core — coming back to it " + p.needGap +
23
36
  (p.needGap === 1 ? " day of use" : " days of use") + " or more after it was made.";
@@ -5,7 +5,7 @@
5
5
  * the four rules in that file's header apply to every line below.
6
6
  */
7
7
  import { TUNABLES, band, emotionalIntensity, promotionEligibility, rep, sal, strength } from "../../../../core/physics/index.js";
8
- import type { PromotionVerdict } from "../../../../core/physics/index.js";
8
+ import type { CoreLane, PromotionVerdict } from "../../../../core/physics/index.js";
9
9
  import { DREAM_MERGE_REASON } from "../../../../core/dream/index.js";
10
10
  import { feelingsLine } from "../../../feelings-line.js";
11
11
  import { coreContextFor, curveSinceDay, isJournal } from "../../../../core/sleep/index.js";
@@ -56,9 +56,11 @@ export interface CoreRoad {
56
56
  readonly holdShort: boolean;
57
57
  readonly oneReturn: boolean;
58
58
  readonly needGap: number;
59
- readonly lane: "fast" | "slow" | null;
59
+ readonly lane: CoreLane | null;
60
60
  readonly eligible: boolean;
61
61
  readonly blocked: "not-about-me" | "demoted-by-owner" | null;
62
+ /** The support door's level and line (2026-10-24, E2), only while `physics.CORE_DOOR_SUPPORT` is on. */
63
+ readonly support?: { readonly level: number; readonly need: number };
62
64
  }
63
65
 
64
66
  /**
@@ -82,10 +84,12 @@ export function coreRoad(verdict: PromotionVerdict): CoreRoad {
82
84
  needSpan: verdict.slow.needSpan,
83
85
  holdShort: verdict.slow.strength !== null && verdict.slow.strength < verdict.slow.needStrength,
84
86
  oneReturn: onlyNoLane && !verdict.fast.met && verdict.fast.intensity >= verdict.fast.needIntensity,
85
- needGap: verdict.fast.needGap,
87
+ // The support door's spacing from the making when it is on (E2 review), else the fast lane's gap.
88
+ needGap: verdict.support?.needGap ?? verdict.fast.needGap,
86
89
  lane: verdict.lane,
87
90
  eligible: verdict.eligible,
88
91
  blocked,
92
+ ...(verdict.support === undefined ? {} : { support: { level: verdict.support.level, need: verdict.support.needLevel } }),
89
93
  };
90
94
  }
91
95
 
@@ -5,7 +5,7 @@
5
5
  * the four rules in that file's header apply to every line below.
6
6
  */
7
7
  import { TUNABLES as PHYSICS, promotionEligibility, sal } from "../../../../core/physics/index.js";
8
- import type { PromotionVerdict } from "../../../../core/physics/index.js";
8
+ import type { CoreLane, PromotionVerdict } from "../../../../core/physics/index.js";
9
9
  import {
10
10
  FRAMING,
11
11
  LEGACY_CONTEXT,
@@ -255,7 +255,7 @@ export interface Candidate {
255
255
  readonly span: number;
256
256
  readonly needSpan: number;
257
257
  /** The lane that is met, when one is: the next consolidation crosses it (the nightly cap permitting). */
258
- readonly lane: "fast" | "slow" | null;
258
+ readonly lane: CoreLane | null;
259
259
  readonly eligible: boolean;
260
260
  /**
261
261
  * THE FAST LANE'S ROAD (round 3, S3): felt strongly enough, and nothing but
@@ -961,7 +961,7 @@ export interface CoreCandidate {
961
961
  readonly days: number;
962
962
  readonly span: number;
963
963
  /** The lane that is met, when one is. */
964
- readonly lane: "fast" | "slow" | null;
964
+ readonly lane: CoreLane | null;
965
965
  readonly eligible: boolean;
966
966
  /** The better of the two lanes' progress, 0..2. */
967
967
  readonly closeness: number;
@@ -19,7 +19,7 @@ export const SERVER_NAME = "counterparts";
19
19
  * host decides whether to trust what follows. Read from a constant rather than
20
20
  * from disk so the server opens no file to answer its first message.
21
21
  */
22
- export const SERVER_VERSION = "0.3.35";
22
+ export const SERVER_VERSION = "0.3.36";
23
23
 
24
24
  /**
25
25
  * THE ONE LINE EVERY TOOL ANSWERS WITH when the store on disk is a schema AHEAD
@@ -2425,7 +2425,7 @@ export class McpServer {
2425
2425
  });
2426
2426
  this.noteRecall(row, 0, question, false, payload, ids, key);
2427
2427
  this.markSeen(ids, key);
2428
- this.noteAsked(ids, key);
2428
+ this.noteAsked(ids, key, question);
2429
2429
  return this.result(payload, false);
2430
2430
  }
2431
2431
 
@@ -2439,12 +2439,12 @@ export class McpServer {
2439
2439
  * like the seen set (`seenKey`); nothing for a session nobody identified.
2440
2440
  * Never throws.
2441
2441
  */
2442
- private noteAsked(ids: readonly string[], key?: string): void {
2442
+ private noteAsked(ids: readonly string[], key?: string, question?: string): void {
2443
2443
  if (ids.length === 0) return;
2444
2444
  const session = key ?? this.seenKey();
2445
2445
  if (session === UNBOUND_SESSION) return;
2446
2446
  this.telemetry(() => {
2447
- this.counterpart.noteAsked(session, ids);
2447
+ this.counterpart.noteAsked(session, ids, question === undefined ? {} : { question });
2448
2448
  });
2449
2449
  }
2450
2450
 
@@ -3368,7 +3368,16 @@ export class McpServer {
3368
3368
  statement: a["statement"] as string,
3369
3369
  ...(a["about"] === "us" || a["about"] === "me" ? { about: a["about"] } : {}),
3370
3370
  });
3371
- return { belief: { stored: out.ok && out.reason === "born", reason: out.reason, ...(out.id === null ? {} : { id: out.id }), ...(out.note === undefined ? {} : { note: out.note }) } };
3371
+ return {
3372
+ belief: {
3373
+ stored: out.ok && out.reason === "born",
3374
+ reason: out.reason,
3375
+ ...(out.id === null ? {} : { id: out.id }),
3376
+ ...(out.note === undefined ? {} : { note: out.note }),
3377
+ // B1: a near-duplicate's filing outcome, beside the refusal.
3378
+ ...(out.support === undefined ? {} : { support: out.support }),
3379
+ },
3380
+ };
3372
3381
  }
3373
3382
 
3374
3383
  /**
@@ -131,8 +131,8 @@ export interface MechanismEvidence {
131
131
  /** Also count how many firings landed TODAY (the window's `today`). */
132
132
  readonly today?: boolean;
133
133
  /**
134
- * The sleep phase it runs in, when it runs on a SCHEDULE rather than every
135
- * day (consolidation: every `CADENCE.consolidate` lived days). A quiet week
134
+ * The sleep phase it runs in, when it runs on a SCHEDULE (consolidation:
135
+ * every `CADENCE.consolidate` lived days, 1 since 2026-10-24). A quiet week
136
136
  * of a phase that ran on time is "next run in N days", not "quiet".
137
137
  */
138
138
  readonly schedule?: Phase;
@@ -294,7 +294,7 @@ export const MECHANISM_EVIDENCE: readonly MechanismEvidence[] = [
294
294
  // BUILT (2026-09-26, dreaming + consolidation): durability now comes from
295
295
  // RETURNS — every spaced return makes a memory fade more slowly, credited
296
296
  // the moment it happens (the census) — and the core from its two lanes,
297
- // decided every three lived days (the schedule). A dream's merges are
297
+ // decided every lived day (the schedule; every third until 2026-10-24). A dream's merges are
298
298
  // consolidation too, and so are its FOLDS (2026-10-20: a fold gathers what
299
299
  // belongs together into what it adds up to). The cycle row itself is not a
300
300
  // proof (it lands every night).
@@ -12,8 +12,14 @@ valenced edge, and recall spreads activation across those edges.
12
12
  Hebbian plasticity — "cells that fire together wire together" — plus spreading activation
13
13
  through the resulting associative network. **Named deviations** (constitution line 12):
14
14
  (a) credit is **retrospective and graded** — full only when the reply actually used the
15
- memory, weak when it surfaced unused, **zero for the merely footnoted**, where in humans
16
- every retrieval trains; (b) homeostasis is enforced structurally (a per-node edge cap and
15
+ memory, weak when it surfaced unused, and the footnoted tier's own credit factor zero, where
16
+ in humans every retrieval trains. *Since 2026-10-19 (the feedback loop):* an unrated footnote
17
+ is a `shown` glimpse today (a use at `W_SHOWN`, credited at a `rated` boundary), and memories
18
+ shown on one turn there lay a faint edge (`SHOWN_TOGETHER_DEPOSIT`, G1 below); memory-to-memory
19
+ pairs train only on credited use. (Was: "zero for the merely footnoted".) *Since 2026-10-24
20
+ (R3 cue learning — an experiment):* a footnote SHOWN AND ACTED ON trains its cue pairs — the
21
+ words of the turn that showed it, wired to it — through a rating (1 a little, 2–3 fully, 0
22
+ depresses) or `drewOn`; one merely shown and passed by still trains no cue pair. (b) homeostasis is enforced structurally (a per-node edge cap and
17
23
  a bounded outgoing weight with proportional renormalization) rather than emerging from
18
24
  metabolic limits.
19
25
 
@@ -41,6 +47,18 @@ metabolic limits.
41
47
  - **Spreading activation is bounded**: a hop limit with per-hop decay, and fan
42
48
  normalization so a hub node does not flood. [v1] §9 TUNABLE (v1: 2 hops, hop decay 0.5,
43
49
  fan normalization on).
50
+ - **Cue pairs, the same homeostasis** (2026-10-24, R3 cue learning — an experiment;
51
+ switch `physics.CUE_LEARNING`). The node Hebb was missing: the CUE WORD. A credited use
52
+ wires the words of the turn that showed the memory to it (`cue_edges`, index terms only),
53
+ split over the words by their weights. Bounded like edges and by the same machinery: a
54
+ saturating update per pair (`CUE_W_CAP`), synaptic scaling per word (`CUE_MAX_OUT`),
55
+ exponential fading with lived days (`S_CUE`) and a floor the flush sweeps; deltas
56
+ buffered (`buffer.ts#CueBuffer`, the declared exemption), drained to the pending file on
57
+ the hook path, applied by the worker in the same claim as the pairs and after them (at
58
+ most once for both), skipped on busy, refused for a pinned or no-longer-live memory, and
59
+ nothing at all under observer — written or read. Erasing a memory deletes its pairs (the
60
+ removal counts them), and every pair out of one of its words that no memory holds after it
61
+ (the privacy guard, df > 0, kept true after the fact — review of #613); a pruned or merged one's are swept at the next cue flush.
44
62
  - **An erased or pruned id must stop conducting.** [v1] scar §2.2 — v1's erase deleted edge
45
63
  rows from the index and then `rebuild()` reloaded the edge file wholesale and
46
64
  **resurrected them**, so the erased id kept conducting activation between its former
@@ -73,7 +91,10 @@ for `recall/`; telemetry by reference.
73
91
 
74
92
  **Guarantees** — **[M]** mechanized, **[A]** advisory:
75
93
 
76
- 1. **[M] Display never trains; engagement does — strength only.** *Reworded 2026-10-11 by
94
+ 1. **[M] Display trains nothing outside a rating; engagement does — strength only.**
95
+ *(Heading reworded 2026-10-24: it read "Display never trains", which the 2026-10-19
96
+ amendment below contradicts — at a `rated` boundary display leaves a faint trail.)*
97
+ *Reworded 2026-10-11 by
77
98
  the drewOn builder, from Mike's 10-10 direction, lightly held (wording from #371).* A
78
99
  memory shown and passed by (footnoted, surfaced, on the wake) trains nothing, in either
79
100
  direction. One the session NAMES in a `drewOn` field is credited at the `engaged` tier
@@ -12,7 +12,9 @@ ruling literally in both directions — **all** the edge arithmetic lives in
12
12
  `edges.ts` (increment, cap, lived-day decay, count cap, renormalization), and
13
13
  `physics/` gains nothing. The one import across that line is `decayCurve`: edges
14
14
  decay on the same CURVE FAMILY as memories, with their own stability constant
15
- (`S_EDGE = 30` against memory's `S_BASE = 60`). That is what "a physics-family
15
+ (`S_EDGE = 30` against memory's `S_BASE = 60` at the time; *2026-10-24: `S_BASE` is gone
16
+ since 2026-10-10, a memory's S follows its q, ~3 lived days for a default note, so the
17
+ comparison no longer holds for weak memories*). That is what "a physics-family
16
18
  curve, own constants" means, and it is why there is no second `Math.exp` in this
17
19
  directory.
18
20
 
@@ -568,3 +570,21 @@ evaporation can do it.
568
570
  (42 through new trails); edges ≥ 0.4: none; the first flush swept ~2,040 inert rows. The
569
571
  reasons and the v14 column's cost are in `docs/IMPROVEMENTS.md` (Group 4); what to look at
570
572
  next is in `docs/CHECK-AFTER.md` (Group 4).
573
+
574
+ ## R3 — cue pairs (2026-10-24, an experiment; switch `physics.CUE_LEARNING`)
575
+
576
+ - `cue_edges` (store v15): index term → memory, weight in [0, `CUE_W_CAP`], realized at
577
+ `last_day` with the edges' exponential curve at `S_CUE` (60 lived days), so writing the
578
+ decayed weight is exact. `planCueFlush` (edges.ts): per touched token, its pairs decayed,
579
+ deltas applied (`w + Δ·(1 − w/cap)`; a negative delta floors at 0 and never creates a pair),
580
+ then synaptic scaling to `CUE_MAX_OUT`, then ≤ `CUE_FLOOR` deleted.
581
+ - One buffer per kind, both declared in `buffer.ts`: `CueBuffer` is signed (a 0 rating
582
+ depresses), so it is not a `DeltaBuffer`, whose `add` drops ≤ 0.
583
+ - The pending file carries cue deltas as a `c` array per line (`appendPendingCues`); an older
584
+ reader ignores the key. `applyPendingAssociations` absorbs and flushes a claim's cue deltas
585
+ only AFTER its pairs landed; a cue write that fails is dropped and counted (`cueDropped` on
586
+ the `associate.flush` row) rather than keeping the claim, which would apply its pairs twice.
587
+ - `learnedCues` (the read) returns nothing for an observer — stricter than `spreadFrom`, by
588
+ the brief (an instrument neither writes nor reads cue pairs).
589
+ - The cue flush sweeps pairs into a memory no longer live (archived, superseded, gone, denied)
590
+ and faded ones; the owner's removal deletes a removed memory's pairs in the chase.
@@ -27,7 +27,7 @@
27
27
  * double-apply them. See index.ts.
28
28
  */
29
29
  import { pairKey } from "./edges.js";
30
- import type { PairDelta } from "./edges.js";
30
+ import type { CueDelta, PairDelta } from "./edges.js";
31
31
 
32
32
  export class DeltaBuffer {
33
33
  private pairs = new Map<string, PairDelta>();
@@ -67,3 +67,43 @@ export class DeltaBuffer {
67
67
  return [...taken.values()];
68
68
  }
69
69
  }
70
+
71
+ /**
72
+ * The CUE half of the same exemption (2026-10-24, R3 cue learning): per-turn
73
+ * word-to-memory deltas, buffered and drained exactly as pair deltas are —
74
+ * declared here, beside them, because this file is the one place the
75
+ * exemption may be declared. Re-earnable by construction: the next credited
76
+ * use of the same memory from the same word earns it again. SIGNED, unlike
77
+ * pairs: a rating of 0 depresses (the pair floors at 0 in the flush), so it
78
+ * is not a `DeltaBuffer`, whose `add` drops anything at or below 0.
79
+ *
80
+ * KEPT ONE BY ONE, NOT SUMMED (review of #613): the flush's update saturates
81
+ * per use (`edges.ts#cueStrengthen`, `w + Δ(1 − w/CUE_W_CAP)`), which holds a
82
+ * pair under its cap only for a Δ no larger than the cap. Summed, three uses
83
+ * of a bare word that reached the worker together (Δ 0.5 each) arrived as one
84
+ * Δ of 1.5 and wrote a pair of 1.5, past `CUE_W_CAP` 1. Kept apart, the flush
85
+ * applies them in arrival order, as the same uses one at a time would be.
86
+ */
87
+ export class CueBuffer {
88
+ private cues: CueDelta[] = [];
89
+
90
+ add(token: string, id: string, delta: number): void {
91
+ if (!Number.isFinite(delta) || delta === 0 || token.length === 0 || id.length === 0) return;
92
+ this.cues.push({ token, id, delta });
93
+ }
94
+
95
+ get size(): number {
96
+ return this.cues.length;
97
+ }
98
+
99
+ pending(): CueDelta[] {
100
+ return this.cues.map((c) => ({ ...c }));
101
+ }
102
+
103
+ /** Swap, as `DeltaBuffer#drain` does: what arrives during a flush survives to the next. */
104
+ drain(): CueDelta[] {
105
+ const taken = this.cues;
106
+ this.cues = [];
107
+ return taken;
108
+ }
109
+ }
@@ -297,3 +297,106 @@ function plan(
297
297
  }
298
298
  return { rows, evictions, renormalized, nodesTouched: nodes.size };
299
299
  }
300
+
301
+ // ═══════════════════════════════════════════════════════════════════════════
302
+ // CUE PAIRS (2026-10-24, R3 cue learning — an experiment)
303
+ // ═══════════════════════════════════════════════════════════════════════════
304
+ //
305
+ // The missing node in "fire together, wire together": the CUE WORD. A pair is
306
+ // (index term → memory), earned when a turn whose words held the term showed
307
+ // the memory and the session then used it. Signed: a rating of 0 depresses
308
+ // the pairs its turn made (cue-specific habituation), and a weight floors at 0.
309
+ // Bounded the way edges are — homeostasis, not a calendar: a saturating update
310
+ // per pair, synaptic scaling per token (`CUE_MAX_OUT`), and exponential fading
311
+ // with lived days (`S_CUE`), realized at the flush as edges' decay is.
312
+
313
+ /** One word-to-memory delta. `token` is an index term (`stemTerm`). Signed. */
314
+ export interface CueDelta {
315
+ readonly token: string;
316
+ readonly id: string;
317
+ readonly delta: number;
318
+ }
319
+
320
+ /** A stored pair, as the planner reads it. */
321
+ export interface CueState {
322
+ readonly token: string;
323
+ readonly id: string;
324
+ readonly weight: number;
325
+ readonly lastDay: number;
326
+ }
327
+
328
+ /** A pair's weight at a lived day: the edges' curve at `S_CUE`. */
329
+ export function cueWeightAt(e: { weight: number; lastDay: number }, day: number, t: AssociateTunables): number {
330
+ const elapsed = day - e.lastDay;
331
+ if (elapsed <= 0) return e.weight;
332
+ return e.weight * decayCurve(elapsed, t.S_CUE, t.EDGE_DECAY_SHAPE);
333
+ }
334
+
335
+ /** One pair, updated: saturating toward `CUE_W_CAP` when positive, floored at 0 when negative. */
336
+ export function cueStrengthen(current: number, delta: number, t: AssociateTunables): number {
337
+ if (delta >= 0) {
338
+ const cap = t.CUE_W_CAP > 0 ? t.CUE_W_CAP : 1;
339
+ return current + delta * Math.max(0, 1 - current / cap);
340
+ }
341
+ return Math.max(0, current + delta);
342
+ }
343
+
344
+ export interface CuePlan {
345
+ /** Absolute rows to write; a weight of 0 deletes. Every pair of a touched token is realized at `day`. */
346
+ readonly rows: readonly CueState[];
347
+ /** Tokens whose total was scaled back to `CUE_MAX_OUT`. */
348
+ readonly scaled: readonly string[];
349
+ readonly tokens: number;
350
+ }
351
+
352
+ /**
353
+ * Plan one cue flush: per token, its pairs decayed to `day`, the deltas
354
+ * applied ONE AT A TIME in arrival order (`cueStrengthen`; the buffer keeps
355
+ * them apart, so a batch trains as its uses would one by one and a pair stays
356
+ * under `CUE_W_CAP`), then synaptic scaling — a token sending out more
357
+ * than `CUE_MAX_OUT` scales all its pairs down in proportion — then anything
358
+ * at or below `CUE_FLOOR` written as 0 (deleted). A negative delta on a pair
359
+ * that does not exist creates nothing. Pure.
360
+ */
361
+ export function planCueFlush(
362
+ deltas: readonly CueDelta[],
363
+ day: number,
364
+ pairsOf: (tokens: readonly string[]) => readonly CueState[],
365
+ t: AssociateTunables,
366
+ ): CuePlan {
367
+ const touched = [...new Set(deltas.map((d) => d.token))].sort();
368
+ if (touched.length === 0) return { rows: [], scaled: [], tokens: 0 };
369
+ const byToken = new Map<string, Map<string, number>>();
370
+ const stored = new Map<string, CueState>();
371
+ for (const tok of touched) byToken.set(tok, new Map());
372
+ for (const e of pairsOf(touched)) {
373
+ const m = byToken.get(e.token);
374
+ if (m === undefined) continue;
375
+ m.set(e.id, cueWeightAt(e, day, t));
376
+ stored.set(`${e.token}\u0000${e.id}`, e);
377
+ }
378
+ for (const d of deltas) {
379
+ if (!Number.isFinite(d.delta) || d.delta === 0) continue;
380
+ const m = byToken.get(d.token) as Map<string, number>;
381
+ const current = m.get(d.id);
382
+ if (current === undefined && d.delta < 0) continue;
383
+ m.set(d.id, cueStrengthen(current ?? 0, d.delta, t));
384
+ }
385
+ const rows: CueState[] = [];
386
+ const scaled: string[] = [];
387
+ for (const tok of touched) {
388
+ const m = byToken.get(tok) as Map<string, number>;
389
+ const total = [...m.values()].reduce((s, w) => s + w, 0);
390
+ const factor = t.CUE_MAX_OUT > 0 && total > t.CUE_MAX_OUT ? t.CUE_MAX_OUT / total : 1;
391
+ if (factor < 1) scaled.push(tok);
392
+ for (const [id, w0] of [...m].sort((x, y) => (x[0] < y[0] ? -1 : 1))) {
393
+ const w = w0 * factor;
394
+ const weight = w > t.CUE_FLOOR ? w : 0;
395
+ const before = stored.get(`${tok}\u0000${id}`);
396
+ if (before === undefined && weight === 0) continue;
397
+ if (before !== undefined && before.weight === weight && before.lastDay === day) continue;
398
+ rows.push({ token: tok, id, weight, lastDay: day });
399
+ }
400
+ }
401
+ return { rows, scaled, tokens: touched.length };
402
+ }