counterparts 0.3.38 → 0.3.40

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.40 — 2026-10-29
4
+
5
+ Open items nobody has touched for two weeks are now parked: they leave the wake's "Still open", which says how many are parked (`· 12 parked`), and nothing is deleted or closed. `recall "still open"` still lists every one (the parked last, marked), a question about one still finds it, and using one again brings it back. Items with a date still to come, a `settlesWhen`, or `status: "asked"` (a question or request still waiting) are never parked. The first wake after upgrading may count a lot of parked items at once on a store that has gathered many; that's the backlog of two-week-old threads, all still there. `counterparts doctor` has an Open items line. No store-format change (store v15, cache v7), and nothing to run after upgrading beyond the usual restart of the dashboard and every Claude Code session. Going back to 0.3.39 needs no store restore: `counterparts disconnect`, 0.3.39's install, then `counterparts connect`.
6
+
7
+ - **Open items nobody has touched for two weeks are parked.** An open item untouched for 14
8
+ lived days (it was 21) leaves the wake's "Still open", and the list's count line ends with
9
+ how many are parked (`· 12 parked`). Parked isn't closed: `recall "still open"` lists parked
10
+ items last, marked, a question about the thing still finds one, and using one again (opening
11
+ it and working with it, quoting it, revising it) brings it back. Items with a date still
12
+ to come (or a week past it, or repeating), or that say what would settle them
13
+ (`settlesWhen`), are never parked; a one-off date that has gone by parks like the rest. `counterparts doctor` has an
14
+ Open items line counting open, carried and parked.
15
+ - **The wake says how many open items are parked, even when "Still open" is short or empty.**
16
+ When "Still open" lists everything it carries, it now ends with `(3 parked; recall "still
17
+ open" lists them)`; when nothing is carried at all it reads `Still open: nothing current · 3
18
+ parked (recall "still open" lists them)`. The one-line summary a tight wake folds its lanes
19
+ into keeps the parked count too. Nothing is added when nothing is parked.
20
+
21
+ ## 0.3.39 — 2026-10-28
22
+
23
+ Counterparts now tells you when an update is out: once a day it asks the npm registry for the newest version number (nothing about you or your memory goes with it), and when you're a few releases behind, or a release is worth taking, your Claude says so once, with the steps for how you installed. **To turn it off,** tell your Claude to stop reminding you about updates, or set `"updateCheck": false` in `~/.counterparts/claude-code.json`, or `COUNTERPARTS_UPDATE_CHECK=off`; it never runs under Claude Code's `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`. A store now keeps its id after its first week (the session-start cleanup no longer deletes its handle salt). When `claude` isn't on PATH, the `claude mcp add …` line to paste sits on one line of its own. No store-format change (store v15, cache v7), and nothing to run after upgrading beyond the usual restart of the dashboard and every Claude Code session. Going back to 0.3.38 needs no store restore: `counterparts disconnect`, 0.3.38's install, then `counterparts connect`.
24
+
25
+ - **Counterparts now tells you when an update is out.** Once a day, it asks the npm registry
26
+ (`registry.npmjs.org`) for the newest version number. The request carries no memory, no
27
+ conversation, no identifier, not even which version you have; because it's daily, npm
28
+ can see your computer's network address and that Counterparts checked that day. When
29
+ you're a few releases behind, or a release is worth taking, your Claude mentions it once,
30
+ with the steps for how you installed. **To turn it off, tell your Claude to stop
31
+ reminding you about updates, or set `"updateCheck": false` in
32
+ `~/.counterparts/claude-code.json` (or `COUNTERPARTS_UPDATE_CHECK=off`).** It doesn't
33
+ run under Claude Code's `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`; a copy that checks
34
+ nothing says once, after 30 days, that a newer one may be out. `counterparts doctor` has
35
+ an Updates line.
36
+ - **Plugin users are offered Claude Code's own auto-update, once.** /plugin → Marketplaces →
37
+ counterparts → Enable auto-update keeps Counterparts current without asking.
38
+ - **The plugin's update step is now Update marketplace.** Fix lines say /plugin →
39
+ Marketplaces → counterparts → Update marketplace, which refreshes the listing before it
40
+ updates, instead of Installed → Update now.
41
+ - **npm lines say `@latest`.** Doctor's and the wake's npm steps, and the install lines in the README,
42
+ QUICKSTART and docs, say `npm install -g counterparts@latest`: on Node 20 the bare form quietly
43
+ installs 0.3.10. After the bun installer, the docs say to open a new terminal.
44
+ - **A store keeps its id after its first week.** The session-start cleanup removed the store's handle salt
45
+ (`sessions/expansions.salt`) seven days after it was made, so the next session made a new one: the store's id
46
+ changed (the sidebar compares it) and earlier handle lookups no longer matched. The salt is now kept however old
47
+ it is. A store that already lost its salt has nothing to recover: the one it made since is kept from now on, and
48
+ handle lookups only last a day anyway.
49
+ - When `claude` isn't on PATH, setup and connect print the `claude mcp add …` line to paste on one line of its own, never wrapped, so pasting it works on a narrow terminal (it's the same line doctor prints). The `claude mcp remove …` line disconnect prints in the same case is on its own line too.
50
+
3
51
  ## 0.3.38 — 2026-10-28
4
52
 
