counterparts 0.3.38 → 0.3.39

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,35 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.39 — 2026-10-28
4
+
5
+ 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`.
6
+
7
+ - **Counterparts now tells you when an update is out.** Once a day, it asks the npm registry
8
+ (`registry.npmjs.org`) for the newest version number. The request carries no memory, no
9
+ conversation, no identifier, not even which version you have; because it's daily, npm
10
+ can see your computer's network address and that Counterparts checked that day. When
11
+ you're a few releases behind, or a release is worth taking, your Claude mentions it once,
12
+ with the steps for how you installed. **To turn it off, tell your Claude to stop
13
+ reminding you about updates, or set `"updateCheck": false` in
14
+ `~/.counterparts/claude-code.json` (or `COUNTERPARTS_UPDATE_CHECK=off`).** It doesn't
15
+ run under Claude Code's `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`; a copy that checks
16
+ nothing says once, after 30 days, that a newer one may be out. `counterparts doctor` has
17
+ an Updates line.
18
+ - **Plugin users are offered Claude Code's own auto-update, once.** /plugin → Marketplaces →
19
+ counterparts → Enable auto-update keeps Counterparts current without asking.
20
+ - **The plugin's update step is now Update marketplace.** Fix lines say /plugin →
21
+ Marketplaces → counterparts → Update marketplace, which refreshes the listing before it
22
+ updates, instead of Installed → Update now.
23
+ - **npm lines say `@latest`.** Doctor's and the wake's npm steps, and the install lines in the README,
24
+ QUICKSTART and docs, say `npm install -g counterparts@latest`: on Node 20 the bare form quietly
25
+ installs 0.3.10. After the bun installer, the docs say to open a new terminal.
26
+ - **A store keeps its id after its first week.** The session-start cleanup removed the store's handle salt
27
+ (`sessions/expansions.salt`) seven days after it was made, so the next session made a new one: the store's id
28
+ changed (the sidebar compares it) and earlier handle lookups no longer matched. The salt is now kept however old
29
+ it is. A store that already lost its salt has nothing to recover: the one it made since is kept from now on, and
30
+ handle lookups only last a day anyway.
31
+ - 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.
32
+
3
33
  ## 0.3.38 — 2026-10-28
4
34
 
5
35
  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.39",
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 {
@@ -119,9 +119,23 @@ 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";
@@ -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
  }
@@ -3497,6 +3511,9 @@ export function doctorFindings(input: DoctorInput): Finding[] {
3497
3511
  ["dreaming", () => dreamingFindings(input, store)],
3498
3512
  // The headless nightly run (2026-09-29): one meta read.
3499
3513
  ["night-run", () => nightRunFindings(input, store)],
3514
+ // The daily update check (U1b): one small file beside the configuration
3515
+ // and one meta read. Never red, and makes no request: not at session start.
3516
+ ...(input.budgetMs !== undefined ? [] : [["updates", (): Finding[] => updateFindings(input, store)] as const]),
3500
3517
  // v9 (2026-09-27): what the upgrade carried, and the reflection.
3501
3518
  ["upgrade-v9", () => upgradeV9Findings(store)],
3502
3519
  ["reflection", () => reflectionFindings(input, store)],
@@ -3556,3 +3573,111 @@ export function doctorFindings(input: DoctorInput): Finding[] {
3556
3573
  }
3557
3574
  return worstFirst(out);
3558
3575
  }
3576
+
3577
+ // ── the daily update check (U1b, 2026-10-28) ───────────────────────────────
3578
+
3579
+ const UPDATES_TITLE = "Updates";
3580
+ const UPDATES_ABOUT =
3581
+ "Once a day Counterparts asks registry.npmjs.org for the newest version number; it sends nothing about you or your memory.";
3582
+
3583
+ /**
3584
+ * THE UPDATES LINE. Doctor makes no request: it reads what the worker last
3585
+ * recorded (`updates.json`, beside the configuration) and the person's own
3586
+ * switches. The configuration's `"updateCheck": false` and "you told your
3587
+ * Claude to stop" (the store's setting) are read here directly; an
3588
+ * environment switch only from the worker's record, because doctor in a
3589
+ * terminal does not share the environment the worker ran in (review of the U1
3590
+ * design, finding 9).
3591
+ */
3592
+ export function updateFindings(input: DoctorInput, store: Store): Finding[] {
3593
+ try {
3594
+ if (TRANSPILED) {
3595
+ return [
3596
+ finding(
3597
+ "updates",
3598
+ "green",
3599
+ UPDATES_TITLE,
3600
+ "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.",
3601
+ "",
3602
+ { switch: "none", transpiled: true },
3603
+ ),
3604
+ ];
3605
+ }
3606
+ const state = readUpdateState(input.configPath);
3607
+ const here = updateSwitch({ config: input.config, asked: askedOff(store), env: {} });
3608
+ const recorded: UpdateSwitch = state?.switch === "env" || state?.switch === "nonessential" ? state.switch : "none";
3609
+ const sw = here !== "none" ? here : recorded;
3610
+ const path = tilde(input.configPath);
3611
+ if (sw !== "none") {
3612
+ const why: Record<Exclude<UpdateSwitch, "none">, readonly [string, string]> = {
3613
+ config: [
3614
+ `The update check is off ("updateCheck": false in ${path}): nothing is asked of npm, and no session mentions updates.`,
3615
+ `To turn it back on, remove "updateCheck": false from ${path}.`,
3616
+ ],
3617
+ asked: [
3618
+ "The update check is off: you asked your Claude to stop. Nothing is asked of npm, and no session mentions updates.",
3619
+ "To turn it back on, tell your Claude to check for updates again.",
3620
+ ],
3621
+ env: [
3622
+ `The update check is off (${UPDATE_CHECK_ENV}=off where Counterparts runs): nothing is asked of npm, and no session mentions updates.`,
3623
+ `To turn it back on, unset ${UPDATE_CHECK_ENV}.`,
3624
+ ],
3625
+ nonessential: [
3626
+ `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.`,
3627
+ `To turn it back on, unset ${NONESSENTIAL_TRAFFIC_ENV}.`,
3628
+ ],
3629
+ };
3630
+ const [detail, fix] = why[sw];
3631
+ return [off("updates", UPDATES_TITLE, detail, fix, { switch: sw })];
3632
+ }
3633
+ if (state?.autoUpdate === true) {
3634
+ return [finding("updates", "green", UPDATES_TITLE, "Claude Code keeps this plugin updated (auto-update is on). No check needed.", "", { switch: "none", autoUpdate: true })];
3635
+ }
3636
+ const route = input.install ?? "either";
3637
+ const installed = installedForRoute(route, installedVersion(), () =>
3638
+ (input.pluginRecorded ?? (() => recordedForThisCopy({ home: homedir(), env: process.env, cwd: process.cwd() })))(),
3639
+ );
3640
+ const latest = state?.latest ?? null;
3641
+ // The wake's own gate (`knownLatestFor`): a plugin install is not told of a
3642
+ // version before the day after npm showed it, nor of a held plugin release.
3643
+ const known = knownLatestFor(route, state, input.today);
3644
+ if (known !== null && installed !== null && versionBelow(installed, known.latest)) {
3645
+ const steps = updateSteps({ route, market: route === "npm" ? null : pluginMarket({ home: homedir(), env: process.env }) });
3646
+ return [
3647
+ finding("updates", "amber", UPDATES_TITLE, `${known.latest} is out (this is ${installed}).`, `To update: ${steps}.`, {
3648
+ switch: "none",
3649
+ latest: known.latest,
3650
+ installed,
3651
+ checked: state?.checkedDate ?? null,
3652
+ }),
3653
+ ];
3654
+ }
3655
+ // A day or two offline is nothing to say: amber only from the third failed
3656
+ // day in a row (one try a day, so three failed requests; a laptop on a
3657
+ // plane, or a week away, stays green).
3658
+ if (state !== null && (state.failures ?? 0) >= 3) {
3659
+ return [
3660
+ finding(
3661
+ "updates",
3662
+ "amber",
3663
+ UPDATES_TITLE,
3664
+ `No successful update check since ${state.failingSince ?? "?"} (${state.failCode ?? "unreachable"}). Nothing else is affected.`,
3665
+ "Counterparts can't reach registry.npmjs.org from here (a proxy or firewall?); nothing needs doing unless you want update notices.",
3666
+ { switch: "none", failCode: state.failCode ?? null, failingSince: state.failingSince ?? null, failures: state.failures ?? 0 },
3667
+ ),
3668
+ ];
3669
+ }
3670
+ if (state?.checkedDate === undefined) {
3671
+ return [finding("updates", "green", UPDATES_TITLE, `Not checked yet. ${UPDATES_ABOUT}`, "", { switch: "none" })];
3672
+ }
3673
+ return [
3674
+ finding("updates", "green", UPDATES_TITLE, `Checked ${state.checkedDate}: ${latest === null ? "nothing newer" : `${latest} is the newest`}. ${UPDATES_ABOUT}`, "", {
3675
+ switch: "none",
3676
+ latest,
3677
+ checked: state.checkedDate,
3678
+ }),
3679
+ ];
3680
+ } catch {
3681
+ return [];
3682
+ }
3683
+ }
@@ -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)}`;
@@ -1635,7 +1635,7 @@ function registerMcp(input: WireInput, u: Ui, mcp: McpReading): WireResult["mcp"
1635
1635
  if (res.missing) {
1636
1636
  u.warn("`claude` is not on this PATH, so the MCP server was not registered.");
1637
1637
  u.hint("The hooks are in. Run this one line yourself, then restart Claude Code:");
1638
- u.hint(` ${line}`);
1638
+ u.command(line);
1639
1639
  return "printed";
1640
1640
  }
1641
1641
  let word: WireResult["mcp"] = "added";
@@ -1657,7 +1657,7 @@ function registerMcp(input: WireInput, u: Ui, mcp: McpReading): WireResult["mcp"
1657
1657
  const detail = `${res.err}${res.out}`.trim();
1658
1658
  if (detail.length > 0) for (const l of detail.split("\n").slice(0, 4)) u.hint(l);
1659
1659
  u.hint("Run this yourself, then restart Claude Code:");
1660
- u.hint(` ${line}`);
1660
+ u.command(line);
1661
1661
  return "printed";
1662
1662
  }
1663
1663
  return word;
@@ -2207,7 +2207,9 @@ export async function unwire(input: WireInput): Promise<WireResult> {
2207
2207
  u.warn(
2208
2208
  "`claude` is not on this PATH and this version does not read Claude Code's own configuration, so whether a memory server is still registered (an npm install's, if there is one) could not be checked.",
2209
2209
  );
2210
- u.hint(`Remove one if it is there: claude mcp remove ${MCP_SERVER_NAME} -s user — and run this again where \`claude\` is on PATH to have it checked.`);
2210
+ u.hint("Remove one if it is there:");
2211
+ u.command(`claude mcp remove ${MCP_SERVER_NAME} -s user`);
2212
+ u.hint("Then run this again where `claude` is on PATH to have it checked.");
2211
2213
  mcpWord = "printed";
2212
2214
  } else if (res.missing) {
2213
2215
  mcpConfirmed = !stillThere();
@@ -2216,7 +2218,8 @@ export async function unwire(input: WireInput): Promise<WireResult> {
2216
2218
  mcpWord = "absent";
2217
2219
  } else {
2218
2220
  u.warn("`claude` is not on this PATH, so the MCP server was not deregistered.");
2219
- u.hint(`Run it yourself: claude mcp remove ${MCP_SERVER_NAME} -s user`);
2221
+ u.hint("Run it yourself:");
2222
+ u.command(`claude mcp remove ${MCP_SERVER_NAME} -s user`);
2220
2223
  mcpWord = "printed";
2221
2224
  }
2222
2225
  } else if (res.code === 0) {
@@ -2233,7 +2236,10 @@ export async function unwire(input: WireInput): Promise<WireResult> {
2233
2236
  } else {
2234
2237
  mcpConfirmed = !stillThere();
2235
2238
  u.warn(`\`claude mcp remove\` exited ${String(res.code ?? -1)}.`);
2236
- if (!mcpConfirmed) u.hint(`Run it yourself: claude mcp remove ${MCP_SERVER_NAME} -s user`);
2239
+ if (!mcpConfirmed) {
2240
+ u.hint("Run it yourself:");
2241
+ u.command(`claude mcp remove ${MCP_SERVER_NAME} -s user`);
2242
+ }
2237
2243
  mcpWord = mcpConfirmed ? "absent" : "printed";
2238
2244
  }
2239
2245
 
@@ -390,6 +390,17 @@ export interface AdapterConfig {
390
390
  * an old setting.
391
391
  */
392
392
  readonly debug?: { readonly nightTranscripts?: boolean };
393
+ /**
394
+ * THE DAILY UPDATE CHECK (U1b, 2026-10-28): `"updateCheck": false` turns it
395
+ * off — no request to registry.npmjs.org, and no update line in any wake
396
+ * (`adapters/update-check.ts`). The durable switch /privacy names first,
397
+ * because it reaches every process that reads this file (the worker under
398
+ * Claude Code, Desktop's server, doctor in a terminal), where an environment
399
+ * variable does not. Read leniently: only `false` means off; any other value
400
+ * is ignored, never a reason to stand the configuration down.
401
+ * ("off", "no", "0" and 0 are read as false too.)
402
+ */
403
+ readonly updateCheck?: false;
393
404
  /**
394
405
  * SETTINGS THIS BUILD NO LONGER READS, phrased for a person — e.g.
395
406
  * `"credentialsFile" is no longer used …`. Present only when the file named
@@ -456,6 +467,7 @@ export function loadConfig(raw: unknown): LoadedConfig {
456
467
  dreaming?: { model?: string; timeoutMs?: number; maxTurns?: number; ignored?: string[] };
457
468
  retention?: { afterWriteUpDays?: number; maxDays?: number; ignored?: string[] };
458
469
  debug?: { nightTranscripts?: boolean };
470
+ updateCheck?: false;
459
471
  retired?: string[];
460
472
  timeZone?: string;
461
473
  timeZoneUnknown?: string;
@@ -639,6 +651,17 @@ export function loadConfig(raw: unknown): LoadedConfig {
639
651
  if (typeof debug === "object" && debug !== null && !Array.isArray(debug)) {
640
652
  out.debug = (debug as Record<string, unknown>)["nightTranscripts"] === true ? { nightTranscripts: true } : {};
641
653
  }
654
+ // THE UPDATE CHECK'S SWITCH (U1b): lenient. `false`, `0`, and the words
655
+ // `COUNTERPARTS_UPDATE_CHECK` takes ("off", "false", "0", "no", "disable",
656
+ // "disabled") all mean off; anything else is ignored, never refused.
657
+ const updateCheck = rec["updateCheck"];
658
+ if (
659
+ updateCheck === false ||
660
+ updateCheck === 0 ||
661
+ (typeof updateCheck === "string" && ["off", "false", "0", "no", "disable", "disabled"].includes(updateCheck.trim().toLowerCase()))
662
+ ) {
663
+ out.updateCheck = false;
664
+ }
642
665
  const identity = rec["identity"];
643
666
  if (identity !== undefined) {
644
667
  const i = identity as Record<string, unknown>;