counterparts 0.3.36 → 0.3.37

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,57 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.37 — 2026-10-25
4
+
5
+ The wake says what the night did: a "Last night:" line under Yesterday, or, before the day's own nightly run, "The night of Oct 24: …" naming the latest night that finished. "Still open" counts what it leaves out calmly and points at `recall "still open"`, which lists every open item, and a terminal left open for hours reads "quiet since …" instead of "(live)". The Yesterday line can now open with day's end's own summary of yesterday, which in 0.3.36 never showed (a chapter's summary recorded no folder), also when yesterday's work spanned several folders. Ambient recall looks up memories by the meaning of what you just typed, not the exchange before it. **Privacy fixes:** a folder you have turned off no longer shows its chapter summaries ("Might be relevant") or its chapter titles (the Yesterday line) in another folder's session start, whichever way the wake arrives: built at session start, handed over as the last turn-end left it, or read back for a lost session. No store-format change (store v15, cache v7), no wiring change: `counterparts connect` is not needed after upgrading. Going back to 0.3.36 needs no store restore: `counterparts disconnect`, 0.3.36'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.
6
+
7
+ - **Recall's meaning lookup is about what you just asked.** Each turn now looks up memories by the meaning of
8
+ its own prompt, not the exchange before it, so a change of subject is followed at once rather than a turn
9
+ later. A store too large to look up in line on every turn still uses the previous exchange, as before.
10
+ Asking `recall` directly is unchanged. To go back: `recall.SEMANTIC_THIS_TURN` false.
11
+ - **Yesterday's line can open with day's end's summary again.** A chapter's summary memory was written with no
12
+ folder, so the privacy check behind "Yesterday, in day's end's words" refused every day with a chapter in it and
13
+ the summary never showed. A chapter's summary now records the folder its chapter was written in, and summaries
14
+ written before are read as written in their chapter's folder. Nothing in the store changes; the privacy check is
15
+ as strict as before.
16
+ - **The wake says what last night did.** A session start's wake has a "Last night:" line
17
+ under the Yesterday line: what the dream and the reflection did, by id and in a few
18
+ words ("dream drm_… made 11 links, 1 fold and 1 feeling; reflection rfl_… rewrote the
19
+ page"), or "a quiet night", or that the nightly run is under way; before the day's run it
20
+ names the latest night that finished (below). A store that has never had a night shows no line.
21
+ - **"Still open" counts the rest calmly.** The line under the open items reads "(96 more
22
+ open, kept quietly; recall "still open" lists them)" instead of a count of how many
23
+ were untouched for two weeks and five bare ids.
24
+ - **A terminal left open is quiet, not live.** "Today, elsewhere" (and "Here, also open")
25
+ says "open since 10-24 16:49, quiet since 07:12" for a session with no turn for two
26
+ hours, instead of "(live)".
27
+ - **A handoff's staleness reads in two parts.** "(1 day old, with a newer chapter here
28
+ since; release 0.3.34 then, 0.3.35 now)" where it said "1 day old; since then: a newer
29
+ chapter here; written on 0.3.34, 0.3.35 now".
30
+ - **Each turn's recall record says what kept memories from showing** (internal): near misses of the bar, habituation, full tiers, the byte budget and duplicates are counted beside the echo and project skips, along with whether a person started the turn. What shows is unchanged.
31
+ - **Yesterday's line can tell the whole day when you work in several folders.** Day's end's summary of
32
+ yesterday may now mention work from your other folders, the way "Today, elsewhere" already names their work.
33
+ Until now one cited piece of work from another folder kept the summary out, so for anyone who works in more
34
+ than one folder it almost never showed. A folder you have turned off or paused still keeps it out: if
35
+ yesterday touched one, the wake lists yesterday's chapters instead, as before.
36
+ - **A folder you have turned off no longer shows its chapter summaries under "Might be relevant"** in another
37
+ folder's session start. They were listed there before, whatever the folder's setting.
38
+ - **Recall can list what's still open.** `recall` with the handle "still open" lists every
39
+ open item the wake's "Still open" carries, in the wake's order, with ids, titles and how
40
+ long since each was touched, twenty to a page. Asking "what's still open?" or "open
41
+ threads" in facts mode gets the same list. The wake's count under "Still open" now points
42
+ at it: "(94 more open, kept quietly; recall "still open" lists them)".
43
+ - **The first wake of the day says what the last night did.** Before the day's nightly run,
44
+ the night line describes the latest night that finished, dated by the day it read ("The
45
+ night of Oct 24: dream drm_… made 11 links, 1 feeling and 1 fold; reflection rfl_…
46
+ rewrote the page."), instead of "Last night: none yet today". A night more than three
47
+ days back says so: "The night of Oct 19 was the last to run: …".
48
+ - **A folder you have turned off keeps its chapter summaries out of "Might be relevant" in other folders, also
49
+ when a session start hands over the wake as the last turn-end wrote it** (for example, in a second app with a
50
+ different size limit).
51
+ - **That wake's "Yesterday" line is the one this folder's own wake would carry**, so a turned-off folder's chapter
52
+ titles are no longer in it. The wake the crash fallback reads a lost session with leaves chapter summaries out
53
+ too.
54
+
3
55
  ## 0.3.36 — 2026-10-25
4
56
 
5
57
  A session opened mid-day now sees what this folder did earlier today (a "Today so far here" line), and the Yesterday line opens with day's end's own summary of yesterday when everything it rests on may be shown in this folder; on a tight day, "Still open" keeps its items before "Today so far" keeps its summaries. When you write the newer state of a recent memory without linking it, a turn that brings back both shows the newer one first and labels the older one "may be out of date". A word that brought a memory back, which the session then used, is wired to it, so next time the word alone can bring it back. The core is decided every night instead of every third (still at most three a night), and a belief you repeat awake counts as support for the one that already says it. A new way of deciding the core, by how much real use has backed a memory, runs **in shadow only**: it records each night what it would have let in or kept out, and nothing changes yet. **This release changes the store's format (v14 to v15, one new table), so after installing, quit the dashboard and every open Claude Code session, then start them again**: one left running from before the update keeps the old code against the upgraded store and stops working on it until it is restarted. The first open saves a copy of your store before upgrading it. **0.3.35 and older refuse the upgraded store**, so going back to 0.3.35 is `counterparts rollback` first, while 0.3.36 is still installed (it puts that pre-upgrade copy back; anything remembered since is set aside, not deleted), then 0.3.35's install and `counterparts connect` as it prints. Cache v7 unchanged; no wiring change, so `counterparts connect` is not needed after upgrading.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.36",
3
+ "version": "0.3.37",
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": {
@@ -1058,6 +1058,8 @@ export class ClaudeCodeAdapter extends Lifecycle {
1058
1058
  // Said outright this turn, so not ALSO handed over as a quiet cue.
1059
1059
  ...(waiting.length === 0 ? {} : { withhold: new Set(waiting.map((r) => r.memoryId)) }),
1060
1060
  ...(byHost ? { noCues: true } : {}),
1061
+ // Who started the turn, for the row only (N1): the reading above.
1062
+ startedBy: !isInteractive(input) ? "unattended" : byHost ? "host" : "person",
1061
1063
  });
