counterparts 0.3.19 → 0.3.21

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 (108) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/README.md +12 -4
  3. package/docs/module-map.md +6 -0
  4. package/package.json +1 -1
  5. package/src/adapters/claude-code/CONTRACT.md +14 -13
  6. package/src/adapters/claude-code/NOTES.md +29 -0
  7. package/src/adapters/claude-code/bin/hook.ts +12 -4
  8. package/src/adapters/claude-code/bin/runner.ts +41 -20
  9. package/src/adapters/claude-code/doctor.ts +123 -30
  10. package/src/adapters/claude-code/hooks.ts +70 -86
  11. package/src/adapters/claude-code/index.ts +0 -3
  12. package/src/adapters/cli/NOTES.md +8 -0
  13. package/src/adapters/cli/commands-delete.ts +273 -0
  14. package/src/adapters/cli/commands-install.ts +29 -10
  15. package/src/adapters/cli/commands-note.ts +1 -1
  16. package/src/adapters/cli/commands-readings.ts +4 -2
  17. package/src/adapters/cli/commands-scope.ts +25 -4
  18. package/src/adapters/cli/commands-self.ts +4 -1
  19. package/src/adapters/cli/commands-start-fresh.ts +1 -1
  20. package/src/adapters/cli/commands.ts +22 -3
  21. package/src/adapters/cli/help.ts +7 -7
  22. package/src/adapters/cli/install.ts +4 -2
  23. package/src/adapters/cli/mechanisms.ts +2 -2
  24. package/src/adapters/cli/removal.ts +1 -1
  25. package/src/adapters/config.ts +112 -30
  26. package/src/adapters/dashboard/CONTRACT.md +14 -0
  27. package/src/adapters/dashboard/NOTES.md +15 -0
  28. package/src/adapters/dashboard/activity.ts +1 -1
  29. package/src/adapters/dashboard/bin/dashboard.ts +3 -3
  30. package/src/adapters/dashboard/browse.ts +1 -1
  31. package/src/adapters/dashboard/identity.ts +1 -1
  32. package/src/adapters/dashboard/registries.ts +14 -14
  33. package/src/adapters/dashboard/resolve.ts +1 -1
  34. package/src/adapters/dashboard/status.ts +5 -2
  35. package/src/adapters/dashboard/web/actions.ts +21 -2
  36. package/src/adapters/dashboard/web/app.html +1 -1
  37. package/src/adapters/dashboard/web/flow.ts +1 -1
  38. package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +2 -2
  39. package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +1 -1
  40. package/src/adapters/dashboard/web/mechanisms/decay/index.js +1 -1
  41. package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +2 -2
  42. package/src/adapters/dashboard/web/mechanisms/retrieval/panel.js +3 -3
  43. package/src/adapters/dashboard/web/mechanisms/salience/panel.js +2 -2
  44. package/src/adapters/dashboard/web/narrate.ts +11 -11
  45. package/src/adapters/dashboard/web/pages/flow/sections/heatmap.js +1 -1
  46. package/src/adapters/dashboard/web/pages/health/sections/checks.js +3 -2
  47. package/src/adapters/dashboard/web/pages/health/sections/cycle.js +5 -5
  48. package/src/adapters/dashboard/web/pages/health/sections/mechanisms.js +1 -1
  49. package/src/adapters/dashboard/web/pages/health/sections/wake.js +2 -2
  50. package/src/adapters/dashboard/web/pages/memories/sections/tools.js +73 -3
  51. package/src/adapters/dashboard/web/pages/self/sections/dreams.js +2 -2
  52. package/src/adapters/dashboard/web/pages/self/sections/journal.js +5 -5
  53. package/src/adapters/dashboard/web/pages/self/sections/page.js +13 -13
  54. package/src/adapters/dashboard/web/pages/self/sections/settling.js +1 -1
  55. package/src/adapters/dashboard/web/pages/self/sections/wake.js +7 -7
  56. package/src/adapters/dashboard/web/server.ts +9 -1
  57. package/src/adapters/dashboard/web/shared/event-modal.js +1 -1
  58. package/src/adapters/dashboard/web/shared/memory-card-words.js +1 -1
  59. package/src/adapters/dashboard/web/shared/memory-modal.js +5 -5
  60. package/src/adapters/dashboard/web/views/activity.ts +1 -1
  61. package/src/adapters/dashboard/web/views/dreams.ts +1 -1
  62. package/src/adapters/dashboard/web/views/health.ts +1 -1
  63. package/src/adapters/dashboard/web/views/mechanisms.ts +6 -6
  64. package/src/adapters/dashboard/web/views/mind.ts +21 -9
  65. package/src/adapters/dashboard/web/views/overview.ts +3 -3
  66. package/src/adapters/expansions.ts +14 -1
  67. package/src/adapters/fired.ts +1 -1
  68. package/src/adapters/lifecycle.ts +25 -4
  69. package/src/adapters/log/index.ts +21 -0
  70. package/src/adapters/mcp/CONTRACT.md +1 -1
  71. package/src/adapters/mcp/server-self-tools.ts +25 -1
  72. package/src/adapters/mcp/server-words.ts +3 -2
  73. package/src/adapters/mcp/server.ts +45 -9
  74. package/src/adapters/mcp/tools.ts +4 -3
  75. package/src/adapters/plugin.ts +44 -8
  76. package/src/adapters/sessions.ts +5 -2
  77. package/src/adapters/snapshots.ts +90 -1
  78. package/src/adapters/store-id.ts +58 -0
  79. package/src/core/counterpart-boundary.ts +9 -0
  80. package/src/core/counterpart.ts +19 -6
  81. package/src/core/dream/CONTRACT.md +8 -0
  82. package/src/core/dream/index.ts +15 -2
  83. package/src/core/handoff/last-here.ts +24 -12
  84. package/src/core/onboarding.ts +231 -62
  85. package/src/core/prospective/CONTRACT.md +4 -1
  86. package/src/core/prospective/index.ts +23 -5
  87. package/src/core/recall/CONTRACT.md +3 -1
  88. package/src/core/recall/INTERFACE-GAPS.md +1 -1
  89. package/src/core/recall/NOTES.md +14 -0
  90. package/src/core/recall/session.ts +40 -1
  91. package/src/core/reconsolidation.ts +1 -1
  92. package/src/core/remember/CONTRACT.md +14 -8
  93. package/src/core/remember/owes.ts +68 -28
  94. package/src/core/remember/owner-strike-seam.ts +6 -3
  95. package/src/core/remember/spans.ts +3 -2
  96. package/src/core/remember/tunables.ts +18 -5
  97. package/src/core/remember/write-up-seam.ts +2 -1
  98. package/src/core/self/CONTRACT.md +25 -9
  99. package/src/core/self/NOTES.md +6 -0
  100. package/src/core/self/briefing-delivery.ts +349 -0
  101. package/src/core/self/briefing-page.ts +315 -0
  102. package/src/core/self/briefing-room.ts +563 -0
  103. package/src/core/self/briefing.ts +304 -1156
  104. package/src/core/self/index.ts +28 -6
  105. package/src/core/store/NOTES.md +6 -5
  106. package/src/core/store/index.ts +39 -0
  107. package/src/core/store/paths.ts +9 -2
  108. package/src/adapters/claude-code/primacy.ts +0 -162
