counterparts 0.3.24 → 0.3.26

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 (78) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/package.json +1 -1
  3. package/src/adapters/claude-code/CONTRACT.md +8 -1
  4. package/src/adapters/claude-code/NOTES.md +30 -0
  5. package/src/adapters/claude-code/bin/hook.ts +18 -3
  6. package/src/adapters/claude-code/bin/runner.ts +1 -1
  7. package/src/adapters/claude-code/doctor-host.ts +26 -10
  8. package/src/adapters/claude-code/doctor-open.ts +41 -0
  9. package/src/adapters/claude-code/doctor.ts +29 -9
  10. package/src/adapters/claude-code/hooks.ts +17 -9
  11. package/src/adapters/cli/commands-readings.ts +4 -0
  12. package/src/adapters/cli/uninstall.ts +9 -3
  13. package/src/adapters/cli/wire.ts +34 -1
  14. package/src/adapters/dashboard/web/views/archive-words.ts +2 -0
  15. package/src/adapters/dashboard/web/views/health.ts +7 -3
  16. package/src/adapters/dashboard/web/views/memories.ts +1 -0
  17. package/src/adapters/dashboard/web/views/memory-words.ts +4 -1
  18. package/src/adapters/dashboard/web/views/memory.ts +5 -3
  19. package/src/adapters/dashboard/web/views/mind.ts +2 -1
  20. package/src/adapters/dashboard/web/views/search.ts +1 -0
  21. package/src/adapters/fired.ts +28 -1
  22. package/src/adapters/host-wiring.ts +7 -1
  23. package/src/adapters/lifecycle.ts +27 -0
  24. package/src/adapters/mcp/NOTES.md +7 -0
  25. package/src/adapters/mcp/bin/serve.ts +30 -10
  26. package/src/adapters/mcp/facts.ts +55 -6
  27. package/src/adapters/mcp/server-self-tools.ts +18 -1
  28. package/src/adapters/mcp/server-session-end.ts +25 -1
  29. package/src/adapters/mcp/server-words.ts +1 -1
  30. package/src/adapters/mcp/server.ts +6 -2
  31. package/src/adapters/mcp/tools.ts +26 -11
  32. package/src/adapters/npm-live.ts +333 -0
  33. package/src/adapters/plugin.ts +42 -14
  34. package/src/adapters/runtime.ts +3 -2
  35. package/src/adapters/sidebar-status.ts +183 -16
  36. package/src/adapters/store-id.ts +35 -3
  37. package/src/core/briefing.ts +31 -8
  38. package/src/core/counterpart-types.ts +11 -2
  39. package/src/core/counterpart.ts +126 -48
  40. package/src/core/dream/CONTRACT.md +7 -0
  41. package/src/core/dream/NOTES.md +52 -0
  42. package/src/core/dream/index.ts +19 -6
  43. package/src/core/dream/reflect.ts +262 -13
  44. package/src/core/dream/slices.ts +195 -3
  45. package/src/core/fit/CONTRACT.md +8 -3
  46. package/src/core/fit/index.ts +12 -2
  47. package/src/core/handoff/CONTRACT.md +17 -12
  48. package/src/core/handoff/NOTES.md +30 -0
  49. package/src/core/handoff/index.ts +75 -81
  50. package/src/core/handoff/last-here.ts +66 -15
  51. package/src/core/leaving.ts +3 -0
  52. package/src/core/recall/NOTES.md +34 -0
  53. package/src/core/recall/activate.ts +57 -0
  54. package/src/core/recall/index.ts +22 -1
  55. package/src/core/recall/session.ts +22 -2
  56. package/src/core/recall/standing.ts +26 -1
  57. package/src/core/recall/time-ask.ts +22 -0
  58. package/src/core/self/CONTRACT.md +92 -22
  59. package/src/core/self/NOTES.md +160 -0
  60. package/src/core/self/briefing-delivery.ts +47 -10
  61. package/src/core/self/briefing-page.ts +23 -2
  62. package/src/core/self/briefing-room.ts +20 -11
  63. package/src/core/self/briefing.ts +206 -31
  64. package/src/core/self/episodes.ts +44 -45
  65. package/src/core/self/identity.ts +115 -17
  66. package/src/core/self/index.ts +466 -210
  67. package/src/core/self/summaries.ts +177 -0
  68. package/src/core/self/tunables.ts +59 -10
  69. package/src/core/self/work.ts +6 -2
  70. package/src/core/self/writer.ts +98 -2
  71. package/src/core/sleep/CONTRACT.md +3 -1
  72. package/src/core/sleep/types.ts +8 -3
  73. package/src/core/store/CONTRACT.md +14 -1
  74. package/src/core/store/NOTES.md +15 -0
  75. package/src/core/store/errors.ts +8 -0
  76. package/src/core/store/index.ts +55 -0
  77. package/src/core/store/operational.ts +36 -1
  78. package/src/core/time.ts +38 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,111 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.26 — 2026-10-18
