counterparts 0.3.31 → 0.3.32

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 (50) hide show
  1. package/CHANGELOG.md +59 -1
  2. package/package.json +1 -1
  3. package/src/adapters/claude-code/doctor-host.ts +22 -0
  4. package/src/adapters/claude-code/doctor-self-page.ts +41 -1
  5. package/src/adapters/claude-code/doctor.ts +42 -1
  6. package/src/adapters/claude-code/hooks.ts +68 -3
  7. package/src/adapters/cli/install.ts +4 -1
  8. package/src/adapters/config.ts +7 -0
  9. package/src/adapters/dashboard/activity.ts +3 -0
  10. package/src/adapters/dashboard/web/narrate.ts +14 -2
  11. package/src/adapters/host-wiring.ts +109 -10
  12. package/src/adapters/lifecycle.ts +2 -0
  13. package/src/adapters/mcp/server-words.ts +1 -1
  14. package/src/adapters/mcp/server.ts +13 -1
  15. package/src/adapters/mcp/tools.ts +10 -4
  16. package/src/adapters/plugin.ts +17 -3
  17. package/src/core/counterpart-events.ts +14 -1
  18. package/src/core/counterpart.ts +67 -3
  19. package/src/core/dream/reflect.ts +183 -22
  20. package/src/core/onboarding.ts +6 -5
  21. package/src/core/recall/CONTRACT.md +44 -0
  22. package/src/core/recall/NOTES.md +36 -0
  23. package/src/core/recall/activate.ts +30 -8
  24. package/src/core/recall/gate.ts +25 -4
  25. package/src/core/recall/index.ts +156 -9
  26. package/src/core/recall/prime.ts +64 -22
  27. package/src/core/recall/probe.ts +5 -2
  28. package/src/core/recall/rated.ts +25 -10
  29. package/src/core/recall/render.ts +79 -11
  30. package/src/core/recall/session.ts +20 -1
  31. package/src/core/recall/tunables.ts +60 -0
  32. package/src/core/retrieval.ts +19 -1
  33. package/src/core/schemas/CONTRACT.md +9 -3
  34. package/src/core/schemas/NOTES.md +15 -0
  35. package/src/core/schemas/index.ts +82 -3
  36. package/src/core/schemas/tags.ts +120 -1
  37. package/src/core/self/CONTRACT.md +7 -0
  38. package/src/core/self/NOTES.md +186 -0
  39. package/src/core/self/identity.ts +86 -2
  40. package/src/core/self/index.ts +10 -2
  41. package/src/core/self/measures.ts +161 -0
  42. package/src/core/self/tunables.ts +95 -0
  43. package/src/core/self/work.ts +10 -0
  44. package/src/core/self/writer.ts +8 -1
  45. package/src/core/sleep/consolidate.ts +7 -4
  46. package/src/core/sleep/types.ts +3 -2
  47. package/src/core/store/NOTES.md +25 -0
  48. package/src/core/store/index.ts +112 -11
  49. package/src/core/store/operational.ts +143 -1
  50. package/src/core/store/reads-memories.ts +95 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.32 — 2026-10-22