1062
1064
  const decision = result.decision;
1063
1065
  // "SINCE YOU STARTED" (2026-10-11): what changed in other directories
@@ -75,7 +75,10 @@ export type Emit = (name: string, data: Record<string, string | number | boolean
75
75
  * prompt keeps at least ~70% of the joined text at typical lengths and the whole
76
76
  * cue stays inside one embedding call. Not measured against surfacing quality
77
77
  * yet — the day-1 watch is whether `semantic: "lagged"` turns into surfaced
78
- * items that were not already lexically cued.
78
+ * items that were not already lexically cued. Since 2026-10-25
79
+ * (`recall.SEMANTIC_THIS_TURN`, on) the next turn ranks its own text instead
80
+ * and reads this row only past the in-line count guard; the row is still
81
+ * written every turn, beside the embed backfill this worker also runs.
79
82
  */
80
83
  export const LAG_PROMPT_BYTES = 2000;
81
84
  export const LAG_REPLY_BYTES = 800;
@@ -1170,7 +1170,16 @@ export class Lifecycle implements HostLifecycle {
1170
1170
  recallTurn(
1171
1171
  input: SessionInput,
1172
1172
  text: string,
1173
- opts: { budgetBytes?: number; withhold?: ReadonlySet<string>; noCues?: boolean } = {},
1173
+ opts: {
1174
+ budgetBytes?: number;
1175
+ withhold?: ReadonlySet<string>;
1176
+ noCues?: boolean;
1177
+ /** Who started this turn, as the host reads it (N1, 2026-10-25): `person`
1178
+ * (an attended session, a prompt no host frame opens), `host` (attended,
1179
+ * but a hand-back, a task notice or a peer's message started it) or
1180
+ * `unattended`. Recorded on the row only; absent where the host cannot say. */
1181
+ startedBy?: "person" | "host" | "unattended";
1182
+ } = {},
1174
1183
  ): ReturnType<Counterpart["recallForTurn"]> {
1175
1184
  const result = this.counterpart.recallForTurn(
1176
1185
  {
@@ -1220,7 +1229,11 @@ export class Lifecycle implements HostLifecycle {
1220
1229
  // watch can read out of the store tomorrow. `semantic: "none"` on every
1221
1230
  // real turn is exactly the finding this PR closes. Since 2026-10-19 a
1222
1231
  // turn the lag never reached (first prompt, stale row) reads `in-line`
1223
- // (or `in-line-skipped` past the vector-count guard); `in-line` on a
1232
+ // (or `in-line-skipped` past the vector-count guard). Since 2026-10-25,
1233
+ // with `recall.SEMANTIC_THIS_TURN` on, every turn that can reads
1234
+ // `in-line`, and `lagged` means it could not (past the guard, with the
1235
+ // worker's fresh row as the fallback). The worker's own health is its
1236
+ // `adapter.semantic.lag` rows. With the switch off, `in-line` on a
1224
1237
  // session's later turns is the lag falling behind, by name.
1225
1238
  semantic: decision.semanticSource,
1226
1239
  semanticFrom: decision.semanticFromTurn,
@@ -1232,6 +1245,22 @@ export class Lifecycle implements HostLifecycle {
1232
1245
  echoSkipped: decision.echoSkipped,
1233
1246
  projectSkipped: decision.projectSkipped,
1234
1247
  crossProjectLifted: decision.crossProjectLifted,
1248
+ // WHAT STOPPED A MEMORY (N1, 2026-10-25, observation only): the decision
1249
+ // row's counts, flat, beside the skips above, so a week's read of the
1250
+ // turns a person started is one table (`startedBy`). The near miss's
1251
+ // margin is on the decision row (`nearMiss.margin`); `turn` joins the two.
1252
+ // Absent with `recall.STOP_COUNTS` off, as on the decision row.
1253
+ turn: decision.turn,
1254
+ ...(decision.nearMiss === undefined
1255
+ ? {}
1256
+ : {
1257
+ habituationCut: decision.habituationCut ?? 0,
1258
+ nearMissCount: decision.nearMiss.count,
1259
+ capped: decision.capped ?? 0,
1260
+ budgetTrimmed: decision.budgetTrimmed ?? 0,
1261
+ inhibited: decision.inhibited ?? 0,
1262
+ }),
1263
+ ...(opts.startedBy === undefined ? {} : { startedBy: opts.startedBy }),
1235
1264
  });
1236
1265
  return result;
1237
1266
  }
@@ -19,7 +19,7 @@ export const SERVER_NAME = "counterparts";
19
19
  * host decides whether to trust what follows. Read from a constant rather than
20
20
  * from disk so the server opens no file to answer its first message.
21
21
  */
22
- export const SERVER_VERSION = "0.3.36";
22
+ export const SERVER_VERSION = "0.3.37";
23
23
 
24
24
  /**
25
25
  * THE ONE LINE EVERY TOOL ANSWERS WITH when the store on disk is a schema AHEAD
@@ -169,7 +169,44 @@ import type { FitIndex, FitMechanism } from "../../core/fit/index.js";
169
169
 
170
170
  /** Recall's keys a night run's short ids may stand in (2026-10-23). */
171
171
  const RECALL_ID_KEYS: ReadonlySet<string> = new Set(["ids", "handle"]);
172
- import { WAKE_BUILD_KEY } from "../../core/self/index.js";
172
+
173
+ /** How many items the `still open` handle gives a page (2026-10-25). CAL. */
174
+ export const STILL_OPEN_PAGE = 20;
175
+
176
+ /**
177
+ * The facts questions that ask for the list itself (2026-10-25, the O1
178
+ * builder): on the owner's 10-25 snapshot these matched none of 156 open
179
+ * threads by content, so they are answered by the `still open` handle. Exact
180
+ * after case, punctuation and spacing are folded: a question about a thing
181
+ * ("is the seed order still open?") is a question, not this.
182
+ */
183
+ const STILL_OPEN_QUESTIONS: ReadonlySet<string> = new Set([
184
+ "still open",
185
+ "whats still open",
186
+ "what is still open",
187
+ "what remains open",
188
+ "whats open",
189
+ "what is open",
190
+ "open threads",
191
+ "my open threads",
192
+ "the open threads",
193
+ "what are the open threads",
194
+ "what are my open threads",
195
+ "list open threads",
196
+ "list the open threads",
197
+ "which threads are open",
198
+ "which threads are still open",
199
+ "what threads are still open",
200
+ "what is still unresolved",
201
+ "whats still unresolved",
202
+ ]);
203
+
204
+ /** True when a facts question asks for exactly the list of what is still open. */
205
+ export function asksStillOpen(question: string): boolean {
206
+ const folded = question.toLowerCase().replace(/[’']/g, "").replace(/[^a-z ]+/g, " ").replace(/\s+/g, " ").trim();
207
+ return STILL_OPEN_QUESTIONS.has(folded);
208
+ }
209
+ import { STILL_OPEN_HANDLE, WAKE_BUILD_KEY } from "../../core/self/index.js";
173
210
  import type { PageWriterMode } from "../../core/self/index.js";
174
211
  import { canonicalToolName, toolDefinitions, toolSpec } from "./tools.js";
175
212
  import { writeUpDoor } from "./write-up.js";
@@ -2167,6 +2204,18 @@ export class McpServer {
2167
2204
  if (typeof handle === "string" && handle.trim().toLowerCase() === LAST_EXCHANGE_HANDLE && args["question"] === undefined && args["ids"] === undefined) {
2168
2205
  return this.lastExchangeTool();
2169
2206
  }
2207
+ // WHAT'S STILL OPEN (2026-10-25): the list "Still open" carries, by the
2208
+ // handle, or by a facts question that asks for exactly that.
2209
+ const stillOpenAsked =
2210
+ (typeof handle === "string" && handle.trim().toLowerCase() === STILL_OPEN_HANDLE && args["question"] === undefined && args["ids"] === undefined) ||
2211
+ (handle === undefined && args["ids"] === undefined && args["mode"] === "facts" && typeof args["question"] === "string" && asksStillOpen(args["question"]));
2212
+ if (stillOpenAsked) {
2213
+ const page = args["page"];
2214
+ if (page !== undefined && (typeof page !== "number" || !Number.isInteger(page) || page < 1)) {
2215
+ return this.refuse("recall", "page-not-a-positive-integer", {});
2216
+ }
2217
+ return this.stillOpenTool(typeof page === "number" ? page : 1, handle === undefined);
2218
+ }
2170
2219
  const question = args["question"];
2171
2220
  const ids = args["ids"];
2172
2221
  if (handle !== undefined && typeof handle !== "string") {
@@ -2323,6 +2372,58 @@ export class McpServer {
2323
2372
  );
2324
2373
  }
2325
2374
 
2375
+ /**
2376
+ * `recall` with the handle `still open` (2026-10-25, the O1 builder;
2377
+ * roadmap 10-25, lightly held): everything the wake's "Still open" carries
2378
+ * — the open threads the carry rule keeps and the core memories being
2379
+ * reconsidered, in the lane's order (`Counterpart#stillOpen`) — with ids,
2380
+ * titles and how long since each was touched, `STILL_OPEN_PAGE` to a page.
2381
+ * What the lane's tail counts, listed. Also reached by a facts question
2382
+ * that asks exactly that ("what's still open", `asksStillOpen`): measured
2383
+ * on the owner's 10-25 snapshot, those matched none of 156 open threads.
2384
+ *
2385
+ * Reads only, like `last exchange`: no recall row, no credit, no seen set,
2386
+ * no quotable record — a ring event alone. Being listed is not a touch
2387
+ * (`self/identity.ts#openCarry`), so asking cannot keep a thread carried.
2388
+ * Never reached under observer (G5): recall stands down first.
2389
+ */
2390
+ private stillOpenTool(page: number, routed: boolean): ToolResult {
2391
+ const { items, notCarried } = this.counterpart.stillOpen();
2392
+ const pages = Math.max(1, Math.ceil(items.length / STILL_OPEN_PAGE));
2393
+ const at = Math.min(page, pages);
2394
+ const shown = items.slice((at - 1) * STILL_OPEN_PAGE, at * STILL_OPEN_PAGE);
2395
+ this.emit("mcp.recall.stillopen", undefined, { total: items.length, page: at, shown: shown.length, notCarried, routed });
2396
+ const touched = (n: number): string => (n === 0 ? "this lived day" : n === 1 ? "1 lived day ago" : `${String(n)} lived days ago`);
2397
+ const faded =
2398
+ notCarried === 0
2399
+ ? ""
2400
+ : ` Not listed: ${String(notCarried)} open ${notCarried === 1 ? "thread" : "threads"} untouched for ${String(this.counterpart.self.tunables.OPEN_CARRY_DAYS)}+ lived days, no longer carried — not closed; a question about the thing itself finds one, and a touch carries it again.`;
2401
+ return this.result(
2402
+ {
2403
+ path: "handle",
2404
+ reason: "still-open",
2405
+ handle: STILL_OPEN_HANDLE,
2406
+ ...(routed ? { routed: "a facts question asking what is still open is answered by this handle" } : {}),
2407
+ total: items.length,
2408
+ page: at,
2409
+ pages,
2410
+ ...(notCarried === 0 ? {} : { notCarried }),
2411
+ items: shown.map((i) => ({
2412
+ id: i.id,
2413
+ title: i.title,
2414
+ touched: touched(i.livedDaysSinceTouched),
2415
+ ...(i.reconsidering === true ? { reconsidering: "a core memory being reconsidered: keep or retire it" } : {}),
2416
+ ...(i.date === undefined ? {} : { date: i.date }),
2417
+ })),
2418
+ note:
2419
+ (items.length === 0
2420
+ ? "Nothing is still open."
2421
+ : `What "Still open" carries, in the wake's order: what is live first, newest touched first.${at < pages ? ` More on page ${String(at + 1)} (page: ${String(at + 1)}).` : ""} Recall an id to read it whole. A lived day is a day the memory was in use.`) + faded,
2422
+ },
2423
+ false,
2424
+ );
2425
+ }
2426
+
2326
2427
  /**
2327
2428
  * A QUESTION, answered by its mode (Release B, 2026-10-03). Embedded in
2328
2429
  * line first — the one deliberate path allowed to (the ruling of
@@ -65,7 +65,7 @@ import { LAST_EXCHANGE_HANDLE } from "../../core/handoff/last-exchange.js";
65
65
  import { RECALL_MAX_IDS } from "./deliberate.js";
66
66
  import { FACTS_MEANING_CAP, FACTS_PAGE_SIZE, FACTS_TAIL_SIZE } from "./facts.js";
67
67
  import { RECURRENCES } from "../../core/time.js";
68
- import { PAGE_ROOM_BYTES } from "../../core/self/briefing.js";
68
+ import { PAGE_ROOM_BYTES, STILL_OPEN_HANDLE } from "../../core/self/briefing.js";
69
69
  import { CLAIM_PREFIX_MIN_CHARS } from "../../core/self/page.js";
70
70
  import { MEET_STEPS } from "../../core/onboarding.js";
71
71
 
@@ -905,11 +905,11 @@ const RECALL: ToolSpec = {
905
905
  page: {
906
906
  type: "integer",
907
907
  minimum: 1,
908
- description: "With a question: which page of the answer (1 is the first). The header says how many more there are.",
908
+ description: `With a question, or the handle "${STILL_OPEN_HANDLE}": which page of the answer (1 is the first). The answer says how many pages there are.`,
909
909
  },
910
910
  handle: {
911
911
  type: "string",
912
- description: `A memory id or exact title to read whole. Exact: never treated as a search term. Takes no mode. A dream's id (drm_…) or a reflection's (rfl_…) reads a short summary of that night, read-only. Or "${LAST_EXCHANGE_HANDLE}": the last thing said to another session in this folder (about the last day) and its last reply, read from what was captured, never stored.`,
912
+ description: `A memory id or exact title to read whole. Exact: never treated as a search term. Takes no mode. A dream's id (drm_…) or a reflection's (rfl_…) reads a short summary of that night, read-only. Or "${LAST_EXCHANGE_HANDLE}": the last thing said to another session in this folder (about the last day) and its last reply, read from what was captured, never stored. Or "${STILL_OPEN_HANDLE}": everything the wake's Still open carries, in its order, with ids and how long since each was touched — paged (see page).`,
913
913
  },
914
914
  ids: {
915
915
  type: "array",
@@ -922,6 +922,15 @@ export const RECALL_DECISION_FIELDS = [
922
922
  "projectSkipped",
923
923
  // Mike's "slightly higher bar" (2026-10-21): what only the cross-project lift kept back.
924
924
  "crossProjectLifted",
925
+ // What stopped a memory, counted (N1, 2026-10-25, observation only): beside
926
+ // the echo and project skips, what habituation alone, a near miss of the
927
+ // bar (with the margin used), a full tier, the render's bytes and lateral
928
+ // inhibition kept from showing. Added the way `echoSkipped` was.
929
+ "habituationCut",
930
+ "nearMiss",
931
+ "capped",
932
+ "budgetTrimmed",
933
+ "inhibited",
925
934
  // An unsettled pair competes (E3, 2026-10-24, an experiment): how many olders
926
935
  // counted at a weight. Undefined, so left out of the written row, while
927
936
  // `UNSETTLED_COMPETES` is off: an off turn's row is byte-identical.
@@ -1072,6 +1081,12 @@ export function recallDecisionRecord(
1072
1081
  // PROJECTS (2026-10-21): another project's work turned away; 0 while off.
1073
1082
  projectSkipped: d.projectSkipped,
1074
1083
  crossProjectLifted: d.crossProjectLifted,
1084
+ // WHAT STOPPED A MEMORY (N1): counts only, copied off the decision.
1085
+ habituationCut: d.habituationCut,
1086
+ nearMiss: d.nearMiss,
1087
+ capped: d.capped,
1088
+ budgetTrimmed: d.budgetTrimmed,
1089
+ inhibited: d.inhibited,
1075
1090
  // AN UNSETTLED PAIR COMPETES (E3): undefined while off, so not written.
1076
1091
  pairsCompeted: d.pairsCompeted,
1077
1092
  // CONTEXT PRIMING (2026-10-19, an experiment): null on a turn it did not run.
@@ -364,8 +364,15 @@ export function sweepWake(cp: Counterpart, override?: number): SweepWake {
364
364
  const composed = cp.self.build({
365
365
  budgetBytes: cap,
366
366
  day: cp.store.livedDay(),
367
+ // A CHAPTER'S SUMMARY THAT RECORDED A FOLDER stands aside too (review
368
+ // of P1, 2026-10-25): one wake serves every crashed folder's chunks
369
+ // (`sweepAll`), so it has no one reader to ask, and the interpreter
370
+ // writes what it proposes under the crashed session's folder — a
371
+ // summary from a folder set off would otherwise travel there. As
372
+ // `Counterpart#hintKeptOut` fails closed for a reader that names no
373
+ // folder.
367
374
  omit: (s) => {
368
- const hide = s.physics.protected;
375
+ const hide = s.physics.protected || (s.source === "episode" && cp["hintKeptOut"](s.id, {}));
369
376
  if (hide) omitted += 1;
370
377
  return hide;
371
378
  },