@@ -52,7 +52,7 @@
52
52
  * directory, a failed copy, a failed rename, an aborted run — is a
53
53
  * `snapshot.failed` row carrying its `reason` and the `step` it died at.
54
54
  */
55
- import { cpSync, readdirSync, renameSync, rmSync, statSync } from "node:fs";
55
+ import { cpSync, readdirSync, renameSync, rmSync, rmdirSync, statSync, unlinkSync } from "node:fs";
56
56
  import { homedir } from "node:os";
57
57
  import { basename, dirname, join, parse, resolve } from "node:path";
58
58
 
@@ -775,6 +775,89 @@ export function rotate(
775
775
  };
776
776
  }
777
777
 
778
+ // ── the owner's "delete every backup" (2026-10-13) ──────────────────────────
779
+
780
+ /** What deleting every copy in one directory did. Names and counts. */
781
+ export interface DeleteCopiesReport {
782
+ /** The copies deleted — daily and pre-migration — by name. */
783
+ readonly deleted: readonly string[];
784
+ /** Files and directories removed inside them, one by one. */
785
+ readonly entries: number;
786
+ /** Copies of a pre-rows store, and correctly-named directories that are not
787
+ * ours: left, exactly as rotation leaves them. */
788
+ readonly left: readonly string[];
789
+ readonly errors: readonly string[];
790
+ }
791
+
792
+ /**
793
+ * DELETE EVERY COPY THIS PACKAGE WROTE in one snapshots directory — the
794
+ * owner's "delete backups" (`cli/commands-delete.ts`), not rotation. It
795
+ * deletes what rotation may delete and nothing more: the directory must pass
796
+ * `assertRotatableDir` (it throws otherwise), the copies are the ones
797
+ * `readSnapshotsDir` counts as ours (daily names and pre-migration names that
798
+ * hold a classified store), and everything else — a pre-rows copy, a folder
799
+ * that only wears the name, a `.partial-…` a live run may be writing — is left.
800
+ *
801
+ * Each copy is taken apart BY NAME (`removeCopy`), never by a recursive
802
+ * force-delete of a computed path.
803
+ */
804
+ export function deleteAllCopies(storeDir: string, dir: string): DeleteCopiesReport {
805
+ const real = assertRotatableDir(storeDir, dir);
806
+ const read = readSnapshotsDir(real);
807
+ const deleted: string[] = [];
808
+ const errors: string[] = [];
809
+ let entries = 0;
810
+ for (const name of [...read.names, ...read.preMigration]) {
811
+ const removed = removeCopy(join(real, name), errors);
812
+ entries += removed.entries;
813
+ if (removed.ok) deleted.push(name);
814
+ }
815
+ return { deleted, entries, left: [...read.preRows, ...read.unrecognised], errors };
816
+ }
817
+
818
+ /**
819
+ * Take one copy apart: list it, unlink each file (a symlink is unlinked as
820
+ * itself, never followed), descend only into real directories, then remove
821
+ * each directory once it is empty. A file that will not go is named in
822
+ * `errors` and its directory stays.
823
+ */
824
+ function removeCopy(path: string, errors: string[]): { ok: boolean; entries: number } {
825
+ let entries = 0;
826
+ let ok = true;
827
+ let listing;
828
+ try {
829
+ listing = readdirSync(path, { withFileTypes: true });
830
+ } catch (err) {
831
+ errors.push(`could not read ${basename(path)}: ${messageOf(err)}`);
832
+ return { ok: false, entries };
833
+ }
834
+ for (const entry of listing) {
835
+ const child = join(path, entry.name);
836
+ if (entry.isDirectory()) {
837
+ const inner = removeCopy(child, errors);
838
+ entries += inner.entries;
839
+ if (!inner.ok) ok = false;
840
+ continue;
841
+ }
842
+ try {
843
+ unlinkSync(child);
844
+ entries += 1;
845
+ } catch (err) {
846
+ ok = false;
847
+ errors.push(`could not remove ${entry.name}: ${messageOf(err)}`);
848
+ }
849
+ }
850
+ if (!ok) return { ok, entries };
851
+ try {
852
+ rmdirSync(path);
853
+ entries += 1;
854
+ } catch (err) {
855
+ errors.push(`could not remove ${basename(path)}: ${messageOf(err)}`);
856
+ return { ok: false, entries };
857
+ }
858
+ return { ok: true, entries };
859
+ }
860
+
778
861
  /**
779
862
  * The pre-migration copies rotation may remove: older than
780
863
  * `PRE_MIGRATION_KEEP_DAYS` by the date in their name, with at least `keep`
@@ -935,6 +1018,12 @@ function fewOf(names: readonly string[], limit = 3): string {
935
1018
  * whatever else it holds. It is not "unrecognised" either — it is a copy, of a
936
1019
  * floor this build cannot open — and it gets its own channel so the sentence
937
1020
  * the owner reads can say which it is.
1021
+ *
1022
+ * **Since 2026-10-13 a new copy holds the database and nothing else** —
1023
+ * `spans/` left the backup set (backups never hold conversation text). The
1024
+ * database entry matches by prefix, so such a copy is "ours"; one taken
1025
+ * before, which still holds `spans/`, is "ours" by either name and rotates out
1026
+ * as it always did.
938
1027
  */