5
53
  Dreams can be found: ask about a dream, or about something only a dream held, and recall shows it labelled `[dream]`, told as dreamed and never as lived; `recall "last dream"` reads the newest one whole. An open item can say what would settle it ("settles when …"), and the night closes a few when that plainly happened. The wake says so when search by meaning is switched on but can't run, with the fix for how you installed, and an open window that meets a memory another window's newer Counterparts upgraded says whether to reload or update. A nightly run that fails now records what Claude Code said, so the next failure can be read. Short check-ins are written up by the next night, and "Last here" names the newest session. **Privacy:** your store is now readable by your account alone (folders 700, files 600, tightened the first time this version writes to it), and `counterparts connect` adds one `deniedMcpServers` entry to `~/.claude/settings.json` so Claude Code never loads Counterparts Online beside this install. **Run `counterparts connect` once after upgrading from npm** to add that entry: until then doctor's new Online line reads amber. No store-format change (store v15, cache v7). Going back to 0.3.37 needs no store restore: `counterparts disconnect`, 0.3.37's install, then `counterparts connect`. Restart the dashboard and every Claude Code session afterwards so the long-running memory server and dashboard load the new version.
package/README.md CHANGED
@@ -15,11 +15,12 @@ macOS and Linux; Windows not yet supported.
15
15
 
16
16
  ```
17
17
  curl -fsSL https://bun.sh/install | bash # if you don't have bun
18
+ # then open a new terminal
18
19
  bun add -g counterparts
19
20
  counterparts
20
21
  ```
21
22
 
22
- With Node instead: `npm install -g counterparts`, then `counterparts`. Whichever runtime
23
+ With Node instead: `npm install -g counterparts@latest`, then `counterparts`. Whichever runtime
23
24
  runs the setup is the one Claude Code's hooks and memory tools are wired to.
24
25
 
25
26
  `counterparts` walks you through setup: your name and connecting Claude Code. No API
@@ -3,11 +3,12 @@
3
3
  ## Install
4
4
 
