counterparts 0.3.1 → 0.3.3

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 (205) hide show
  1. package/CHANGELOG.md +121 -1
  2. package/docs/module-map.md +2 -0
  3. package/package.json +1 -1
  4. package/src/adapters/claude-code/NOTES.md +44 -0
  5. package/src/adapters/claude-code/bin/hook.ts +100 -24
  6. package/src/adapters/claude-code/bin/runner.ts +3 -1
  7. package/src/adapters/claude-code/config.ts +30 -0
  8. package/src/adapters/claude-code/doctor.ts +59 -24
  9. package/src/adapters/claude-code/hooks.ts +185 -14
  10. package/src/adapters/claude-code/index.ts +4 -0
  11. package/src/adapters/cli/commands.ts +189 -59
  12. package/src/adapters/cli/export.ts +27 -3
  13. package/src/adapters/cli/help.ts +22 -8
  14. package/src/adapters/cli/install.ts +3 -5
  15. package/src/adapters/cli/mechanisms.ts +320 -0
  16. package/src/adapters/cli/repair-dates.ts +3 -1
  17. package/src/adapters/dashboard/CONTRACT.md +13 -9
  18. package/src/adapters/dashboard/NOTES.md +3 -2
  19. package/src/adapters/dashboard/activity.ts +2 -1
  20. package/src/adapters/dashboard/bin/dashboard.ts +18 -3
  21. package/src/adapters/dashboard/registries.ts +4 -0
  22. package/src/adapters/dashboard/upgrade.ts +23 -0
  23. package/src/adapters/dashboard/web/README.md +161 -0
  24. package/src/adapters/dashboard/web/actions.ts +631 -0
  25. package/src/adapters/dashboard/web/app.html +40 -1703
  26. package/src/adapters/dashboard/web/app.js +55 -0
  27. package/src/adapters/dashboard/web/flow.ts +2 -0
  28. package/src/adapters/dashboard/web/mechanisms/association/index.js +15 -0
  29. package/src/adapters/dashboard/web/mechanisms/association/panel.js +17 -0
  30. package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +15 -0
  31. package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +23 -0
  32. package/src/adapters/dashboard/web/mechanisms/decay/index.js +15 -0
  33. package/src/adapters/dashboard/web/mechanisms/decay/panel.js +45 -0
  34. package/src/adapters/dashboard/web/mechanisms/emotional/index.js +19 -0
  35. package/src/adapters/dashboard/web/mechanisms/episodic-semantic/index.js +15 -0
  36. package/src/adapters/dashboard/web/mechanisms/index.js +60 -0
  37. package/src/adapters/dashboard/web/mechanisms/interference/index.js +15 -0
  38. package/src/adapters/dashboard/web/mechanisms/picture.js +28 -0
  39. package/src/adapters/dashboard/web/mechanisms/prospective/index.js +18 -0
  40. package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +15 -0
  41. package/src/adapters/dashboard/web/mechanisms/reconsolidation/panel.js +15 -0
  42. package/src/adapters/dashboard/web/mechanisms/regions.js +30 -0
  43. package/src/adapters/dashboard/web/mechanisms/retrieval/index.js +15 -0
  44. package/src/adapters/dashboard/web/mechanisms/retrieval/panel.js +20 -0
  45. package/src/adapters/dashboard/web/mechanisms/salience/index.js +15 -0
  46. package/src/adapters/dashboard/web/mechanisms/salience/panel.js +14 -0
  47. package/src/adapters/dashboard/web/mechanisms/schema/index.js +15 -0
  48. package/src/adapters/dashboard/web/narrate.ts +18 -10
  49. package/src/adapters/dashboard/web/pages/flow/flow.css +38 -0
  50. package/src/adapters/dashboard/web/pages/flow/index.js +117 -0
  51. package/src/adapters/dashboard/web/pages/flow/sections/blind.js +12 -0
  52. package/src/adapters/dashboard/web/pages/flow/sections/detail.js +45 -0
  53. package/src/adapters/dashboard/web/pages/flow/sections/diagram.js +291 -0
  54. package/src/adapters/dashboard/web/pages/flow/sections/feed.js +11 -0
  55. package/src/adapters/dashboard/web/pages/flow/sections/fired.js +41 -0
  56. package/src/adapters/dashboard/web/pages/flow/sections/heatmap.js +25 -0
  57. package/src/adapters/dashboard/web/pages/flow/sections/records.js +24 -0
  58. package/src/adapters/dashboard/web/pages/flow/sections/symmetry.js +17 -0
  59. package/src/adapters/dashboard/web/pages/flow/state.js +3 -0
  60. package/src/adapters/dashboard/web/pages/health/health.css +93 -0
  61. package/src/adapters/dashboard/web/pages/health/index.js +41 -0
  62. package/src/adapters/dashboard/web/pages/health/sections/archive.js +84 -0
  63. package/src/adapters/dashboard/web/pages/health/sections/checks.js +188 -0
  64. package/src/adapters/dashboard/web/pages/health/sections/cycle.js +37 -0
  65. package/src/adapters/dashboard/web/pages/health/sections/verify.js +54 -0
  66. package/src/adapters/dashboard/web/pages/home/brain.js +375 -0
  67. package/src/adapters/dashboard/web/pages/home/home.css +134 -0
  68. package/src/adapters/dashboard/web/pages/home/index.js +84 -0
  69. package/src/adapters/dashboard/web/pages/home/sections/explorer.js +206 -0
  70. package/src/adapters/dashboard/web/pages/home/sections/hero.js +22 -0
  71. package/src/adapters/dashboard/web/pages/home/sections/live-activity.js +25 -0
  72. package/src/adapters/dashboard/web/pages/home/sections/recent-chapters.js +13 -0
  73. package/src/adapters/dashboard/web/pages/home/sections/tiles.js +52 -0
  74. package/src/adapters/dashboard/web/pages/memories/index.js +75 -0
  75. package/src/adapters/dashboard/web/pages/memories/memories.css +143 -0
  76. package/src/adapters/dashboard/web/pages/memories/sections/constellation.js +178 -0
  77. package/src/adapters/dashboard/web/pages/memories/sections/kinds.js +42 -0
  78. package/src/adapters/dashboard/web/pages/memories/sections/list.js +114 -0
  79. package/src/adapters/dashboard/web/pages/memories/sections/search.js +102 -0
  80. package/src/adapters/dashboard/web/pages/memories/sections/tools.js +155 -0
  81. package/src/adapters/dashboard/web/pages/memories/state.js +22 -0
  82. package/src/adapters/dashboard/web/pages/self/diff.js +79 -0
  83. package/src/adapters/dashboard/web/pages/self/index.js +82 -0
  84. package/src/adapters/dashboard/web/pages/self/markdown.js +61 -0
  85. package/src/adapters/dashboard/web/pages/self/sections/journal.js +88 -0
  86. package/src/adapters/dashboard/web/pages/self/sections/page.js +192 -0
  87. package/src/adapters/dashboard/web/pages/self/sections/settling.js +145 -0
  88. package/src/adapters/dashboard/web/pages/self/sections/stories.js +47 -0
  89. package/src/adapters/dashboard/web/pages/self/sections/wake.js +90 -0
  90. package/src/adapters/dashboard/web/pages/self/self.css +242 -0
  91. package/src/adapters/dashboard/web/pages/self/state.js +23 -0
  92. package/src/adapters/dashboard/web/pages/self/tips.js +50 -0
  93. package/src/adapters/dashboard/web/server.ts +305 -28
  94. package/src/adapters/dashboard/web/shared/absence.js +14 -0
  95. package/src/adapters/dashboard/web/shared/actions.js +48 -0
  96. package/src/adapters/dashboard/web/shared/api.js +17 -0
  97. package/src/adapters/dashboard/web/shared/base.css +34 -0
  98. package/src/adapters/dashboard/web/shared/canvas.js +68 -0
  99. package/src/adapters/dashboard/web/shared/colors.js +6 -0
  100. package/src/adapters/dashboard/web/shared/dom.js +4 -0
  101. package/src/adapters/dashboard/web/shared/event-modal.js +25 -0
  102. package/src/adapters/dashboard/web/shared/fonts/OFL-courier-prime.txt +93 -0
  103. package/src/adapters/dashboard/web/shared/fonts/OFL-outfit.txt +93 -0
  104. package/src/adapters/dashboard/web/shared/fonts/courier-prime-latin-400.woff2 +0 -0
  105. package/src/adapters/dashboard/web/shared/fonts/courier-prime-latin-700.woff2 +0 -0
  106. package/src/adapters/dashboard/web/shared/fonts/outfit-latin-wght.woff2 +0 -0
  107. package/src/adapters/dashboard/web/shared/format.js +31 -0
  108. package/src/adapters/dashboard/web/shared/layout.css +32 -0
  109. package/src/adapters/dashboard/web/shared/memory-modal.js +133 -0
  110. package/src/adapters/dashboard/web/shared/modal.css +24 -0
  111. package/src/adapters/dashboard/web/shared/modal.js +22 -0
  112. package/src/adapters/dashboard/web/shared/state.js +12 -0
  113. package/src/adapters/dashboard/web/shared/tip.css +4 -0
  114. package/src/adapters/dashboard/web/shared/tip.js +12 -0
  115. package/src/adapters/dashboard/web/shared/tokens.css +50 -0
  116. package/src/adapters/dashboard/web/shared/type.css +52 -0
  117. package/src/adapters/dashboard/web/shared/utilities.css +5 -0
  118. package/src/adapters/dashboard/web/shared/vendor/MIT-three.txt +21 -0
  119. package/src/adapters/dashboard/web/shared/vendor/three.module.min.js +6 -0
  120. package/src/adapters/dashboard/web/shared/widgets/bar.css +9 -0
  121. package/src/adapters/dashboard/web/shared/widgets/card.css +6 -0
  122. package/src/adapters/dashboard/web/shared/widgets/chapters.js +15 -0
  123. package/src/adapters/dashboard/web/shared/widgets/chart.css +4 -0
  124. package/src/adapters/dashboard/web/shared/widgets/confirm.css +31 -0
  125. package/src/adapters/dashboard/web/shared/widgets/confirm.js +52 -0
  126. package/src/adapters/dashboard/web/shared/widgets/feed.css +13 -0
  127. package/src/adapters/dashboard/web/shared/widgets/feed.js +41 -0
  128. package/src/adapters/dashboard/web/shared/widgets/light.css +4 -0
  129. package/src/adapters/dashboard/web/shared/widgets/light.js +15 -0
  130. package/src/adapters/dashboard/web/shared/widgets/rows.css +7 -0
  131. package/src/adapters/dashboard/web/shared/widgets/table.css +17 -0
  132. package/src/adapters/dashboard/web/shared/widgets/tiles.css +14 -0
  133. package/src/adapters/dashboard/web/shell/pages.js +15 -0
  134. package/src/adapters/dashboard/web/shell/pulse.js +86 -0
  135. package/src/adapters/dashboard/web/shell/tabs.js +49 -0
  136. package/src/adapters/dashboard/web/static.ts +76 -0
  137. package/src/adapters/dashboard/web/views/activity.ts +80 -0
  138. package/src/adapters/dashboard/web/views/archive-words.ts +57 -0
  139. package/src/adapters/dashboard/web/views/flow-view.ts +217 -0
  140. package/src/adapters/dashboard/web/views/health.ts +328 -0
  141. package/src/adapters/dashboard/web/views/mechanism-panel.ts +370 -0
  142. package/src/adapters/dashboard/web/views/mechanisms.ts +373 -0
  143. package/src/adapters/dashboard/web/views/memories.ts +342 -0
  144. package/src/adapters/dashboard/web/views/memory.ts +224 -0
  145. package/src/adapters/dashboard/web/views/meta.ts +64 -0
  146. package/src/adapters/dashboard/web/views/mind.ts +853 -0
  147. package/src/adapters/dashboard/web/views/overview.ts +282 -0
  148. package/src/adapters/dashboard/web/views/pulse.ts +19 -0
  149. package/src/adapters/dashboard/web/views/rows.ts +207 -0
  150. package/src/adapters/dashboard/web/views/search.ts +62 -0
  151. package/src/adapters/dashboard/web/views/shared.ts +161 -0
  152. package/src/adapters/dashboard/web/views.ts +34 -1724
  153. package/src/adapters/feelings-line.ts +74 -0
  154. package/src/adapters/fired.ts +106 -35
  155. package/src/adapters/mcp/CONTRACT.md +8 -0
  156. package/src/adapters/mcp/NOTES.md +88 -0
  157. package/src/adapters/mcp/bin/serve.ts +5 -1
  158. package/src/adapters/mcp/index.ts +3 -0
  159. package/src/adapters/mcp/server.ts +322 -6
  160. package/src/adapters/mcp/tools.ts +89 -0
  161. package/src/adapters/mcp/write-up.ts +1 -1
  162. package/src/core/bridge.ts +21 -16
  163. package/src/core/counterpart.ts +337 -5
  164. package/src/core/encode/CONTRACT.md +7 -1
  165. package/src/core/feelings-wheel.ts +376 -0
  166. package/src/core/mint.ts +23 -2
  167. package/src/core/physics/CONTRACT.md +43 -0
  168. package/src/core/physics/NOTES.md +94 -0
  169. package/src/core/physics/index.ts +98 -6
  170. package/src/core/prospective/CONTRACT.md +35 -6
  171. package/src/core/prospective/INTERFACE-GAPS.md +16 -1
  172. package/src/core/prospective/NOTES.md +175 -4
  173. package/src/core/prospective/derive.ts +32 -3
  174. package/src/core/prospective/index.ts +362 -39
  175. package/src/core/prospective/tunables.ts +18 -1
  176. package/src/core/prospective/windows.ts +110 -90
  177. package/src/core/recall/CONTRACT.md +28 -0
  178. package/src/core/recall/NOTES.md +39 -0
  179. package/src/core/recall/activate.ts +32 -5
  180. package/src/core/recall/gate.ts +7 -1
  181. package/src/core/recall/index.ts +19 -0
  182. package/src/core/recall/mood.ts +106 -0
  183. package/src/core/recall/tunables.ts +26 -0
  184. package/src/core/remember/index.ts +1 -0
  185. package/src/core/remember/proposals.ts +86 -3
  186. package/src/core/self/NOTES.md +17 -0
  187. package/src/core/self/calendar.ts +7 -78
  188. package/src/core/self/episodes.ts +7 -8
  189. package/src/core/self/identity.ts +20 -1
  190. package/src/core/self/index.ts +32 -11
  191. package/src/core/self/writer.ts +22 -22
  192. package/src/core/sleep/cycle.ts +8 -2
  193. package/src/core/store/CONTRACT.md +33 -7
  194. package/src/core/store/NOTES.md +162 -0
  195. package/src/core/store/errors.ts +15 -0
  196. package/src/core/store/feelings.ts +199 -0
  197. package/src/core/store/index.ts +397 -48
  198. package/src/core/store/operational.ts +148 -12
  199. package/src/core/store/owner-op-seam.ts +13 -3
  200. package/src/core/store/pre-migration.ts +3 -1
  201. package/src/core/store/prose.ts +8 -1
  202. package/src/core/store/render.ts +3 -0
  203. package/src/core/time.ts +374 -0
  204. package/src/core/types.ts +22 -0
  205. package/src/adapters/dashboard/web/brain.html +0 -463