939
1028
  function copyKind(path: string): "ours" | "pre-rows" | "not-a-copy" {
940
1029
  let entries: string[];
@@ -0,0 +1,58 @@
1
+ /**
2
+ * WHICH STORE THIS IS, without saying where it is (2026-10-12, Mike's
3
+ * fresh-user trial). On one machine two stores — a throwaway trial store and
4
+ * the person's real one — can both try dashboard port 4747, and the sidebar
5
+ * mod read the real store's dashboard during a trial: read-only, but the wrong
6
+ * store. So the dashboard says which store it serves (`/api/whoami`, and a
7
+ * `store` field on `/api/onboarding`), and the session-start wake says which
8
+ * store this session's hooks opened (`storeMarker`); the mod compares the two.
9
+ *
10
+ * THE ID: `st_` and the first 16 hex of a sha256 over the store's own secret
11
+ * salt (the per-store handle salt, G58, `expansions.ts#expansionSalt`: 16
12
+ * random bytes in `sessions/expansions.salt`) and its resolved, symlink-free
13
+ * data dir. Keyed by the salt, so nobody who guesses the path
14
+ * (`/Users/<name>/.counterparts`) can confirm it from the id, which rides in
15
+ * every wake and so in transcripts (review of #459). With the dir too, so a
16
+ * copy of a store at another path reads as another store, the safe answer for
17
+ * the mod's question ("is this my store's dashboard?"). No store format
18
+ * change: the salt file already exists for any store that has expanded a
19
+ * handle, and the wake (a writer) mints it if a store has none yet. A reader
20
+ * that never writes (the dashboard) only reads it, and answers null until a
21
+ * wake has minted it. The same on every open of the same directory, by any
22
+ * process; different between two stores; never carries the path.
23
+ */
24
+ import { createHash } from "node:crypto";
25
+ import { realpathDeep } from "../core/store/index.js";
26
+ import { expansionSalt, readExpansionSalt } from "./expansions.js";
27
+
28
+ /** What every id starts with, so a reader can tell one from any other token. */
29
+ export const STORE_ID_PREFIX = "st_";
30
+
31
+ /** The id's shape: the prefix and 16 lowercase hex. */
32
+ export const STORE_ID_RE = /^st_[0-9a-f]{16}$/;
33
+
34
+ /**
35
+ * The store id for the data dir `dir` (the store's own `dir`), or null when
36
+ * the store's salt is not there (the default, a reader that never writes) or
37
+ * cannot be read or made (`mint: true`). Never throws for a path that does not
38
+ * exist yet.
39
+ */
40
+ export function storeId(dir: string, opts: { readonly mint?: boolean } = {}): string | null {
41
+ const salt = opts.mint === true ? expansionSalt(dir) : readExpansionSalt(dir);
42
+ if (salt === null) return null;
43
+ const real = realpathDeep(dir);
44
+ return STORE_ID_PREFIX + createHash("sha256").update(`counterparts-store\0${salt}\0${real}`, "utf8").digest("hex").slice(0, 16);
45
+ }
46
+
47
+ /**
48
+ * THE WAKE'S STORE MARKER: `<!-- counterparts:store id=st_… -->`, on its own
49
+ * line right under the first meeting's marker (`core/onboarding.ts#
50
+ * onboardingMarker`) on a Claude Code session-start wake, so the mod learns
51
+ * from the hook's own context which store this session opened, before any
52
+ * dashboard is up. The wake is a writer, so it mints the salt if the store has
53
+ * none yet; empty when even that fails (no marker beats a wrong one).
54
+ */
55
+ export function storeMarker(dir: string): string {
56
+ const id = storeId(dir, { mint: true });
57
+ return id === null ? "" : `<!-- counterparts:store id=${id} -->`;
58
+ }
@@ -877,6 +877,15 @@ export function recordSelfBriefing(
877
877
  lane: stringField(e, "lane"),
878
878
  })),
