counterparts 0.3.0 → 0.3.2

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 (207) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/docs/module-map.md +2 -0
  3. package/package.json +2 -1
  4. package/src/adapters/claude-code/CONTRACT.md +2 -1
  5. package/src/adapters/claude-code/NOTES.md +90 -2
  6. package/src/adapters/claude-code/bin/hook.ts +17 -2
  7. package/src/adapters/claude-code/bin/runner.ts +4 -1
  8. package/src/adapters/claude-code/config.ts +23 -0
  9. package/src/adapters/claude-code/doctor.ts +148 -26
  10. package/src/adapters/claude-code/hooks.ts +37 -12
  11. package/src/adapters/claude-code/index.ts +2 -0
  12. package/src/adapters/claude-code/standdown.ts +12 -1
  13. package/src/adapters/claude-code/transcript.ts +79 -6
  14. package/src/adapters/cli/INTERFACE-GAPS.md +4 -0
  15. package/src/adapters/cli/commands.ts +209 -61
  16. package/src/adapters/cli/export.ts +27 -3
  17. package/src/adapters/cli/help.ts +22 -8
  18. package/src/adapters/cli/install.ts +3 -5
  19. package/src/adapters/cli/mechanisms.ts +295 -0
  20. package/src/adapters/cli/repair-dates.ts +3 -1
  21. package/src/adapters/cli/snapshot.ts +4 -27
  22. package/src/adapters/dashboard/CONTRACT.md +13 -9
  23. package/src/adapters/dashboard/INTERFACE-GAPS.md +4 -0
  24. package/src/adapters/dashboard/NOTES.md +3 -2
  25. package/src/adapters/dashboard/activity.ts +2 -1
  26. package/src/adapters/dashboard/bin/dashboard.ts +18 -3
  27. package/src/adapters/dashboard/upgrade.ts +23 -0
  28. package/src/adapters/dashboard/web/README.md +153 -0
  29. package/src/adapters/dashboard/web/actions.ts +631 -0
  30. package/src/adapters/dashboard/web/app.html +40 -1703
  31. package/src/adapters/dashboard/web/app.js +55 -0
  32. package/src/adapters/dashboard/web/mechanisms/association/index.js +15 -0
  33. package/src/adapters/dashboard/web/mechanisms/association/panel.js +17 -0
  34. package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +15 -0
  35. package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +23 -0
  36. package/src/adapters/dashboard/web/mechanisms/decay/index.js +15 -0
  37. package/src/adapters/dashboard/web/mechanisms/decay/panel.js +45 -0
  38. package/src/adapters/dashboard/web/mechanisms/emotional/index.js +15 -0
  39. package/src/adapters/dashboard/web/mechanisms/episodic-semantic/index.js +15 -0
  40. package/src/adapters/dashboard/web/mechanisms/index.js +60 -0
  41. package/src/adapters/dashboard/web/mechanisms/interference/index.js +15 -0
  42. package/src/adapters/dashboard/web/mechanisms/picture.js +28 -0
  43. package/src/adapters/dashboard/web/mechanisms/prospective/index.js +15 -0
  44. package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +15 -0
  45. package/src/adapters/dashboard/web/mechanisms/reconsolidation/panel.js +15 -0
  46. package/src/adapters/dashboard/web/mechanisms/regions.js +30 -0
  47. package/src/adapters/dashboard/web/mechanisms/retrieval/index.js +15 -0
  48. package/src/adapters/dashboard/web/mechanisms/retrieval/panel.js +20 -0
  49. package/src/adapters/dashboard/web/mechanisms/salience/index.js +15 -0
  50. package/src/adapters/dashboard/web/mechanisms/salience/panel.js +14 -0
  51. package/src/adapters/dashboard/web/mechanisms/schema/index.js +15 -0
  52. package/src/adapters/dashboard/web/narrate.ts +10 -10
  53. package/src/adapters/dashboard/web/pages/flow/flow.css +38 -0
  54. package/src/adapters/dashboard/web/pages/flow/index.js +117 -0
  55. package/src/adapters/dashboard/web/pages/flow/sections/blind.js +12 -0
  56. package/src/adapters/dashboard/web/pages/flow/sections/detail.js +45 -0
  57. package/src/adapters/dashboard/web/pages/flow/sections/diagram.js +291 -0
  58. package/src/adapters/dashboard/web/pages/flow/sections/feed.js +11 -0
  59. package/src/adapters/dashboard/web/pages/flow/sections/fired.js +41 -0
  60. package/src/adapters/dashboard/web/pages/flow/sections/heatmap.js +25 -0
  61. package/src/adapters/dashboard/web/pages/flow/sections/records.js +24 -0
  62. package/src/adapters/dashboard/web/pages/flow/sections/symmetry.js +17 -0
  63. package/src/adapters/dashboard/web/pages/flow/state.js +3 -0
  64. package/src/adapters/dashboard/web/pages/health/health.css +93 -0
  65. package/src/adapters/dashboard/web/pages/health/index.js +41 -0
  66. package/src/adapters/dashboard/web/pages/health/sections/archive.js +84 -0
  67. package/src/adapters/dashboard/web/pages/health/sections/checks.js +172 -0
  68. package/src/adapters/dashboard/web/pages/health/sections/cycle.js +37 -0
  69. package/src/adapters/dashboard/web/pages/health/sections/verify.js +54 -0
  70. package/src/adapters/dashboard/web/pages/home/brain.js +375 -0
  71. package/src/adapters/dashboard/web/pages/home/home.css +134 -0
  72. package/src/adapters/dashboard/web/pages/home/index.js +84 -0
  73. package/src/adapters/dashboard/web/pages/home/sections/explorer.js +206 -0
  74. package/src/adapters/dashboard/web/pages/home/sections/hero.js +22 -0
  75. package/src/adapters/dashboard/web/pages/home/sections/live-activity.js +25 -0
  76. package/src/adapters/dashboard/web/pages/home/sections/recent-chapters.js +13 -0
  77. package/src/adapters/dashboard/web/pages/home/sections/tiles.js +52 -0
  78. package/src/adapters/dashboard/web/pages/memories/index.js +75 -0
  79. package/src/adapters/dashboard/web/pages/memories/memories.css +143 -0
  80. package/src/adapters/dashboard/web/pages/memories/sections/constellation.js +178 -0
  81. package/src/adapters/dashboard/web/pages/memories/sections/kinds.js +42 -0
  82. package/src/adapters/dashboard/web/pages/memories/sections/list.js +114 -0
  83. package/src/adapters/dashboard/web/pages/memories/sections/search.js +102 -0
  84. package/src/adapters/dashboard/web/pages/memories/sections/tools.js +155 -0
  85. package/src/adapters/dashboard/web/pages/memories/state.js +22 -0
  86. package/src/adapters/dashboard/web/pages/self/diff.js +79 -0
  87. package/src/adapters/dashboard/web/pages/self/index.js +43 -0
  88. package/src/adapters/dashboard/web/pages/self/markdown.js +61 -0
  89. package/src/adapters/dashboard/web/pages/self/sections/journal.js +32 -0
  90. package/src/adapters/dashboard/web/pages/self/sections/page.js +149 -0
  91. package/src/adapters/dashboard/web/pages/self/sections/settling.js +150 -0
  92. package/src/adapters/dashboard/web/pages/self/sections/stories.js +47 -0
  93. package/src/adapters/dashboard/web/pages/self/sections/wake.js +74 -0
  94. package/src/adapters/dashboard/web/pages/self/self.css +182 -0
  95. package/src/adapters/dashboard/web/server.ts +305 -28
  96. package/src/adapters/dashboard/web/shared/absence.js +14 -0
  97. package/src/adapters/dashboard/web/shared/actions.js +48 -0
  98. package/src/adapters/dashboard/web/shared/api.js +17 -0
  99. package/src/adapters/dashboard/web/shared/base.css +34 -0
  100. package/src/adapters/dashboard/web/shared/canvas.js +68 -0
  101. package/src/adapters/dashboard/web/shared/colors.js +6 -0
  102. package/src/adapters/dashboard/web/shared/dom.js +4 -0
  103. package/src/adapters/dashboard/web/shared/event-modal.js +25 -0
  104. package/src/adapters/dashboard/web/shared/fonts/OFL-courier-prime.txt +93 -0
  105. package/src/adapters/dashboard/web/shared/fonts/OFL-outfit.txt +93 -0
  106. package/src/adapters/dashboard/web/shared/fonts/courier-prime-latin-400.woff2 +0 -0
  107. package/src/adapters/dashboard/web/shared/fonts/courier-prime-latin-700.woff2 +0 -0
  108. package/src/adapters/dashboard/web/shared/fonts/outfit-latin-wght.woff2 +0 -0
  109. package/src/adapters/dashboard/web/shared/format.js +31 -0
  110. package/src/adapters/dashboard/web/shared/layout.css +32 -0
  111. package/src/adapters/dashboard/web/shared/memory-modal.js +124 -0
  112. package/src/adapters/dashboard/web/shared/modal.css +24 -0
  113. package/src/adapters/dashboard/web/shared/modal.js +22 -0
  114. package/src/adapters/dashboard/web/shared/state.js +12 -0
  115. package/src/adapters/dashboard/web/shared/tip.css +4 -0
  116. package/src/adapters/dashboard/web/shared/tip.js +12 -0
  117. package/src/adapters/dashboard/web/shared/tokens.css +50 -0
  118. package/src/adapters/dashboard/web/shared/type.css +52 -0
  119. package/src/adapters/dashboard/web/shared/utilities.css +5 -0
  120. package/src/adapters/dashboard/web/shared/vendor/MIT-three.txt +21 -0
  121. package/src/adapters/dashboard/web/shared/vendor/three.module.min.js +6 -0
  122. package/src/adapters/dashboard/web/shared/widgets/bar.css +9 -0
  123. package/src/adapters/dashboard/web/shared/widgets/card.css +6 -0
  124. package/src/adapters/dashboard/web/shared/widgets/chapters.js +15 -0
  125. package/src/adapters/dashboard/web/shared/widgets/chart.css +4 -0
  126. package/src/adapters/dashboard/web/shared/widgets/confirm.css +31 -0
  127. package/src/adapters/dashboard/web/shared/widgets/confirm.js +52 -0
  128. package/src/adapters/dashboard/web/shared/widgets/feed.css +13 -0
  129. package/src/adapters/dashboard/web/shared/widgets/feed.js +41 -0
  130. package/src/adapters/dashboard/web/shared/widgets/light.css +4 -0
  131. package/src/adapters/dashboard/web/shared/widgets/light.js +15 -0
  132. package/src/adapters/dashboard/web/shared/widgets/rows.css +7 -0
  133. package/src/adapters/dashboard/web/shared/widgets/table.css +17 -0
  134. package/src/adapters/dashboard/web/shared/widgets/tiles.css +14 -0
  135. package/src/adapters/dashboard/web/shell/pages.js +15 -0
  136. package/src/adapters/dashboard/web/shell/pulse.js +86 -0
  137. package/src/adapters/dashboard/web/shell/tabs.js +49 -0
  138. package/src/adapters/dashboard/web/static.ts +76 -0
  139. package/src/adapters/dashboard/web/views/activity.ts +80 -0
  140. package/src/adapters/dashboard/web/views/archive-words.ts +57 -0
  141. package/src/adapters/dashboard/web/views/flow-view.ts +217 -0
  142. package/src/adapters/dashboard/web/views/health.ts +328 -0
  143. package/src/adapters/dashboard/web/views/mechanism-panel.ts +370 -0
  144. package/src/adapters/dashboard/web/views/mechanisms.ts +302 -0
  145. package/src/adapters/dashboard/web/views/memories.ts +342 -0
  146. package/src/adapters/dashboard/web/views/memory.ts +210 -0
  147. package/src/adapters/dashboard/web/views/meta.ts +64 -0
  148. package/src/adapters/dashboard/web/views/mind.ts +729 -0
  149. package/src/adapters/dashboard/web/views/overview.ts +282 -0
  150. package/src/adapters/dashboard/web/views/pulse.ts +19 -0
  151. package/src/adapters/dashboard/web/views/rows.ts +207 -0
  152. package/src/adapters/dashboard/web/views/search.ts +62 -0
  153. package/src/adapters/dashboard/web/views/shared.ts +161 -0
  154. package/src/adapters/dashboard/web/views.ts +34 -1724
  155. package/src/adapters/fired.ts +138 -31
  156. package/src/adapters/mcp/INTERFACE-GAPS.md +4 -1
  157. package/src/adapters/mcp/NOTES.md +43 -0
  158. package/src/adapters/mcp/bin/serve.ts +9 -1
  159. package/src/adapters/mcp/index.ts +7 -0
  160. package/src/adapters/mcp/server.ts +167 -6
  161. package/src/adapters/mcp/tools.ts +42 -0
  162. package/src/adapters/mcp/write-up.ts +1 -1
  163. package/src/adapters/sessions.ts +18 -1
  164. package/src/adapters/snapshots.ts +71 -39
  165. package/src/core/associate/INTERFACE-GAPS.md +8 -0
  166. package/src/core/counterpart.ts +86 -7
  167. package/src/core/encode/INTERFACE-GAPS.md +12 -0
  168. package/src/core/feelings-wheel.ts +218 -0
  169. package/src/core/handoff/INTERFACE-GAPS.md +2 -0
  170. package/src/core/mint.ts +14 -2
  171. package/src/core/prospective/INTERFACE-GAPS.md +14 -0
  172. package/src/core/prospective/windows.ts +10 -48
  173. package/src/core/recall/INTERFACE-GAPS.md +6 -0
  174. package/src/core/remember/INTERFACE-GAPS.md +10 -0
  175. package/src/core/schemas/INTERFACE-GAPS.md +8 -0
  176. package/src/core/schemas/NOTES.md +118 -1
  177. package/src/core/schemas/index.ts +330 -40
  178. package/src/core/schemas/tunables.ts +23 -0
  179. package/src/core/schemas/types.ts +64 -1
  180. package/src/core/self/CONTRACT.md +3 -0
  181. package/src/core/self/INTERFACE-GAPS.md +10 -0
  182. package/src/core/self/NOTES.md +33 -2
  183. package/src/core/self/calendar.ts +7 -78
  184. package/src/core/self/episodes.ts +52 -12
  185. package/src/core/self/index.ts +40 -12
  186. package/src/core/self/writer.ts +22 -22
  187. package/src/core/sleep/NOTES.md +36 -0
  188. package/src/core/sleep/cycle.ts +38 -3
  189. package/src/core/sleep/fade.ts +76 -0
  190. package/src/core/sleep/index.ts +4 -1
  191. package/src/core/sleep/prune.ts +8 -1
  192. package/src/core/sleep/tunables.ts +5 -0
  193. package/src/core/sleep/types.ts +24 -0
  194. package/src/core/store/CONTRACT.md +36 -7
  195. package/src/core/store/NOTES.md +197 -0
  196. package/src/core/store/errors.ts +22 -0
  197. package/src/core/store/feelings.ts +182 -0
  198. package/src/core/store/index.ts +339 -45
  199. package/src/core/store/operational.ts +240 -22
  200. package/src/core/store/owner-op-seam.ts +13 -3
  201. package/src/core/store/paths.ts +15 -1
  202. package/src/core/store/pre-migration.ts +258 -0
  203. package/src/core/store/prose.ts +8 -1
  204. package/src/core/store/render.ts +3 -0
  205. package/src/core/time.ts +374 -0
  206. package/src/core/types.ts +13 -0
  207. package/src/adapters/dashboard/web/brain.html +0 -463