4
+
5
+ The sidebar is now a plugin of its own, `counterparts-sidebar`, and `counterparts` is the memory alone. If you use the plugin, the update (`/plugin marketplace update counterparts`) removes the sidebar; `/plugin install counterparts-sidebar@counterparts` brings it back, starting from the default view, theme and avatar. With the npm install beside both plugins, doctor's Claude Code line is green: the plugin stays installed for the sidebar and stands down. Open threads change meaning: an item is open only when someone owes an answer (a question to you, a check with a date, a promise), and one nobody has touched in 21 lived days, with no date and not a question you were asked, stops being carried in the wake and offered to the reflection; it is not closed, and using or revising it carries it again. **The first morning after upgrading counts the whole untouched backlog at once**, so that morning's share may say a large number left; it says the number once, never the list. Beliefs now show: the strongest two or three about a person, project or topic a message names come up beside the footnotes, and a project's folder may open with a short line of them. Doctor gains a Builds line. The core from beliefs is built and off (`self.CORE_FROM_BELIEFS`). No store-format change (store v14, cache v7), no wiring change: `counterparts connect` is not needed after upgrading. Restart the dashboard and every Claude Code session afterwards so the long-running memory server and dashboard load the new version.
6
+
7
+ - **The sidebar is a plugin of its own: `counterparts-sidebar`.** `counterparts` is now the
8
+ memory alone (hooks, memory server, commands); the pane beside the chat comes with
9
+ `/plugin install counterparts-sidebar@counterparts`, which installs `counterparts` too
10
+ if it isn't there. If you already have the plugin, `claude plugin update
11
+ counterparts@counterparts` moves you to memory alone and the sidebar goes until you
12
+ install it; installing the sidebar before that update stops and tells you to run it, so
13
+ you never get two panes. The sidebar starts with the default view, theme and avatar.
14
+ With the npm install, adding the sidebar plugin gives one pane and every memory tool
15
+ once, as before.
16
+ - **Doctor beside the sidebar plugin.** With the npm install, the `counterparts` plugin and
17
+ the `counterparts-sidebar` plugin (the way to get the sidebar with the npm install), doctor's
18
+ Claude Code line is green now: it says the plugin is installed for the sidebar, which needs
19
+ it, and stands down. It is amber only when both installs really run (a plugin build that
20
+ doesn't stand down), and then it says to update the plugin, never to uninstall it. The
21
+ plugin's one session-start line there says the same: nothing needs to change.
22
+ - **The first meeting's close** names `/counterparts` only where a sidebar answers it: with
23
+ the sidebar plugin (installed, on, and with a `counterparts` it accepts), or a
24
+ `counterparts` plugin from before the split. That now includes the npm install beside
25
+ the sidebar plugin.
26
+ - **"Open" now means someone owes an answer.** A memory is marked open only for a question to
27
+ you, a check with a date, or a promise; a bug note, a design note or a fact is kept without
28
+ the open flag. The end-of-session ask says so too.
29
+ - **The end-of-session ask names that session's own open items**, by title, up to five, so
30
+ closing one is a glance at a line rather than a search. A session with nothing open sees the
31
+ ask as before.
32
+ - **Open items nobody has touched in three weeks stop being carried** (an experiment). One with
33
+ no date and not a question you were asked, untouched for 21 lived days, leaves the wake's
34
+ "Still open" and its count, and the nightly reflection stops being offered it. It is not
35
+ closed: recall still finds it, and using it (rating it, drawing on it) or revising it carries
36
+ it again; only seeing it again in a footnote does not. The morning share says how many left,
37
+ once, never the list.
38
+ - **What I believe about something comes up when you mention it.** When a message names a person,
39
+ project or topic I hold beliefs about, the strongest two or three appear in their own short
40
+ block beside the usual footnotes, each with how sure I am and how many memories back it. Rating
41
+ one counts as using it, never as evidence for it.
42
+ - **A project's folder opens with what I hold about the project** (an experiment): a short line of
43
+ its strongest beliefs at the foot of the wake, only when there is room left.
44
+ - **Tags help warm up related memories.** Memories sharing a tag with what a session is using get
45
+ a small head start in recall, beside the links that already do.
46
+ - **Doctor names the builds this store has run.** Each new version, the first time it
47
+ opens the store, notes the day it arrived, and what it writes (memories, the night's
48
+ rows, the log) carries its version, so a later look can say which build did what.
49
+ Doctor's new green Builds line lists the last three. Nothing else changes; a `"build"`
50
+ key now shows wherever a row is printed raw (`--json`, exports, the dashboard's raw rows).
51
+ - **The core from beliefs, built and off.** With `self.CORE_FROM_BELIEFS` on, the night's
52
+ reflection would state as settled in the core only what a well-backed belief about me or
53
+ us says. It is off (a code tunable, not a setting), so nothing about the core changes in
54
+ this release.
55
+ - **For code that embeds Counterparts:** new exports, nothing removed. `counterparts`
56
+ adds `beliefCoreCandidates`, `coreBeliefFloors`, `coreBeliefMiss`, `coreFromBeliefs` and
57
+ `livedSupportDays`; `counterparts/store` adds `BUILD_LOG_PREFIX`, `BUILD_UNKNOWN`,
58
+ `buildLogKeys`, `parseBuildLog`, `readBuildFrom`, `runningBuild`, `setRunningBuild`,
59
+ `setSettingsInForce`, `settingsInForce` and `withBuild`.
60
+
3
61
  ## 0.3.31 — 2026-10-22
4
62
 
5
63
  This release changes the store's format (v13 to v14), so **after installing, quit the dashboard and every open Claude Code session, then start them again**: one left running from before the update keeps the old code against the upgraded store and stops working on it (the dashboard answers with errors) until it is restarted; an older version that opens the store afresh refuses it plainly. The first open saves a copy of your store before upgrading it, and doctor gains one green line saying what the upgrade did. Going back to 0.3.30 is `counterparts rollback` (it puts that copy back; anything written since is set aside, not deleted), then 0.3.30's install and `counterparts connect` as it prints. What you will see: the dashboard has a subjects tab, a page for every person, project, place and topic your memories name, under a tag cloud. Memories can carry a few tags, and each night tidies them and, in a short separate step on a small model, tags memories that have none and sorts cards into person, project, place or topic. The night's reflection and dream start forming beliefs from real memories; nothing shows them in sessions, the wake or the core yet. Related folders can be one project (`counterparts project join`, or a yes when the morning share asks), and craft learned in one folder takes turns in every folder's "Work here"; work from another project needs a slightly stronger match to come up while you talk. Two fixes: one nightly cycle at a time per store, and a name no longer gets two cards (cards already doubled stay doubled for now). The night's tag work and the beliefs are each one switch in the tunables (`schemas.TAGS_NIGHT`, `schemas.BELIEFS_BIRTH`), both on. Store v14, cache v7 unchanged; no wiring change, so `counterparts connect` is not needed after upgrading.
@@ -67,7 +125,7 @@ This release changes the store's format (v13 to v14), so **after installing, qui
67
125
  belief with a memory that fits, note a memory that goes against one, or write a few new
68
126
  ones, each resting on real memories and starting weak. A belief that met more against
69
127
  it than for it can be let go. Beliefs are still not shown in sessions, the wake or the
70
- core. The owner can turn this off with one setting.
128
+ core. Off: `BELIEFS_BIRTH` in the schemas tunables (a code tunable, not a setting).
71
129
  - **Beliefs from the dream, from the moment, and the owner's word.** The dream may now
72
130
  suggest a belief it sees across several memories; it never makes one, and the morning's
73
131
  reflection keeps it or lets it go. A session can write one in the moment, rarely, from
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.31",
3
+ "version": "0.3.32",
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": {
@@ -83,6 +83,9 @@ export interface HostReading {
83
83
  /** The Counterparts Claude Code plugin, when Claude Code records it
84
84
  * installed (`host-wiring.ts#pluginInstall`); absent or null when not. */
85
85
  readonly plugin?: PluginInstallRead | null;
86
+ /** Claude Code records a `counterparts-sidebar@…` install, which needs the
87
+ * plugin (`host-wiring.ts#sidebarPluginRecorded`); absent when not read. */
88
+ readonly sidebarPlugin?: boolean;
86
89
  /** The npm install's marker (`npm-live.ts`) as a directory-flavor plugin
87
90
  * would read it: which halves it would stand down for. Null when there is
88
91
  * none it would believe; absent when not read. */