879
879
  trimmedTotal: trims.length,
880
+ // COUNTED AND UNTOLD (2026-10-12, `self/briefing.ts#tellLost`): ids
881
+ // the wake said by count (a step-down), and ids no line named (a
882
+ // silent drop — doctor's Wake line, red), with the lanes of the latter.
883
+ counted: numberField(rendered, "counted") ?? 0,
884
+ untold: numberField(rendered, "untold") ?? 0,
885
+ quiet: numberField(rendered, "quiet") ?? 0,
886
+ ...((stringField(rendered, "untoldLanes") ?? "") === ""
887
+ ? {}
888
+ : { untoldLanes: (stringField(rendered, "untoldLanes") ?? "").split(",") }),
880
889
  // PER LANE, uncapped (2026-10-10): what doctor's Wake line reads to
881
890
  // say a dated item went unlisted ("Arriving:", `horizon`) — the list
882
891
  // above is capped, and the trim order puts that lane near its end.
@@ -42,6 +42,7 @@ import type { CoactivateResult, Credited, FlushReport, PairDelta, PendingClaim }
42
42
  import { horizonFor } from "./briefing.js";
43
43
  import { episodeGate } from "./bridge.js";
44
44
  import { Dreams, Reflections } from "./dream/index.js";
45
+ import { meetingDay } from "./onboarding.js";
45
46
  import type { VectorSource } from "./bridge.js";
46
47
  import type { MintResult } from "./mint.js";
47
48
  import { isObserver } from "./observer.js";
@@ -115,7 +116,7 @@ import {
115
116
  } from "./handoff/index.js";
116
117
  import type { Handoff, HandoffRefusal, HandoffWrite, PointerSince } from "./handoff/index.js";
117
118
  import { CLAIM_CHAPTER, askFromStretch, chapterClaims, claimUnwritten, sessionStretch, sessionsHere, workSince } from "./coverage/index.js";