4
+
5
+ The wake leads with what is live. "Still open" puts the questions touched in the last two weeks first and counts how many of the rest have gone untouched; a stale handoff says how stale it is in one sentence, and when every handoff listed is stale only the newest shows whole; the Yesterday line names the other folders worked in instead of counting them; and a session still open from an earlier day says its start with the date. Doctor reads mood matching, switched off since 10-10, as disabled rather than amber. No store-format change (store v13, cache v6) and no wiring change: nothing to run after upgrading from 0.3.25, and `counterparts connect` is not needed.
6
+
7
+ - **"Still open" shows what is live first.** Open questions touched in the last two weeks come
8
+ before the ones nobody has touched since, a plain one before one that may be out of date,
9
+ and the count says how many of the rest are weeks old.
10
+ - **A handoff says how stale it is in one sentence.** "2 days old; since then: a newer
11
+ chapter here; written on 0.3.24, 0.3.25 now". When every handoff in a folder is stale, the
12
+ wake shows the newest and lists the others by id.
13
+ - **The Yesterday line names the other folders worked in**, rather than counting "sessions in
14
+ other projects", and only the folders the "Today, elsewhere" line may name.
15
+ - **"Today, elsewhere" dates a session that started on an earlier day.** A session opened
16
+ the day before and still live read `open since 09:08 (live)`, a clock that looked like a
17
+ time later today; it now reads `open since 10-16 09:08 (live)`.
18
+ - **Doctor's Fired line reads mood matching as `disabled`** while both mood weights are 0
19
+ (stood down by decision since 10-10), instead of amber "gone quiet". Turning the weights
20
+ back up restores the ordinary grading.
21
+ - **Facts: a coarse event date only partly inside the time asked says so.** A month, year
22
+ or range that straddles the window reads `happened 2023-04 · may be inside the time
23
+ asked`, where a bare month beside a day window read as outside it. Held lightly.
24
+
25
+ ## 0.3.25 — 2026-10-16
26
+
27
+ A chapter of the journal is now stood for by one short summary memory instead of a full copy: the `chapter` tool takes a `summary`, the engine writes a short one from the chapter's opening lines when the session gives none, and summaries fade like any other memory while the chapter itself keeps every word. The nightly reflection can propose closing items that have sat in "Still open" for days, and nothing closes until you say yes. The wake is shorter and lists more: long items as one line each, the tags on one line, today's date said once, "Coming up" only what is due today, and the self page written to about 4,600 bytes. Recall reads "in the last month" and "the past 3 months" as rolling windows, and facts' event dates carry their weekday. The plugin's sidebar says where you left off, can be clicked again in a few small ways, and the build from Anthropic's directory stands down beside the npm install. No store-format change (store v13, cache v6) and no wiring change: nothing to run after upgrading from 0.3.24, and `counterparts connect` is not needed.
28
+
29
+ - **The sidebar's fox tries a picture first, everywhere.** Instead of guessing from your
30
+ terminal's name whether it can show pictures, it tries one and lets Claude Code say: where
31
+ the picture can't show, it draws the finer sextant fox in terminals whose fonts have them
32
+ (iTerm2, WezTerm, VS Code, Ghostty, kitty) and the half-block fox elsewhere. It reads four
33
+ environment variables for that, down from seven.
34
+ - **The sidebar keeps its numbers beside an npm install when the plugin is loaded from a
35
+ folder.** A plugin started with `claude --plugin-dir` stands its own server down there, and
36
+ until now nothing told the npm install's processes the sidebar was present, so they deleted
37
+ its status file. The stood-down server now leaves a small marker beside the configuration
38
+ while its session runs (`sidebar-plugin-here`, refreshed every ten minutes, counted for
39
+ thirty, or for up to a day while that server is still running, so a laptop waking from sleep
40
+ keeps the file), and the memory server asks again at each write instead of once at its start.
41
+ - **After a rollback or a snapshot restore the sidebar catches up straight away.** A status
42
+ file written before the store was put back named a later point in the log than the log now
43
+ has, and both the writers and the sidebar kept it until the log caught up. A writer now
44
+ replaces a file that is ahead of the log, and the sidebar accepts an older point in the log
45
+ from the same store when the file is more than five seconds newer.
46
+ - **The store's note of where the sidebar file lives no longer disappears every week.** It is
47
+ touched on every write, so the session-start cleanup keeps it.
48
+ - **The plugin from Anthropic's directory stands down beside the npm install.** It reads none
49
+ of Claude Code's files, so it couldn't tell the npm install was there, and Claude was
50
+ offered every memory tool twice. The npm install now leaves a small note beside its
51
+ configuration, `~/.counterparts/npm-live.json`, when it connects and as its sessions
52
+ start; the plugin's hooks and server stand down while the note is recent and the program
53
+ it names is still installed. `counterparts disconnect` and
54
+ `uninstall` remove it.
55
+ - **Installed twice now recommends keeping one.** The session-start line, the stood-down
56
+ server's note and `counterparts doctor` no longer say "nothing needs to change": both use
57
+ the same memory, so nothing is lost either way, and they name both ways out, `counterparts
58
+ disconnect` (keep the plugin) or `/plugin uninstall counterparts@…` (keep the npm install).
59
+ - **The sidebar says where you left off.** Under the last dream, the sidebar shows the first
60
+ of these that has something: where you left off in this folder ("Last here"), what's
61
+ coming up next (with its date as "Today", "Tomorrow" or "Oct 20"), or what happened
62
+ yesterday. Click it to read all of it, as with the dream. It's the first thing to make room when the session fills the sidebar.
63
+ - **The sidebar's footer stops offering the intro once you've had it,** and while the fox
64
+ shows it says how to hide it: `/counterparts avatar off`.
65
+ - **The "Mechanisms today" bars are on a log scale,** so a mechanism that fired once and one
66
+ that fired a dozen times look different even beside one that fired a hundred times. The
67
+ count beside each bar is unchanged.
68
+ - **The plugin's README says what the sidebar can reach.** A "What it can reach" section
69
+ lists what it reads (the nine environment variables among them), runs, sends and keeps,
70
+ how it treats text other hooks add, and the `claude plugin validate` lines that show it.
71
+ - **A chapter is stood for by a summary, not a full copy.** The `chapter` tool takes a
72
+ `summary`: the memory that stands for the chapter, while the chapter keeps every word. When
73
+ a session gives none, the engine writes a short one from the chapter's opening lines, and a
74
+ summary the session writes later replaces it. Summaries are ordinary memories and fade like
75
+ one; the full copies made before this release stay as they are. Dreams and reflections see a
76
+ busy day's chapters as their summaries, so more of the day fits. Doctor has a `Chapter
77
+ summaries` line: written vs automatic over the week. No store-format change.
78
+ - **The nightly reflection proposes closing stale open items.** It is shown up to five
79
+ memories still open after four lived days untouched, and may propose closing the ones that
80
+ look done; the proposal comes as one question in what it shares. Nothing closes until you
81
+ say yes, and then the reflect tool's new `close` phase closes only what it proposed.
82
+ - **The wake lists more of what's open, coming up and relevant.** A long memory in "How I
83
+ work", "Still open", "Might be relevant" or "Coming up" now shows as one line, its date,
84
+ its title and its id, instead of its whole first paragraph, so many more fit beside the
85
+ self page. The first item of "Still open" and of "Coming up" is still shown in full when
86
+ there's room, and so is a reminder due today. Recall reads any of them in full by its id.
87
+ - **Doctor's Lookups line counts the wake too:** how many of the items it listed as a line a
88
+ session then read in full.
89
+ - **The plugin's sidebar can be clicked again, in a few small ways.** In the terminal,
90
+ "Meet your counterpart" sits at the top while the first meeting is waiting: a click puts `/counterparts:meet` in your
91
+ prompt box, and you press Enter (a draft you are writing is left alone, and the row says so).
92
+ The footer's Dashboard line does the same with `/counterparts:dashboard`. On the terminal,
93
+ COUNTERPARTS ↗ links to the dashboard again; Counterparts now writes the dashboard's address
94
+ into the sidebar's status file for it. The footer's view and avatar switches are back: one
95
+ click closes the pane to quiet, or turns the fox on or off. The plugin directory's build of
96
+ the sidebar is unchanged.
97
+ - **Recall reads "in the last month" as a rolling month.** "In the last month", "the past
98
+ month" and "the past 3 months" (digits or words) now mean back from today, like "the past
99
+ week"; plain "last month" is still the calendar month. Facts' event dates carry their
100
+ weekday ("happened Mon 05-15").
101
+ - **A shorter, roomier wake.** The three tags at the top of a session's memory share one line;
102
+ today's date is said once, on the `Now:` line (the header, "Yesterday" and the page's
103
+ "Last revised" no longer repeat it, and item dates read "Oct 15 (due Oct 18)"); the header
104
+ and the line under it are shorter. "How I work" no longer lists craft memories (they still
105
+ come up when a conversation reaches them), and "Coming up" lists what is due today,
106
+ with one line counting the rest by id (the overdue said so). The self page is now written to about
107
+ 4,600 bytes, with "How I work" as a few short lessons. The room goes to the lists.
108
+
3
109
  ## 0.3.24 — 2026-10-14
4
110
 
5
111
  Forgetting now waits: a memory is put away only after 14 lived days under the floor, not 14 days after it was last used, and a release that changes how strength is read starts that wait fresh for everything it lowered. So nothing is archived for the first 14 lived days after you upgrade to this release; archived memories keep their words and stay readable by id. Old claims the claims era lowers now read at today's default all the way down. At the end-of-session ask Claude now also rates the memories it was shown, 0 to 3; the ratings are only recorded and change nothing yet. The `salience` field tells Claude to leave routine work at the default, a faded match is labelled "faded: weak, below reach", closing a reminder closes every memory it moved through, a revision with no title keeps the old one's, and `recall` takes `query` as another name for `question`. With both the plugin and the npm install, uninstalling the plugin and keeping the memories leaves the npm install's memory server and hooks working. The sidebar counts feelings under Emotion. If `/plugin update counterparts@counterparts` does nothing, run `/plugin marketplace update counterparts`, then `/plugin uninstall counterparts@counterparts` and `/plugin install counterparts@counterparts`. These are Claude Code's own plugin commands, not `/counterparts:uninstall`, and your memories in `~/.counterparts` are untouched. No store-format change (store v13, cache v6) and no wiring change: nothing to run after upgrading from 0.3.23, and `counterparts connect` is not needed. Going back to 0.3.23 gives up the wait: it counts 14 days from last use again.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.24",
3
+ "version": "0.3.26",
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": {
@@ -669,7 +669,14 @@ row, saying which source answered, existed until the keys were removed — §1a.
669
669
  or its `.mjs` shim, `counterparts-hook`, or `<binary> hook`, whatever one-token
670
670
  flags come before or after `run`, and nothing with a shell operator in it.
671
671
  So a plugin reads what a newer `connect` writes. (The plugin's server stands
672
- down the same way, by the registration's NAME.) `connect`'s own rewrite keeps
672
+ down the same way, by the registration's NAME.) The plugin directory's
673
+ flavor reads none of Claude Code's files, so it stands down by the npm
674
+ install's marker instead (`adapters/npm-live.ts`, since 2026-10-15): a
675
+ reading of the user-level wiring that the npm side writes beside the
676
+ configuration (`connect` at once, the npm server at its start, the npm
677
+ hook at each session start and otherwise at most daily, past the
678
+ configuration refusals and an off or paused folder), believed for a week
679
+ (the hooks half: two days) and only while the program it names is on disk. `connect`'s own rewrite keeps
673
680
  the strict reading (`isOurHookCommand`): it rewrites only what it can fully
674
681
  parse. A writer that adds a flag writes it as ONE token, or older readers
675
682
  take its value for the script.
@@ -2589,3 +2589,33 @@ outside the disclosed files. The hooks no longer ask who delivers, `loadConfig`
2589
2589
  resolver moved to `tools/parallel/primacy.ts` for the instrument that still reads old run directories.
2590
2590
  The `adapter.primacy.*` event names stay in core and the dashboard so a store's old rows still read.
2591
2591
  Earlier entries above that mention primacy describe the code as it was then.
2592
+
2593
+ ## 2026-10-15 — the directory flavor stands down by a marker
2594
+
2595
+ The directory flavor reads none of Claude Code's files (2026-10-14), so beside a live npm install it stood
2596
+ nothing down: the claim kept one wake per event, but every memory tool was offered twice, which the owner,
2597
+ running both, found confusing. The npm install now leaves `npm-live.json` beside the configuration
2598
+ (`adapters/npm-live.ts`); the directory flavor's gates read it and nothing else. What the build settled:
2599
+
2600
+ - **A reading, not a heartbeat.** The first sketch had the npm hook and the npm server each stamp "I ran".
2601
+ Two holes: the nightly run's server is a non-plugin server under the plugin too (the run strips
2602
+ `CLAUDE_PLUGIN_ROOT`), and an npm install whose `claude mcp add` never happened would have stood the
2603
+ plugin's server down with no server left at all. So the marker records what the npm side READS of the
2604
+ user-level wiring — the live hook's command and file, the live `-s user` server — written by `connect`, by
2605
+ the npm server at its start, and by the npm hook at each session start (other events: once a day, or when
2606
+ missing or another build's). Any npm-side writer is then truthful, the nightly server included; a race
2607
+ between two only leaves one of two true readings. One file per Claude Code directory (`CLAUDE_CONFIG_DIR`
2608
+ hashed into the name), so two configurations sharing a memory never rewrite each other's (review).
2609
+ - **User level only.** A hook in one project's settings must not stand the plugin down in every other.
2610
+ - **Program-exists, and a week (hooks: two days).** Liveness is re-checked by stat. An age bound is kept as
2611
+ well, for npm wiring removed by hand while the package stays: nobody refreshes the marker then, and without
2612
+ the bound the plugin would stay down, memoryless, with its once-only line long said. The hooks half's bound
2613
+ is shorter because a plugin hook not standing down costs nothing (the claim) and an npm hook beside it
2614
+ would have refreshed the file at its session start. The bounds' cost is one session of doubled tools after
2615
+ a week away.
2616
+ - **Not in a paused folder.** The write sits after the folder checks in `runHook`, so an off or paused folder
2617
+ still writes nothing under the install (`a paused folder with two wirings` holds it).
2618
+ - **The line.** "Nothing needs to change" became "keeping one install is simpler", with both ways out
2619
+ (`plugin.ts#keepOne`), the plugin's id read off its install path, phrased for the person and asking nothing
2620
+ of the model. The folder-origin wording is unchanged.
2621
+
@@ -39,7 +39,7 @@ import {
39
39
  stanceOfMode,
40
40
  } from "../../scopes.js";