@@ -340,10 +343,26 @@ export function hostFindings(reading: HostReading): Finding[] {
340
343
  : `ALSO installed as the Claude Code plugin (${plugin.id}), which stands down while this wiring is live`;
341
344
  // KEEP ONE (2026-10-15, as the plugin's own session-start line says it,
342
345
  // `plugin.ts#keepOne`): both ways out, the same memory either way.
346
+ // Beside the counterparts-sidebar plugin (2026-10-20), which needs this one,
347
+ // the plugin is no second install to remove: it is how the sidebar comes
348
+ // (docs/plugin.md "Two plugins"). Standing down, that is the setup we
349
+ // recommend to an npm user who wants the sidebar, so the line is green and
350
+ // asks nothing (2026-10-22, a coordinator call for Mike to review). Only when
351
+ // both really run is it amber, and then the fix never says to uninstall it.
352
+ const forSidebar = plugin !== null && reading.sidebarPlugin === true;
343
353
  const twiceFix =
344
354
  plugin === null
345
355
  ? ""
356
+ : forSidebar
357
+ ? bothRun
358
+ ? readsMarker
359
+ ? `Both run until this install's hooks have run in a session; then the plugin (${plugin.id}) stands down on its own and stays installed for the counterparts-sidebar plugin, which needs it. To keep only the plugin instead, run \`counterparts disconnect\` and restart Claude Code.`
360
+ : `Both run: this build of the plugin (${plugin.id}) does not check for the other install. Keep it installed (the counterparts-sidebar plugin needs it) and update it, \`claude plugin update ${plugin.id}\`, to a build that stands down beside this one; or keep only the plugin: run \`counterparts disconnect\` and restart Claude Code.`
361
+ : ""
346
362
  : `Installed twice; keeping one is simpler, and nothing is lost either way: to keep only the plugin, run \`counterparts disconnect\` and restart Claude Code; to keep only this install, run \`claude plugin uninstall ${plugin.id}\` (or \`/plugin uninstall ${plugin.id}\` inside Claude Code).`;
363
+ // Standing down for the sidebar: nothing to fix, said as it is.
364
+ const sidebarClause =
365
+ plugin === null ? "" : `the Claude Code plugin (${plugin.id}) is installed for the counterparts-sidebar plugin, which needs it, and stands down while this wiring is live`;
347
366
  const mcpClause = reading.mcpRead === false
348
367
  ? ""
349
368
  : reading.mcp
@@ -354,6 +373,9 @@ export function hostFindings(reading: HostReading): Finding[] {
354
373
 
355
374
  if (missing.length === 0 && stale.length === 0 && reading.mcp) {
356
375
  if (plugin !== null) {
376
+ if (forSidebar && !bothRun) {
377
+ return [finding("host", "green", "Claude Code", `connected: ${String(total)} hooks and the memory tools; ${sidebarClause}`, "", data)];
378
+ }
357
379
  return [finding("host", "amber", "Claude Code", `connected: ${String(total)} hooks and the memory tools; ${twiceClause}`, twiceFix, data)];
358
380
  }
359
381
  // THE ONE LINE THE PERSON CAME FOR: is my assistant joined up to this
@@ -16,7 +16,7 @@ import {
16
16
  import type { DreamingSetting } from "../../core/dream/index.js";
17
17
  // The page's own reader, so this line cannot drift from what the wake prints.
18
18
  import { clearedMarker, findPageRow, readSelfPage } from "../../core/self/page.js";
19
- import { coreSupport, pageTrace } from "../../core/self/measures.js";
19
+ import { coreBeliefFloors, coreFromBeliefs, coreSupport, pageTrace } from "../../core/self/measures.js";
20
20
  import type { CoreSupportRow } from "../../core/self/measures.js";
21
21
  import {
22
22
  dayBefore,
@@ -311,6 +311,46 @@ export function selfPageTraceFindings(store: Store): Finding[] {
311
311
  * session-start reading.
312
312
  */
313
313
  export function coreSupportFindings(store: Store): Finding[] {
314
+ return [...coreLaneFindings(store), ...coreBeliefFindings(store)];
315
+ }
316
+
317
+ /**
318
+ * THE CORE FROM BELIEFS (wave 2 lane F, 2026-10-22; `self.CORE_FROM_BELIEFS`):
319
+ * with the switch on, the beliefs about me and us the core reads, what stands
320
+ * behind each (memories, lived days), and what the floors held back. A
321
+ * reading, always green. Off: nothing, so doctor reads as before.
322
+ */
323
+ function coreBeliefFindings(store: Store): Finding[] {
324
+ if (!SELF_TUNABLES.CORE_FROM_BELIEFS) return [];
325
+ const f = coreBeliefFloors();
326
+ const r = coreFromBeliefs(store, store.livedDay(), f);
327
+ const els = r.elements;
328
+ const floors = `strength ${String(f.strength)}+, ${String(f.memories)}+ memories, ${String(f.days)}+ lived days`;
329
+ const held = Object.entries(r.held)
330
+ .filter(([, n]) => n > 0)
331
+ .map(([k, n]) => `${String(n)} by ${k}`)
332
+ .join(", ");
333
+ const range = (pick: (e: (typeof els)[number]) => number): string => {
334
+ const v = els.map(pick);
335
+ const lo = Math.min(...v);
336
+ const hi = Math.max(...v);
337
+ return lo === hi ? String(lo) : `${String(lo)}–${String(hi)}`;
338
+ };
339
+ const what =
340
+ els.length === 0
341
+ ? `none of ${String(r.considered)} ${r.considered === 1 ? "belief" : "beliefs"} about me and us has earned it yet`
342
+ : `${String(els.length)} of ${String(r.considered)} ${r.considered === 1 ? "belief" : "beliefs"} about me and us; memories ${range((e) => e.memories)}, lived days ${range((e) => e.days)}`;
343
+ return [
344
+ finding("core-beliefs", "green", "Core from beliefs", `${what} (floors: ${floors})${held.length > 0 ? `; held back: ${held}` : ""}`, "", {
345
+ elements: els.length,
346
+ considered: r.considered,
347
+ ...r.held,
348
+ rows: els.map((e) => `${e.id}:${String(e.memories)}m/${String(e.days)}d/${e.strength.toFixed(2)}`).join(" "),
349
+ }),
350
+ ];
351
+ }
352
+
353
+ function coreLaneFindings(store: Store): Finding[] {
314
354
  const s = coreSupport(store);
315
355
  const els = s.elements;
316
356
  if (els.length === 0) return [finding("core-support", "green", "Core", "no elements yet", "", { elements: 0 })];
@@ -105,7 +105,7 @@ import {
105
105
  import { TUNABLES, resolveEmbedder, retentionClocks, withEmbedderDefault } from "../config.js";
106
106
  import type { EmbedderSource } from "../config.js";
107
107
  import { MODEL_FILE, STATIC_WEIGHTS_ENV, STATIC_WEIGHTS_PACKAGE, resolveStaticWeights } from "../../core/embed/static.js";
108
- import { DATABASE_FILE, heldExits, readRollbackHold, rollbackHeld } from "../../core/store/index.js";
108
+ import { DATABASE_FILE, heldExits, readRollbackHold, rollbackHeld, runningBuild } from "../../core/store/index.js";
109
109
  // Retention's own reading and its own week, so the Raw transcripts line cannot
110
110
  // promise a different number from the job that does the deleting. READ-ONLY:
111
111
  // `remember/index.ts` re-exports the plan and the readers, never the deleter.
@@ -2022,6 +2022,45 @@ export function writeFieldFindings(store: Store): Finding[] {
2022
2022
  ];
2023
2023
  }
2024
2024
 
2025
+ /**
2026
+ * THE BUILD LOG, informational, never amber or red (2026-10-22, provenance):
2027
+ * the last three builds that opened this store for writing, newest first,
2028
+ * each with the lived day it arrived and any settings it ran with
2029
+ * (`Store#buildLog`). A read after a release splits its rows by these.
2030
+ * Silent on a store no build has logged yet.
2031
+ *
2032
+ * The line leads with the build RUNNING now (`runningBuild`), not the newest
2033
+ * in the log: the log keeps one row per version, so a downgrade to a build it
2034
+ * already holds adds nothing (review of #591: 0.3.30 → 0.3.31 → 0.3.30 left
2035
+ * 0.3.31 newest while new rows were stamped 0.3.30). When the two differ the
2036
+ * line says so.
2037
+ */
2038
+ export function buildLogFindings(store: Store, running: string = runningBuild()): Finding[] {
2039
+ let log: ReturnType<Store["buildLog"]>;
2040
+ try {
2041
+ log = store.buildLog();
2042
+ } catch {
2043
+ return [];
2044
+ }
2045
+ const newest = log.slice(-3).reverse();
2046
+ const head = newest[0];
2047
+ if (head === undefined) return [];
2048
+ const words = newest.map((l) => {
2049
+ const set = l.settings === null || l.settings.length === 0 ? "" : ` (${l.settings.map((s) => `${s.module}.${s.key}=${String(s.value)}`).join(", ")})`;
2050
+ return `${l.build} since lived day ${l.since === null ? "?" : String(l.since)}${set}`;
2051
+ });
2052
+ const earlier = log.length - newest.length;
2053
+ const lead = running === head.build ? `running ${running}` : `running ${running}, newest logged ${head.build}`;
2054
+ return [
2055
+ finding("build-log", "green", "Builds", `${lead}: ${words.join("; ")}${earlier > 0 ? `; ${String(earlier)} earlier` : ""}`, "", {
2056
+ builds: log.length,
2057
+ running,
2058
+ newest: head.build,
2059
+ since: head.since,
2060
+ }),
2061
+ ];
2062
+ }
2063
+
2025
2064
  /**
2026
2065
  * THE OLD-CLAIMS ERA, informational, never amber or red (2026-10-10; decided
2027
2066
  * by Mike, 2026-10-10, loosely held): whether the curve reads old claims at
@@ -3421,6 +3460,8 @@ export function doctorFindings(input: DoctorInput): Finding[] {
3421
3460
  ["write-fields", () => writeFieldFindings(store)],
3422
3461
  // 2026-10-10: the old-claims era — on or off, and how many it reads at today's default (lower, higher).
3423
3462
  ["claims-era", () => claimsEraFindings(store)],
3463
+ // 2026-10-22: which builds wrote this store, and since which lived day. One prefix read.
3464
+ ["build-log", () => buildLogFindings(store)],
3424
3465
  ["recognition-lane", () => recognitionLaneFindings(store)],
3425
3466
  ["contradictions", () => contradictionFindings(store)],
3426
3467
  // Build B (2026-09-28): does anyone read what an index offers in part?
@@ -74,6 +74,7 @@ import { Lifecycle, codeOf, plainContextLine, plainLine } from "../lifecycle.js"
74
74
  import type { LifecycleOptions, PlainLines, SessionInput } from "../lifecycle.js";
75
75
 
76
76
  import { localDate } from "../../core/time.js";
77
+ import { openThread } from "../../core/self/identity.js";
77
78
  import { TUNABLES } from "../config.js";
78
79
  import { TUNABLES as RECALL_TUNABLES } from "../../core/recall/tunables.js";
79
80
  import { SESSION_NOTICE_BUDGET_MS, checkoutIsGraded, doctorFindings, noticeMessage, readCheckout } from "./doctor.js";
@@ -521,10 +522,52 @@ export const PAGE_WRITER_TOOL = "counterparts self_page";
521
522
  */
522
523
  export const RATE_CLAUSE = "`rated` 0–3 each footnote shown since you last wrote, and each `drewOn` id";
523
524
 
524
- export function stopAsk(sessionId: string, chapter: number): string {
525
+ /**
526
+ * WHAT OPEN MEANS, IN THE ASK (2026-10-22, the open-threads brief): the same
527
+ * narrowing as the `unresolved` field's own text (`mcp/tools.ts#UNRESOLVED_PROPERTY`).
528
+ */
529
+ export const OPEN_MEANS = "`unresolved` only when someone owes an answer (a question to them, a check with a date, a promise)";
530
+
531
+ /** How long one open item's title may run in the ask's last line (2026-10-22). */
532
+ const OPEN_TITLE_CHARS = 60;
533
+
534
+ /**
535
+ * The most the ask's open line may run, whole (the review of #592, F5): a
536
+ * title is clipped at `OPEN_TITLE_CHARS` and an id is 16 characters, so five
537
+ * items fit; an item past it is left out, never cut. With the two lines'
538
+ * own pin (720) the whole ask stays under ~1,250 characters.
539
+ */
540
+ export const OPEN_LINE_MAX_CHARS = 520;
541
+
542
+ /**
543
+ * THE ASK NAMES THIS SESSION'S OWN OPEN ITEMS (2026-10-22, the open-threads
544
+ * brief): the open memories it wrote or touched (`Store#openThreadsOfSession`),
545
+ * at most `TUNABLES.STOP_OPEN_MAX`, by title and id — so closing one is an
546
+ * `updates` on a line it can see, not a search. A third line, unnumbered, and
547
+ * only when there is one: with none the ask is its two lines, as before.
548
+ */
549
+ export function openHereLine(open: readonly { readonly id: string; readonly title: string }[]): string | null {
550
+ if (open.length === 0) return null;
551
+ const clip = (t: string): string => {
552
+ const one = t.replace(/\s+/g, " ").trim();
553
+ return one.length <= OPEN_TITLE_CHARS ? one : `${one.slice(0, OPEN_TITLE_CHARS - 1).trimEnd()}…`;
554
+ };
555
+ const head = "Still open from this session — close any now answered with `updates` and `unresolved: false`: ";
556
+ const items: string[] = [];
557
+ for (const o of open) {
558
+ const item = `"${clip(o.title)}" (${o.id})`;
559
+ if (items.length > 0 && head.length + [...items, item].join("; ").length + 1 > OPEN_LINE_MAX_CHARS) break;
560
+ items.push(item);
561
+ }
562
+ return `${head}${items.join("; ")}.`;
563
+ }
564
+
565
+ export function stopAsk(sessionId: string, chapter: number, open: readonly { readonly id: string; readonly title: string }[] = []): string {
566
+ const here = openHereLine(open);
525
567
  return [
526
- `${STOP_ASK_OPENER} 1) hand back what caught your attention since you last wrote, one idea each — what you read, what they said, what happened — with the counterparts session_end tool, session: ${sessionId}. \`handoff\` only if work here is unfinished; \`retireHandoff\` any now done; \`updates\` anything dated or open now done; ${RATE_CLAUSE}. ${PRONOUN_RULE}`,
568
+ `${STOP_ASK_OPENER} 1) hand back what caught your attention since you last wrote, one idea each — what you read, what they said, what happened — with the counterparts session_end tool, session: ${sessionId}. \`handoff\` only if work here is unfinished; \`retireHandoff\` any now done; \`updates\` anything dated or open now done; ${OPEN_MEANS}; ${RATE_CLAUSE}. ${PRONOUN_RULE}`,
527
569
  `2) Write chapter ${String(chapter)} with the counterparts chapter tool, session: ${sessionId}.`,
570
+ ...(here === null ? [] : [here]),
528
571
  ].join("\n");
529
572
  }
530
573
 
@@ -1612,7 +1655,29 @@ export class ClaudeCodeAdapter extends Lifecycle {
1612
1655
  // server binds itself with, so an ask that omitted it would be an
1613
1656
  // invitation the model has no way to accept on this host — and the
1614
1657
  // chapter number is the STORE's, one past what was written.
1615
- return chapter === null ? null : stopAsk(input.sessionId, chapter);
1658
+ return chapter === null ? null : stopAsk(input.sessionId, chapter, this.openHere(input.sessionId));
1659
+ }
1660
+
1661
+ /**
1662
+ * This session's own open items, for the ask's last line (2026-10-22,
1663
+ * `openHereLine`): what the store says it wrote or touched, the flag
1664
+ * confirmed on the prose. Never fails the Stop: none on any error.
1665
+ */
1666
+ private openHere(sessionId: string): { id: string; title: string }[] {
1667
+ const max = TUNABLES.STOP_OPEN_MAX;
1668
+ if (!(max > 0)) return [];
1669
+ try {
1670
+ const store = this.counterpart.store;
1671
+ // What a thread is, the carry's own test (`openThread`: not dreamed, not
1672
+ // settled over, the flag on the prose — the review of #592, F2), asked
1673
+ // of a few more than the cap so one left out does not shorten the list.
1674
+ return store
1675
+ .openThreadsOfSession(sessionId, max * 4)
1676
+ .filter((o) => openThread(store, o.id))
1677
+ .slice(0, max);
1678
+ } catch {
1679
+ return [];
1680
+ }
1616
1681
  }
1617
1682
 
1618
1683
  /**
@@ -61,7 +61,7 @@ import type { EmbedderKind } from "../config.js";
61
61
  import { CONFIG_ENV, CONFIG_FLAG, defaultConfigPath } from "../config-path.js";
62
62
  import { entryScript, parseScriptInvocation, readsHostUserConfig, runtimeOf, runtimePresent, scriptArgs, shellTokens } from "../runtime.js";
63
63
  import type { RuntimeKind } from "../runtime.js";
64
- import { pluginInstall, readOurHook } from "../host-wiring.js";
64
+ import { pluginInstall, readOurHook, sidebarPluginRecorded } from "../host-wiring.js";
65
65
  import type { PluginInstallRead } from "../host-wiring.js";
66
66
  // `preRowsMarkersIn` reads FILENAMES and opens nothing, which is the only
67
67
  // reason a module that promises never to open a parked store may call it —
@@ -586,6 +586,8 @@ export interface HostRead {
586
586
  /** The Counterparts Claude Code plugin, when Claude Code records it
587
587
  * installed (`host-wiring.ts#pluginInstall`), else null. */
588
588
  readonly plugin: PluginInstallRead | null;
589
+ /** A recorded `counterparts-sidebar@…` install (`host-wiring.ts#sidebarPluginRecorded`). */
590
+ readonly sidebarPlugin: boolean;
589
591
  }
590
592
 
591
593
  /** Which of our host entries a runtime row came from: Claude Code's hooks, its
@@ -883,6 +885,7 @@ export function readHost(
883
885
  projectEnv: [...row.projectEnv].sort(),
884
886
  })),
885
887
  plugin: pluginInstall({ home, env, cwd }),
888
+ sidebarPlugin: sidebarPluginRecorded({ home, env, cwd }),
886
889
  };
887
890
  }
888
891
 
@@ -151,6 +151,13 @@ export const TUNABLES = {
151
151
  * own — and nothing here is at the Stop, where §13 G3's one pacer lives.
152
152
  */
153
153
  WRITE_UP_ASKS_PER_DAY: 2,
154
+ /**
155
+ * THE STOP ASK NAMES THIS SESSION'S OWN OPEN ITEMS (2026-10-22, the
156
+ * open-threads brief; a starting point, check 2026-11-05): at most this
157
+ * many, by title and id, the newest touched first, in one line under the
158
+ * ask (`claude-code/hooks.ts#openHereLine`); none, no line. Revert: 0.
159
+ */
160
+ STOP_OPEN_MAX: 5,
154
161
  /**
155
162
  * A plain reminder's handle — the memory's title or first line — is clipped
156
163
  * to this many characters in the line a person reads (2026-09-26). One
@@ -132,7 +132,10 @@ function payloadLine(src: DashboardSource, payload: string | null, style: Style)
132
132
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
133
133
  return truncate(String(parsed), 72);
134
134
  }
135
+ // The row's build stamp (2026-10-22) is not repeated on every line: doctor's
136
+ // Builds line names it, and the raw row keeps it (review of #591).
135
137
  return resolvePayload(src.store, parsed as Record<string, unknown>, 40)
138
+ .filter((p) => p.key !== "build")
136
139
  .map((p) => `${p.key} ${p.value}`)
137
140
  .join(" · ");
138
141
  }
@@ -771,6 +771,13 @@ export const NARRATORS = {
771
771
  const surfaced = idsIn(t, "surfaced");
772
772
  const footnotes = idsIn(t, "footnotes");
773
773
  const turn = n(t, "turn") ?? 0;
774
+ // The beliefs slot (lane E): what the turn's subjects are held to be, shown beside the memories.
775
+ const slot = t.p["beliefs"];
776
+ const held = slot !== null && typeof slot === "object" && Array.isArray((slot as { shown?: unknown }).shown) ? (slot as { shown: unknown[] }).shown.length : 0;
777
+ const heldTail = held === 0 ? "" : `, and I held up ${held === 1 ? "one belief" : `${String(held)} beliefs`} about what you named`;
778
+ if (surfaced.length === 0 && footnotes.length === 0 && held > 0) {
779
+ return calm(`On turn ${turn} no memory rose above the turn's own background, but you named something I hold beliefs about, so I showed ${held === 1 ? "one" : String(held)}.`);
780
+ }
774
781
  if (surfaced.length === 0 && footnotes.length === 0) {
775
782
  return calm(
776
783
  `On turn ${turn} nothing rose above the turn's own background, so I said nothing. Most turns end here, and that is the design.`,
@@ -778,10 +785,10 @@ export const NARRATORS = {
778
785
  }
779
786
  if (surfaced.length === 0) {
780
787
  return calm(
781
- `On turn ${turn} I kept ${nameSome(t, footnotes)} as a footnote — near enough to mention, not near enough to say out loud.`,
788
+ `On turn ${turn} I kept ${nameSome(t, footnotes)} as a footnote — near enough to mention, not near enough to say out loud${heldTail}.`,
782
789
  );
783
790
  }
784
- const tail = footnotes.length === 0 ? "" : `, with ${footnotes.length} more held back as footnotes`;
791
+ const tail = `${footnotes.length === 0 ? "" : `, with ${footnotes.length} more held back as footnotes`}${heldTail}`;
785
792
  return notable(`On turn ${turn} ${nameSome(t, surfaced)} came to mind${tail}.`);
786
793
  },
787
794
  "adapter.recall": (t) => {
@@ -791,6 +798,11 @@ export const NARRATORS = {
791
798
  }
792
799
  const count = n(t, "surfaced") ?? n(t, "count") ?? 0;
793
800
  const bytes = n(t, "bytes") ?? 0;
801
+ // A turn may hand over only the beliefs slot (lane E): its count and bytes say so.
802
+ const beliefs = n(t, "beliefs") ?? 0;
803
+ if (count === 0 && beliefs > 0 && bytes > 0) {
804
+ return calm(`A turn's recall was composed for the host: ${beliefs === 1 ? "one belief" : `${String(beliefs)} beliefs`} about what was named, ${bytes} bytes.`);
805
+ }
794
806
  return calm(
795
807
  count === 0
796
808
  ? `A turn's recall was composed and came to nothing — no bytes handed over.`
@@ -381,16 +381,7 @@ export function pluginInstall(input: {
381
381
  if (id === undefined) return null;
382
382
  const records = plugins[id];
383
383
  const first = Array.isArray(records) ? (records as unknown[]).find(isRecord) : isRecord(records) ? records : undefined;
384
- const files = [claudeUserFiles(input.home, input.env).settings];
385
- if (input.cwd !== null && input.cwd.length > 0) {
386
- files.push(join(resolve(input.cwd), ".claude", "settings.json"), join(resolve(input.cwd), ".claude", "settings.local.json"));
387
- }
388
- let enabled = true;
389
- for (const file of files) {
390
- const settings = readObject(file);
391
- const on = settings === null ? undefined : settings["enabledPlugins"];
392
- if (isRecord(on) && typeof on[id] === "boolean") enabled = on[id] as boolean;
393
- }
384
+ const enabled = pluginEnabled(id, input);
394
385
  const installPath = first !== undefined && typeof first["installPath"] === "string" ? first["installPath"] : null;
395
386
  return {
396
387
  id,
@@ -404,6 +395,114 @@ export function pluginInstall(input: {
404
395
  };
405
396
  }
406
397
 
398
+ /** Whether the settings Claude Code reads for a session in `cwd` leave plugin
399
+ * `id` on: the user settings, then the project's and its local ones, the last
400
+ * that names it wins; on when none does. */
401
+ function pluginEnabled(id: string, input: { readonly home: string; readonly env: Record<string, string | undefined>; readonly cwd?: string | null }): boolean {
402
+ const files = [claudeUserFiles(input.home, input.env).settings];
403
+ if (input.cwd !== undefined && input.cwd !== null && input.cwd.length > 0) {
404
+ files.push(join(resolve(input.cwd), ".claude", "settings.json"), join(resolve(input.cwd), ".claude", "settings.local.json"));
405
+ }
406
+ let enabled = true;
407
+ for (const file of files) {
408
+ const settings = readObject(file);
409
+ const on = settings === null ? undefined : settings["enabledPlugins"];
410
+ if (isRecord(on) && typeof on[id] === "boolean") enabled = on[id] as boolean;
411
+ }
412
+ return enabled;
413
+ }
414
+
415
+ /** `a` is `b` or later (`x.y.z`, a `-suffix` ignored); false when either is not a version. */
416
+ function versionAtLeast(a: string, b: string): boolean {
417
+ const parse = (v: string): number[] | null => {
418
+ const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v.trim());
419
+ return m === null ? null : [Number(m[1]), Number(m[2]), Number(m[3])];
420
+ };
421
+ const x = parse(a);
422
+ const y = parse(b);
423
+ if (x === null || y === null) return false;
424
+ for (let i = 0; i < 3; i++) if (x[i] !== y[i]) return x[i]! > y[i]!;
425
+ return true;
426
+ }
427
+
428
+ /**
429
+ * Will Claude Code load a `counterparts-sidebar@…` install? The sidebar
430
+ * plugin (2026-10-20, docs/plugin.md "Two plugins") depends on the
431
+ * `counterparts` plugin, so advice to uninstall that one has to know, and the
432
+ * first meeting's close names `/counterparts` only where it answers. As
433
+ * {@link pluginInstall} reads the record: recorded, and left on by the
434
+ * settings for `cwd` (`enabledPlugins`); and, as Claude Code checks a
435
+ * dependency, its installed copy's `dependencies` met by the `counterparts`
436
+ * install recorded beside it, at a version in range. An install refused for
437
+ * an older `counterparts` stays recorded (measured, tools/plugin-loop/split.sh
438
+ * 4b) but loads nothing. Scope and project path are not checked, as
439
+ * `pluginInstall` does not check them. READ-ONLY; false when the record
440
+ * can't be read.
441
+ */
442
+ export function sidebarPluginRecorded(input: {
443
+ readonly home: string;
444
+ readonly env: Record<string, string | undefined>;
445
+ readonly cwd?: string | null;
446
+ }): boolean {
447
+ const moved = (input.env["CLAUDE_CONFIG_DIR"] ?? "").trim();
448
+ const configDir = moved.length > 0 ? moved : join(input.home, ".claude");
449
+ const cacheRoot = (input.env["CLAUDE_CODE_PLUGIN_CACHE_DIR"] ?? "").trim();
450
+ const pluginsRoot = cacheRoot.length > 0 ? cacheRoot : join(configDir, "plugins");
451
+ const plugins = readObject(join(pluginsRoot, "installed_plugins.json"))?.["plugins"];
452
+ if (!isRecord(plugins)) return false;
453
+ const id = Object.keys(plugins).find((k) => k.startsWith("counterparts-sidebar@"));
454
+ if (id === undefined || !pluginEnabled(id, input)) return false;
455
+ const first = (v: unknown): Record<string, unknown> | undefined => (Array.isArray(v) ? (v as unknown[]).find(isRecord) : isRecord(v) ? v : undefined);
456
+ const record = first(plugins[id]);
457
+ const installPath = record !== undefined && typeof record["installPath"] === "string" ? record["installPath"] : "";
458
+ const manifest = installPath.length > 0 ? readObject(join(installPath, ".claude-plugin", "plugin.json")) : null;
459
+ // No copy to read: trust the record, as before (a dependency can't be checked).
460
+ if (manifest === null) return true;
461
+ const deps = Array.isArray(manifest["dependencies"]) ? (manifest["dependencies"] as unknown[]) : [];
462
+ for (const d of deps) {
463
+ const name = typeof d === "string" ? d : isRecord(d) && typeof d["name"] === "string" ? d["name"] : null;
464
+ if (name !== NPM_MCP_NAME) continue;
465
+ const coreId = Object.keys(plugins).find((k) => k.startsWith(`${NPM_MCP_NAME}@`));
466
+ if (coreId === undefined || !pluginEnabled(coreId, input)) return false;
467
+ const range = isRecord(d) && typeof d["version"] === "string" ? d["version"].trim() : "";
468
+ const floor = /^>=\s*(\d+\.\d+\.\d+)$/.exec(range)?.[1];
469
+ if (floor === undefined) continue;
470
+ const coreRecord = first(plugins[coreId]);
471
+ const coreVersion = coreRecord !== undefined && typeof coreRecord["version"] === "string" ? coreRecord["version"] : "";
472
+ if (!versionAtLeast(coreVersion, floor)) return false;
473
+ }
474
+ return true;
475
+ }
476
+
477
+ /**
478
+ * Is a sidebar here? Either Claude Code will load the `counterparts-sidebar`
479
+ * plugin ({@link sidebarPluginRecorded}), or the `counterparts` plugin loaded
480
+ * from `pluginRoot` (null: the one Claude Code records, if any and on) draws
481
+ * it itself, as the one plugin did before the split: its `hooks/hooks.json`
482
+ * names a hooks module (the full flavor's, and the repository's own for
483
+ * `--plugin-dir`; core's build drops `modules`). For the first meeting's close, which names `/counterparts`
484
+ * only where there is a sidebar to open (2026-10-22). READ-ONLY; never throws.
485
+ */
486
+ export function sidebarBeside(input: {
487
+ readonly home: string;
488
+ readonly env: Record<string, string | undefined>;
489
+ readonly pluginRoot: string | null;
490
+ readonly cwd?: string | null;
491
+ }): boolean {
492
+ try {
493
+ if (sidebarPluginRecorded({ home: input.home, env: input.env, cwd: input.cwd ?? null })) return true;
494
+ // No plugin root (the npm install's server): the counterparts plugin
495
+ // Claude Code records, when the settings leave it on.
496
+ const recorded = input.pluginRoot === null ? pluginInstall({ home: input.home, env: input.env, cwd: input.cwd ?? null }) : null;
497
+ const root = (input.pluginRoot ?? (recorded?.enabled === true ? recorded.installPath : null) ?? "").trim();
498
+ if (root.length === 0) return false;
499
+ const modules = readObject(join(root, "hooks", "hooks.json"))?.["modules"];
500
+ return Array.isArray(modules) && modules.length > 0;
501
+ } catch {
502
+ return false;
503
+ }
504
+ }
505
+
407
506
  /**
408
507
  * The npm install's wiring as Claude Code will see it for a session in `cwd`:
409
508
  * our hook entries in the user, project and local settings files, and a
@@ -1211,6 +1211,8 @@ export class Lifecycle implements HostLifecycle {
1211
1211
  reason: decision.reason,
1212
1212
  surfaced: decision.surfaced.length,
1213
1213
  footnotes: decision.footnotes.length,
1214
+ // The beliefs slot's lines (lane E): a turn may hand over these alone.
1215
+ beliefs: decision.beliefs?.shown.length ?? 0,
1214
1216
  bytes: decision.bytes,
1215
1217
  budget: decision.budgetBytes,
1216
1218
  observer: decision.observer,
@@ -19,7 +19,7 @@ export const SERVER_NAME = "counterparts";
19
19
  * host decides whether to trust what follows. Read from a constant rather than
20
20
  * from disk so the server opens no file to answer its first message.
21
21
  */
22
- export const SERVER_VERSION = "0.3.31";
22
+ export const SERVER_VERSION = "0.3.32";
23
23
 
24
24
  /**
25
25
  * THE ONE LINE EVERY TOOL ANSWERS WITH when the store on disk is a schema AHEAD
@@ -88,7 +88,9 @@ import { randomUUID } from "node:crypto";
88
88
  import { homedir } from "node:os";
89
89
 
90
90
  import { CODE_TAB_ENTRYPOINT, DEFAULT_HOST, DESKTOP_HOST, DESKTOP_SCOPE, claudeCodeEnvMarker, hostOfClient, isPseudoScope, wordingFor } from "../hosts.js";
91
+ import { PLUGIN_ROOT_ENV } from "../plugin.js";
91
92
  import type { InstallRoute } from "../plugin.js";
93
+ import { sidebarBeside } from "../host-wiring.js";
92
94
  import {
93
95
  MEET_STEPS,
94
96
  STYLE_CHOICES,
@@ -1427,10 +1429,20 @@ export class McpServer {
1427
1429
  this.emit("mcp.meet.step", undefined, { step, stored: null });
1428
1430
  const view = { recorded: step, ...onboardingView(store) };
1429
1431
  // Unbound, the close still comes; the write-up names the id to pass.
1432
+ // The close names `/counterparts` only where a sidebar answers it, the
1433
+ // plugin install's or the npm one's: the counterparts-sidebar plugin,
1434
+ // or a counterparts plugin from before the split. Never in Desktop.
1430
1435
  const next = finishText({
1431
1436
  name: this.counterpart.ownerDisplayName(),
1432
1437
  dreaming: this.counterpart.dreams.setting(),
1433
- plugin: this.install === "plugin" && !this.desktop,
1438
+ sidebar:
1439
+ !this.desktop &&
1440
+ sidebarBeside({
1441
+ home: homedir(),
1442
+ env: this.env,
1443
+ pluginRoot: this.install === "plugin" ? (this.env[PLUGIN_ROOT_ENV] ?? null) : null,
1444
+ cwd: this.env["CLAUDE_PROJECT_DIR"] ?? null,
1445
+ }),
1434
1446
  session: writeUp ? session : "<your session id, as the wake names it>",
1435
1447
  });
1436
1448
  return { content: [{ type: "text", text: next }], structuredContent: { ...view, next } };