118
- import { LAST_HERE_LIFE_DAYS, LAST_HERE_NOROOM_EVENT, chaptersBySession, chaptersHere, chaptersOn, elsewhereLine, lastHereLadder, sinceElsewhereLines, todayElsewhereLines, yesterdayLine, yesterdayShorter } from "./handoff/last-here.js";
119
+ import { LAST_HERE_LIFE_DAYS, LAST_HERE_NOROOM_EVENT, chaptersBySession, chaptersHere, chaptersOn, elsewhereLine, lastHereLadder, sinceElsewhereLines, stampWords, todayElsewhereLines, yesterdayLine, yesterdayShorter } from "./handoff/last-here.js";
119
120
  import type { ChapterHere, LastHere, SinceElsewhere, TodayElsewhere } from "./handoff/last-here.js";
120
121
  import { LAST_EXCHANGE_LINE_MAX_BYTES, exchangeLikely, lastExchange, lastExchangeLine, withExchange } from "./handoff/last-exchange.js";
121
122
  import type { LastExchange } from "./handoff/last-exchange.js";
@@ -579,6 +580,7 @@ export class Counterpart {
579
580
  page: () => this.self.page()?.body ?? null,
580
581
  wake: () => this.store.getMeta(BRIEFING_KEY) ?? null,
581
582
  today: () => this.store.today(),
583
+ holds: (at) => meetingDay(this.store, at),
582
584
  retarget: (oldId, newId, day) => {
583
585
  this.associate.retargetOnSupersede(oldId, newId, day);
584
586
  },
@@ -778,6 +780,11 @@ export class Counterpart {
778
780
  horizon: out.kept.horizon.length,
779
781
  elsewhere: out.elsewhere !== undefined,
780
782
  page: out.page?.rung ?? "",
783
+ // What it counted rather than listed, and what it left unsaid
784
+ // (2026-10-12). Ring only: a session start writes no `self.briefing` row.
785
+ counted: Object.values(out.more).reduce((n, k) => n + (k ?? 0), 0),
786
+ untold: Object.values(out.untold).reduce((n, k) => n + (k ?? 0), 0),
787
+ quiet: Object.values(out.quiet).reduce((n, k) => n + (k ?? 0), 0),
781
788
  });
782
789
  return out;