package/CHANGELOG.md CHANGED
@@ -1,6 +1,126 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.1 — unreleased
3
+ ## 0.3.3 — 2026-09-26
4
+
5
+ Reminders with dates, and feelings start to matter. The store's format is unchanged (still
6
+ v7), so there is no upgrade step; close every Claude Code session before installing, and
7
+ run `/mcp` → Reconnect in any you missed.
8
+
9
+ Reminders work.
10
+
11
+ - **A memory can carry a date, and it comes back around then.** `note` and each
12
+ `session_end` memory take an optional `eventDate`: a day `2026-10-15`, a month
13
+ `2026-10`, or a range `2026-10-20..2026-10-31` (how to say "late October"). Claude writes
14
+ the date itself; nothing is read out of the text, and a date that cannot be read is
15
+ refused with the shapes that can. A year alone is kept but never comes back on its own.
16
+ - **Plain or quiet.** Beside the date, `remind: "plain"` for something that really has to
17
+ happen — a deadline, an important day, or anything you say not to forget. On its day
18
+ you see it in the terminal (`Today: pay your taxes`) and Claude has it in context, once;
19
+ a month or a range is said on its first day and again on its last. Everything else is
20
+ quiet, the default: it can come back as a footnote around the date, at most twice.
21
+ Giving a memory a date is what makes it eligible, however ordinary the memory; one that
22
+ has faded away or been archived still never comes back.
23
+ - **A plain line is spent only when you can see it.** If the morning's wake is too full
24
+ for the terminal line, it waits for your first prompt instead of being used up unseen,
25
+ and the update notice never pushes it out.
26
+ - **A quiet reminder is not repeated every turn.** A footnote that came back spends one of
27
+ its two mentions, at most one a day. Month and range dates spread their warmth over the
28
+ first week instead of all landing on the 1st, keep their second mention for after the
29
+ dates pass, and never take one of the wake's two "Arriving" lines — those are for
30
+ day-dated things, and a tie goes to the one happening sooner.
31
+ - **The gauge shows it.** `counterparts mechanisms` and the dashboard's Prospective light
32
+ count dated memories held and reminders that came back this week, plain and quiet apart
33
+ (the dashboard adds today's). Grey only when nothing is dated.
34
+ - **Revising a dated memory keeps its date.** A revision (`updates:`) that leaves the date
35
+ or `remind` out carries them over, and the older memory stops coming back, so one
36
+ reminder is never said twice; `eventDate: null` drops the date. The reminder is found
37
+ where it moved even when a later revision names the older memory, and what was already
38
+ said or used for the same window still counts after the move.
39
+ - **A date that has already passed is kept, and the reply says it won't come back**, so a
40
+ wrong year can be caught when it is written.
41
+
42
+ **Feelings start to matter.** No change to the store's format.
43
+
44
+ - **A memory's strongest feeling holds it higher and makes it fade more slowly** — yours or
45
+ Claude's, or its emotional score if that is stronger. This changes how existing memories
46
+ fade too: the ones that carry feeling now last longer (a strongly felt note about 1.7
47
+ times as long before it is let go). The first nightly cleanup after upgrading may move a
48
+ few felt memories up a band. Feeling does not count toward becoming core: what it takes
49
+ to reach identity is unchanged.
50
+ - **A recorded feeling softens faster than the memory it sits on.** The feeling is kept as
51
+ it was recorded; the softened strength is what recall and the displays read.
52
+ - **Mood-matching.** When a feeling was recorded in the last few hours, memories that
53
+ carried the same feeling for the same person come to mind more easily, and the other
54
+ person's matching feelings help a little. It only helps a memory the conversation
55
+ already reached — it never brings up one on its own.
56
+ - **An emotional score given on its own is no longer ignored by the memory gate.**
57
+ - **More words on the feelings wheel**, from real use: grateful, curious, tender,
58
+ sheepish, relieved, moved, wistful, bittersweet, fond and intrigued (marked as
59
+ additions, not the poster's), and "exposed" reads as vulnerable. Blends count under
60
+ both their feelings (tender: sad and happy). A word that is not on the wheel is kept as
61
+ your own, and the reply suggests a wheel word only for a near misspelling — "tender" is
62
+ no longer offered "despair".
63
+ - **Showing it.** The dashboard's memory view and `counterparts ask --full` / `--id` show a
64
+ memory's feelings as `you: … · me: …`. The Emotion light on the dashboard and in
65
+ `counterparts mechanisms` now counts memories carrying feeling and turns where a mood
66
+ brought memories closer.
67
+
68
+ **The dashboard's Self tab, round 2.** Lighter: one line on top, with the explanations
69
+ behind a small `?`. Beside the page, a side column says when it was last rewritten, what
70
+ the page writer did on its last night, the version dots and how much of the wake it
71
+ takes. A version's changes open on a click, settling is one compact chart, the journal is
72
+ a strip of days, and the tab refreshes itself while it is open. The Health row says how
73
+ many days since the page was rewritten.
74
+
75
+ ## 0.3.2 — 2026-09-25
76
+
77
+ Dates and times follow your clock, and the store's format moves to v7.
78
+
79
+ **Before upgrading, close every Claude Code session.** The first session after the upgrade
80
+ saves a copy of the store and then updates its format; a session left open is still
81
+ running the old memory server, so in any you missed, run `/mcp` and choose Reconnect.
82
+ If your store is not in the default place (a `dataDir` outside `~/.counterparts/store`,
83
+ or `COUNTERPARTS_DATA_DIR`), set `snapshots.dir` in the config first: the upgrade will
84
+ not run without somewhere to save that copy, and memory stays off until it is set
85
+ (`doctor` says so).
86
+
87
+ - **Your day is your local day.** The day a memory was learned, "today", and the dates
88
+ in `doctor` and `counterparts fired` now use this computer's time zone instead of UTC,
89
+ so a memory saved at 11:50 pm belongs to that evening. Console commands read the zone
90
+ from the config beside the store, as the hooks do. Memories saved before keep the
91
+ dates they have. A `timeZone` setting in the config (for example `"America/Denver"`)
92
+ pins a zone, for a machine set to UTC; install says which zone it found.
93
+ - **Sessions know what time it is.** The wake opens with a line like
94
+ `Now: Fri 25 Sep 2026, 1:40 pm MDT`, and every turn carries the current time too.
95
+ - **Each memory records when it was written and changed, and which model wrote it.**
96
+ Notes, end-of-session memories, journal chapters and the self page carry the model the
97
+ session was using.
98
+ - **Feelings can be recorded on a memory** — several per memory, yours and Claude's side
99
+ by side, each named on a feelings wheel (six core emotions and the finer words under
100
+ them) with a strength and what carried it. `note` and `session_end` take them; a word
101
+ not on the wheel is kept, and the reply suggests the nearest ones. They change nothing
102
+ about how memories are held yet.
103
+ - **The store can hold a reminder's date** — a day, a month, or a range like
104
+ `2026-10-20..2026-10-31` — ready for reminders to use in a later release.
105
+ - One module now does every date conversion, and a test keeps it that way.
106
+
107
+ **A new dashboard** (`counterparts dashboard`):
108
+
109
+ - **A new home page**: the brain beside a few plain counts, and the 11 mechanisms the
110
+ site describes, each lit when it is working. Click one to see what it did lately.
111
+ - **Memories**: every memory in a list, newest first, with search, Ask, and filters for
112
+ kind, band and archived.
113
+ - **Self**: the self page with its history, what is settling into the core, the
114
+ briefing for the next session, and the journal by day.
115
+ - **Health**: "is it working?" as a checklist from `doctor`, the last sleep cycle, and
116
+ where archived memories went.
117
+ - **Manage memory from the dashboard**: write a note, remove a memory, back up, export,
118
+ rebrief, check the index, and ask, through the same code as the console. Removing
119
+ asks you to confirm first.
120
+ - The site's fonts, served from the package.
121
+ - A store waiting for its upgrade shows a short page saying so, instead of an error.
122
+
123
+ ## 0.3.1 — 2026-09-25
4
124
 
5
125
  A small release of fixes. No change to the store's format, so no migration and no
6
126
  Reconnect.
@@ -23,6 +23,8 @@ code and the `NOTES.md` / `INTERFACE-GAPS.md` next to it.*
23
23
  | `prospective/` | prospective memory | Future intentions, cued by time or context; fire / suppress / reference telemetry. |
24
24
  | `handoff/` | working context for a place | The per-directory handoff: where the work here stands, written as a field on the end-of-session ask, shown as a two-line pointer at the next wake in that directory, expiring in lived days. **Never a memory** — out of recall, out of credit, out of consolidation, out of identity. **Added 2026-09-20 (E1, spec §6.4 / §15 item 6).** |
25
25
  | `sleep/` | systems consolidation | Pure math on a cycle: decay tick (active-day clock), floor-pruning (real forgetting), re-render of the wake briefing. Zero standing model calls. |
26
+ | *(`time.ts`)* | — (a clock, not a memory) | The one module that converts: a moment (UTC ms from `store.now()`) to a person's local date or clock line, "today" in a zone, and calendar dates as said (day, month, year, range). A file, not a module; a test keeps hand-built dates out of `src/`. **Added 2026-09-25 (`docs/time.md`).** |
27
+ | *(`feelings-wheel.ts`)* | — (a vocabulary) | The feelings wheel as a typed list: six cores, the middle and outer rings, valence, and the key scheme (`<core>.<word>` only for a word printed under two cores). Read by `store/` to validate the `feelings` table. **Added 2026-09-25.** |
26
28
  | *(observer)* | — (instrument stance) | **RESOLVED (owner, 2026-08-25): a MODE, not a module** — one predicate threaded through the core API, checked at the store seam. Spec moved to `docs/observer-mode.md`. |
27
29
 
28
30
  **Third open question (check-in): the `remember`/`encode` boundary.** With the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
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": {
@@ -1561,3 +1561,47 @@ What the build settled, beyond the CONTRACT section:
1561
1561
  are the item's; anything else keeps the paid-shaped rules (limit 64, blame only an
1562
1562
  item the embedder named). Core's `no-credential` / `no-credentials` reasons are left in
1563
1563
  its vocabulary, because rows already written carry them.
1564
+
1565
+ ## 2026-09-25 — the person's clock (docs/time.md)
1566
+
1567
+ - **`timeZone` in the config** (optional, an IANA name) is read leniently: a name this
1568
+ machine does not know is ignored, kept as `timeZoneUnknown`, and named on doctor's Clock
1569
+ line — a misspelt zone must not stand memory down the way an unreadable setting does.
1570
+ It reaches the store through `Counterpart.open({ timeZone })` in `openAdapter`, the
1571
+ runner, and the MCP entry point.
1572
+ - **The hook's `at` is the person's day** (`bin/hook.ts#toHookInput`, `todayIn(zone)`),
1573
+ so the rows it dates, the wake preface's date, prospective's "today" and the date the
1574
+ boundary hands the lived clock are local. The evening-of-the-upgrade case (a local date
1575
+ one day behind the last UTC one) is store NOTES 2026-09-25: refused, named, the day
1576
+ holds.
1577
+ - **The wake's first line is `Now: Fri 25 Sep 2026, 1:40 pm MDT`**, and a turn that
1578
+ recalls something carries the same line above its note. Both sit OUTSIDE the block they
1579
+ precede, so the wake's byte count, its two sentinels and the preface reserve are
1580
+ untouched, and the delivery check (which finds sentinels by prefix) reads as before.
1581
+ The line's bytes are counted wherever the host's ceiling is: `sent`, not `woke.bytes`,
1582
+ decides the over-budget event and the room an ask may take. `bytes` in the result is
1583
+ still the wake's own count. **Every turn** prints the line — alone when recall surfaced
1584
+ nothing, and on an empty prompt (owner, 2026-09-25: ~40 bytes a turn is fine). A
1585
+ primacy stand-down still prints nothing: a muted session is muted.
1586
+ - **Doctor**: the header lost its "(UTC)"; the Clock line names the zone in use
1587
+ (`today 2026-09-25 (America/Denver)`). `rowDate`'s fallback, the oldest-event and
1588
+ database-birth days, and the page's staleness read that zone.
1589
+ - **Install** says the zone in one line after the name question and asks nothing:
1590
+ "Times read in America/Denver, this computer's zone — "timeZone" in the config pins
1591
+ another."
1592
+
1593
+ - **Review of #231, S1 (2026-09-25):** the evening of the upgrade no longer turns doctor
1594
+ RED. The store holds a one-day-back date as the same lived day, and the migration
1595
+ clamps `lastActiveDate`; details are in store NOTES.
1596
+
1597
+ ## 2026-09-26 — plain reminders are claimed only once the envelope carries them (PR #243 review)
1598
+
1599
+ Plain reminder lines ("Today: pay your taxes") now go FIRST among the terminal notices,
1600
+ ahead of the doctor's red line, and are claimed only after `bin/hook.ts#deliverTurn` has
1601
+ probed the envelope and found room for them — the update notice's "mark only what is
1602
+ certainly leaving". The priority order above still holds for the notices that follow them.
1603
+ The reason for going first: the doctor's line returns at the next start, while a plain
1604
+ beat is spent once. A full wake (the ~9 KB case above) therefore defers the plain lines —
1605
+ unclaimed, and stripped from the model's copy too (`hooks.ts#withoutPlain`) — to the first
1606
+ prompt, whose envelope is small. When a plain line and the update notice do not fit
1607
+ together at a prompt, the update notice waits. Details: `docs/adversarial-review-pr243-2026-09-26.md`.
@@ -34,11 +34,13 @@ import {
34
34
  stanceOfMode,
35
35
  } from "../../scopes.js";
36
36
  import type { ScopeRead, ScopeVerdict } from "../../scopes.js";
37
- import { canonicalScope, readSession } from "../../sessions.js";
37
+ import { PAGE_WRITER_ENV, canonicalScope, readSession } from "../../sessions.js";
38
+ import { resolveZone, todayIn } from "../../../core/time.js";
38
39
  import { loadConfig, withEmbedderDefault } from "../config.js";
39
40
  import type { AdapterConfig } from "../config.js";
40
41
  import { HOOKS, openAdapter } from "../index.js";
41
- import { STOP_HUMAN_LINE } from "../hooks.js";
42
+ import { STOP_HUMAN_LINE, plainLine, withoutPlain } from "../hooks.js";
43
+ import type { PlainReminder } from "../../../core/counterpart.js";
42
44
  import type { HookInput, HookName } from "../hooks.js";
43
45
  import {
44
46
  CONFIG_REFUSED,
@@ -363,6 +365,8 @@ export function toHookInput(
363
365
  readonly scope?: string;
364
366
  readonly dataDir?: string;
365
367
  readonly env?: NodeJS.ProcessEnv;
368
+ /** The config's `timeZone`; absent, the machine's current zone. */
369
+ readonly timeZone?: string;
366
370
  } = {},
367
371
  ): HookInput {
368
372
  const scope = opts.scope ?? sessionScope(opts.dataDir, payload, opts.env ?? process.env);
@@ -390,7 +394,17 @@ export function toHookInput(
390
394
  // nothing (`hooks.ts#askAtStop`).
391
395
  ...(payload["stop_hook_active"] === true ? { reFired: true } : {}),
392
396
  ...(typeof payload["prompt"] === "string" ? { prompt: payload["prompt"] } : {}),
393
- at: new Date().toISOString().slice(0, 10),
397
+ // The host-mode page writer's headless child (`page-writer.ts` sets this):
398
+ // no one reads its terminal, so it must not spend a plain reminder's beat.
399
+ ...(((opts.env ?? process.env)[PAGE_WRITER_ENV] ?? "").trim().length > 0 ? { pageWriter: true } : {}),
400
+ // THE PERSON'S DAY (docs/time.md, 2026-09-25; UTC before). It dates the
401
+ // hook's rows, the wake preface, the prospective "today" and the date the
402
+ // boundary hands the lived clock — which is why the lived clock can see a
403
+ // date one day BEHIND its last on the evening of an upgrade west of UTC,
404
+ // or after flying west: the store refuses it (`CLOCK_BACKWARDS`), the
405
+ // cycle stays on the day it already believed, and the next local date
406
+ // moves it on (store NOTES 2026-09-25).
407
+ at: todayIn(resolveZone(opts.timeZone)),
394
408
  };
395
409
  }
396
410
 
@@ -707,7 +721,10 @@ async function runHook(
707
721
  // that twice on the hot path. The scope is handed IN rather than resolved
708
722
  // again: it was decided above, the registry verdict was taken on it, and two
709
723
  // resolutions of one value is the shape scar §2.13 is about.
710
- const input = toHookInput(payload, { scope });
724
+ const input = toHookInput(payload, {
725
+ scope,
726
+ ...(loaded.timeZone === undefined ? {} : { timeZone: loaded.timeZone }),
727
+ });
711
728
  const result = adapter.hook(name, input);
712
729
  // THE WORK HAPPENED. Recall was composed, the turn was captured, the session
713
730
  // record was written — whatever this event's job was, `adapter.hook` has
@@ -726,6 +743,11 @@ async function runHook(
726
743
  // AND THE UPDATE NOTICE AT A PROMPT (roadmap E, 2026-09-23), fail-open
727
744
  // (`deliverTurn`): once per session, when the MCP server this session talks
728
745
  // to runs an older build than this installed one.
746
+ //
747
+ // AND PLAIN REMINDERS (2026-09-26), at both events, FIRST — `deliverTurn`
748
+ // adds them from `result.plain` and claims them only once the envelope is
749
+ // known to carry them (2026-09-26 review): a plain beat is spent once and
750
+ // never comes back, while the doctor's line returns at the next start.
729
751
  const delivery = deliverTurn(
730
752
  name,
731
753
  result,
@@ -770,38 +792,92 @@ async function runHook(
770
792
  export interface UpdateNoticeDoors {
771
793
  updateNotice(input: HookInput): string | null;
772
794
  markUpdateNotice(input: HookInput): boolean;
795
+ /**
796
+ * Claim plain reminders this delivery is certainly about to show, returning
797
+ * the ones claimed (`ClaudeCodeAdapter#claimPlain`). Absent: nothing can be
798
+ * claimed, so nothing is shown and every one waits for a later turn.
799
+ */
800
+ claimPlain?(input: HookInput, due: readonly PlainReminder[]): readonly PlainReminder[];
773
801
  }
774
802
 
775
803
  /**
776
- * THIS EVENT'S OUTPUT, WITH THE UPDATE NOTICE FOLDED IN FAIL-OPEN (roadmap E;
777
- * #187 re-review, N4).
804
+ * THIS EVENT'S OUTPUT, WITH PLAIN REMINDERS AND THE UPDATE NOTICE FOLDED IN
805
+ * FAIL-OPEN (roadmap E; #187 re-review, N4; 2026-09-26 review).
806
+ *
807
+ * PLAIN REMINDERS FIRST, and under the update notice's own rule — MARK ONLY
808
+ * WHAT IS CERTAINLY LEAVING. A plain beat is spent once and never comes back,
809
+ * so it is claimed only after the envelope is known to carry its line to the
810
+ * terminal, and it goes ahead of every other notice (the doctor's red line
811
+ * returns at the next start; the beat would not). A turn with no room — a full
812
+ * wake at SessionStart — claims nothing and strips the lines from the model's
813
+ * context too (`withoutPlain`), so the first prompt, whose envelope is small,
814
+ * says them instead. A line whose claim is lost to another process is stripped
815
+ * the same way.
778
816
  *
779
- * The plain delivery is computed first and is the answer whenever anything
780
- * about the notice goes wrong: a door that throws, a mark that will not land.
781
- * The notice is MARKED only once it is certainly leaving — after the envelope
782
- * is known to carry it — and SHOWN only if the mark landed, so it never repeats
783
- * and is never marked-but-lost; a turn whose recall leaves no room drops it,
784
- * marks nothing, and tries again next turn. Every event but
785
- * `user-prompt-submit` is exactly `hostDelivery`.
817
+ * Then the update notice: the delivery without it is the answer whenever
818
+ * anything about it goes wrong — a door that throws, a mark that will not
819
+ * land, an envelope with no room for it — so it can never cost a line that
820
+ * already fit. It is MARKED only once it is certainly leaving and SHOWN only if
821
+ * the mark landed, so it never repeats and is never marked-but-lost; a turn
822
+ * whose recall leaves no room marks nothing and tries again next turn.
786
823
  */
787
824
  export function deliverTurn(
788
825
  name: HookName,
789
- result: { injection: string | null; ask: string | null },
826
+ result: {
827
+ injection: string | null;
828
+ ask: string | null;
829
+ notices?: readonly string[];
830
+ plain?: readonly PlainReminder[];
831
+ },
790
832
  payload: Record<string, unknown>,
791
- sessionStartNotices: readonly (string | null)[] | null,
833
+ /** SessionStart's priority-ordered notices (after any plain reminders), or
834
+ * null. At a prompt, null: the plain lines come from `result.plain`. */
835
+ notices: readonly (string | null)[] | null,
792
836
  doors: UpdateNoticeDoors,
793
837
  input: HookInput,
794
838
  ): Delivery {
795
- const plain = hostDelivery(name, result, payload, sessionStartNotices);
796
- if (name !== "user-prompt-submit") return plain;
839
+ let r = result;
840
+ let ordered = notices;
841
+ let deferred: Delivery["dropped"] = null;
842
+ const due = result.plain ?? [];
843
+ if (due.length > 0) {
844
+ // The longest run, in order, whose lines the envelope carries: a day with
845
+ // more plain items than room says what fits and keeps the rest for later.
846
+ let fits = 0;
847
+ for (let k = due.length; k > 0; k--) {
848
+ const probe = hostDelivery(name, r, payload, [due.slice(0, k).map(plainLine).join("\n")]);
849
+ if (probe.dropped === null) {
850
+ fits = k;
851
+ break;
852
+ }
853
+ if (k === due.length) deferred = probe.dropped;
854
+ }
855
+ let claimed: readonly PlainReminder[] = [];
856
+ if (fits > 0) {
857
+ try {
858
+ claimed = doors.claimPlain?.(input, due.slice(0, fits)) ?? [];
859
+ } catch {
860
+ claimed = [];
861
+ }
862
+ }
863
+ // By the beat's identity, not the object's: a door may hand back copies.
864
+ const beat = (x: PlainReminder): string => `${x.memoryId} ${x.windowKey} ${x.beat}`;
865
+ const kept = new Set(claimed.map(beat));
866
+ const shownPlain = due.filter((d) => kept.has(beat(d)));
867
+ r = withoutPlain(r, due.filter((d) => !kept.has(beat(d))));
868
+ if (shownPlain.length > 0) ordered = [shownPlain.map(plainLine).join("\n"), ...(notices ?? [])];
869
+ }
870
+ const shown = hostDelivery(name, r, payload, ordered);
871
+ const base = shown.dropped === null && deferred !== null ? { ...shown, dropped: deferred } : shown;
872
+ if (name !== "user-prompt-submit") return base;
797
873
  try {
798
874
  const update = doors.updateNotice(input);
799
- if (update === null) return plain;
800
- const carried = hostDelivery(name, result, payload, update);
801
- if (carried.dropped !== null) return carried;
802
- return doors.markUpdateNotice(input) ? carried : plain;
875
+ if (update === null) return base;
876
+ const carried = hostDelivery(name, r, payload, [...(ordered ?? []), update]);
877
+ if (carried.dropped !== null) return { ...base, dropped: base.dropped ?? carried.dropped };
878
+ return doors.markUpdateNotice(input) ? carried : base;
803
879
  } catch {
804
- return plain;
880
+ return base;
805
881
  }
806
882
  }
807
883
 
@@ -877,7 +953,7 @@ export function hostDelivery(
877
953
  * each is added only while the envelope still fits, so a lower line can never
878
954
  * cost a higher one its place. At a prompt the lines are ALL OR NOTHING —
879
955
  * joined into one `systemMessage`, or all dropped — which is what lets
880
- * `deliverTurn` mark only an envelope that carried them; today there is one.
956
+ * `deliverTurn` mark only an envelope that carried them; since 2026-09-26 that is plain reminders and the update notice.
881
957
  */
882
958
  notice: string | null | readonly (string | null)[] = null,
883
959
  ): Delivery {
@@ -922,7 +998,7 @@ export function hostDelivery(
922
998
  // no notice prints what it always has — plain text, or nothing. More than
923
999
  // one line would be JOINED into the one `systemMessage` an object carries,
924
1000
  // never one replacing another, and dropped all together or not at all —
925
- // not SessionStart's priority order; today the update notice is the only one.
1001
+ // not SessionStart's priority order; since 2026-09-26 the plain reminders and the update notice (`deliverTurn` tries the two together and falls back to the first alone).
926
1002
  if (name === "user-prompt-submit" && notices.length > 0) {
927
1003
  const message = notices.join("\n");
928
1004
  const envelope = JSON.stringify({
@@ -332,12 +332,14 @@ export async function runOnce(input: {
332
332
  ? {}
333
333
  : { budgetBytes: config.injectionBudgetBytes }),
334
334
  ...(config.owner === undefined ? {} : { owner: config.owner }),
335
+ ...(config.timeZone === undefined ? {} : { timeZone: config.timeZone }),
335
336
  onEvent: (e) => emit(e.name, { ...(e.data ?? {}) }),
336
337
  });
337
338
  // ONE DATE FOR THE WHOLE RUN, resolved before the first step that could
338
339
  // record anything. The `sweep.gate` row carries it; so must every failure row,
339
340
  // or a replay with a pinned date would dedup against the wall clock instead.
340
- const today = input.date ?? new Date().toISOString().slice(0, 10);
341
+ // The person's day, in the store's zone (docs/time.md; UTC before 2026-09-25).
342
+ const today = input.date ?? counterpart.store.today();
341
343
 
342
344
  let lag: LagReport | null = null;
343
345
  let backfill: BackfillReport | null = null;
@@ -25,6 +25,8 @@
25
25
  */
26
26
  import { isAbsolute } from "node:path";
27
27
 
28
+ import { isZone } from "../../core/time.js";
29
+
28
30
  import { PAGE_WRITER_MODES } from "../../core/self/index.js";
29
31
  import type { PageWriterMode } from "../../core/self/index.js";
30
32
  import { DEFAULT_KEEP as SNAPSHOT_DEFAULT_KEEP } from "../snapshots.js";
@@ -78,6 +80,13 @@ export const TUNABLES = {
78
80
  * own — and nothing here is at the Stop, where §13 G3's one pacer lives.
79
81
  */
80
82
  WRITE_UP_ASKS_PER_DAY: 2,
83
+ /**
84
+ * A plain reminder's handle — the memory's title or first line — is clipped
85
+ * to this many characters in the line a person reads (2026-09-26). One
86
+ * glance's worth: a longer title is a paragraph, and the memory's id rides
87
+ * beside it in the model's copy.
88
+ */
89
+ PLAIN_WHAT_MAX_CHARS: 120,
81
90
  /**
82
91
  * The host's cap on a hook's whole output, in characters. The host's own
83
92
  * words: "Hook output strings, including `additionalContext`, `systemMessage`,
@@ -225,6 +234,19 @@ export interface AdapterConfig {
225
234
  readonly retired?: readonly string[];
226
235
  /** Is this the owner's own session? Withholding is the safe direction. */
227
236
  readonly owner?: boolean;
237
+ /**
238
+ * THE PERSON'S ZONE, an IANA name (`"America/Denver"`), when it should not
239
+ * follow the computer — a server set to UTC (docs/time.md rule 2). Absent,
240
+ * every local date follows the machine's current zone. Optional, and not
241
+ * asked at install: install prints the zone it detected in one line.
242
+ */
243
+ readonly timeZone?: string;
244
+ /**
245
+ * A `timeZone` this machine does not know, as written. It is IGNORED — the
246
+ * machine's zone is used — and doctor names it; a misspelt zone must not
247
+ * stand anybody's memory down the way an unreadable setting does.
248
+ */
249
+ readonly timeZoneUnknown?: string;
228
250
  /** An instrument stands down. Fail direction: an unreadable config lands here. */
229
251
  readonly observer?: boolean;
230
252
  /** The identity core's name is the OWNER's; there is no default. */
@@ -270,6 +292,8 @@ export function loadConfig(raw: unknown): LoadedConfig {
270
292
  pageWriter?: { mode: PageWriterMode; timeoutMs?: number; ignored?: string[] };
271
293
  retired?: string[];
272
294
  owner?: boolean;
295
+ timeZone?: string;
296
+ timeZoneUnknown?: string;
273
297
  observer?: boolean;
274
298
  identity?: { name: string; aliases?: readonly string[] };
275
299
  } = {};
@@ -332,6 +356,12 @@ export function loadConfig(raw: unknown): LoadedConfig {
332
356
  if (typeof rec["observer"] !== "boolean") unreadable = true;
333
357
  else out.observer = rec["observer"];
334
358
  }
359
+ // Read LENIENTLY, unlike the stance keys above: a zone that is not one is
360
+ // ignored and named, never a reason to stand the configuration down.
361
+ if (rec["timeZone"] !== undefined) {
362
+ if (isZone(rec["timeZone"])) out.timeZone = rec["timeZone"];
363
+ else out.timeZoneUnknown = String(rec["timeZone"]).slice(0, 64);
364
+ }
335
365
  const embedder = rec["embedder"];
336
366
  if (embedder !== undefined) {
337
367
  // The egress knob is read STRICTLY. A misspelled or half-written `embedder`