counterparts 0.3.11 → 0.3.13

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 (150) hide show
  1. package/CHANGELOG.md +326 -0
  2. package/docs/QUICKSTART.md +5 -0
  3. package/docs/README.md +2 -2
  4. package/docs/module-map.md +3 -3
  5. package/package.json +1 -1
  6. package/src/adapters/claude-code/CONTRACT.md +36 -10
  7. package/src/adapters/claude-code/INTERFACE-GAPS.md +116 -16
  8. package/src/adapters/claude-code/NOTES.md +182 -0
  9. package/src/adapters/claude-code/bin/hook.ts +46 -12
  10. package/src/adapters/claude-code/bin/runner.ts +7 -1
  11. package/src/adapters/claude-code/doctor.ts +632 -18
  12. package/src/adapters/claude-code/hooks.ts +61 -16
  13. package/src/adapters/claude-code/index.ts +11 -0
  14. package/src/adapters/claude-code/night-run.ts +150 -14
  15. package/src/adapters/claude-code/transcript.ts +268 -1
  16. package/src/adapters/cli/CONTRACT.md +5 -0
  17. package/src/adapters/cli/INTERFACE-GAPS.md +8 -4
  18. package/src/adapters/cli/NOTES.md +111 -0
  19. package/src/adapters/cli/commands.ts +134 -92
  20. package/src/adapters/cli/dream-core.ts +57 -42
  21. package/src/adapters/cli/export.ts +320 -21
  22. package/src/adapters/cli/help.ts +2 -1
  23. package/src/adapters/cli/index.ts +1 -0
  24. package/src/adapters/cli/install.ts +39 -7
  25. package/src/adapters/cli/mechanisms.ts +7 -1
  26. package/src/adapters/cli/uninstall.ts +13 -5
  27. package/src/adapters/cli/wire.ts +189 -63
  28. package/src/adapters/config.ts +2 -0
  29. package/src/adapters/dashboard/INTERFACE-GAPS.md +10 -1
  30. package/src/adapters/dashboard/NOTES.md +79 -0
  31. package/src/adapters/dashboard/registries.ts +34 -2
  32. package/src/adapters/dashboard/web/README.md +19 -14
  33. package/src/adapters/dashboard/web/actions.ts +23 -1
  34. package/src/adapters/dashboard/web/flow.ts +14 -0
  35. package/src/adapters/dashboard/web/lanes.ts +10 -0
  36. package/src/adapters/dashboard/web/narrate.ts +88 -2
  37. package/src/adapters/dashboard/web/pages/flow/sections/fired.js +1 -0
  38. package/src/adapters/dashboard/web/pages/health/sections/checks.js +2 -0
  39. package/src/adapters/dashboard/web/pages/health/sections/wake.js +3 -1
  40. package/src/adapters/dashboard/web/pages/memories/memories.css +17 -4
  41. package/src/adapters/dashboard/web/pages/memories/row.js +37 -21
  42. package/src/adapters/dashboard/web/pages/memories/sections/search.js +279 -60
  43. package/src/adapters/dashboard/web/pages/memories/state.js +2 -1
  44. package/src/adapters/dashboard/web/server.ts +0 -5
  45. package/src/adapters/dashboard/web/shared/memory-marks.css +7 -0
  46. package/src/adapters/dashboard/web/shared/memory-marks.js +33 -0
  47. package/src/adapters/dashboard/web/shared/memory-modal.js +5 -3
  48. package/src/adapters/dashboard/web/views/health.ts +21 -3
  49. package/src/adapters/dashboard/web/views/search.ts +4 -45
  50. package/src/adapters/dashboard/web/views.ts +2 -2
  51. package/src/adapters/fired.ts +430 -28
  52. package/src/adapters/host-wiring.ts +300 -0
  53. package/src/adapters/hosts.ts +11 -0
  54. package/src/adapters/lifecycle.ts +42 -2
  55. package/src/adapters/log/index.ts +9 -0
  56. package/src/adapters/mcp/CONTRACT.md +151 -11
  57. package/src/adapters/mcp/INTERFACE-GAPS.md +24 -2
  58. package/src/adapters/mcp/NOTES.md +313 -1
  59. package/src/adapters/mcp/bin/serve.ts +74 -1
  60. package/src/adapters/mcp/deliberate.ts +169 -651
  61. package/src/adapters/mcp/facts.ts +1094 -0
  62. package/src/adapters/mcp/index.ts +25 -7
  63. package/src/adapters/mcp/meaning.ts +1610 -0
  64. package/src/adapters/mcp/server.ts +835 -150
  65. package/src/adapters/mcp/stdio.ts +3 -1
  66. package/src/adapters/mcp/stood-down.ts +51 -0
  67. package/src/adapters/mcp/tools.ts +167 -41
  68. package/src/adapters/plugin-run.sh +133 -0
  69. package/src/adapters/plugin.ts +329 -0
  70. package/src/adapters/sessions.ts +18 -4
  71. package/src/core/associate/CONTRACT.md +2 -1
  72. package/src/core/associate/INTERFACE-GAPS.md +6 -1
  73. package/src/core/associate/NOTES.md +45 -0
  74. package/src/core/briefing.ts +12 -3
  75. package/src/core/contradictions.ts +184 -0
  76. package/src/core/counterpart.ts +797 -51
  77. package/src/core/dream/CONTRACT.md +36 -4
  78. package/src/core/dream/INTERFACE-GAPS.md +29 -6
  79. package/src/core/dream/NOTES.md +107 -0
  80. package/src/core/dream/feeling-weeks.ts +198 -0
  81. package/src/core/dream/index.ts +109 -18
  82. package/src/core/dream/reflect.ts +346 -87
  83. package/src/core/dream/tunables.ts +24 -4
  84. package/src/core/encode/INTERFACE-GAPS.md +3 -1
  85. package/src/core/encode/NOTES.md +7 -0
  86. package/src/core/encode/words.ts +45 -0
  87. package/src/core/fit/INTERFACE-GAPS.md +8 -2
  88. package/src/core/fit/NOTES.md +39 -1
  89. package/src/core/fit/index.ts +40 -0
  90. package/src/core/handoff/CONTRACT.md +37 -2
  91. package/src/core/handoff/INTERFACE-GAPS.md +10 -0
  92. package/src/core/handoff/NOTES.md +72 -0
  93. package/src/core/handoff/index.ts +214 -12
  94. package/src/core/handoff/last-here.ts +6 -4
  95. package/src/core/mint.ts +12 -2
  96. package/src/core/physics/CONTRACT.md +14 -2
  97. package/src/core/physics/NOTES.md +33 -1
  98. package/src/core/physics/index.ts +28 -5
  99. package/src/core/prospective/CONTRACT.md +45 -6
  100. package/src/core/prospective/INTERFACE-GAPS.md +4 -0
  101. package/src/core/prospective/NOTES.md +138 -0
  102. package/src/core/prospective/derive.ts +33 -5
  103. package/src/core/prospective/index.ts +90 -5
  104. package/src/core/prospective/windows.ts +72 -1
  105. package/src/core/recall/CONTRACT.md +31 -12
  106. package/src/core/recall/INTERFACE-GAPS.md +28 -4
  107. package/src/core/recall/NOTES.md +70 -1
  108. package/src/core/recall/feeling-ask.ts +10 -1
  109. package/src/core/recall/index.ts +3 -1
  110. package/src/core/recall/probe.ts +58 -0
  111. package/src/core/recall/session.ts +46 -2
  112. package/src/core/recall/time-ask.ts +487 -0
  113. package/src/core/remember/CONTRACT.md +4 -1
  114. package/src/core/remember/INTERFACE-GAPS.md +9 -1
  115. package/src/core/remember/NOTES.md +8 -0
  116. package/src/core/remember/proposals.ts +47 -5
  117. package/src/core/revision.ts +18 -1
  118. package/src/core/schemas/CONTRACT.md +21 -1
  119. package/src/core/schemas/INTERFACE-GAPS.md +20 -2
  120. package/src/core/schemas/NOTES.md +144 -0
  121. package/src/core/schemas/aliases.ts +55 -5
  122. package/src/core/schemas/index.ts +93 -1
  123. package/src/core/schemas/types.ts +2 -0
  124. package/src/core/self/CONTRACT.md +32 -5
  125. package/src/core/self/INTERFACE-GAPS.md +7 -2
  126. package/src/core/self/NOTES.md +102 -1
  127. package/src/core/self/behind.ts +43 -3
  128. package/src/core/self/briefing.ts +12 -2
  129. package/src/core/self/chapter-address.ts +254 -0
  130. package/src/core/self/episodes.ts +27 -0
  131. package/src/core/self/index.ts +83 -8
  132. package/src/core/self/page.ts +88 -0
  133. package/src/core/self/tunables.ts +5 -0
  134. package/src/core/self/work.ts +35 -2
  135. package/src/core/self/writer.ts +30 -0
  136. package/src/core/sleep/INTERFACE-GAPS.md +22 -3
  137. package/src/core/sleep/NOTES.md +20 -1
  138. package/src/core/sleep/consolidate.ts +59 -7
  139. package/src/core/sleep/index.ts +3 -0
  140. package/src/core/sleep/prune.ts +6 -2
  141. package/src/core/sleep/types.ts +7 -0
  142. package/src/core/store/CONTRACT.md +16 -0
  143. package/src/core/store/NOTES.md +66 -0
  144. package/src/core/store/feelings.ts +14 -1
  145. package/src/core/store/index.ts +483 -16
  146. package/src/core/store/operational.ts +95 -2
  147. package/src/core/store/owner-op-seam.ts +23 -0
  148. package/src/core/time.ts +152 -0
  149. package/tools/install-loop/run.sh +48 -12
  150. package/src/adapters/dashboard/web/pages/memories/fold.js +0 -53