package/CHANGELOG.md ADDED
@@ -0,0 +1,76 @@
1
+ # Changelog
2
+
3
+ ## 0.3.2 — 2026-09-25
4
+
5
+ Dates and times follow your clock, and the store's format moves to v7.
6
+
7
+ **Before upgrading, close every Claude Code session.** The first session after the upgrade
8
+ saves a copy of the store and then updates its format; a session left open is still
9
+ running the old memory server, so in any you missed, run `/mcp` and choose Reconnect.
10
+ If your store is not in the default place (a `dataDir` outside `~/.counterparts/store`,
11
+ or `COUNTERPARTS_DATA_DIR`), set `snapshots.dir` in the config first: the upgrade will
12
+ not run without somewhere to save that copy, and memory stays off until it is set
13
+ (`doctor` says so).
14
+
15
+ - **Your day is your local day.** The day a memory was learned, "today", and the dates
16
+ in `doctor` and `counterparts fired` now use this computer's time zone instead of UTC,
17
+ so a memory saved at 11:50 pm belongs to that evening. Console commands read the zone
18
+ from the config beside the store, as the hooks do. Memories saved before keep the
19
+ dates they have. A `timeZone` setting in the config (for example `"America/Denver"`)
20
+ pins a zone, for a machine set to UTC; install says which zone it found.
21
+ - **Sessions know what time it is.** The wake opens with a line like
22
+ `Now: Fri 25 Sep 2026, 1:40 pm MDT`, and every turn carries the current time too.
23
+ - **Each memory records when it was written and changed, and which model wrote it.**
24
+ Notes, end-of-session memories, journal chapters and the self page carry the model the
25
+ session was using.
26
+ - **Feelings can be recorded on a memory** — several per memory, yours and Claude's side
27
+ by side, each named on a feelings wheel (six core emotions and the finer words under
28
+ them) with a strength and what carried it. `note` and `session_end` take them; a word
29
+ not on the wheel is kept, and the reply suggests the nearest ones. They change nothing
30
+ about how memories are held yet.
31
+ - **The store can hold a reminder's date** — a day, a month, or a range like
32
+ `2026-10-20..2026-10-31` — ready for reminders to use in a later release.
33
+ - One module now does every date conversion, and a test keeps it that way.
34
+
35
+ **A new dashboard** (`counterparts dashboard`):
36
+
37
+ - **A new home page**: the brain beside a few plain counts, and the 11 mechanisms the
38
+ site describes, each lit when it is working. Click one to see what it did lately.
39
+ - **Memories**: every memory in a list, newest first, with search, Ask, and filters for
40
+ kind, band and archived.
41
+ - **Self**: the self page with its history, what is settling into the core, the
42
+ briefing for the next session, and the journal by day.
43
+ - **Health**: "is it working?" as a checklist from `doctor`, the last sleep cycle, and
44
+ where archived memories went.
45
+ - **Manage memory from the dashboard**: write a note, remove a memory, back up, export,
46
+ rebrief, check the index, and ask, through the same code as the console. Removing
47
+ asks you to confirm first.
48
+ - The site's fonts, served from the package.
49
+ - A store waiting for its upgrade shows a short page saying so, instead of an error.
50
+
51
+ ## 0.3.1 — 2026-09-25
52
+
53
+ A small release of fixes. No change to the store's format, so no migration and no
54
+ Reconnect.
55
+
56
+ - **Cards for people, places and the identity core are no longer archived after about
57
+ 90 days of use** (#215). The nightly cleanup was treating them like ordinary memories.
58
+ They now fade only through a gentle phase of their own: months of quiet on both the
59
+ lived and the calendar clock (180 days, 365 for people), never while beliefs still
60
+ hang on them, and never the identity core. Nobody's store is old enough to have been
61
+ hit, which is why this ships now.
62
+ - **A faded card comes back when a saved memory names it** (#220), and **a card named
63
+ in a saved memory counts as used** (#218), so the people and things you still talk
64
+ about stay live.
65
+ - **Prompts typed while Claude is still working are saved** (#213). They were missed
66
+ before, about one typed prompt in twelve.
67
+ - **A checked snapshot is taken before any change to the store's format** (#214). If the
68
+ copy can't be made, the change waits. `doctor` shows a store that needs one: red when
69
+ the copy can't be made, amber when it can.
70
+ - **Each journal chapter records the model that wrote it** (#217).
71
+ - **`counterparts fired` and `doctor` show fading** as a mechanism of its own.
72
+
73
+ ## 0.3.0 — 2026-09-24
74
+
75
+ No API keys: nothing leaves the machine except through Claude Code. A quieter end-of-turn
76
+ ask, paced by what you type. `counterparts ask` searches by meaning.
@@ -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.0",
3
+ "version": "0.3.2",
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": {
@@ -49,6 +49,7 @@
49
49
  "tools/install-loop/",
50
50
  "CONSTITUTION.md",
51
51
  "README.md",
52
+ "CHANGELOG.md",
52
53
  "LICENSE"
53
54
  ],
54
55
  "dependencies": {
@@ -228,7 +228,8 @@ row, saying which source answered, existed until the keys were removed — §1a.
228
228
  record is also WHERE THE SESSION IS FILED.** SessionStart writes
229
229
  `<dataDir>/sessions/<id>.json` (id, scope, started, last boundary, and the marks a
230
230
  later hook process needs: which configuration was read, whether the first-launch
231
- question went out, the wake's sentinel and whether its arrival has been checked), Stop
231
+ question went out, the wake's sentinel and whether its arrival has been checked, the
232
+ model that last answered — which the `chapter` tool records per chapter), Stop
232
233
  refreshes the clock — creating the record when it is missing — and SessionEnd closes
233
234
  it. The writes
234
235
  are atomic (temp + rename), tiny, and silent on failure, because a hook may not fail
@@ -1073,7 +1073,8 @@ one pacer — nothing here adds a second).
1073
1073
 
1074
1074
  Measured 2026-09-23 on Claude Code 2.1.28x, reading **shapes only** (keys, flags, the
1075
1075
  first few characters of host frames) across every transcript under `~/.claude/projects/`;
1076
- no content was copied. `parseTranscript` reads only entries with a `message.role`.
1076
+ no content was copied. `parseTranscript` reads only entries with a `message.role` (and, since
1077
+ 2026-09-24, the person's queued prompts).
1077
1078
 
1078
1079
  | what | the entry's own metadata | text opens with | now |
1079
1080
  |---|---|---|---|
@@ -1088,7 +1089,7 @@ no content was copied. `parseTranscript` reads only entries with a `message.role
1088
1089
  | slash-command echo, `!`-command | no metadata | `<command-name>`, `<local-command-stdout>`, `<bash-input>`, `<bash-stdout>` | unchanged text rule; `<bash-stdout>`/`<bash-stderr>` now `injected` |
1089
1090
  | an interrupt | `interruptedMessageId`, no origin | `[Request interrupted by user]` | `injected` |
1090
1091
  | hook output (`UserPromptSubmit hook success`, `hook_additional_context`, `hook_system_message`) | `type: "attachment"`, **no role** | — | never a turn (unchanged) |
1091
- | **a prompt typed while the model works** (review M3: 76 seen, 58 never written again) | `type: "attachment"`, `attachment.type: "queued_command"`, `commandMode: "prompt"`, `origin.kind: "human"` | — | **never a turn — the person's own words, missed.** Pre-existing; `INTERFACE-GAPS.md` §14 |
1092
+ | **a prompt typed while the model works** (review M3: 76 seen) | `type: "attachment"`, `attachment.type: "queued_command"`, `commandMode: "prompt"`, `origin.kind: "human"` | — | `conversation` since 2026-09-24 — see "Prompts typed mid-turn" below (was never a turn) |
1092
1093
  | an API error written as the assistant | `isApiErrorMessage: true`, `model: "<synthetic>"` | `API Error: …` | `injected` (was `conversation`) |
1093
1094
 
1094
1095
  So "UserPromptSubmit hook success" was never counted by this reader: it is how the host
@@ -1123,6 +1124,61 @@ capture keeps its wrapper verbatim, labelled only by `injected`. It is out of pa
1123
1124
  either way; whether capture should label it the way a `<cross-session-message>` is
1124
1125
  labelled is a capture-quality question for another round.
1125
1126
 
1127
+ ### Prompts typed mid-turn (2026-09-24)
1128
+
1129
+ A prompt the person types while the model is still working reaches the model inside
1130
+ the running turn, and the host writes it only as an attachment line:
1131
+ `type: "attachment"`, `attachment: { type: "queued_command", commandMode: "prompt",
1132
+ origin: { kind: "human" }, prompt, source_uuid, timestamp }`, sometimes `humanTurn: true`
1133
+ or `imagePasteIds`, with `rendered` on the entry. `prompt` is a string, or content blocks
1134
+ when an image was pasted. The same attachment type also carries host work —
1135
+ `commandMode: "task-notification"`, and `commandMode: "prompt"` with `origin.kind: "peer"`
1136
+ and `isMeta: true` (hand-backs) — which stays skipped.
1137
+
1138
+ `parseTranscript` now reads the human ones as a typed user turn at the position the line
1139
+ stands in, with its own entry ordinal, through the same `blocksOf`/`pieceOf` as a typed
1140
+ entry. A mode other than `prompt` (`bash`, say) is skipped; none was seen. A prompt
1141
+ that opens with `/` is kept, as the same typed words would be ("/tmp is full"); the
1142
+ host was never seen writing a slash command as a `prompt` attachment.
1143
+
1144
+ Measured on this project's 27 transcripts (shapes only): 33 such prompts, against 376
1145
+ typed turns before — 409 after, about 8% of what the person typed. The queue itself is
1146
+ logged as `queue-operation` lines (`enqueue`, `dequeue`, `remove` with
1147
+ `reason: "absorbed_mid_turn"`); a prompt still queued when the turn ends is instead
1148
+ written as an ordinary user entry with `promptSource: "queued"` (7 seen), which was
1149
+ always read.
1150
+
1151
+ **No twin was found.** None of the 33 was written again as a user entry. The only later
1152
+ copies are inside a compaction summary (7, all in one session; `injected`, never
1153
+ paced) and in the assistant's own tool calls. `source_uuid` matches no `uuid` or
1154
+ `promptId` in any file, and the attachment's `timestamp` is the line's own. So the
1155
+ dedupe is defensive: a user entry with `origin.kind: "human"`, `promptSource: "queued"`
1156
+ and the same text (whitespace collapsed) as a queued prompt already read is skipped,
1157
+ once per queued prompt. The first appearance is kept because the capture cursor is an
1158
+ index into the turn list, and the list may only grow.
1159
+
1160
+ The window is the person's next sent entry. Any other human entry closes it, so the
1161
+ same short words queued again much later ("yes") still count; a person who types them
1162
+ the ordinary way always counts. Assistant lines do not close it, because the turn goes
1163
+ on after the attachment, and a prompt still queued at a turn's end is written after
1164
+ `turn_duration`, as the next turn's first entry — where a twin would most likely sit.
1165
+ Review M3 counted 18 of 76 "written again" across all projects; if those are real
1166
+ user-entry twins with some other `promptSource`, they would count twice — check before
1167
+ widening the rule.
1168
+
1169
+ **Deploy note.** The capture cursor is an index. A session open across this deploy has
1170
+ a cursor from the old list; queued prompts before it now occupy slots, so the next
1171
+ boundary starts k turns early and re-captures the last k already-captured turns once
1172
+ (k = queued prompts before the cursor). Nothing is lost, but queued prompts from before
1173
+ the deploy are mostly not captured after the fact. A cursor that survives inserted turns
1174
+ is `INTERFACE-GAPS.md` §14's first ask.
1175
+
1176
+ Pacing moves once too. Turns only rise, so `rebasedWatermark` does not fire, but
1177
+ `sinceTurns` (`self/episodes.ts#askDue`, typed turns minus the watermark) jumps by the
1178
+ queued prompts from before the last ask, which the watermark never counted. A session
1179
+ open across the deploy may be re-asked at its next Stop. One time only: the next ask
1180
+ sets the watermark on the new count.
1181
+
1126
1182
  ### The Stop ask's shapes
1127
1183
 
1128
1184
  **2026-09-24: ONE shape — `hookSpecificOutput.additionalContext` on Stop.**
@@ -1505,3 +1561,35 @@ What the build settled, beyond the CONTRACT section:
1505
1561
  are the item's; anything else keeps the paid-shaped rules (limit 64, blame only an
1506
1562
  item the embedder named). Core's `no-credential` / `no-credentials` reasons are left in
1507
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.
@@ -35,6 +35,7 @@ import {
35
35
  } from "../../scopes.js";
36
36
  import type { ScopeRead, ScopeVerdict } from "../../scopes.js";
37
37
  import { 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";
@@ -363,6 +364,8 @@ export function toHookInput(
363
364
  readonly scope?: string;
364
365
  readonly dataDir?: string;
365
366
  readonly env?: NodeJS.ProcessEnv;
367
+ /** The config's `timeZone`; absent, the machine's current zone. */
368
+ readonly timeZone?: string;
366
369
  } = {},
367
370
  ): HookInput {
368
371
  const scope = opts.scope ?? sessionScope(opts.dataDir, payload, opts.env ?? process.env);
@@ -383,12 +386,21 @@ export function toHookInput(
383
386
  // (`hooks.ts#checkWakeArrival`), and a parsed turn list cannot answer for
384
387
  // what the host injected.
385
388
  ...(transcriptPath === undefined ? {} : { transcriptPath }),
389
+ // The model that last answered, for the session record (and so the chapter).
390
+ ...(transcript.model === undefined ? {} : { model: transcript.model }),
386
391
  // The host's re-fire of a blocked Stop, carried INTO the adapter and not
387
392
  // only handled at delivery: the pass that says nothing must also advance
388
393
  // nothing (`hooks.ts#askAtStop`).
389
394
  ...(payload["stop_hook_active"] === true ? { reFired: true } : {}),
390
395
  ...(typeof payload["prompt"] === "string" ? { prompt: payload["prompt"] } : {}),
391
- at: new Date().toISOString().slice(0, 10),
396
+ // THE PERSON'S DAY (docs/time.md, 2026-09-25; UTC before). It dates the
397
+ // hook's rows, the wake preface, the prospective "today" and the date the
398
+ // boundary hands the lived clock — which is why the lived clock can see a
399
+ // date one day BEHIND its last on the evening of an upgrade west of UTC,
400
+ // or after flying west: the store refuses it (`CLOCK_BACKWARDS`), the
401
+ // cycle stays on the day it already believed, and the next local date
402
+ // moves it on (store NOTES 2026-09-25).
403
+ at: todayIn(resolveZone(opts.timeZone)),
392
404
  };
393
405
  }
394
406
 
@@ -705,7 +717,10 @@ async function runHook(
705
717
  // that twice on the hot path. The scope is handed IN rather than resolved
706
718
  // again: it was decided above, the registry verdict was taken on it, and two
707
719
  // resolutions of one value is the shape scar §2.13 is about.
708
- const input = toHookInput(payload, { scope });
720
+ const input = toHookInput(payload, {
721
+ scope,
722
+ ...(loaded.timeZone === undefined ? {} : { timeZone: loaded.timeZone }),
723
+ });
709
724
  const result = adapter.hook(name, input);
710
725
  // THE WORK HAPPENED. Recall was composed, the turn was captured, the session
711
726
  // record was written — whatever this event's job was, `adapter.hook` has
@@ -326,17 +326,20 @@ export async function runOnce(input: {
326
326
 
327
327
  const counterpart = Counterpart.open({
328
328
  dir: config.dataDir,
329
+ ...(config.snapshots?.dir === undefined ? {} : { snapshotsDir: config.snapshots.dir }),
329
330
  ...(embedder === null ? {} : { embed: embedder.embed, vectors: embedder }),
330
331
  ...(config.injectionBudgetBytes === undefined
331
332
  ? {}
332
333
  : { budgetBytes: config.injectionBudgetBytes }),
333
334
  ...(config.owner === undefined ? {} : { owner: config.owner }),
335
+ ...(config.timeZone === undefined ? {} : { timeZone: config.timeZone }),
334
336
  onEvent: (e) => emit(e.name, { ...(e.data ?? {}) }),
335
337
  });
336
338
  // ONE DATE FOR THE WHOLE RUN, resolved before the first step that could
337
339
  // record anything. The `sweep.gate` row carries it; so must every failure row,
338
340
  // or a replay with a pinned date would dedup against the wall clock instead.
339
- 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();
340
343
 
341
344
  let lag: LagReport | null = null;
342
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";
@@ -225,6 +227,19 @@ export interface AdapterConfig {
225
227
  readonly retired?: readonly string[];
226
228
  /** Is this the owner's own session? Withholding is the safe direction. */
227
229
  readonly owner?: boolean;
230
+ /**
231
+ * THE PERSON'S ZONE, an IANA name (`"America/Denver"`), when it should not
232
+ * follow the computer — a server set to UTC (docs/time.md rule 2). Absent,
233
+ * every local date follows the machine's current zone. Optional, and not
234
+ * asked at install: install prints the zone it detected in one line.
235
+ */
236
+ readonly timeZone?: string;
237
+ /**
238
+ * A `timeZone` this machine does not know, as written. It is IGNORED — the
239
+ * machine's zone is used — and doctor names it; a misspelt zone must not
240
+ * stand anybody's memory down the way an unreadable setting does.
241
+ */
242
+ readonly timeZoneUnknown?: string;
228
243
  /** An instrument stands down. Fail direction: an unreadable config lands here. */
229
244
  readonly observer?: boolean;
230
245
  /** The identity core's name is the OWNER's; there is no default. */
@@ -270,6 +285,8 @@ export function loadConfig(raw: unknown): LoadedConfig {
270
285
  pageWriter?: { mode: PageWriterMode; timeoutMs?: number; ignored?: string[] };
271
286
  retired?: string[];
272
287
  owner?: boolean;
288
+ timeZone?: string;
289
+ timeZoneUnknown?: string;
273
290
  observer?: boolean;
274
291
  identity?: { name: string; aliases?: readonly string[] };
275
292
  } = {};
@@ -332,6 +349,12 @@ export function loadConfig(raw: unknown): LoadedConfig {
332
349
  if (typeof rec["observer"] !== "boolean") unreadable = true;
333
350
  else out.observer = rec["observer"];
334
351
  }
352
+ // Read LENIENTLY, unlike the stance keys above: a zone that is not one is
353
+ // ignored and named, never a reason to stand the configuration down.
354
+ if (rec["timeZone"] !== undefined) {
355
+ if (isZone(rec["timeZone"])) out.timeZone = rec["timeZone"];
356
+ else out.timeZoneUnknown = String(rec["timeZone"]).slice(0, 64);
357
+ }
335
358
  const embedder = rec["embedder"];
336
359
  if (embedder !== undefined) {
337
360
  // The egress knob is read STRICTLY. A misspelled or half-written `embedder`