41
41
  import type { ScopeCommandContext, ScopeRead, ScopeVerdict } from "../../scopes.js";
42
- import { canonicalScope, isEntrypoint, readSession } from "../../sessions.js";
42
+ import { canonicalScope, installedVersion, isEntrypoint, readSession } from "../../sessions.js";
43
43
  import { openLog } from "../../log/index.js";
44
44
  import type { LogEvent, ProcessLog } from "../../log/index.js";
45
45
  import { resolveZone, todayIn } from "../../../core/time.js";
@@ -63,7 +63,7 @@ import type { SaysSoHook, StandDownFault } from "../standdown.js";
63
63
  import { readTranscript } from "../transcript.js";
64
64
  import { BINARY, entryScript, scriptArgs } from "../../runtime.js";
65
65
  import type { Binary } from "../../runtime.js";
66
- import { npmWiring } from "../../host-wiring.js";
66
+ import { noteNpmLive, npmWiringForGate } from "../../npm-live.js";
67
67
  import {
68
68
  PLUGIN_ROOT_ENV,
69
69
  ensureFirstRun,
@@ -698,7 +698,8 @@ async function main(): Promise<void> {
698
698
  const home = homedir();
699
699
  const projectDir = process.env["CLAUDE_PROJECT_DIR"] ?? eventDirectory(payload);
700
700
  const gate = hookGate(
701
- npmWiring({ home, env: process.env, cwd: projectDir, read: { mcp: false } }),
701
+ // The directory flavor reads the npm install's marker instead (`npm-live.ts`).
702
+ npmWiringForGate({ home, env: process.env, cwd: projectDir, configPath: choice.path, read: { mcp: false } }),
702
703
  home,
703
704
  // Where the plugin was loaded from changes only the session-start line.
704
705
  name === "session-start" ? pluginOrigin({ home, env: process.env, cwd: projectDir }) : undefined,
@@ -917,6 +918,20 @@ async function runHook(
917
918
  sayPaused(name, verdict, scope, "session", payload, said, choice.path);
918
919
  return;
919
920
  }
921
+ // THE NPM INSTALL SAYS IT IS WIRED (`npm-live.ts`), for a plugin of the
922
+ // directory flavor beside it, which reads none of Claude Code's files. Here,
923
+ // past the configuration refusals (the explicit-dir guard among them) and a
924
+ // folder that is off or paused, which write nothing. At a session start, one
925
+ // reading of the user-level wiring (so wiring removed by hand is known by the
926
+ // next session); at any other event, usually one small read that finds the
927
+ // file fresh. Written in an observer folder too: it is host state beside the
928
+ // configuration, not memory. Never from the plugin's own hook.
929
+ if (!runningAsPlugin(process.env)) {
930
+ const force = name === "session-start";
931
+ if (noteNpmLive({ configPath: choice.path, home: homedir(), env: process.env, build: installedVersion(), force }) === "failed") {
932
+ process.stderr.write("[counterparts] could not write the npm-live marker beside the configuration\n");
933
+ }
934
+ }
920
935
  // THE COMBINATION: the most restrictive of what the configuration said and
921
936
  // what the registry says (`adapters/scopes.ts#effectiveStance`, applied here
922
937
  // by folding the registry's `observer` into the config the adapter opens on).
@@ -675,7 +675,7 @@ async function main(): Promise<void> {
675
675
  observer: config.observer === true,
676
676
  });
677
677
  log.start();
678
- const sidebarWanted = sidebarInstalled(process.env, homedir());
678
+ const sidebarWanted = sidebarInstalled(process.env, homedir(), choice.path);
679
679
  if (!sidebarWanted && removeSidebarStatus(choice.path)) log.event({ name: "runner.sidebar", data: { removed: true } });
680
680
  try {
681
681
  const report = await runOnce({
@@ -53,7 +53,8 @@ export interface HostReading {
53
53
  readonly mcpUnreadable: boolean;
54
54
  /** False: this build does not open the MCP file at all (the plugin
55
55
  * directory's, `runtime.ts#readsHostUserConfig`), so there is no MCP clause,
56
- * and its plugin does not stand down beside the npm install. Absent: read. */
56
+ * and its plugin stands down beside the npm install only by the npm
57
+ * install's marker (`npmMarker`, `npm-live.ts`). Absent: read. */
57
58
  readonly mcpRead?: boolean;
58
59
  /**
59
60
  * Whether a `claude` executable is on the PATH the caller would run
@@ -82,6 +83,10 @@ export interface HostReading {
82
83
  /** The Counterparts Claude Code plugin, when Claude Code records it
83
84
  * installed (`host-wiring.ts#pluginInstall`); absent or null when not. */
84
85
  readonly plugin?: PluginInstallRead | null;
86
+ /** The npm install's marker (`npm-live.ts`) as a directory-flavor plugin
87
+ * would read it: which halves it would stand down for. Null when there is
88
+ * none it would believe; absent when not read. */
89
+ readonly npmMarker?: { readonly hooks: boolean; readonly server: boolean } | null;
85
90
  }
86
91
 
87
92
  /** How a Runtime row names where a command was wired: `desktop` is Claude
@@ -311,23 +316,34 @@ export function hostFindings(reading: HostReading): Finding[] {
311
316
  ),
312
317
  ];
313
318
  }
314
- // THE PLUGIN DIRECTORY'S BUILD DOES NOT STAND DOWN (2026-10-14): it never
315
- // reads `~/.claude.json`, so it cannot tell this wiring is there, and both
316
- // run, on the same memory, until a marker-based check lands (docs/plugin.md).
317
- // Known two ways: this doctor IS that build (`mcpRead` false), or the
318
- // installed plugin is (`standsDown` false, read from its `installPath`, the
319
- // case of an npm doctor beside it). Unknown (null) keeps the launcher's word.
320
- const bothRun = plugin !== null && (reading.mcpRead === false || plugin.standsDown === false);
319
+ // THE PLUGIN DIRECTORY'S BUILD (2026-10-14): it never reads Claude Code's
320
+ // files, so it cannot see this wiring. Known two ways: this doctor IS that
321
+ // build (`mcpRead` false), or the installed plugin is (`standsDown` false,
322
+ // read from its `installPath`, the case of an npm doctor beside it). Unknown
323
+ // (null) keeps the launcher's word. Since 2026-10-15 it stands down by the
324
+ // npm install's marker (`npm-live.ts`) when it carries the reader
325
+ // (`readsMarker`; this doctor, when it is that build) and the marker holds
326
+ // for the hooks, and for the server when one is registered. A build without
327
+ // the reader, or a marker the hooks have not written yet, runs beside it.
328
+ const directory = plugin !== null && (reading.mcpRead === false || plugin.standsDown === false);
329
+ const readsMarker = reading.mcpRead === false || plugin?.readsMarker === true;
330
+ const marker = reading.npmMarker ?? null;
331
+ const markerHolds = marker !== null && marker.hooks && (marker.server || !reading.mcp);
332
+ const bothRun = directory && !(readsMarker && markerHolds);
321
333
  const twiceClause =
322
334
  plugin === null
323
335
  ? ""
324
336
  : bothRun
325
- ? `ALSO installed as the Claude Code plugin (${plugin.id}), whose build does not check for the other install, so both are running, on the same memory: every hook and memory tool is wired twice until a later version checks`
337
+ ? readsMarker
338
+ ? `ALSO installed as the Claude Code plugin (${plugin.id}), which reads none of Claude Code's files and has no word from this install yet, so both are running, on the same memory, until this install's hooks have run in a session`
339
+ : `ALSO installed as the Claude Code plugin (${plugin.id}), whose build does not check for the other install, so both are running, on the same memory: every hook and memory tool is wired twice until a later version checks`
326
340
  : `ALSO installed as the Claude Code plugin (${plugin.id}), which stands down while this wiring is live`;
341
+ // KEEP ONE (2026-10-15, as the plugin's own session-start line says it,
342
+ // `plugin.ts#keepOne`): both ways out, the same memory either way.
327
343
  const twiceFix =
328
344
  plugin === null
329
345
  ? ""
330
- : `Installed twice${bothRun ? "; remove one" : ""}: to keep only the plugin, run \`counterparts disconnect\` and restart Claude Code; to keep only this install, run \`claude plugin uninstall ${plugin.id}\`. Same memory either way.`;
346
+ : `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).`;
331
347
  const mcpClause = reading.mcpRead === false
332
348
  ? ""
333
349
  : reading.mcp
@@ -5,6 +5,7 @@ import { Counterpart } from "../../core/counterpart.js";
5
5
  import {
6
6
  Store,
7
7
  assertPreMigrationTarget,
8
+ chapterSummaryKind,
8
9
  isStoreError,
9
10
  paths,
10
11
  pendingMigration,
@@ -335,3 +336,43 @@ export function journalCopyFindings(store: Store): Finding[] {
335
336
  ),
336
337
  ];
337
338
  }
339
+
340
+ /** The window the summaries line counts over, in days. */
341
+ const SUMMARY_WINDOW_DAYS = 7;
342
+
343
+ /**
344
+ * CHAPTER SUMMARIES (2026-10-15): how many of the last week's chapters got a
345
+ * summary their session WROTE, and how many stand on an AUTOMATIC one the
346
+ * boundary wrote from the chapter's opening lines because the session gave
347
+ * none. Green and informational — a run of automatic ones says sessions are
348
+ * skipping the `summary` field, which is worth seeing, not a fault. Silent
349
+ * when the week holds no summary at all (a store before the change, or a
350
+ * quiet week). One read of the journal's memories; meta only.
351
+ */
352
+ export function chapterSummaryFindings(store: Store): Finding[] {
353
+ const since = store.now() - SUMMARY_WINDOW_DAYS * 86_400_000;
354
+ let written = 0;
355
+ let automatic = 0;
356
+ try {
357
+ for (const id of store.list({ type: "memory", source: "episode" })) {
358
+ const row = store.row(id);
359
+ if (row === undefined || (row.created_at ?? 0) < since) continue;
360
+ const kind = chapterSummaryKind(row.meta);
361
+ if (kind === "written") written += 1;
362
+ else if (kind === "automatic") automatic += 1;
363
+ }
364
+ } catch {
365
+ return [];
366
+ }
367
+ if (written + automatic === 0) return [];
368
+ return [
369
+ finding(
370
+ "chapter-summaries",
371
+ "green",
372
+ "Chapter summaries",
373
+ `${String(written)} written by the session, ${String(automatic)} automatic (its opening lines, because the session gave none), over the last ${String(SUMMARY_WINDOW_DAYS)} days`,
374
+ "",
375
+ { written, automatic, days: SUMMARY_WINDOW_DAYS },
376
+ ),
377
+ ];
378
+ }
@@ -63,6 +63,7 @@ import {
63
63
  SPAWN_STARTED_EVENT,
64
64
  SWEEP_GATE_EVENT,
65
65
  WAKE_DELIVERED_EVENT,
66
+ WAKE_INJECTED_EVENT,
66
67
  } from "../../core/counterpart.js";
67
68
  import { Counterpart } from "../../core/counterpart.js";
68
69
  import {
@@ -120,7 +121,7 @@ import { finding, tilde, payloadOf, str, num, off, newestRows, undetermined } fr
120
121
  import type { Finding } from "./doctor-finding.js";
121
122
  import { checkoutFindings } from "./doctor-checkout.js";
122
123
  import type { CheckoutReading } from "./doctor-checkout.js";
123
- import { openFindings, journalFindings, journalCopyFindings } from "./doctor-open.js";
124
+ import { openFindings, journalFindings, journalCopyFindings, chapterSummaryFindings } from "./doctor-open.js";
124
125
  import type { OpenReading, MigrationReading } from "./doctor-open.js";
125
126
  import {
126
127
  metaJson,
@@ -2347,14 +2348,25 @@ const LOOKUP_WINDOW_DAYS = 14;
2347
2348
  */
2348
2349
  export function lookupFindings(store: Store): Finding[] {
2349
2350
  const since = Math.max(0, store.livedDay() - LOOKUP_WINDOW_DAYS);
2350
- const offered = { dream: 0, reflection: 0 };
2351
- const runs = { dream: 0, reflection: 0 };
2352
- const looked = { dream: 0, reflection: 0 };
2351
+ const offered = { dream: 0, reflection: 0, wake: 0 };
2352
+ const runs = { dream: 0, reflection: 0, wake: 0 };
2353
+ const looked = { dream: 0, reflection: 0, wake: 0 };
2353
2354
  let unread = false;
2354
2355
  try {
2355
2356
  const begun = store.eventLog({ name: "dream.begun", sinceDay: since, order: "desc", limit: LOOKUP_ROWS });
2356
2357
  const recalls = store.eventLog({ name: "mcp.recall", sinceDay: since, order: "desc", limit: LOOKUP_ROWS });
2357
- unread = begun.length >= LOOKUP_ROWS || recalls.length >= LOOKUP_ROWS;
2358
+ // The wake's list items as lines (#489 C): each session start's row says
2359
+ // how many it listed that way; a start before that build says nothing.
2360
+ const woke = store.eventLog({ name: WAKE_INJECTED_EVENT, sinceDay: since, order: "desc", limit: LOOKUP_ROWS });
2361
+ unread = begun.length >= LOOKUP_ROWS || recalls.length >= LOOKUP_ROWS || woke.length >= LOOKUP_ROWS;
2362
+ for (const row of woke) {
2363
+ const p = payloadOf(row);
2364
+ const n = num(p, "lined");
2365
+ // A resume composes no wake: not a session start that offered nothing.
2366
+ if (n === null || p["resumed"] === true) continue;
2367
+ runs.wake += 1;
2368
+ offered.wake += n;
2369
+ }
2358
2370
  for (const row of begun) {
2359
2371
  const n = num(payloadOf(row), "offered");
2360
2372
  if (n === null) continue;
@@ -2375,7 +2387,7 @@ export function lookupFindings(store: Store): Finding[] {
2375
2387
  for (const row of recalls) {
2376
2388
  const from = payloadOf(row)["fromIndex"];
2377
2389
  if (from === null || typeof from !== "object") continue;
2378
- for (const m of ["dream", "reflection"] as const) {
2390
+ for (const m of ["dream", "reflection", "wake"] as const) {
2379
2391
  const v = (from as Record<string, unknown>)[m];
2380
2392
  if (typeof v === "number") looked[m] += v;
2381
2393
  }
@@ -2383,17 +2395,20 @@ export function lookupFindings(store: Store): Finding[] {
2383
2395
  } catch {
2384
2396
  return [];
2385
2397
  }
2386
- const say = (m: "dream" | "reflection", runWord: string): string =>
2398
+ const say = (m: "dream" | "reflection" | "wake", runWord: string): string =>
2387
2399
  runs[m] === 0
2388
2400
  ? `${m}: no ${runWord} measured yet`
2389
2401
  : `${m}: ${String(looked[m])} looked up of ${String(offered[m])} offered in part, over ${String(runs[m])} ${runWord}${runs[m] === 1 ? "" : "s"}`;
2390
- const none = runs.dream + runs.reflection > 0 && offered.dream + offered.reflection > 0 && looked.dream + looked.reflection === 0;
2402
+ const none =
2403
+ runs.dream + runs.reflection + runs.wake > 0 &&
2404
+ offered.dream + offered.reflection + offered.wake > 0 &&
2405
+ looked.dream + looked.reflection + looked.wake === 0;
2391
2406
  return [
2392
2407
  finding(
2393
2408
  "lookups",
2394
2409
  "green",
2395
2410
  "Lookups",
2396
- `last ${String(LOOKUP_WINDOW_DAYS)} lived days — ${say("dream", "night")}; ${say("reflection", "reflection")}` +
2411
+ `last ${String(LOOKUP_WINDOW_DAYS)} lived days — ${say("dream", "night")}; ${say("reflection", "reflection")}; ${say("wake", "session start")}` +
2397
2412
  (none ? ". None looked up yet: if that holds, the lines may be too thin or the lookup unclear" : "") +
2398
2413
  (unread ? ". More rows than were read: the counts are a floor" : ""),
2399
2414
  "",
@@ -2404,6 +2419,9 @@ export function lookupFindings(store: Store): Finding[] {
2404
2419
  reflectionOffered: offered.reflection,
2405
2420
  reflectionLooked: looked.reflection,
2406
2421
  reflections: runs.reflection,
2422
+ wakeOffered: offered.wake,
2423
+ wakeLooked: looked.wake,
2424
+ wakes: runs.wake,
2407
2425
  floor: unread,
2408
2426
  },
2409
2427
  ),
@@ -3336,6 +3354,8 @@ export function doctorFindings(input: DoctorInput): Finding[] {
3336
3354
  : [["crash-write-up", (): Finding[] => crashWriteUpFindings(input, store, owedReading)] as const]),
3337
3355
  // F6: silent unless a copy failure is standing. Two bounded event reads.
3338
3356
  ["journal-copy", () => journalCopyFindings(store)],
3357
+ // 2026-10-15: written vs automatic chapter summaries this week. Silent without any.
3358
+ ["chapter-summaries", () => chapterSummaryFindings(store)],
3339
3359
  // The process log (2026-09-30): one directory listing and today's file.
3340
3360
  // Not in the session-start reading: it is never red, and it reads a file.
3341
3361
  ...(input.budgetMs !== undefined ? [] : [["log", (): Finding[] => logFindings(input)] as const]),
@@ -82,6 +82,7 @@ import { nightRowTimeoutMs, planNightRunner } from "./night-run.js";
82
82
  import { NOTHING_OWED_BEFORE_KEY, catchUpOf, catchUpWords, owedBefore } from "./night-catch-up.js";
83
83
  import type { NightKind } from "./night-run.js";
84
84
  import { spawnDetached } from "../spawn.js";
85
+ import { ONE_TAG_LINE, wakeTagLead } from "../store-id.js";
85
86
  import type { SpawnOutcome } from "../spawn.js";
86
87
  import { NO_ARRIVAL, STOP_ASK_OPENER, readWakeArrival, startedByHost } from "./transcript.js";
87
88
  import type { WakeArrival } from "./transcript.js";
@@ -536,7 +537,7 @@ export const RESUME_WAKE_LINE =
536
537
  "Counterparts: this session was resumed; the wake it was handed when it started (above) still holds.";
537
538
 
538
539
  /** What `sessionStart` hands the host: a composed wake, or a resume's line. */
539
- type WokeHere = Pick<ReturnType<Lifecycle["composeWake"]>, "text" | "ok" | "bytes" | "sentinel" | "preface"> & {
540
+ type WokeHere = Pick<ReturnType<Lifecycle["composeWake"]>, "text" | "ok" | "bytes" | "sentinel" | "preface" | "lined"> & {
540
541
  readonly reason: string;
541
542
  };
542
543
 
@@ -693,14 +694,15 @@ export class ClaudeCodeAdapter extends Lifecycle {
693
694
  // are Claude Desktop's server, which serves a call as this session only
694
695
  // when the call names it. A terminal session's wake is unchanged.
695
696
  const codeTab = codeTabSessionLine(input);
696
- // THE FIRST MEETING'S MARKER (2026-10-11), on its own line under the
697
- // clock, on every session-start wake: the state word only, for the mod,
698
- // which cannot reach the dashboard before somebody starts it. The store
699
- // marker on the line under it (2026-10-12) says which store this session
700
- // opened, so the mod can tell this store's dashboard from another's.
701
- const storeLine = this.storeMarker();
702
- const marker = `${this.onboardingMarker(input)}\n${storeLine.length === 0 ? "" : `${storeLine}\n`}`;
703
- const lead = `${woke.text.length === 0 && plain.context.length === 0 && codeTab === null ? "" : `${this.nowLine()}\n`}${marker}${codeTab === null ? "" : `${codeTab}\n`}${plain.context}`;
697
+ // THE FIRST MEETING'S MARKER (2026-10-11), on every session-start wake:
698
+ // the state word only, for the mod, which cannot reach the dashboard
699
+ // before somebody starts it. The store marker beside it (2026-10-12)
700
+ // says which store this session opened, so the mod can tell this
701
+ // store's dashboard from another's. Since 2026-10-16 both ride on the
702
+ // wake's own head line, just above its body (`wakeTagLead`, lightly
703
+ // held); `ONE_TAG_LINE` off puts them back under the clock.
704
+ const tags = wakeTagLead([this.onboardingMarker(input), this.storeMarker()], woke.text);
705
+ const lead = `${woke.text.length === 0 && plain.context.length === 0 && codeTab === null ? "" : `${this.nowLine()}\n`}${ONE_TAG_LINE ? "" : tags}${codeTab === null ? "" : `${codeTab}\n`}${plain.context}${ONE_TAG_LINE ? tags : ""}`;
704
706
  const sent = woke.bytes + Buffer.byteLength(lead, "utf8");
705
707
  const rides =
706
708
  plain.due.length > 0 &&
@@ -741,6 +743,12 @@ export class ClaudeCodeAdapter extends Lifecycle {
741
743
  interactive: isInteractive(input) && input.nightRun !== true,
742
744
  // A resume's short wake (2026-10-11): `bytes` is the line, not a bundle.
743
745
  resumed,
746
+ // How many items it listed as a line (#489 C): doctor's Lookups line
747
+ // reads what was offered from here, and what was expanded from
748
+ // `mcp.recall`'s `fromIndex.wake`. Not on the nightly run's row: its
749
+ // wake writes no ledger (`Lifecycle#noteWakeIndex`), so its lines
750
+ // could never count as looked up (review of #508).
751
+ ...(input.nightRun === true ? {} : { lined: woke.lined?.length ?? 0 }),
744
752
  });
745
753
  // THE QUESTION RIDES BESIDE THE WAKE, NEVER INSIDE IT, and only if it
746
754
  // FITS.
@@ -67,6 +67,7 @@ import { readHost, mcpCommand } from "./install.js";
67
67
  import { coverageLines } from "./coverage.js";
68
68
  import { readDesktop } from "./desktop.js";
69
69
  import { runtimeLabel } from "../runtime.js";
70
+ import { npmMarkerReading } from "../npm-live.js";
70
71
  import { installRoute } from "../plugin.js";
71
72
  // The terminal layouts for the two readings a person checks an install with.
72
73
  // Both fall back to today's exact bytes for a console that is not a terminal.
@@ -969,6 +970,9 @@ export function doctorCommand(
969
970
  claudeOnPath: claudeOnPath(env),
970
971
  mcpAddLine: mcpCommand(dir, undefined, customConfigPath(named, home ?? homedir())),
971
972
  consoleRuntime: runtimeLabel(),
973
+ // THE NPM INSTALL'S MARKER, as a directory-flavor plugin reads it
974
+ // (`npm-live.ts`): whether that plugin stands down beside this wiring.
975
+ npmMarker: npmMarkerReading(configPath, env),
972
976
  },
973
977
  // CLAUDE DESKTOP'S ENTRY (2026-09-30): two small reads of the host's
974
978
  // files, like `host` above. Quiet in the report when there is none.
@@ -26,7 +26,11 @@
26
26
  * - the configuration file, and our own temp and backup siblings of it;
27
27
  * - `scopes.json` and its siblings;
28
28
  * - `sidebar.json` (what the Claude Code sidebar shows, `sidebar-status.ts`)
29
- * and its temp siblings — a file this package left;
29
+ * and its temp siblings, and `sidebar-plugin-here` (a folder-loaded plugin's
30
+ * marker, same file) — files this package left;
31
+ * - `npm-live.json` and `npm-live.<hash>.json` (the npm install's word that
32
+ * it is wired, which a directory-flavor plugin stands down by,
33
+ * `npm-live.ts`) and their temp siblings;
30
34
  * - `snapshots/`, when it is the one this layout owns rather than a directory
31
35
  * the owner pointed at;
32
36
  * - the STORE — at `dataDir`, **wherever that is**, which is the other half of
@@ -93,7 +97,8 @@ import { basename, dirname, isAbsolute, join, parse as parsePath, resolve } from
93
97
  import { Store, assertSafeDataDir, dateOf, isWithin, storeExists } from "../../core/store/index.js";
94
98
  import { isJournal } from "../../core/sleep/index.js";
95
99
  import { SCOPES_FILE_NAME, shellWord } from "../scopes.js";
96
- import { SIDEBAR_FILE_NAME } from "../sidebar-status.js";
100
+ import { NPM_LIVE_NAME } from "../npm-live.js";
101
+ import { PLUGIN_PRESENCE_NAME, SIDEBAR_FILE_NAME } from "../sidebar-status.js";
97
102
  import { PLUGIN_ROOT_ENV, installRoute } from "../plugin.js";
98
103
  import { pluginInstall } from "../host-wiring.js";
99
104
  import { pluginConsoleWords } from "../runtime.js";
@@ -299,7 +304,8 @@ export function ownedKind(name: string, owned: OwnedNames): OwnedKind | null {
299
304
  if (name === owned.scopes) return "scopes";
300
305
  if (owned.snapshots !== null && name === owned.snapshots) return "snapshots";
301
306
  if (owned.store !== null && name === owned.store) return "store";
302
- if (name === SIDEBAR_FILE_NAME || /^sidebar\.json\.\d+\.tmp$/.test(name)) return "sidecar";
307
+ if (name === SIDEBAR_FILE_NAME || name === PLUGIN_PRESENCE_NAME || /^sidebar\.json\.\d+\.tmp$/.test(name)) return "sidecar";
308
+ if (NPM_LIVE_NAME.test(name)) return "sidecar";
303
309
  const bases = [owned.config, owned.scopes, owned.snapshots, owned.store];
304
310
  for (const base of bases) {
305
311
  if (base === null || !name.startsWith(`${base}.`)) continue;