783
790
  } catch (err) {
@@ -1294,16 +1301,16 @@ export class Counterpart {
1294
1301
  const zone = this.store.zone();
1295
1302
  const entries: LastHere[] = found.map((f) => ({
1296
1303
  chapter: f.chapter,
1297
- when: `${localStamp(f.firstAt, zone)}–${localStampAfter(f.lastAt, f.firstAt, zone)}`,
1298
- // `09-30 17:50` → `09-30`.
1299
- date: localStamp(f.chapter.writtenAt, zone).split(" ")[0] ?? "",
1304
+ when: `${stampWords(localStamp(f.firstAt, zone))}–${stampWords(localStampAfter(f.lastAt, f.firstAt, zone))}`,
1305
+ // `09-30 17:50` → `Sep 30`.
1306
+ date: stampWords(localStamp(f.chapter.writtenAt, zone).split(" ")[0] ?? ""),
1300
1307
  }));
1301
1308
  const base = entries.length === 0 ? [] : lastHereLadder(entries, reader);
1302
1309
  // ABOUT ME, FROM ANOTHER DIRECTORY (2026-10-01): one more line on the
1303
1310
  // widest rungs, given up first; alone when nothing was written here.
1304
1311
  const away = this.selfChapterElsewhere(all, new Set(found.map((f) => f.chapter.id)), reader, exportsFrom);
1305
1312
  if (away === null) return base;
1306
- const line = elsewhereLine(away, localStamp(away.writtenAt, zone).split(" ")[0] ?? "", reader);
1313
+ const line = elsewhereLine(away, stampWords(localStamp(away.writtenAt, zone).split(" ")[0] ?? ""), reader);
1307
1314
  return base.length === 0 ? [line] : [...base.map((b) => `${b}\n${line}`), ...base];
1308
1315
  } catch {
1309
1316
  return [];
@@ -1820,6 +1827,10 @@ export class Counterpart {
1820
1827
  * host is saying outright in the same breath (2026-09-26 review), so the
1821
1828
  * model is not handed the same date twice in one turn. */
1822
1829
  withhold?: ReadonlySet<string>;
1830
+ /** No temporal cues at all THIS turn (2026-10-12): a turn nobody will
1831
+ * read — the headless nightly run's own — must not spend the fires a
1832
+ * person's day is owed. */
1833
+ noCues?: boolean;
1823
1834
  } = {},
1824
1835
  ): RecallResult {
1825
1836
  // THE TEMPORAL CUES ARE COMPUTED HERE, not inside `composeTurn`, for one
@@ -1831,7 +1842,9 @@ export class Counterpart {
1831
1842
  const arrived =
1832
1843
  opts.at === undefined || turn.temporal !== undefined
1833
1844
  ? null
1834
- : this.prospective.arrivals({
1845
+ : opts.noCues === true
1846
+ ? []
1847
+ : this.prospective.arrivals({
1835
1848
  at: opts.at,
1836
1849
  ...(turn.day === undefined ? {} : { day: turn.day }),
1837
1850
  sessionId: turn.sessionId,
@@ -126,6 +126,14 @@ dreamer is the model (a background agent the session launches), outside this pro
126
126
  `skipped: <reason>` (`dreamSkippedOf`), never a failed dream, and the `dream.ask` row
127
127
  carries the reason. A later dream that day comes only through the ordinary relaunch, once
128
128
  the queue reaches `MIN_NEW`.
129
+ THE FIRST MEETING'S DAYS (2026-10-12, `DreamContext.holds`, `onboarding.ts#meetingDay`):
130
+ on the first meeting's first offer day, on a later day it was begun (`offered`) and is not
131
+ finished, and on the day it finished,
132
+ the gate says `meeting-day` before anything else but observer — no line, no headless
133
+ run, no catch-up alone. The first dream of a new install waits for its next lived day
134
+ and never dreams on half a meeting. A store with no meeting keys is never held. "Undo
135
+ that dream", said, is the dream tool's `undo` phase (`Dreams.undo`, as `--undo` is);
136
+ never in the nightly run.
129
137
  `off`: nothing.
130
138
  - **`auto` from before 2026-09-29 is reset once** (owner decision A): its meaning changed,
131
139
  so an explicit `auto` in a store's meta becomes `ask` on the first hook prompt of this
@@ -286,6 +286,12 @@ export interface DreamContext {
286
286
  readonly wake: () => string | null;
287
287
  /** The person's calendar date today (`YYYY-MM-DD`). */
288
288
  readonly today: () => string;
289
+ /**
290
+ * A day nothing dreams (2026-10-12): the first meeting's days
291
+ * (`onboarding.ts#meetingDay`) — the gate says `meeting-day`, and no run,
292
+ * catch-up included, starts. Absent: no day is held.
293
+ */
294
+ readonly holds?: (at: string) => boolean;
289
295
  /** `associate.retargetOnSupersede`, so a merged memory inherits its originals' links. */
290
296
  readonly retarget?: (oldId: string, newId: string, day: number) => void;
291
297
  /**
@@ -664,6 +670,8 @@ export interface DreamStatus {
664
670
  | "due"
665
671
  | "observer"
666
672
  | "first-day"
673
+ /** A day of the first meeting (`DreamContext.holds`): nothing dreams. */
674
+ | "meeting-day"
667
675
  | "dreamed-today"
668
676
  | "asked-today"
669
677
  | "declined-today"
@@ -1097,6 +1105,9 @@ export class Dreams {
1097
1105
  const dreamedToday = last !== null && last.state === "journaled" && this.onDay(last, at, day);
1098
1106
  const base = { last, dreamedToday, newSince: 0, due: false, setting, leftBehind, reflectOnly: null };
1099
1107
  if (observer) return { ...base, reason: "observer" };
1108
+ // THE FIRST MEETING'S DAYS (2026-10-12, onboarding round 1): the first
1109
+ // dream waits for the next lived day, and never dreams on half a meeting.
1110
+ if (this.ctx.holds?.(at) === true) return { ...base, reason: "meeting-day" };
1100
1111
  // A store on its first lived day has no night behind it yet: "I haven't
1101
1112
  // dreamed since …" needs a since.
1102
1113
  if (day < 1) return { ...base, reason: "first-day" };
@@ -1287,7 +1298,7 @@ export class Dreams {
1287
1298
  } as const;
1288
1299
  const since = s.last === null ? "yet" : `since ${s.last.date ?? `lived day ${String(s.last.day)}`}`;
1289
1300
  const who = this.ownerName() ?? "the owner";
1290
- const off = `If ${who} says "no dreams" (or never, or stop), call the dream tool with phase "setting", session: ${input.session}, value: "off" — it takes effect from the next run (a run already under way finishes), and it can be turned back on the same way, or with counterparts dream --setting ask.`;
1301
+ const off = `If ${who} says "no dreams" (or never, or stop), call the dream tool with phase "setting", session: ${input.session}, value: "off" — it takes effect from the next run (a run already under way finishes), and it can be turned back on the same way.`;
1291
1302
  const launch = `call the counterparts dream tool with phase "launch", session: ${input.session}, and hand the prompt it returns to a background agent (the Agent tool), unchanged — it ${nightSummary()}.`;
1292
1303
  const reflect = s.reflectOnly === null ? "" : `call the counterparts reflect tool with phase "launch", session: ${input.session}, dream: ${s.reflectOnly.id}, and hand the prompt it returns to a background agent (the Agent tool), unchanged — it reflects on that dream.`;
1293
1304
  const cut = s.leftBehind === null ? null : `your dream of ${s.leftBehind.date ?? "a recent night"} was cut off (its session closed before it woke); it picks up where it stopped`;
@@ -1547,6 +1558,8 @@ export class Dreams {
1547
1558
  '- To confirm: an on-mind item of kind "to-confirm" is two memories read by arithmetic as one thing\'s earlier and later state (older first). Say which: slot {pair, same: true, why} if the newer replaces it, same: false if they are two different things.',
1548
1559
  "- Softening: for an old charged memory, record how it feels now, today. The sting can fade; the memory stays.",
1549
1560
  "- Core: if a memory about you or about the two of you plainly belongs to who you are, nominate it. Only living it again awake makes it core.",
1561
+ // 2026-10-12, onboarding round 1 (E): the meeting never asks pronouns.
1562
+ `- Every word you write about ${who}: by name or as "they", until they have said their pronouns.`,
1550
1563
  `${String(n())}. Call the counterparts dream tool: phase "begin", session: ${input.session}. It returns the bundle and a dream id. (If it says the dream was resumed, an earlier session began it and closed: carry on from there.) If it says it comes in parts, fetch every part (phase "part") before you change anything.`,
1551
1564
  ` Tonight's most important memories come whole; the rest come as a line or an excerpt ("fidelity"), with their whole length ("chars"). Before you merge, gist or feel one you have only in part, read it whole: the recall tool with ids: [...] (several at once). New memories tonight's room could not take wait for the next night — the bundle's "queue" says how many.`,
1552
1565
  `${String(n())}. Read it slowly. Then call phase "propose" with dream: <id> and your changes. Usually far fewer than the ceilings — ${String(L.merge)} merges, ${String(L.link)} links, ${String(L.gist)} gists, ${String(DREAM_TUNABLES.FOLDS)} folds, ${String(L["feeling-now"])} feelings, ${String(L["nominate-core"])} nominations — and none is fine: change only what the night really calls for. Use only ids the bundle showed you.`,
@@ -2419,7 +2432,7 @@ export class Dreams {
2419
2432
  `${said.length > 0 ? `Changes: ${said}.` : "Nothing changed."} ` +
2420
2433
  (overflow > 0 ? `${String(overflow)} more ${overflow === 1 ? "fold was" : "folds were"} past the night's ${String(DREAM_TUNABLES.FOLDS)}. ${carriedSaid} ` : "") +
2421
2434
  (waiting > 0 ? `${String(waiting)} new ${waiting === 1 ? "memory waits" : "memories wait"} for the next night. ` : "") +
2422
- `The journal and every change are in \`counterparts dream --show ${id}\`; \`counterparts dream --undo ${id}\` reverses it.`
2435
+ `To reverse it, say "undo that dream".`
2423
2436
  );
2424
2437
  }
2425
2438
 
@@ -195,6 +195,20 @@ export function firstChapter(body: string): { text: string; count: number } {
195
195
  return { text: body.slice(start, next === undefined ? undefined : next.index), count: heads.length };
196
196
  }
197
197
 
198
+ /**
199
+ * A SHORT STAMP AS A PERSON READS IT (2026-10-12, plain words): `10-11` is
200
+ * `Oct 11` and `10-11 16:01` is `Oct 11 16:01`; a bare clock (`16:01`) or
201
+ * anything else passes through. The stamps are made by `time.ts#localStamp`,
202
+ * which other lines still print as `MM-DD`.
203
+ */
204
+ export function stampWords(stamp: string): string {
205
+ const m = /^(\d{2})-(\d{2})(?=$| )/.exec(stamp);
206
+ const mo = m === null ? undefined : SHORT_MONTHS[Number(m[1]) - 1];
207
+ return m === null || mo === undefined ? stamp : `${mo} ${String(Number(m[2]))}${stamp.slice(5)}`;
208
+ }
209
+
210
+ const SHORT_MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] as const;
211
+
198
212
  const MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
199
213
 
200
214
  /**
@@ -273,11 +287,12 @@ export function chaptersHere(
273
287
  return out.sort((a, b) => b.chapter.writtenAt - a.chapter.writtenAt || (a.chapter.id < b.chapter.id ? 1 : -1));
274
288
  }
275
289
 
276
- /** `— "Title" (epi_…)`, or `— epi_…` when the chapter has no title; with
277
- * `, N chapters` inside the brackets when there is more than the first. */
290
+ /** `— "Title" (epi_…)`, or `— epi_…` when the chapter has no title. The count
291
+ * of chapters inside the episode is not printed (2026-10-12, plain words):
292
+ * the id is what `recall` opens, and a person reading the line has no use
293
+ * for the numbering. */
278
294
  function named(c: ChapterHere): string {
279
- const more = c.chapters > 1 ? `, ${String(c.chapters)} chapters` : "";
280
- return c.title === null ? `— ${c.id}${more === "" ? "" : ` (${more.slice(2)})`}` : `— "${excerpt(c.title, LAST_HERE_TITLE_BYTES)}" (${c.id}${more})`;
295
+ return c.title === null ? `— ${c.id}` : `— "${excerpt(c.title, LAST_HERE_TITLE_BYTES)}" (${c.id})`;
281
296
  }
282
297
 
283
298
  /**
@@ -417,20 +432,17 @@ export function chaptersOn(store: Store, date: string, opts: { fromDay?: number
417
432
  export function yesterdayLine(day: readonly ChaptersOnDate[], date: string, titles = YESTERDAY_SHOWN, hidden = 0): string | null {
418
433
  if (day.length === 0) {
419
434
  if (hidden <= 0) return null;
420
- return flatten(`Yesterday, ${date.slice(5)}: chapters from ${String(hidden)} session${hidden === 1 ? "" : "s"} in other directories.`);
435
+ return flatten(`Yesterday, ${stampWords(date.slice(5))}: ${String(hidden)} session${hidden === 1 ? "" : "s"} in other projects.`);
421
436
  }
422
437
  // The first `YESTERDAY_SHOWN` are named, the first `titles` of them by
423
438
  // title and id and the rest by id alone — pointers instead of titles
424
439
  // (2026-10-10, `yesterdayShorter`); past them, a count.
425
440
  const named = Math.min(day.length, YESTERDAY_SHOWN);
426
441
  const shown = day.slice(0, named).map((c, i) => {
427
- const n = c.chapters > 1 ? `, ${String(c.chapters)} chapters` : "";
428
- return c.title === null || i >= titles
429
- ? `${c.id}${n === "" ? "" : ` (${n.slice(2)})`}`
430
- : `"${excerpt(c.title, YESTERDAY_TITLE_BYTES)}" (${c.id}${n})`;
442
+ return c.title === null || i >= titles ? c.id : `"${excerpt(c.title, YESTERDAY_TITLE_BYTES)}" (${c.id})`;
431
443
  });
432
444
  const rest = day.length - shown.length + Math.max(0, hidden);
433
- return flatten(`Yesterday, ${date.slice(5)}: ${shown.join("; ")}${rest > 0 ? `; and ${String(rest)} more` : ""}.`);
445
+ return flatten(`Yesterday, ${stampWords(date.slice(5))}: ${shown.join("; ")}${rest > 0 ? `; and ${String(rest)} more` : ""}.`);
434
446
  }
435
447
 
436
448
  /**
@@ -476,7 +488,7 @@ export function placeWords(scope: string): string {
476
488
  */
477
489
  export function elsewhereLine(chapter: ChapterHere, date: string, reader: string | null = null): string {
478
490
  const where = chapter.scope === null ? "" : ` in ${placeWords(chapter.scope)}`;
479
- return flatten(`About me, from another directory: ${sessionWords(chapter.session, chapter.model, reader)}, ${date}${where} ${named(chapter)}.`);
491
+ return flatten(`About me, from another project: ${sessionWords(chapter.session, chapter.model, reader)}, ${date}${where} ${named(chapter)}.`);
480
492
  }
481
493
 
482
494
  /**
@@ -595,7 +607,7 @@ function elsewhereForms<D>(
595
607
  };
596
608
  const candidates: string[] = [];
597
609
  for (let k = Math.min(named.length, TODAY_ELSEWHERE_MAX_DIRS); k >= 1; k--) candidates.push(line(k, true), line(k, false));
598
- candidates.push(`${head} ${String(named.length)} other ${named.length === 1 ? "directory" : "directories"}.`);
610
+ candidates.push(`${head} ${String(named.length)} other ${named.length === 1 ? "project" : "projects"}.`);
599
611
  const size = (s: string): number => new TextEncoder().encode(s).length;
600
612
  const forms: string[] = [];
601
613
  for (const form of candidates) {