5
5
  You need [bun](https://bun.sh) 1.3 or newer, or [Node](https://nodejs.org) 22.15 or newer,
6
- on macOS or Linux. With Node, install with `npm install -g counterparts` instead of the
6
+ on macOS or Linux. With Node, install with `npm install -g counterparts@latest` instead of the
7
7
  `bun add` line below; the rest is the same.
8
8
 
9
9
  ```
10
10
  curl -fsSL https://bun.sh/install | bash # if you don't have bun
11
+ # then open a new terminal
11
12
  bun add -g counterparts
12
13
  counterparts --version
13
14
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.38",
3
+ "version": "0.3.40",
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": {
@@ -23,6 +23,14 @@
23
23
  "bun": ">=1.3.0",
24
24
  "node": ">=22.15.0"
25
25
  },
26
+ "counterparts": {
27
+ "updates": {
28
+ "tellBelow": null,
29
+ "urgentBelow": null,
30
+ "tellBehind": 3,
31
+ "plugin": true
32
+ }
33
+ },
26
34
  "bin": {
27
35
  "counterparts": "./src/adapters/cli/bin/counterparts.mjs",
28
36
  "counterparts-hook": "./src/adapters/claude-code/bin/hook.mjs",
@@ -2779,3 +2779,47 @@ in its notice slot (`mcp/bin/serve.ts#desktopWakeNotice`).
2779
2779
  `resolveStaticWeights` looks. The table is "found" only with both files, as the loader needs.
2780
2780
  `stopped` points at doctor (`/counterparts:doctor`, or `counterparts doctor` in a terminal).
2781
2781
  - **Not covered**: `held` and `cache-ahead` (the store withdrawing the channel) stay doctor's.
2782
+
2783
+ ## 2026-10-28 — the daily update check and its lines (U1b)
2784
+
2785
+ The design is `~/counterparts-notes/2026-10-27-briefs/U1-design-note.md` rev 2; the code is
2786
+ `../update-check.ts` (a leaf: the worker, this hook, Desktop's server and the MCP `scope` tool
2787
+ all use it).
2788
+ - **The request lives in the worker**, as step 6 after `counterpart.close()`, beside the
2789
+ sidebar's file. "Stop" is read from the store before the close. No hook ever makes it.
2790
+ - **A timer of its own, not `AbortSignal.timeout`.** Under Node that timer is unref'd, so a
2791
+ request holding nothing else open let the loop drain before the limit fired (the node smoke
2792
+ test caught it). `setTimeout` + `AbortController`, cleared in `finally`.
2793
+ - **"Stop reminding me" is the whole switch, not a mute** (builder's call on Mike's Q4). The
2794
+ /privacy draft says "tell your Claude to stop checking for updates", so it stops the request
2795
+ too. It is `scope`'s `updates: "off"`, one store meta key (`adapter.update.check`), so the
2796
+ worker, every wake and doctor see it wherever they run; no process rewrites
2797
+ `claude-code.json` (a bad write there is observer, memory off).
2798
+ - **Differs from the note:** a person who said no (config key, telling their Claude, the env
2799
+ switch) gets no age line either. The note kept it for the off switch; Mike's Q4 ("stop
2800
+ reminding me") wins. Only Claude Code's no-traffic switch, the directory flavor and a check
2801
+ failing for 14 days get it.
2802
+ - **"Not on the meeting day"** is the day the meeting was last offered
2803
+ (`lastOffer(store)?.on === today`). Not "while the meeting is pending" (review of #672):
2804
+ `offered`/`later` outlive the offer days, so a person who put the meeting off never heard of
2805
+ an update, urgent included. A wake that makes the offer (or a re-offer) counts too
2806
+ (`offerDue`, re-check of #672): the offer is recorded only after the wake is built, so a fresh
2807
+ install's first wake otherwise carried "Enable auto-update" beside the meeting.
2808
+ - **An urgent day is the urgent line's alone**: a second window that day gets no tell/behind.
2809
+ - **Review of #672, the rest.** At most one request a day, failures included (a failed day tries
2810
+ again the next; doctor's amber counts failed days in a row, from the third). A U1 line is
2811
+ composed only where it fits: the wake, the lines above it and itself `UPDATE_ROOM_MARGIN`
2812
+ (600 bytes) under the host's ceiling; otherwise it is not claimed and the next wake says it.
2813
+ The urgent line's days spent, the release is told once more as an ordinary line. Desktop's
2814
+ long-running server says no update line while the package on disk differs from what it
2815
+ loaded. The worker reads "stop" fail-closed. The age line is said once per copy, softly.
2816
+ - **`counterparts start-fresh` does not carry the "stop"** (`adapter.update.check` is store meta,
2817
+ and start-fresh carries no store meta across). After start-fresh,
2818
+ a person who had said stop says it again, or sets `"updateCheck": false`.
2819
+ - **Once-ness** is one meta key (`adapter.update.told`) claimed with `updateMeta`, as the
2820
+ older-windows line is; the worker's try latches are files under `updates/` beside the
2821
+ configuration (it has no store open by then).
2822
+ - **Unverified:** Update marketplace vs Update now (no throwaway-home run yet); whether
2823
+ `known_marketplaces.json` carries `autoUpdate` at the default; which marketplace the
2824
+ directory listing lands in (`claude-community` and `@synced` are both handled off the copy's
2825
+ own path).
@@ -84,7 +84,8 @@ import { dataDir, describeGuardRefusal } from "../../../core/store/index.js";
84
84
  import type { Store } from "../../../core/store/index.js";
85
85
  import { hostSessionEvidence, installedVersion, writeUpSources } from "../../sessions.js";
86
86
  import { openLog } from "../../log/index.js";
87
- import { BINARY } from "../../runtime.js";
87
+ import { BINARY, TRANSPILED } from "../../runtime.js";
88
+ import { installRoute } from "../../plugin.js";
88
89
  import { usePrivateUmask } from "../../private-umask.js";
89
90
  import type { Binary } from "../../runtime.js";
90
91
 
@@ -106,6 +107,8 @@ import { DATA_DIR_ENV, SCOPE_ENV, SESSION_ENV, WATCHDOG_ENV } from "../../spawn.
106
107
  import { backfillVectors, laggedSemantic } from "../vectors.js";
107
108
  import type { BackfillReport, LagReport } from "../vectors.js";
108
109
  import { removeSidebarStatus, sidebarInstalled, writeSidebarStatus } from "../../sidebar-status.js";
110
+ import { askedOff, claudeAutoUpdate, pluginMarket, runUpdateCheck } from "../../update-check.js";
111
+ import type { FetchLike, UpdateCheckReport } from "../../update-check.js";
109
112
  import type { SidebarWrite } from "../../sidebar-status.js";
110
113
  import { runSnapshot } from "../../snapshots.js";
111
114
  import type { SnapshotRunReport } from "../../snapshots.js";
@@ -158,6 +161,9 @@ export interface RunReport {
158
161
  /** The sidebar's status file (`adapters/sidebar-status.ts`), written after the
159
162
  * store closed; absent when the run was not asked to (no configuration path). */
160
163
  readonly sidebar?: SidebarWrite;
164
+ /** The daily update check (`adapters/update-check.ts`), after the store
165
+ * closed; absent when the run was not asked to (no configuration path). */
166
+ readonly updates?: UpdateCheckReport;
161
167
  }
162
168
 
163
169
  /** What the retention step came to on one worker run. */
@@ -329,6 +335,17 @@ export async function runOnce(input: {
329
335
  /** The configuration this run read: the sidebar's status file is written
330
336
  * beside it once the run is done (`adapters/sidebar-status.ts`). Absent: none. */
331
337
  sidebarConfigPath?: string;
338
+ /** THE DAILY UPDATE CHECK (U1b): the configuration this run read (its
339
+ * `updates.json` goes beside it), the fetch to make the one request with,
340
+ * and the environment its switches are read from. Absent: no check — a
341
+ * test, an embedder, or the directory flavor (`runtime.ts#TRANSPILED`). */
342
+ updateCheck?: {
343
+ readonly configPath: string;
344
+ readonly fetch: FetchLike;
345
+ readonly env: Record<string, string | undefined>;
346
+ /** Claude Code keeps this plugin updated itself: no request. */
347
+ readonly autoUpdate?: boolean;
348
+ };
332
349
  onEvent?: (name: string, data: Record<string, string | number | boolean | null>) => void;
333
350
  }): Promise<RunReport> {
334
351
  const { config } = input;
@@ -367,6 +384,10 @@ export async function runOnce(input: {
367
384
  // or a replay with a pinned date would dedup against the wall clock instead.
368
385
  // The person's day, in the store's zone (docs/time.md; UTC before 2026-09-25).
369
386
  const today = input.date ?? counterpart.store.today();
387
+ // Read now, while the store is open: the update check runs after `close()`
388
+ // (it needs no store, and holds none open across its network wait).
389
+ // Fail closed: a store that will not say whether the person said stop is read as stop.
390
+ const updatesAsked = input.updateCheck === undefined ? false : askedOff(counterpart.store, { failClosed: true });
370
391
 
371
392
  let lag: LagReport | null = null;
372
393
  let backfill: BackfillReport | null = null;
@@ -577,7 +598,31 @@ export async function runOnce(input: {
577
598
  });
578
599
  emit("runner.sidebar", { written: sidebar.written, reason: sidebar.reason, bytes: sidebar.bytes, ms: sidebar.ms });
579
600
  }
580
- return { ...result, snapshot: snapshotReport, retention: retentionReport, ...(sidebar === undefined ? {} : { sidebar }) };
601
+ // 6. THE DAILY UPDATE CHECK (U1b, 2026-10-28), after the store closed and
602
+ // beside the sidebar's file: at most one GET of npm's `/latest` a day,
603
+ // carrying nothing about the person (`adapters/update-check.ts`). It never
604
+ // throws, and the watchdog's signal ends it with the run.
605
+ let updates: UpdateCheckReport | undefined;
606
+ if (input.updateCheck !== undefined) {
607
+ updates = await runUpdateCheck({
608
+ configPath: input.updateCheck.configPath,
609
+ config,
610
+ asked: updatesAsked,
611
+ env: input.updateCheck.env,
612
+ date: today,
613
+ fetch: input.updateCheck.fetch,
614
+ ...(input.signal === undefined ? {} : { signal: input.signal }),
615
+ ...(input.updateCheck.autoUpdate === true ? { autoUpdate: true } : {}),
616
+ });
617
+ emit("runner.updates", { reason: updates.reason, switch: updates.switch, code: updates.code ?? null, latest: updates.latest ?? null });
618
+ }
619
+ return {
620
+ ...result,
621
+ snapshot: snapshotReport,
622
+ retention: retentionReport,
623
+ ...(sidebar === undefined ? {} : { sidebar }),
624
+ ...(updates === undefined ? {} : { updates }),
625
+ };
581
626
  }
582
627
 
583
628
  /**
@@ -737,6 +782,9 @@ async function main(): Promise<void> {
737
782
  ...(pinnedScope() === null ? {} : { scope: pinnedScope() as string }),
738
783
  // Only where the sidebar is installed (the plugin); otherwise an old file goes.
739
784
  ...(sidebarWanted ? { sidebarConfigPath: choice.path } : {}),
785
+ // The update check: never in the directory flavor, which reads nothing
786
+ // of Claude Code's and sends nothing anywhere (`runtime.ts#TRANSPILED`).
787
+ ...(TRANSPILED ? {} : { updateCheck: workerUpdateCheck(choice.path) }),
740
788
  onEvent: (name, data) => log.event({ name, data }),
741
789
  });
742
790
  log.end(report.reason, { swept: report.swept, minted: report.minted, code: report.code });
@@ -748,6 +796,18 @@ async function main(): Promise<void> {
748
796
  }
749
797
  }
750
798
 
799
+ /**
800
+ * What this process's update check needs: the configuration's path, the
801
+ * runtime's own `fetch`, this environment, and whether Claude Code keeps this
802
+ * plugin updated itself (read only for a plugin copy).
803
+ */
804
+ function workerUpdateCheck(configPath: string): NonNullable<Parameters<typeof runOnce>[0]["updateCheck"]> {
805
+ const env = process.env;
806
+ const market = installRoute(env) === "plugin" ? pluginMarket({ home: homedir(), env }) : null;
807
+ const autoUpdate = market !== null && market !== "synced" && claudeAutoUpdate({ home: homedir(), env, market });
808
+ return { configPath, fetch: (url, init) => fetch(url, init), env, ...(autoUpdate ? { autoUpdate: true } : {}) };
809
+ }
810
+
751
811
  /** One worker run, then exit — what this file does as a script, and what the
752
812
  * single binary's `runner` mode calls. */
753
813
  export function start(): void {
@@ -14,6 +14,7 @@ import {
14
14
  import type { EventRow } from "../../core/store/index.js";
15
15
  import { BUSY_TIMEOUT_MS, journalModeOf } from "../../core/store/db.js";
16
16
  import { JOURNAL_COPY_FAILED_EVENT, JOURNAL_COPY_WRITTEN_EVENT } from "../../core/self/journal-file.js";
17
+ import { SELF_TUNABLES, STILL_OPEN_HANDLE, openCarry } from "../../core/self/index.js";
17
18
  // The same vocabulary the hook's stand-down uses, so the terminal and the
18
19
  // console cannot end up with two answers to "why did it not open".
19
20
  import { describeFault, faultPath, faultId } from "./standdown.js";
@@ -386,3 +387,30 @@ export function chapterSummaryFindings(store: Store): Finding[] {
386
387
  ),
387
388
  ];
388
389
  }
390
+
391
+ /**
392
+ * OPEN ITEMS, CARRIED AND PARKED (P2, 2026-10-28; roadmap 10-28, lightly
393
+ * held): how many open threads the store holds, how many the wake's "Still
394
+ * open" carries, and how many are parked — untouched `OPEN_CARRY_DAYS` lived
395
+ * days with no date and no `settlesWhen` (`self/identity.ts#openCarry`, the
396
+ * one rule). Green and informational: parking is not a fault, and nothing is
397
+ * closed by it. Silent with no open thread. One read of the open rows.
398
+ */
399
+ export function openItemsFindings(store: Store): Finding[] {
400
+ const days = SELF_TUNABLES.OPEN_CARRY_DAYS;
401
+ const carry = openCarry(store, store.livedDay(), days, SELF_TUNABLES.OPEN_CARRY_GLIMPSE_TOUCH);
402
+ const carried = carry.carried.length;
403
+ const parked = carry.notCarried.size;
404
+ const open = carried + parked;
405
+ if (open === 0) return [];
406
+ return [
407
+ finding(
408
+ "open-items",
409
+ "green",
410
+ "Open items",
411
+ `${String(open)} open: ${String(carried)} carried in Still open, ${String(parked)} parked (untouched ${String(days)}+ lived days; not closed, and recall "${STILL_OPEN_HANDLE}" lists them)`,
412
+ "",
413
+ { open, carried, parked, days },
414
+ ),
415
+ ];
416
+ }
@@ -119,13 +119,27 @@ import { CLAIMS_DIR, claimsSetAside } from "./claim.js";
119
119
  import type { AdapterConfig } from "../config.js";
120
120
  import { LOG_DAYS, logReading } from "../log/index.js";
121
121
  import { finding, tilde, payloadOf, str, num, off, newestRows, undetermined } from "./doctor-finding.js";
122
- import { PLUGIN_TABLE_UPDATE, PLUGIN_UPDATE, RELOAD_STEP, byRoute, npmTableCommand, tableOnDisk } from "./doctor-meaning.js";
122
+ import { PLUGIN_TABLE_UPDATE, PLUGIN_UPDATE, RELOAD_STEP, byRoute, npmTableCommand, npmUpdateCommand, tableOnDisk } from "./doctor-meaning.js";
123
123
  import { newerStoreWords } from "../update-words.js";
124
124
  import { installedVersion } from "../sessions.js";
125
+ import { TRANSPILED } from "../runtime.js";
126
+ import {
127
+ NONESSENTIAL_TRAFFIC_ENV,
128
+ UPDATE_CHECK_ENV,
129
+ askedOff,
130
+ installedForRoute,
131
+ knownLatestFor,
132
+ pluginMarket,
133
+ readUpdateState,
134
+ updateSteps,
135
+ updateSwitch,
136
+ versionBelow,
137
+ } from "../update-check.js";
138
+ import type { UpdateSwitch } from "../update-check.js";
125
139
  import type { Finding } from "./doctor-finding.js";
126
140
  import { checkoutFindings } from "./doctor-checkout.js";
127
141
  import type { CheckoutReading } from "./doctor-checkout.js";
128
- import { openFindings, journalFindings, journalCopyFindings, chapterSummaryFindings } from "./doctor-open.js";
142
+ import { openFindings, journalFindings, journalCopyFindings, chapterSummaryFindings, openItemsFindings } from "./doctor-open.js";
129
143
  import { aheadWriter } from "./standdown.js";
130
144
  import type { OpenReading, MigrationReading } from "./doctor-open.js";
131
145
  import {
@@ -755,7 +769,7 @@ function withdrawnFinding(input: DoctorInput): Finding | null {
755
769
  "amber",
756
770
  RECALL_TITLE,
757
771
  `off in this process — the store's cache was written by a newer Counterparts (cache v${v.found}; this build reads v${v.expected}). Recall still matches on words, but may miss words the newer build indexed in another form`,
758
- `Either install the newer build again (${byInstall(input, "bun add -g counterparts@latest", "in Claude Code, /plugin → Installed → counterparts → Update now")}), or, to stay on this one, delete ${tilde(input.dir)}/cache/cache.sqlite* (the search cache alone; no memory is kept there) and run \`counterparts verify --rebuild --keep-vectors --dir ${tilde(input.dir)}\` to rebuild its word index — then in Claude Code ${byInstall(input, "run /mcp → Reconnect", RELOAD_STEP)} so the server opens it.`,
772
+ `Either install the newer build again (${byInstall(input, npmUpdateCommand())}), or, to stay on this one, delete ${tilde(input.dir)}/cache/cache.sqlite* (the search cache alone; no memory is kept there) and run \`counterparts verify --rebuild --keep-vectors --dir ${tilde(input.dir)}\` to rebuild its word index — then in Claude Code ${byInstall(input, "run /mcp → Reconnect", RELOAD_STEP)} so the server opens it.`,
759
773
  { cacheAhead: true, found: v.found, expected: v.expected },
760
774
  );
761
775
  }
@@ -3484,6 +3498,10 @@ export function doctorFindings(input: DoctorInput): Finding[] {
3484
3498
  ["journal-copy", () => journalCopyFindings(store)],
3485
3499
  // 2026-10-15: written vs automatic chapter summaries this week. Silent without any.
3486
3500
  ["chapter-summaries", () => chapterSummaryFindings(store)],
3501
+ // P2 (2026-10-28): open items, carried and parked; silent with none. Not in
3502
+ // the session-start reading (review of #674): it is never red, which is all
3503
+ // that notice prints, and it reads every open row (`openCarry`).
3504
+ ...(input.budgetMs !== undefined ? [] : [["open-items", (): Finding[] => openItemsFindings(store)] as const]),
3487
3505
  // The process log (2026-09-30): one directory listing and today's file.
3488
3506
  // Not in the session-start reading: it is never red, and it reads a file.
3489
3507
  ...(input.budgetMs !== undefined ? [] : [["log", (): Finding[] => logFindings(input)] as const]),
@@ -3497,6 +3515,9 @@ export function doctorFindings(input: DoctorInput): Finding[] {
3497
3515
  ["dreaming", () => dreamingFindings(input, store)],
3498
3516
  // The headless nightly run (2026-09-29): one meta read.
3499
3517
  ["night-run", () => nightRunFindings(input, store)],
3518
+ // The daily update check (U1b): one small file beside the configuration
3519
+ // and one meta read. Never red, and makes no request: not at session start.
3520
+ ...(input.budgetMs !== undefined ? [] : [["updates", (): Finding[] => updateFindings(input, store)] as const]),
3500
3521
  // v9 (2026-09-27): what the upgrade carried, and the reflection.
3501
3522
  ["upgrade-v9", () => upgradeV9Findings(store)],
3502
3523
  ["reflection", () => reflectionFindings(input, store)],
@@ -3556,3 +3577,111 @@ export function doctorFindings(input: DoctorInput): Finding[] {
3556
3577
  }
3557
3578
  return worstFirst(out);
3558
3579
  }
3580
+
3581
+ // ── the daily update check (U1b, 2026-10-28) ───────────────────────────────
3582
+
3583
+ const UPDATES_TITLE = "Updates";
3584
+ const UPDATES_ABOUT =
3585
+ "Once a day Counterparts asks registry.npmjs.org for the newest version number; it sends nothing about you or your memory.";
3586
+
3587
+ /**
3588
+ * THE UPDATES LINE. Doctor makes no request: it reads what the worker last
3589
+ * recorded (`updates.json`, beside the configuration) and the person's own
3590
+ * switches. The configuration's `"updateCheck": false` and "you told your
3591
+ * Claude to stop" (the store's setting) are read here directly; an
3592
+ * environment switch only from the worker's record, because doctor in a
3593
+ * terminal does not share the environment the worker ran in (review of the U1
3594
+ * design, finding 9).
3595
+ */
3596
+ export function updateFindings(input: DoctorInput, store: Store): Finding[] {
3597
+ try {
3598
+ if (TRANSPILED) {
3599
+ return [
3600
+ finding(
3601
+ "updates",
3602
+ "green",
3603
+ UPDATES_TITLE,
3604
+ "This copy makes no update check and sends nothing anywhere; 30 days after its release, the wake says once that a newer one may be out.",
3605
+ "",
3606
+ { switch: "none", transpiled: true },
3607
+ ),
3608
+ ];
3609
+ }
3610
+ const state = readUpdateState(input.configPath);
3611
+ const here = updateSwitch({ config: input.config, asked: askedOff(store), env: {} });
3612
+ const recorded: UpdateSwitch = state?.switch === "env" || state?.switch === "nonessential" ? state.switch : "none";
3613
+ const sw = here !== "none" ? here : recorded;
3614
+ const path = tilde(input.configPath);
3615
+ if (sw !== "none") {
3616
+ const why: Record<Exclude<UpdateSwitch, "none">, readonly [string, string]> = {
3617
+ config: [
3618
+ `The update check is off ("updateCheck": false in ${path}): nothing is asked of npm, and no session mentions updates.`,
3619
+ `To turn it back on, remove "updateCheck": false from ${path}.`,
3620
+ ],
3621
+ asked: [
3622
+ "The update check is off: you asked your Claude to stop. Nothing is asked of npm, and no session mentions updates.",
3623
+ "To turn it back on, tell your Claude to check for updates again.",
3624
+ ],
3625
+ env: [
3626
+ `The update check is off (${UPDATE_CHECK_ENV}=off where Counterparts runs): nothing is asked of npm, and no session mentions updates.`,
3627
+ `To turn it back on, unset ${UPDATE_CHECK_ENV}.`,
3628
+ ],
3629
+ nonessential: [
3630
+ `The update check is off (Claude Code's ${NONESSENTIAL_TRAFFIC_ENV} is set). 30 days after this copy's release, the wake says once that a newer one may be out.`,
3631
+ `To turn it back on, unset ${NONESSENTIAL_TRAFFIC_ENV}.`,
3632
+ ],
3633
+ };
3634
+ const [detail, fix] = why[sw];
3635
+ return [off("updates", UPDATES_TITLE, detail, fix, { switch: sw })];
3636
+ }
3637
+ if (state?.autoUpdate === true) {
3638
+ return [finding("updates", "green", UPDATES_TITLE, "Claude Code keeps this plugin updated (auto-update is on). No check needed.", "", { switch: "none", autoUpdate: true })];
3639
+ }
3640
+ const route = input.install ?? "either";
3641
+ const installed = installedForRoute(route, installedVersion(), () =>
3642
+ (input.pluginRecorded ?? (() => recordedForThisCopy({ home: homedir(), env: process.env, cwd: process.cwd() })))(),
3643
+ );
3644
+ const latest = state?.latest ?? null;
3645
+ // The wake's own gate (`knownLatestFor`): a plugin install is not told of a
3646
+ // version before the day after npm showed it, nor of a held plugin release.
3647
+ const known = knownLatestFor(route, state, input.today);
3648
+ if (known !== null && installed !== null && versionBelow(installed, known.latest)) {
3649
+ const steps = updateSteps({ route, market: route === "npm" ? null : pluginMarket({ home: homedir(), env: process.env }) });
3650
+ return [
3651
+ finding("updates", "amber", UPDATES_TITLE, `${known.latest} is out (this is ${installed}).`, `To update: ${steps}.`, {
3652
+ switch: "none",
3653
+ latest: known.latest,
3654
+ installed,
3655
+ checked: state?.checkedDate ?? null,
3656
+ }),
3657
+ ];
3658
+ }
3659
+ // A day or two offline is nothing to say: amber only from the third failed
3660
+ // day in a row (one try a day, so three failed requests; a laptop on a
3661
+ // plane, or a week away, stays green).
3662
+ if (state !== null && (state.failures ?? 0) >= 3) {
3663
+ return [
3664
+ finding(
3665
+ "updates",
3666
+ "amber",
3667
+ UPDATES_TITLE,
3668
+ `No successful update check since ${state.failingSince ?? "?"} (${state.failCode ?? "unreachable"}). Nothing else is affected.`,
3669
+ "Counterparts can't reach registry.npmjs.org from here (a proxy or firewall?); nothing needs doing unless you want update notices.",
3670
+ { switch: "none", failCode: state.failCode ?? null, failingSince: state.failingSince ?? null, failures: state.failures ?? 0 },
3671
+ ),
3672
+ ];
3673
+ }
3674
+ if (state?.checkedDate === undefined) {
3675
+ return [finding("updates", "green", UPDATES_TITLE, `Not checked yet. ${UPDATES_ABOUT}`, "", { switch: "none" })];
3676
+ }
3677
+ return [
3678
+ finding("updates", "green", UPDATES_TITLE, `Checked ${state.checkedDate}: ${latest === null ? "nothing newer" : `${latest} is the newest`}. ${UPDATES_ABOUT}`, "", {
3679
+ switch: "none",
3680
+ latest,
3681
+ checked: state.checkedDate,
3682
+ }),
3683
+ ];
3684
+ } catch {
3685
+ return [];
3686
+ }
3687
+ }
@@ -82,6 +82,7 @@ import { SESSION_NOTICE_BUDGET_MS, checkoutIsGraded, doctorFindings, noticeMessa
82
82
  import type { CheckoutReading } from "./doctor.js";
83
83
  import { staleWindowsLine as staleWindowsSaid } from "./stale-windows.js";
84
84
  import { upperFirst, windowStep } from "../update-words.js";
85
+ import { UPDATE_ROOM_MARGIN, updateLineInputHere, updateNoticeLine, urgentUpdateLine } from "../update-check.js";
85
86
  import { nightRowTimeoutMs, planNightRunner } from "./night-run.js";
86
87
  import { NOTHING_OWED_BEFORE_KEY, catchUpOf, catchUpWords, owedBefore } from "./night-catch-up.js";
87
88
  import type { NightKind } from "./night-run.js";
@@ -761,7 +762,30 @@ export class ClaudeCodeAdapter extends Lifecycle {
761
762
  // once per store version by the first watched wake that finds older
762
763
  // servers still running (`stale-windows.ts`), under the same rule.
763
764
  const stale = resumed || !watched ? null : this.staleWindowsLine(input);
764
- const leadLines = [codeTab, stale, meaning].filter((l): l is string => l !== null);
765
+ // UPDATES (2026-10-28, U1b), under the same rule, in the design's order
766
+ // (U1 note §3): older windows, then an URGENT update (short, above W1's
767
+ // line), then W1's, then ONE of tell/behind, the auto-update offer or the
768
+ // age line — at most three maintenance lines in a wake. A line past the
769
+ // cap is not composed, so not claimed: it waits for the next wake. When
770
+ // W1's step is the plugin's update, the fourth is skipped (doing W1's
771
+ // step updates).
772
+ //
773
+ // AND ONLY WHERE IT FITS (review of #672): lead lines are never deferred
774
+ // once composed, so a U1 line is composed only when the wake, the lines
775
+ // above it and itself stay `UPDATE_ROOM_MARGIN` under the host's ceiling
776
+ // (room left for the asks). One that does not fit is not claimed.
777
+ const fitsUnder = (above: readonly (string | null)[]) => (line: string): boolean => {
778
+ const lines = [codeTab, ...above, line].filter((l): l is string => l !== null);
779
+ const bytes = woke.bytes + Buffer.byteLength(`${this.nowLine()}\n${lines.join("\n")}\n${plain.context}`, "utf8");
780
+ return bytes <= TUNABLES.HOST_OUTPUT_CHARS - UPDATE_ROOM_MARGIN;
781
+ };
782
+ const urgent = resumed || !watched ? null : this.updateLine(input, "urgent", { fits: fitsUnder([stale, meaning]) });
783
+ const maintenance = [stale, urgent, meaning].filter((l) => l !== null).length;
784
+ const update =
785
+ resumed || !watched || maintenance >= 3 || (meaning !== null && this.install === "plugin")
786
+ ? null
787
+ : this.updateLine(input, "notice", { fits: fitsUnder([stale, urgent, meaning]), urgentSaid: urgent !== null });
788
+ const leadLines = [codeTab, stale, urgent, meaning, update].filter((l): l is string => l !== null);
765
789
  // THE FIRST MEETING'S MARKER (2026-10-11), on every session-start wake:
766
790
  // the state word only, for the mod, which cannot reach the dashboard
767
791
  // before somebody starts it. The store marker beside it (2026-10-12)
@@ -1895,6 +1919,47 @@ export class ClaudeCodeAdapter extends Lifecycle {
1895
1919
  }
1896
1920
  }
1897
1921
 
1922
+ /**
1923
+ * AN UPDATE LINE (2026-10-28, U1b; `update-check.ts`), or null: `urgent`
1924
+ * for a release this copy is below the urgent floor of, `notice` for the
1925
+ * rest (tell, behind, the auto-update offer, the age line). Claimed when
1926
+ * composed. An observer says nothing; a person who said no — `"updateCheck":
1927
+ * false`, telling their Claude to stop, `COUNTERPARTS_UPDATE_CHECK=off` —
1928
+ * hears nothing. Reads the worker's small `updates.json` and two meta keys;
1929
+ * makes no request (a hook never does). Never throws.
1930
+ */
1931
+ updateLine(
1932
+ input: HookInput,
1933
+ which: "urgent" | "notice",
1934
+ opts: { readonly fits?: (line: string) => boolean; readonly urgentSaid?: boolean } = {},
1935
+ ): string | null {
1936
+ if (this.observer) return null;
1937
+ try {
1938
+ const here = updateLineInputHere({
1939
+ store: this.counterpart.store,
1940
+ configPath: this.configPath,
1941
+ config: this.config,
1942
+ route: this.install ?? "either",
1943
+ today: input.at ?? localDate(this.nowFn(), this.counterpart.store.zone()),
1944
+ home: homedir(),
1945
+ cwd: input.scope,
1946
+ codeTab: input.entrypoint === CODE_TAB_ENTRYPOINT,
1947
+ session: input.sessionId,
1948
+ });
1949
+ const lineInput = {
1950
+ ...here,
1951
+ ...(opts.fits === undefined ? {} : { fits: opts.fits }),
1952
+ ...(opts.urgentSaid === true ? { urgentSaid: true } : {}),
1953
+ };
1954
+ const line = which === "urgent" ? urgentUpdateLine(lineInput) : updateNoticeLine(lineInput);
1955
+ if (line !== null) this.emit("adapter.update.notice", { which });
1956
+ return line;
1957
+ } catch (err) {
1958
+ this.emit("adapter.update.failed", { code: codeOf(err) });
1959
+ return null;
1960
+ }
1961
+ }
1962
+
1898
1963
  /**
1899
1964
  * THE WAKE'S LINE ABOUT OLDER WINDOWS (2026-10-27, U1a;
1900
1965
  * `stale-windows.ts#staleWindowsLine`), or null: Claude Code windows still
@@ -348,7 +348,7 @@ export const BINARY_CONNECT_REFUSAL =
348
348
  "This is Counterparts' single program, the one the Claude Code plugin downloads when a computer has no Bun or Node.js. " +
349
349
  "It doesn't connect hosts itself: the plugin already runs the hooks and the memory server, and anything wired to this file " +
350
350
  "would stop working when the plugin is uninstalled. To wire Claude Code or Claude Desktop by hand, install Counterparts with " +
351
- "npm (`npm i -g counterparts`) and run `counterparts connect` from that install.";
351
+ "npm (`npm i -g counterparts@latest`) and run `counterparts connect` from that install.";
352
352
 
353
353
  /**
354
354
  * THE CONSOLE'S MAP — about forty lines, grouped, one line per command.
@@ -816,6 +816,12 @@ export interface Ui {
816
816
  warning(text: string, ...more: readonly string[]): void;
817
817
  /** An aside under the line above it: dim, and indented into the gutter. */
818
818
  hint(text: string): void;
819
+ /**
820
+ * A paste-ready command, alone on its line and NEVER folded (W3, 10-28): a
821
+ * command broken across lines breaks when pasted. Indented under the hints
822
+ * around it; the prose around it may wrap, this may not.
823
+ */
824
+ command(text: string): void;
819
825
  /** A doctor-shaped line: the grade in colour, the label in its column, a
820
826
  * SHORT message, and the fix on its own indented dim line. */
821
827
  statusLine(grade: Grade, label: string, message: string, fix?: string): void;
@@ -897,6 +903,10 @@ export function ui(io: Io, env: UiEnv, opts: InteractiveOptions = {}): Ui {
897
903
  for (const line of emit(cell, text, MARK_COLUMN)) io.out(p.dim(line));
898
904
  },
899
905
 
906
+ command(text: string): void {
907
+ io.out(`${" ".repeat(MARK_COLUMN + 2)}${text}`);
908
+ },
909
+
900
910
  statusLine(grade: Grade, label: string, message: string, fix?: string): void {
901
911
  const gradeCell = grade.padEnd(GRADE_COLUMN);
902
912
  const prefix = `${gradeCell}${labelCell(label)}`;