@@ -103,6 +103,11 @@ import type { Band, Kind } from "../../core/types.js";
103
103
  // rules about what recall means. `mcp/deliberate.ts` imports nothing from here,
104
104
  // so the direction stays one-way.
105
105
  import { deliberateRecall, embedQuestion } from "../mcp/deliberate.js";
106
+ // A question at the console is answered in FACTS MODE, the MCP `recall`'s own
107
+ // path (2026-10-03), for the same reason — and in MEANING MODE, its other path,
108
+ // when `--mode meaning` asks for it (2026-10-09).
109
+ import { factsRecall, renderFacts } from "../mcp/facts.js";
110
+ import { meaningRecall, renderMeaning } from "../mcp/meaning.js";
106
111
  // The ONE rule for "which host configuration": the console resolves it with the
107
112
  // same function the hook, the worker and the MCP server do.
108
113
  import {
@@ -182,7 +187,7 @@ import {
182
187
  configObject,
183
188
  resolveEmbedderBlock,
184
189
  hookCommand,
185
- hostConfigBase,
190
+ hostSettingsDir,
186
191
  installLayout,
187
192
  parkedSiblings,
188
193
  throwawayDefaultRefusal,
@@ -235,8 +240,8 @@ import type { ParkStep, StartFreshPlan, UndoPlan } from "./start-fresh.js";
235
240
  import { realProcessLister, realSpawner, sessionsNote, tilde, unwire, wire } from "./wire.js";
236
241
  import { connectDesktop, desktopUnavailable, readDesktop } from "./desktop.js";
237
242
  import { runtimeLabel } from "../runtime.js";
238
- import { DESKTOP_HOST, upgradeWords } from "../hosts.js";
239
- import { hostsSeen } from "../sessions.js";
243
+ import { DESKTOP_ALWAYS_ALLOW, DESKTOP_HOST, upgradeWords } from "../hosts.js";
244
+ import { hostsSeen, installedVersion } from "../sessions.js";
240
245
  import type {
241
246
  Outcome as WireOutcome,
242
247
  ProcessLister,
@@ -683,8 +688,8 @@ export const COMMAND_FLAGS: Record<Command, readonly string[]> = {
683
688
  note: ["kind", "title", "salience", "config"],
684
689
  // Two names, ONE row each and the same one: a flag that worked under `recall`
685
690
  // and not under `ask` would be the rename leaking into behaviour.
686
- ask: ["id", "json", "full", "config", "voiced"],
687
- recall: ["id", "json", "full", "config", "voiced"],
691
+ ask: ["id", "json", "full", "page", "mode", "config", "voiced"],
692
+ recall: ["id", "json", "full", "page", "mode", "config", "voiced"],
688
693
  export: [
689
694
  "out",
690
695
  "passphrase",
@@ -795,7 +800,7 @@ export const COMMAND_BLURB: Record<Command, string> = {
795
800
  "Put back beliefs and current-state rows the nightly dedup pass archived as duplicates of an ordinary memory. Dry run unless --apply. --apply requires --dir.",
796
801
  rebrief: "Re-render and republish the wake bundle NOW, through the boundary's own renderer.",
797
802
  "probe-oq4":
798
- "The OQ4 probe: footnotes delivered vs. later expanded, by calendar date, from recall.decision and recall.credit rows. Read-only.",
803
+ "The OQ4 probe: footnotes delivered vs. later expanded, by calendar date, from recall.decision and recall.credit rows, then recall's hit rate — of what it showed, how much a reply expanded or quoted, loud, footnoted and pointer. Read-only.",
799
804
  mechanisms:
800
805
  "Is each memory mechanism working? One line per mechanism, with a light (● working this week, ◐ built but not firing, ○ not built yet) and the count from the store behind it, then the plumbing in one line that names only what is failing. --all prints the full report: every part, silent first, when it last fired, how often in the last 7 days, what it turned away, and why the store cannot tell for the ones nothing records. Read-only.",
801
806
  fired:
@@ -888,18 +893,22 @@ const FLAG_HELP: Record<string, string> = {
888
893
  title: "a title for the memory, instead of one taken from its first line",
889
894
  salience: "0..1 — how much this one matters",
890
895
  id: "one memory, by id, instead of a question",
891
- full: "every answer in full, with how the question was answered and what each tier means — not just the top five, one line each",
896
+ full: "the whole facts answer, as the model reads it: a count header and every result's labeled lines (who said it, its status, when it happened and was learned, whether it still holds) — not just the top five, one line each",
897
+ page: "which page of the answer (ten results a page; in meaning mode, eight entries of the arc), with --full or --json",
898
+ mode: "facts (the default): every memory that answers the question, counted and paged — or meaning: what a person, a project or a feeling has been over time, the chapters that hold it in time order",
892
899
  // TWO COMMANDS, ONE SENTENCE (`recall --json` is the MCP tool's payload,
893
900
  // `doctor --json` is the findings): the table is keyed by flag NAME, so the
894
901
  // sentence has to be true of both.
895
902
  json: "machine-readable output — the structured payload rather than the console's rendering",
896
903
  voiced:
897
- "the question is already in the counterpart's own voice (the dashboard's rewrite), so \"I\" in a question about feeling means the counterpart, not you",
904
+ "the question is already in the counterpart's own voice (the dashboard's rewrite): in meaning mode its \"I\" is the counterpart, so a question about feeling asks about the counterpart's feelings; a facts answer reads no feelings and is the same either way",
898
905
  out: "the directory to write into",
899
906
  passphrase: "encrypt the export with this secret",
900
907
  plaintext: "do not encrypt the export (said on purpose, never by default)",
901
- markdown: "export the readable markdown tree instead of the database file",
902
- "include-confidential": "include confidential memories in the markdown tree (they are omitted, and counted, by default)",
908
+ markdown:
909
+ "export the readable markdown tree instead of the database file: memories, the journal, the self page, and a file per dream and per reflection (its README says what is where)",
910
+ "include-confidential":
911
+ "include confidential memories in the markdown tree, and the dreams and reflections that rest on one (they are omitted, and counted, by default)",
903
912
  // NOT `--versions`: `self-page` takes both `--versions` and `--version`, and
904
913
  // the help-page totality test reads flags as substrings — an `export
905
914
  // --versions` puts the string `--version` on export's page, where it names a
@@ -1179,6 +1188,7 @@ const VALUED_FLAGS: readonly string[] = [
1179
1188
  "version",
1180
1189
  "restore",
1181
1190
  "if-version",
1191
+ "mode",
1182
1192
  "show",
1183
1193
  "demote",
1184
1194
  "pair",
@@ -1324,6 +1334,10 @@ export function parse(argv: readonly string[]): Parsed {
1324
1334
  id: { type: "string" },
1325
1335
  json: { type: "boolean" },
1326
1336
  full: { type: "boolean" },
1337
+ // `ask`'s page of a facts answer (2026-10-03).
1338
+ page: { type: "string" },
1339
+ // `ask`'s mode: facts (the default) or meaning (2026-10-09).
1340
+ mode: { type: "string" },
1327
1341
  // `ask`'s: the question is already in the counterpart's voice (U13).
1328
1342
  voiced: { type: "boolean" },
1329
1343
  apply: { type: "boolean" },
@@ -2709,6 +2723,11 @@ export function firedLines(report: FiredReport, all = false): string[] {
2709
2723
  if (report.wentBlocked.length > 0) {
2710
2724
  lines.push(`Fired last week and STOPPED this week: ${report.wentBlocked.join("; ")}`, "");
2711
2725
  }
2726
+ // An occasion that came and was not answered (2026-10-09): the one silence
2727
+ // among the `waiting` rows that is still a fault, said before the groups.
2728
+ if (report.missedOccasion.length > 0) {
2729
+ lines.push(`Its occasion came this week and it did not fire: ${report.missedOccasion.join("; ")}`, "");
2730
+ }
2712
2731
  if (report.wentQuiet.length > 0) {
2713
2732
  lines.push(`Fired last week and not once this week: ${report.wentQuiet.join("; ")}`, "");
2714
2733
  }
@@ -3584,6 +3603,10 @@ function installDesktop(
3584
3603
  // under a running Desktop can be written over.
3585
3604
  io.out("If Claude Desktop was open while this ran, quit it and run this again — it rewrites its own config file while it runs.");
3586
3605
  io.out("Then open Claude Desktop. In a new chat, ask it to call the counterparts wake tool first (or pick the \"Start with Counterparts\" prompt where Desktop lists it).");
3606
+ // MEASURED 2026-10-02: a chat whose tools still asked permission never
3607
+ // called `wake`, answered from recall alone, and called that the full
3608
+ // record. Doctor cannot see the setting, so this says it.
3609
+ io.out(DESKTOP_ALWAYS_ALLOW);
3587
3610
  io.out(`Then run \`${BIN.cli} doctor\`: its Claude Desktop line shows the entry, and the last wake once there has been one.`);
3588
3611
  return EXIT.ok;
3589
3612
  case "refused":
@@ -3879,8 +3902,9 @@ async function installConversation(
3879
3902
  *
3880
3903
  * Two questions, and either one answering yes is enough, because they fail in
3881
3904
  * opposite directions. The DIRECTORY is what a person who has ever run Claude
3882
- * Code has — `CLAUDE_CONFIG_DIR` moves it, and `install.ts#hostConfigBase` is
3883
- * the one place that knows so. The BINARY on PATH is what a fresh install has
3905
+ * Code has — `CLAUDE_CONFIG_DIR` moves it (and IS it, when set: not a
3906
+ * `.claude` inside it, 2026-10-09), and `install.ts#hostSettingsDir` is the one
3907
+ * place that knows so. The BINARY on PATH is what a fresh install has
3884
3908
  * before it has been run, and the reason `install.ts`'s own docstring exists: a
3885
3909
  * process's PATH is not a login shell's, so a `claude` we cannot see may still
3886
3910
  * be there for the person.
@@ -3895,7 +3919,7 @@ function claudeCodeHere(
3895
3919
  env: Record<string, string | undefined>,
3896
3920
  spawner: Spawner,
3897
3921
  ): boolean {
3898
- if (existsSync(join(hostConfigBase(home, env), ".claude"))) return true;
3922
+ if (existsSync(hostSettingsDir(home, env))) return true;
3899
3923
  return !spawner(["--version"]).missing;
3900
3924
  }
3901
3925
 
@@ -4217,7 +4241,7 @@ async function hostWiringCommand(
4217
4241
  result.outcome === "ok" &&
4218
4242
  (result.hooks !== "already" || result.mcp !== "already")
4219
4243
  ) {
4220
- sessionsNote(ui(io, env), lister);
4244
+ sessionsNote(ui(io, env), lister, { dataDir: store, env });
4221
4245
  }
4222
4246
  return exitFor(result.outcome);
4223
4247
  }
@@ -5712,6 +5736,15 @@ async function recallCommand(
5712
5736
  io.err("refused: a question and --id are two different asks. Send one.");
5713
5737
  return EXIT.usage;
5714
5738
  }
5739
+ // THE MODE, as the MCP `recall` takes it (2026-10-09): facts unless meaning
5740
+ // is asked for by name. Read before the store opens, so a mistyped mode is a
5741
+ // refusal rather than a facts answer to a question meant for the arc. With
5742
+ // `--id` there is no question to answer in a mode, and it is not read.
5743
+ const modeFlag = parsed.flags["mode"];
5744
+ if (modeFlag !== undefined && modeFlag !== "facts" && modeFlag !== "meaning") {
5745
+ io.err(`refused: --mode is facts or meaning, not ${typeof modeFlag === "string" ? JSON.stringify(modeFlag) : "empty"}.`);
5746
+ return EXIT.usage;
5747
+ }
5715
5748
  if (!storeExists(dir)) {
5716
5749
  io.err(`no store at ${dir}. Run 'counterparts install' first.`);
5717
5750
  return EXIT.failed;
@@ -5735,81 +5768,92 @@ async function recallCommand(
5735
5768
  try {
5736
5769
  // Same rule as `note` and `status`: say which store answered.
5737
5770
  if (parsed.flags["json"] !== true) io.out(`Store: ${counterpart.store.dir}`);
5738
- // In line, and every way it can decline said by name (§9.1 G5) — the same
5739
- // call the MCP `recall` makes (`mcp/deliberate.ts#embedQuestion`).
5740
- const embedded =
5741
- question.length > 0
5742
- ? await embedQuestion(embedder, question)
5743
- : { vector: null, semantic: "embedder-off" as const };
5744
- const result = deliberateRecall(
5745
- counterpart,
5746
- idFlag.length > 0 ? { handle: idFlag } : { question },
5747
- {
5748
- sessionId: "console",
5749
- owner: true,
5750
- vector: embedded.vector,
5751
- semantic: embedded.semantic,
5752
- // WHOSE "I" (U13): the owner is the one typing here, so "what have I
5753
- // felt" is his — unless the dashboard rewrote the question into the
5754
- // counterpart's voice first (`--voiced`), and then "I" is the counterpart.
5755
- asker: parsed.flags["voiced"] === true ? "self" : "owner",
5756
- },
5757
- );
5758
- if (parsed.flags["json"] === true) {
5759
- io.out(JSON.stringify(result, null, 2));
5760
- return result.memories.length > 0 ? EXIT.ok : EXIT.ok;
5761
- }
5762
- // SHORT BY DEFAULT (2026-09-24): a header in plain words and the top few,
5763
- // numbered, two lines each. `--full` is the page this command printed before, and
5764
- // `--id` is always a whole memory.
5765
- if (parsed.flags["full"] !== true && idFlag.length === 0) {
5771
+ // A QUESTION is answered in FACTS MODE (Release B, 2026-10-03) — the same
5772
+ // path the MCP `recall` takes with `mode: "facts"` (`mcp/facts.ts`), so
5773
+ // the console cannot drift into a softer question path than the model
5774
+ // gets. Embedded in line, and every way it can decline said by name — the
5775
+ // same call the MCP `recall` makes (`mcp/deliberate.ts#embedQuestion`).
5776
+ if (idFlag.length === 0) {
5777
+ const embedded = await embedQuestion(embedder, question);
5778
+ const page = typeof parsed.flags["page"] === "string" && /^[1-9]\d*$/.test(parsed.flags["page"]) ? { page: Number(parsed.flags["page"]) } : {};
5779
+ // MEANING MODE: the arc, the MCP `recall`'s `mode: "meaning"` path. Whose
5780
+ // "I" a question about feeling means is the one thing the console adds:
5781
+ // a question typed here is the owner's, so his; one the dashboard turned
5782
+ // into my voice (`--voiced`) is mine. Its rendering is already short, so
5783
+ // there is no list form: `--json` is the payload, anything else the answer.
5784
+ if (modeFlag === "meaning") {
5785
+ const meaning = meaningRecall(
5786
+ {
5787
+ counterpart,
5788
+ sessionId: "console",
5789
+ owner: true,
5790
+ vector: embedded.vector,
5791
+ semantic: embedded.semantic,
5792
+ asker: parsed.flags["voiced"] === true ? "self" : "owner",
5793
+ },
5794
+ question,
5795
+ page,
5796
+ );
5797
+ io.out(parsed.flags["json"] === true ? JSON.stringify(meaning, null, 2) : renderMeaning(meaning));
5798
+ return EXIT.ok;
5799
+ }
5800
+ const facts = factsRecall(
5801
+ { counterpart, sessionId: "console", owner: true, vector: embedded.vector, semantic: embedded.semantic },
5802
+ question,
5803
+ page,
5804
+ );
5805
+ if (parsed.flags["json"] === true) {
5806
+ io.out(JSON.stringify(facts, null, 2));
5807
+ return EXIT.ok;
5808
+ }
5809
+ // SHORT BY DEFAULT (2026-09-24): a header in plain words and the top
5810
+ // few, numbered, two lines each. `--full` is the facts answer as the
5811
+ // model reads it — every result's labeled lines.
5812
+ if (parsed.flags["full"] === true) {
5813
+ io.out(renderFacts(facts));
5814
+ return EXIT.ok;
5815
+ }
5766
5816
  printAskList(
5767
5817
  io,
5768
- result,
5769
- askChannel(result.semantic, counterpart.store.embedderVerdict.kind, embedder),
5818
+ facts,
5819
+ askChannel(facts.semantic, counterpart.store.embedderVerdict.kind, embedder),
5770
5820
  said,
5771
5821
  {
5772
- learnedOn: (id) => {
5773
- try {
5774
- return counterpart.store.readProse(id).learnedOn;
5775
- } catch {
5776
- return null;
5777
- }
5778
- },
5822
+ learnedOn: (id) => facts.memories.find((m) => m.id === id)?.learned ?? null,
5779
5823
  dim: paint(io, env).dim,
5780
5824
  },
5781
5825
  );
5782
5826
  return EXIT.ok;
5783
5827
  }
5828
+ const result = deliberateRecall(counterpart, { handle: idFlag }, { sessionId: "console", owner: true });
5829
+ if (parsed.flags["json"] === true) {
5830
+ io.out(JSON.stringify(result, null, 2));
5831
+ return EXIT.ok;
5832
+ }
5784
5833
  io.out(
5785
- `${result.path} · ${result.reason} · semantic ${result.semantic} · ` +
5834
+ `${result.path} · ${result.reason} · ` +
5786
5835
  // "live rows", not "live memories": the denominator counts schemas and
5787
5836
  // episodes too, so a store made with `install --name` reads one higher
5788
5837
  // than its memory count. Naming the population is cheaper than a second
5789
5838
  // number, and `status` prints the split.
5790
- `considered ${result.considered} of ${result.storeSize} live rows · returned ${result.memories.length}`,
5839
+ `${result.storeSize} live rows · returned ${result.memories.length}`,
5791
5840
  );
5792
5841
  if (result.memories.length === 0) {
5793
5842
  io.out("");
5794
5843
  // NOTHING CAME, said as a sentence rather than as an absence. A blank
5795
5844
  // where a memory would have been is the one output a reader cannot tell
5796
5845
  // from a crash, and the reason belongs in the same breath.
5797
- io.out(
5798
- result.considered === 0
5799
- ? "NOTHING CAME BACK — nothing in the store shared a word with the question, so no memory was even scored."
5800
- : `NOTHING CAME BACK — ${result.considered} ${result.considered === 1 ? "memory was" : "memories were"} scored and none was close enough to show.`,
5801
- );
5802
- io.out(" Try words the memory itself would use, or ask for it by id:");
5803
- io.out(` ${BIN.cli} ${said} --id <mem_...>`);
5846
+ io.out(`NOTHING CAME BACK — no memory has that id or that exact title.`);
5847
+ io.out(` Ask a question instead: ${BIN.cli} ${said} "..."`);
5804
5848
  return EXIT.ok;
5805
5849
  }
5806
5850
  for (const m of result.memories) {
5807
5851
  io.out("");
5808
5852
  // THE JOURNAL SAYS SO (owner ruling, 2026-09-04 — LAUNCH-STATUS §I14). A
5809
5853
  // chapter stays recallable and is never presented as a memory; the word
5810
- // rides in front of the kind, where the tier already is.
5854
+ // rides in front of the kind.
5811
5855
  const journal = m.journal ? "[journal] " : "";
5812
- io.out(` ${m.id} [${m.tier}] ${journal}${m.kind}${m.title === null ? "" : ` — ${m.title}`}`);
5856
+ io.out(` ${m.id} ${journal}${m.kind}${m.title === null ? "" : ` — ${m.title}`}`);
5813
5857
  // ITS STANDING, before the words (2026-09-29): earlier, corrected by,
5814
5858
  // replaced by, disagrees with, unsettled — so an old memory never reads as current.
5815
5859
  if (m.standing !== undefined) io.out(` (${m.standing})`);
@@ -5825,26 +5869,8 @@ async function recallCommand(
5825
5869
  }
5826
5870
  if (felt !== "") io.out(` feelings — ${felt}`);
5827
5871
  }
5828
- // THE TIER LEGEND, and it is not decoration. `answered` means the question
5829
- // reached something, never that the something is right, and the loudest
5830
- // tier present is the only confidence signal in the output. A reader who
5831
- // takes `[quiet]` for a strong hit is reading a footnote as an answer —
5832
- // the cold-stranger review asked a one-row store about Mars, got the
5833
- // espresso machine, and had nothing on screen to tell it apart from the
5834
- // right answer to a real question.
5835
- io.out("");
5836
- const tiers = new Set(result.memories.map((m) => m.tier));
5837
- for (const [tier, gloss] of [
5838
- ["vivid", "came clearly to mind; the ambient path would have surfaced this"],
5839
- ["quiet", "quietly available; the ambient path would have footnoted it, not said it"],
5840
- ["dim", "reached only because you asked deliberately — lower confidence, and labelled so"],
5841
- ] as const) {
5842
- if (tiers.has(tier)) io.out(` ${tier} = ${gloss}`);
5843
- }
5844
- if (!tiers.has("vivid")) {
5845
- io.out(" Nothing here came back vividly, so treat these as leads rather than answers.");
5846
- }
5847
5872
  if (result.memories.some((m) => m.journal)) {
5873
+ io.out("");
5848
5874
  io.out(
5849
5875
  " journal = a chapter, the first-person account a memory was made from — not a memory, and outside decay and the prune.",
5850
5876
  );
@@ -5861,17 +5887,22 @@ async function recallCommand(
5861
5887
  * numbered, two lines each and a blank line between — the words first
5862
5888
  * (`askGist`), and under them a quieter line saying what it is, when, and its
5863
5889
  * id (`askMeta`), dimmed on a terminal that takes colour (`ui.ts#paint`: never
5864
- * on a pipe unless FORCE_COLOR asks, never under NO_COLOR). What `--full` adds
5865
- * is the path, the reason, the considered/stored numbers, every body in full
5866
- * and the tier legend.
5890
+ * on a pipe unless FORCE_COLOR asks, never under NO_COLOR). What `--full`
5891
+ * prints is the facts answer as the model reads it (2026-10-03): the count
5892
+ * header, and every result's labeled lines — who said it, its status, when
5893
+ * it happened and when it was learned, whether it still holds.
5867
5894
  *
5868
- * The "nothing came back vividly — treat these as leads" line is GONE from
5869
- * here: on the owner's store it read as doubt about an answer that was right.
5870
- * `--full`'s tier legend still says it, unchanged.
5895
+ * The count is facts mode's `matched` — every distinct fact that matched, not
5896
+ * only the page — when the result carries it.
5871
5897
  */
5872
5898
  export function printAskList(
5873
5899
  io: Io,
5874
- result: ReturnType<typeof deliberateRecall>,
5900
+ result: {
5901
+ readonly memories: readonly { readonly id: string; readonly title: string | null; readonly kind: string; readonly journal: boolean; readonly body: string }[];
5902
+ readonly considered: number;
5903
+ readonly matched?: number;
5904
+ readonly fadedTotal?: number;
5905
+ },
5875
5906
  how: string,
5876
5907
  said: string,
5877
5908
  opts: {
@@ -5881,13 +5912,16 @@ export function printAskList(
5881
5912
  readonly dim?: (s: string) => string;
5882
5913
  } = {},
5883
5914
  ): void {
5884
- const found = result.memories.length;
5915
+ const found = Math.max(result.matched ?? 0, result.memories.length);
5885
5916
  if (found === 0) {
5886
5917
  io.out(`Nothing found (${how}).`);
5918
+ const faded = result.fadedTotal ?? 0;
5887
5919
  io.out(
5888
- result.considered === 0
5889
- ? " Nothing in the store came near the question, so no memory was even scored."
5890
- : ` ${result.considered} ${result.considered === 1 ? "memory was" : "memories were"} scored and none was close enough to show.`,
5920
+ faded > 0
5921
+ ? ` Only ${String(faded)} faded ${faded === 1 ? "memory" : "memories"} matched: --full lists them.`
5922
+ : result.considered === 0
5923
+ ? " Nothing in the store came near the question, so no memory was even scored."
5924
+ : ` ${result.considered} ${result.considered === 1 ? "memory was" : "memories were"} weighed and none was close enough to show.`,
5891
5925
  );
5892
5926
  io.out(` Try words the memory itself would use, or ask for it by id: ${BIN.cli} ${said} --id <mem_...>`);
5893
5927
  return;
@@ -7092,6 +7126,12 @@ function exportCommand(
7092
7126
  omittedConfidential: report.omittedConfidential,
7093
7127
  versions: flags["with-versions"] === true,
7094
7128
  notRendered: report.notRendered.length,
7129
+ // The nights, counted apart from `rows` (2026-10-09): the
7130
+ // dashboard reads `rows` as memories.
7131
+ dreams: report.dreams,
7132
+ reflections: report.reflections,
7133
+ omittedDreams: report.omittedDreams,
7134
+ omittedReflections: report.omittedReflections,
7095
7135
  },
7096
7136
  });
7097
7137
  } catch {
@@ -8687,6 +8727,8 @@ export function openCounterpart(
8687
8727
  return Counterpart.open({
8688
8728
  dir,
8689
8729
  observer,
8730
+ // A wake `rebrief` publishes is stamped with this build (2026-10-02).
8731
+ build: installedVersion(),
8690
8732
  ...(timeZone === undefined ? {} : { timeZone }),
8691
8733
  ...(identity === undefined ? {} : { identity }),
8692
8734
  ...(embed === undefined ? {} : { embed }),
@@ -12,12 +12,13 @@ import type { Counterpart } from "../../core/counterpart.js";
12
12
  import { nightPartsWords, nightRunWords } from "../../core/dream/index.js";
13
13
  import type { DreamingSetting, NightRun } from "../../core/dream/index.js";
14
14
  import { acceptsReflectedFeeling } from "../../core/sleep/index.js";
15
- import type { ReflectionRow } from "../../core/store/index.js";
15
+ import type { DreamChangeRow, ReflectionRow, Store } from "../../core/store/index.js";
16
16
 
17
- /** How a memory id reads in a list: its first line, or why it is not shown. */
18
- export function memoryWords(counterpart: Counterpart, id: string | null, max = 80): string {
17
+ /** How a memory id reads in a list: its first line, or why it is not shown.
18
+ * Only the store is read, so `export --markdown` asks it too. */
19
+ export function memoryWords(source: { readonly store: Store }, id: string | null, max = 80): string {
19
20
  if (id === null) return "(removed by the owner)";
20
- const row = counterpart.store.row(id);
21
+ const row = source.store.row(id);
21
22
  if (row === undefined) return "(no such memory)";
22
23
  if (row.confidential === 1) return "[confidential]";
23
24
  if (row.body === "") return "(removed by the owner)";
@@ -97,7 +98,7 @@ export function dreamListLines(counterpart: Counterpart, limit: number | "all" =
97
98
  return out;
98
99
  }
99
100
 
100
- function parseIdList(json: string): string[] {
101
+ export function parseIdList(json: string): string[] {
101
102
  try {
102
103
  const v: unknown = JSON.parse(json);
103
104
  return Array.isArray(v) ? v.filter((x): x is string => typeof x === "string") : [];
@@ -106,18 +107,63 @@ function parseIdList(json: string): string[] {
106
107
  }
107
108
  }
108
109
 
110
+ /** What became of a morning share, in the words `dream --show` and the export both use. */
111
+ export const SHARE_STATE_WORDS: Readonly<Record<string, string>> = {
112
+ none: "no share",
113
+ offered: "share not told yet",
114
+ carried: "share carried to a later session",
115
+ told: "share told",
116
+ };
117
+
109
118
  /** One line: after which dream, what it did, and what became of the share. */
110
- function reflectionSummary(r: ReflectionRow): string {
119
+ export function reflectionSummary(r: ReflectionRow): string {
111
120
  const parts: string[] = [];
112
121
  parts.push(r.dream_id === null ? "on its own" : `after ${r.dream_id}`);
113
122
  if (r.state !== "reflected") return `${parts.join(", ")} — begun, not finished`;
114
123
  if (r.entry_id === null) parts.push("nothing much");
115
124
  if (r.page_version !== null) parts.push("rewrote the page");
116
- const share: Record<string, string> = { none: "no share", offered: "share not told yet", carried: "share carried to a later session", told: "share told" };
117
- parts.push(share[r.share_state] ?? r.share_state);
125
+ parts.push(SHARE_STATE_WORDS[r.share_state] ?? r.share_state);
118
126
  return parts.join(", ");
119
127
  }
120
128
 
129
+ /**
130
+ * ONE CHANGE A DREAM MADE, in words: its line, then any lines under it (a
131
+ * merge's originals, each "from …"). No mark and no indent: `dream --show`
132
+ * puts its own in front, and `export --markdown` makes a list of it.
133
+ */
134
+ export function dreamChangeWords(source: { readonly store: Store }, c: DreamChangeRow): [string, ...string[]] {
135
+ const words = (x: string | null): string => (x === null ? "(removed by the owner)" : `${x} "${memoryWords(source, x)}"`);
136
+ const a = c.ref;
137
+ const b = c.ref2;
138
+ switch (c.action) {
139
+ case "link":
140
+ case "contradiction":
141
+ return [`${c.action}: ${words(a)} ↔ ${words(b)}`];
142
+ case "settle": {
143
+ let how = "settled";
144
+ try {
145
+ const d = JSON.parse(c.detail) as { how?: unknown };
146
+ if (typeof d.how === "string") how = d.how;
147
+ } catch {
148
+ how = "settled";
149
+ }
150
+ return [`settle (${how}): ${words(a)} holds over ${words(b)}`];
151
+ }
152
+ case "merge": {
153
+ let from: string[] = [];
154
+ try {
155
+ const d = JSON.parse(c.detail) as { from?: unknown };
156
+ if (Array.isArray(d.from)) from = d.from.filter((x): x is string => typeof x === "string");
157
+ } catch {
158
+ from = [];
159
+ }
160
+ return [`merge into ${words(a)}`, ...from.map((f) => `from ${words(f)}`)];
161
+ }
162
+ default:
163
+ return [`${c.action}: ${words(a)}`];
164
+ }
165
+ }
166
+
121
167
  /** `counterparts dream --show <rfl_…>`: one reflection, whole. */
122
168
  export function reflectionShowLines(counterpart: Counterpart, id: string): string[] | null {
123
169
  const r = counterpart.reflections.show(id);
@@ -168,40 +214,9 @@ export function dreamShowLines(counterpart: Counterpart, id: string): string[] |
168
214
  out.push("", changes.length === 0 ? "Changes: none." : `Changes (${String(changes.length)}):`);
169
215
  for (const c of changes) {
170
216
  const mark = c.undone === 1 ? " [undone] " : " ";
171
- const a = c.ref === null ? null : c.ref;
172
- const b = c.ref2;
173
- const words = (x: string | null): string => (x === null ? "(removed by the owner)" : `${x} "${memoryWords(counterpart, x)}"`);
174
- switch (c.action) {
175
- case "link":
176
- case "contradiction":
177
- out.push(`${mark}${c.action}: ${words(a)} ↔ ${words(b)}`);
178
- break;
179
- case "settle": {
180
- let how = "settled";
181
- try {
182
- const d = JSON.parse(c.detail) as { how?: unknown };
183
- if (typeof d.how === "string") how = d.how;
184
- } catch {
185
- how = "settled";
186
- }
187
- out.push(`${mark}settle (${how}): ${words(a)} holds over ${words(b)}`);
188
- break;
189
- }
190
- case "merge": {
191
- let from: string[] = [];
192
- try {
193
- const d = JSON.parse(c.detail) as { from?: unknown };
194
- if (Array.isArray(d.from)) from = d.from.filter((x): x is string => typeof x === "string");
195
- } catch {
196
- from = [];
197
- }
198
- out.push(`${mark}merge into ${words(a)}`);
199
- for (const f of from) out.push(`${mark} from ${words(f)}`);
200
- break;
201
- }
202
- default:
203
- out.push(`${mark}${c.action}: ${words(a)}`);
204
- }
217
+ const [head, ...under] = dreamChangeWords(counterpart, c);
218
+ out.push(`${mark}${head}`);
219
+ for (const line of under) out.push(`${mark} ${line}`);
205
220
  }
206
221
  if (dream.state !== "undone") out.push("", `Reverse all of it: counterparts dream --undo ${dream.id}`);
207
222
  // What the waking self made of it — lived, so an undo of the dream leaves it.