counterparts 0.3.37 → 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 +188 -0
- package/README.md +2 -1
- package/docs/QUICKSTART.md +14 -8
- package/docs/module-map.md +4 -2
- package/package.json +9 -1
- package/src/adapters/claude-code/CONTRACT.md +26 -4
- package/src/adapters/claude-code/NOTES.md +116 -0
- package/src/adapters/claude-code/bin/hook.ts +70 -6
- package/src/adapters/claude-code/bin/nightly.ts +2 -0
- package/src/adapters/claude-code/bin/runner.ts +64 -2
- package/src/adapters/claude-code/child-error.ts +211 -0
- package/src/adapters/claude-code/child.ts +29 -10
- package/src/adapters/claude-code/doctor-checkout.ts +4 -2
- package/src/adapters/claude-code/doctor-host.ts +31 -0
- package/src/adapters/claude-code/doctor-meaning.ts +200 -0
- package/src/adapters/claude-code/doctor-modes.ts +115 -0
- package/src/adapters/claude-code/doctor-open.ts +12 -2
- package/src/adapters/claude-code/doctor-self-page.ts +2 -0
- package/src/adapters/claude-code/doctor-write-ups.ts +84 -19
- package/src/adapters/claude-code/doctor.ts +199 -23
- package/src/adapters/claude-code/hooks.ts +162 -11
- package/src/adapters/claude-code/index.ts +15 -0
- package/src/adapters/claude-code/night-catch-up.ts +25 -5
- package/src/adapters/claude-code/night-run.ts +86 -11
- package/src/adapters/claude-code/stale-windows.ts +160 -0
- package/src/adapters/claude-code/standdown.ts +70 -3
- package/src/adapters/cli/INTERFACE-GAPS.md +14 -0
- package/src/adapters/cli/NOTES.md +25 -0
- package/src/adapters/cli/bin/counterparts.ts +4 -2
- package/src/adapters/cli/commands-dashboard.ts +8 -5
- package/src/adapters/cli/commands-install.ts +12 -14
- package/src/adapters/cli/commands.ts +5 -2
- package/src/adapters/cli/coverage.ts +28 -6
- package/src/adapters/cli/help.ts +6 -1
- package/src/adapters/cli/index.ts +2 -0
- package/src/adapters/cli/install.ts +24 -1
- package/src/adapters/cli/mechanisms.ts +31 -8
- package/src/adapters/cli/rollback.ts +3 -3
- package/src/adapters/cli/snapshot.ts +4 -4
- package/src/adapters/cli/ui.ts +10 -0
- package/src/adapters/cli/uninstall.ts +16 -74
- package/src/adapters/cli/wire.ts +227 -33
- package/src/adapters/config.ts +23 -0
- package/src/adapters/dashboard/bin/dashboard.ts +2 -0
- package/src/adapters/dashboard/registries.ts +1 -1
- package/src/adapters/dashboard/web/mechanisms/index.js +2 -0
- package/src/adapters/dashboard/web/mechanisms/schema/index.js +9 -6
- package/src/adapters/dashboard/web/mechanisms/schema/panel.js +14 -0
- package/src/adapters/dashboard/web/narrate.ts +10 -3
- package/src/adapters/dashboard/web/views/mechanism-panel.ts +44 -0
- package/src/adapters/dashboard/web/views/mechanisms.ts +13 -1
- package/src/adapters/expansions.ts +4 -3
- package/src/adapters/fired.ts +29 -0
- package/src/adapters/host-wiring.ts +56 -1
- package/src/adapters/hosts.ts +51 -0
- package/src/adapters/lifecycle.ts +4 -2
- package/src/adapters/mcp/CONTRACT.md +26 -3
- package/src/adapters/mcp/INTERFACE-GAPS.md +11 -0
- package/src/adapters/mcp/NOTES.md +149 -0
- package/src/adapters/mcp/bin/serve.ts +83 -4
- package/src/adapters/mcp/chat-wake.ts +111 -0
- package/src/adapters/mcp/deliberate.ts +5 -2
- package/src/adapters/mcp/index.ts +3 -1
- package/src/adapters/mcp/nights.ts +434 -9
- package/src/adapters/mcp/protocol.ts +11 -2
- package/src/adapters/mcp/server-args.ts +6 -0
- package/src/adapters/mcp/server-options.ts +19 -2
- package/src/adapters/mcp/server-self-tools.ts +23 -8
- package/src/adapters/mcp/server-session-end.ts +5 -3
- package/src/adapters/mcp/server-words.ts +218 -4
- package/src/adapters/mcp/server.ts +524 -56
- package/src/adapters/mcp/tools.ts +266 -12
- package/src/adapters/mechanism-evidence.ts +90 -15
- package/src/adapters/owned-names.ts +105 -0
- package/src/adapters/plugin.ts +34 -7
- package/src/adapters/private-base.ts +175 -0
- package/src/adapters/private-umask.ts +71 -0
- package/src/adapters/remote/CONTRACT.md +75 -0
- package/src/adapters/remote/INTERFACE-GAPS.md +20 -0
- package/src/adapters/remote/NOTES.md +80 -0
- package/src/adapters/remote/bin/serve-http.ts +258 -0
- package/src/adapters/remote/call-log.ts +206 -0
- package/src/adapters/remote/http.ts +500 -0
- package/src/adapters/sessions.ts +121 -7
- package/src/adapters/snapshots.ts +3 -3
- package/src/adapters/spawn.ts +13 -6
- package/src/adapters/update-check.ts +870 -0
- package/src/adapters/update-words.ts +230 -0
- package/src/core/counterpart-deposit.ts +35 -2
- package/src/core/counterpart-sweep.ts +7 -1
- package/src/core/counterpart-types.ts +7 -0
- package/src/core/counterpart.ts +185 -23
- package/src/core/coverage/CONTRACT.md +12 -5
- package/src/core/coverage/NOTES.md +40 -1
- package/src/core/coverage/index.ts +73 -14
- package/src/core/coverage/tunables.ts +15 -1
- package/src/core/dream/CONTRACT.md +47 -9
- package/src/core/dream/NOTES.md +115 -0
- package/src/core/dream/index.ts +51 -6
- package/src/core/dream/recalled.ts +90 -0
- package/src/core/dream/reflect.ts +156 -25
- package/src/core/dream/tunables.ts +61 -0
- package/src/core/handoff/CONTRACT.md +8 -1
- package/src/core/handoff/NOTES.md +52 -0
- package/src/core/handoff/last-here.ts +52 -0
- package/src/core/mint.ts +8 -1
- package/src/core/onboarding.ts +35 -8
- package/src/core/recall/CONTRACT.md +11 -0
- package/src/core/reconsolidation.ts +2 -1
- package/src/core/remember/CONTRACT.md +2 -1
- package/src/core/remember/owes.ts +7 -1
- package/src/core/remember/proposals.ts +41 -1
- package/src/core/schemas/CONTRACT.md +4 -2
- package/src/core/self/INTERFACE-GAPS.md +20 -0
- package/src/core/self/briefing.ts +37 -1
- package/src/core/self/identity.ts +54 -4
- package/src/core/self/index.ts +69 -4
- package/src/core/self/work.ts +20 -0
- package/src/core/self/writer.ts +15 -1
- package/src/core/store/CONTRACT.md +28 -2
- package/src/core/store/NOTES.md +97 -2
- package/src/core/store/db.ts +24 -1
- package/src/core/store/index.ts +28 -2
- package/src/core/store/operational.ts +37 -1
- package/src/core/store/pre-migration.ts +6 -2
- package/src/core/store/private.ts +319 -0
- package/src/core/store/shapes.ts +6 -0
- package/src/core/types.ts +28 -0
- package/tools/install-loop/run.sh +3 -0
|
@@ -1316,7 +1316,9 @@ export const REF_KIND = {
|
|
|
1316
1316
|
"handoff.shown": "handoff",
|
|
1317
1317
|
"handoff.cleared": "handoff",
|
|
1318
1318
|
"handoff.refused": "none",
|
|
1319
|
-
// The ref is the chapter (an episode row) the line would have named
|
|
1319
|
+
// The ref is the chapter (an episode row) the line would have named — or,
|
|
1320
|
+
// since the review of #636, the later session with no chapter it named
|
|
1321
|
+
// first, which no store row answers (`subjectOf` prints it as a session).
|
|
1320
1322
|
"handoff.lasthere.noroom": "memory",
|
|
1321
1323
|
"recall.credit": "none",
|
|
1322
1324
|
"recall.rated": "session",
|
|
@@ -1367,8 +1369,13 @@ function subjectOf(store: ReadOnlyStore, row: EventRow): string | null {
|
|
|
1367
1369
|
// A name this file has never heard of, carrying a ref. Print the raw
|
|
1368
1370
|
// address rather than guessing at what it points to.
|
|
1369
1371
|
return row.ref;
|
|
1370
|
-
default:
|
|
1371
|
-
|
|
1372
|
+
default: {
|
|
1373
|
+
const r = reveal(store, row.ref, 60);
|
|
1374
|
+
// "Last here"'s no-room row names a session when the line led with one
|
|
1375
|
+
// that wrote no chapter: not an unknown memory.
|
|
1376
|
+
if (row.name === "handoff.lasthere.noroom" && r.state === "unknown") return `session ${row.ref}`;
|
|
1377
|
+
return r.label;
|
|
1378
|
+
}
|
|
1372
1379
|
}
|
|
1373
1380
|
}
|
|
1374
1381
|
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* dreaming — the memories the last dream changed
|
|
19
19
|
* reconsolidation — recent corrections weighed against old memories
|
|
20
20
|
* episodic-semantic — the patterns dreams wrote as memories of their own
|
|
21
|
+
* schema — the newest beliefs formed, with what backs and goes against each
|
|
21
22
|
*
|
|
22
23
|
* A grey mechanism (not built) gets no picture and no activity: it has none.
|
|
23
24
|
* Which rows count as a firing is `MECHANISM_PROOFS`, in `mechanisms.ts`.
|
|
@@ -192,6 +193,17 @@ export type Picture =
|
|
|
192
193
|
readonly bar: number;
|
|
193
194
|
readonly crossed: boolean;
|
|
194
195
|
}[];
|
|
196
|
+
}
|
|
197
|
+
| {
|
|
198
|
+
readonly kind: "schema";
|
|
199
|
+
/** The newest live beliefs born here (not carried from v1), with how many memories back each and go against it. */
|
|
200
|
+
readonly beliefs: readonly (Said & {
|
|
201
|
+
readonly day: number;
|
|
202
|
+
/** `reflection`, `session`, `dream` (adopted) or `correction` (`memories.birth_route`). */
|
|
203
|
+
readonly route: string;
|
|
204
|
+
readonly support: number;
|
|
205
|
+
readonly against: number;
|
|
206
|
+
})[];
|
|
195
207
|
};
|
|
196
208
|
|
|
197
209
|
export interface MechanismPanelView {
|
|
@@ -311,6 +323,8 @@ function pictureOf(src: DashboardSource, id: string, day: number): Picture | nul
|
|
|
311
323
|
return reconsolidationPicture(src);
|
|
312
324
|
case "interference":
|
|
313
325
|
return interferencePicture(src);
|
|
326
|
+
case "schema":
|
|
327
|
+
return schemaPicture(src);
|
|
314
328
|
default:
|
|
315
329
|
return null;
|
|
316
330
|
}
|
|
@@ -785,6 +799,36 @@ function reconsolidationPicture(src: DashboardSource): Picture {
|
|
|
785
799
|
return { kind: "reconsolidation", revisions };
|
|
786
800
|
}
|
|
787
801
|
|
|
802
|
+
// ── schemas ─────────────────────────────────────────────────────────────────
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* The newest beliefs formed here (2026-10-26): each live belief with a birth
|
|
806
|
+
* route other than `migrated`, newest born first, with the memories counted
|
|
807
|
+
* for and against it (`belief_support`).
|
|
808
|
+
*/
|
|
809
|
+
function schemaPicture(src: DashboardSource): Picture {
|
|
810
|
+
const store = src.store;
|
|
811
|
+
if (!store.hasColumn("memories", "birth_route")) return { kind: "schema", beliefs: [] };
|
|
812
|
+
const born: { id: string; day: number; at: number; route: string }[] = [];
|
|
813
|
+
for (const id of store.list({ type: "schema", archived: false })) {
|
|
814
|
+
const row = store.row(id);
|
|
815
|
+
if (row === undefined || row.birth_route === null || row.birth_route === undefined || row.birth_route === "migrated") continue;
|
|
816
|
+
born.push({ id, day: row.birth_day ?? 0, at: row.created_at ?? 0, route: row.birth_route });
|
|
817
|
+
}
|
|
818
|
+
born.sort((a, b) => b.day - a.day || b.at - a.at || (a.id < b.id ? -1 : 1));
|
|
819
|
+
const beliefs = born.slice(0, PICTURE_ROWS).map((b) => {
|
|
820
|
+
const filed = store.supportOf(b.id);
|
|
821
|
+
return {
|
|
822
|
+
...said(src, b.id),
|
|
823
|
+
day: b.day,
|
|
824
|
+
route: b.route,
|
|
825
|
+
support: filed.filter((r) => r.stance === "support").length,
|
|
826
|
+
against: filed.filter((r) => r.stance === "contrary").length,
|
|
827
|
+
};
|
|
828
|
+
});
|
|
829
|
+
return { kind: "schema", beliefs };
|
|
830
|
+
}
|
|
831
|
+
|
|
788
832
|
/**
|
|
789
833
|
* One memory's fade, as the physics computes it: from its last use (at most
|
|
790
834
|
* `FADE_BEHIND` lived days back) to `FADE_AHEAD` days past `day`, one
|
|
@@ -186,6 +186,13 @@ export const LEADS: Readonly<Record<string, readonly LeadCandidate[]>> = {
|
|
|
186
186
|
lead(["faded"], "earlier memory faded under a newer one", "earlier memories faded under newer ones"),
|
|
187
187
|
],
|
|
188
188
|
"episodic-semantic": [lead(["gist"], "pattern dreamed into a memory of its own", "patterns dreamed into memories of their own")],
|
|
189
|
+
// Beliefs formed first (2026-10-26), then the memories filed for them, then what is held.
|
|
190
|
+
schema: [
|
|
191
|
+
lead(["born", "adopted"], "belief formed", "beliefs formed"),
|
|
192
|
+
lead(["support"], "memory filed as support for a belief", "memories filed as support for beliefs"),
|
|
193
|
+
lead(["contrary"], "memory filed against a belief", "memories filed against beliefs"),
|
|
194
|
+
lead(["held"], "belief held", "beliefs held", false),
|
|
195
|
+
],
|
|
189
196
|
};
|
|
190
197
|
|
|
191
198
|
/** The big number, from a verdict's parts (and the returns split, and what it holds). */
|
|
@@ -259,9 +266,14 @@ export function lightOf(v: Verdict, returns?: ReturnsBySource): MechanismLight {
|
|
|
259
266
|
events: [],
|
|
260
267
|
};
|
|
261
268
|
}
|
|
269
|
+
// A mechanism read only off its rows (Schemas) keeps no firing day: with
|
|
270
|
+
// rows held it has fired before, so "no record of it firing" would be false.
|
|
271
|
+
const censusOnly = row.proofs.length === 0 && (v.held ?? 0) > 0;
|
|
262
272
|
const evidence =
|
|
263
273
|
v.lastFiredDay === null
|
|
264
|
-
?
|
|
274
|
+
? censusOnly
|
|
275
|
+
? `Built, but quiet for ${MECHANISM_DAYS} days of use.`
|
|
276
|
+
: `Built, and no record of it firing yet.`
|
|
265
277
|
: `Built, but quiet for ${MECHANISM_DAYS} days of use (last fired on day ${v.lastFiredDay} of use).`;
|
|
266
278
|
return { ...base, status: "amber", evidence: `${evidence}${heldLine}`, events: [] };
|
|
267
279
|
}
|
|
@@ -83,7 +83,7 @@ import { createHash, randomBytes } from "node:crypto";
|
|
|
83
83
|
import { appendFileSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
84
84
|
import { join } from "node:path";
|
|
85
85
|
|
|
86
|
-
import { SESSIONS_DIR, canonicalScope } from "./sessions.js";
|
|
86
|
+
import { EXPANSIONS_SALT_FILE, SESSIONS_DIR, canonicalScope } from "./sessions.js";
|
|
87
87
|
|
|
88
88
|
/** One file, inside the registry's directory — see the header on placement. */
|
|
89
89
|
export const EXPANSIONS_FILE = "expansions.jsonl";
|
|
@@ -147,8 +147,9 @@ export function expansionsPath(dataDir: string): string {
|
|
|
147
147
|
return join(dataDir, SESSIONS_DIR, EXPANSIONS_FILE);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
/** The salt file, beside the log — see `expansionSalt`.
|
|
151
|
-
|
|
150
|
+
/** The salt file, beside the log — see `expansionSalt`. Spelled in
|
|
151
|
+
* `sessions.ts`, whose prune keeps it by name (`KEPT_BY_NAME`). */
|
|
152
|
+
export { EXPANSIONS_SALT_FILE };
|
|
152
153
|
|
|
153
154
|
/** 16 random bytes, hex. Long enough that guessing it is not the cheap attack. */
|
|
154
155
|
const SALT_BYTES = 16;
|
package/src/adapters/fired.ts
CHANGED
|
@@ -220,6 +220,10 @@ export type ProbeId =
|
|
|
220
220
|
| "dreamed"
|
|
221
221
|
/** Journal chapters, each dated by the moment it was written (`meta.chapterAt`, v12), else the episode's birth. */
|
|
222
222
|
| "chapters"
|
|
223
|
+
/** Live beliefs born here (a v14 birth route, not `migrated`), dated by when. */
|
|
224
|
+
| "beliefs.born"
|
|
225
|
+
/** Memories filed for or against a live belief (`belief_support`), dated by when. */
|
|
226
|
+
| "beliefs.filed"
|
|
223
227
|
| `versions:${string}`;
|
|
224
228
|
|
|
225
229
|
export type Evidence =
|
|
@@ -497,6 +501,23 @@ export const MECHANISMS: readonly Mechanism[] = [
|
|
|
497
501
|
"a birth shows only as another entity in the store, and a refusal shows nowhere at all — the reasons live in an in-process ring that dies with the hook.",
|
|
498
502
|
},
|
|
499
503
|
},
|
|
504
|
+
// BELIEFS (wave 2 lane C, 2026-10-21): the schemas' own events live in the
|
|
505
|
+
// ring, so these read the rows a belief leaves — its birth route and moment,
|
|
506
|
+
// and each memory filed for or against it.
|
|
507
|
+
{
|
|
508
|
+
id: "belief-birth",
|
|
509
|
+
label: "a belief was formed (by the night's reflection or a session) or adopted from a dream, born weak",
|
|
510
|
+
module: "schemas/index.ts#addBelief, dream/reflect.ts",
|
|
511
|
+
evidence: { kind: "probe", probe: "beliefs.born" },
|
|
512
|
+
since: "2026-10-21",
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
id: "belief-support",
|
|
516
|
+
label: "a lived memory was filed for or against a belief, counted once",
|
|
517
|
+
module: "schemas/index.ts#fileSupport",
|
|
518
|
+
evidence: { kind: "probe", probe: "beliefs.filed" },
|
|
519
|
+
since: "2026-10-21",
|
|
520
|
+
},
|
|
500
521
|
{
|
|
501
522
|
id: "accommodation",
|
|
502
523
|
label: "something the owner declared outright replaced what had been inferred",
|
|
@@ -2275,6 +2296,12 @@ function readProbes(store: ReadOnlyStore, w: Window): Probed {
|
|
|
2275
2296
|
if (row !== undefined && row.archived === 0 && row.source === "dreamed") {
|
|
2276
2297
|
bump("dreamed", { at: row.created_at, livedDay: row.birth_day });
|
|
2277
2298
|
}
|
|
2299
|
+
// A LIVE BELIEF (v14): born here unless carried from v1, and every memory
|
|
2300
|
+
// filed for or against it, each dated by the moment it was filed.
|
|
2301
|
+
if (row !== undefined && row.archived === 0 && row.type === "schema" && row.birth_route !== null && row.birth_route !== undefined) {
|
|
2302
|
+
if (row.birth_route !== "migrated") bump("beliefs.born", { at: row.created_at, livedDay: row.birth_day });
|
|
2303
|
+
for (const f of store.supportOf(id)) bump("beliefs.filed", { at: f.createdAt, livedDay: f.day });
|
|
2304
|
+
}
|
|
2278
2305
|
// A CHAPTER WRITTEN: one per stored moment; an episode from before
|
|
2279
2306
|
// moments were stored counts its birth (its first chapter) once.
|
|
2280
2307
|
if (row !== undefined && row.archived === 0 && row.type === "episode") {
|
|
@@ -2338,5 +2365,7 @@ function probeLabel(probe: ProbeId): string {
|
|
|
2338
2365
|
if (probe === "returns.dream") return "the returns table (dream replays)";
|
|
2339
2366
|
if (probe === "dreamed") return "memories a dream wrote";
|
|
2340
2367
|
if (probe === "chapters") return "the journal's chapters";
|
|
2368
|
+
if (probe === "beliefs.born") return "beliefs born here";
|
|
2369
|
+
if (probe === "beliefs.filed") return "the belief support table";
|
|
2341
2370
|
return `the ${probe.replace(".", " ")} table`;
|
|
2342
2371
|
}
|
|
@@ -412,8 +412,63 @@ function pluginEnabled(id: string, input: { readonly home: string; readonly env:
|
|
|
412
412
|
return enabled;
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
+
/**
|
|
416
|
+
* THE NEWEST COUNTERPARTS PLUGIN CLAUDE CODE HAS RECORDED FOR THIS FOLDER
|
|
417
|
+
* (U1a, 2026-10-27): the highest `x.y.z` among the `counterparts@…` records
|
|
418
|
+
* in `installed_plugins.json`, as a plain `x.y.z` — a `-<sha>` suffix (the
|
|
419
|
+
* marketplace's `0.3.37-14cfc833eed5`) is build metadata and dropped, and
|
|
420
|
+
* `resolvedVersion` stands in for a record whose `version` is not one. A
|
|
421
|
+
* project- or local-scope record counts only for its own folder (`cwd`, or
|
|
422
|
+
* any folder when `cwd` is null). It is what `/reload-plugins` would load, so
|
|
423
|
+
* an old window can be told "reload" only when this is newer than the code it
|
|
424
|
+
* runs (`update-words.ts#newerStoreStep`). READ-ONLY; null when nothing
|
|
425
|
+
* readable is recorded.
|
|
426
|
+
*/
|
|
427
|
+
export function pluginVersionRecorded(input: {
|
|
428
|
+
readonly home: string;
|
|
429
|
+
readonly env: Record<string, string | undefined>;
|
|
430
|
+
readonly cwd: string | null;
|
|
431
|
+
/** Only this record (`counterparts@<marketplace>`, the running copy's —
|
|
432
|
+
* `plugin.ts#pluginOrigin`); absent, every `counterparts@` record. */
|
|
433
|
+
readonly id?: string;
|
|
434
|
+
}): string | null {
|
|
435
|
+
try {
|
|
436
|
+
const moved = (input.env["CLAUDE_CONFIG_DIR"] ?? "").trim();
|
|
437
|
+
const configDir = moved.length > 0 ? moved : join(input.home, ".claude");
|
|
438
|
+
const cacheRoot = (input.env["CLAUDE_CODE_PLUGIN_CACHE_DIR"] ?? "").trim();
|
|
439
|
+
const pluginsRoot = cacheRoot.length > 0 ? cacheRoot : join(configDir, "plugins");
|
|
440
|
+
const plugins = readObject(join(pluginsRoot, "installed_plugins.json"))?.["plugins"];
|
|
441
|
+
if (!isRecord(plugins)) return null;
|
|
442
|
+
const here = input.cwd === null || input.cwd.length === 0 ? null : resolve(input.cwd);
|
|
443
|
+
let best: string | null = null;
|
|
444
|
+
for (const id of Object.keys(plugins)) {
|
|
445
|
+
if (!id.startsWith(`${NPM_MCP_NAME}@`)) continue;
|
|
446
|
+
if (input.id !== undefined && id !== input.id) continue;
|
|
447
|
+
const raw = plugins[id];
|
|
448
|
+
const records = Array.isArray(raw) ? (raw as unknown[]) : [raw];
|
|
449
|
+
for (const r of records) {
|
|
450
|
+
if (!isRecord(r)) continue;
|
|
451
|
+
const project = typeof r["projectPath"] === "string" && r["projectPath"].length > 0 ? resolve(r["projectPath"]) : null;
|
|
452
|
+
if (project !== null && here !== null && here !== project && !here.startsWith(`${project}/`)) continue;
|
|
453
|
+
const v = versionCore(r["version"]) ?? versionCore(r["resolvedVersion"]);
|
|
454
|
+
if (v !== null && (best === null || versionAtLeast(v, best))) best = v;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return best;
|
|
458
|
+
} catch {
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/** The `x.y.z` of a version string (`0.3.37`, `0.3.37-14cfc833eed5`), or null. */
|
|
464
|
+
export function versionCore(v: unknown): string | null {
|
|
465
|
+
if (typeof v !== "string") return null;
|
|
466
|
+
const m = /^(\d{1,6})\.(\d{1,6})\.(\d{1,6})(?:[-+][0-9A-Za-z.-]*)?$/.exec(v.trim());
|
|
467
|
+
return m === null ? null : `${Number(m[1])}.${Number(m[2])}.${Number(m[3])}`;
|
|
468
|
+
}
|
|
469
|
+
|
|
415
470
|
/** `a` is `b` or later (`x.y.z`, a `-suffix` ignored); false when either is not a version. */
|
|
416
|
-
function versionAtLeast(a: string, b: string): boolean {
|
|
471
|
+
export function versionAtLeast(a: string, b: string): boolean {
|
|
417
472
|
const parse = (v: string): number[] | null => {
|
|
418
473
|
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v.trim());
|
|
419
474
|
return m === null ? null : [Number(m[1]), Number(m[2]), Number(m[3])];
|
package/src/adapters/hosts.ts
CHANGED
|
@@ -45,6 +45,42 @@ export function isHostName(value: unknown): value is string {
|
|
|
45
45
|
*/
|
|
46
46
|
export const DESKTOP_HOST = "claude-desktop";
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* CLAUDE.AI'S CHAT, OVER THE WEB (2026-10-26, the claude.ai trial). A custom
|
|
50
|
+
* connector: claude.ai web and mobile reach this server as remote MCP over
|
|
51
|
+
* HTTPS (`adapters/remote/`), from Anthropic's cloud. Hookless, like Desktop's
|
|
52
|
+
* chat — no SessionStart, no Stop, no transcript — so the server is its own hook
|
|
53
|
+
* here too (`wake`), with its own place, `claude-ai:`. The HOST is decided by the
|
|
54
|
+
* transport that launched the server, never by the client's name: what name the
|
|
55
|
+
* remote client sends is unknown until the trial measures it, and `claude-ai`
|
|
56
|
+
* is already Desktop's chat's name (`hostOfClient`).
|
|
57
|
+
*/
|
|
58
|
+
export const CLAUDE_AI_HOST = "claude-ai";
|
|
59
|
+
|
|
60
|
+
/** The one place every claude.ai chat shares, as Desktop's chats share theirs. */
|
|
61
|
+
export const CLAUDE_AI_SCOPE = "claude-ai:";
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* THE HOOKLESS CHAT HOSTS and the place each files under. A server serving one
|
|
65
|
+
* of these mints its sessions with `wake`, binds per call, and carries the
|
|
66
|
+
* write-up ask on a tool result (`mcp/server.ts`, where `desktop` reads "a
|
|
67
|
+
* hookless chat host").
|
|
68
|
+
*/
|
|
69
|
+
export const CHAT_HOST_SCOPES: Readonly<Record<string, string>> = {
|
|
70
|
+
["claude-desktop"]: "claude-desktop:",
|
|
71
|
+
[CLAUDE_AI_HOST]: CLAUDE_AI_SCOPE,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** Is `host` a chat host with no hooks (Desktop's chat, claude.ai)? */
|
|
75
|
+
export function isChatHost(host: string): boolean {
|
|
76
|
+
return Object.prototype.hasOwnProperty.call(CHAT_HOST_SCOPES, host);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** The place a chat host files under, or null for a host with directories. */
|
|
80
|
+
export function chatScopeOf(host: string): string | null {
|
|
81
|
+
return isChatHost(host) ? (CHAT_HOST_SCOPES[host] as string) : null;
|
|
82
|
+
}
|
|
83
|
+
|
|
48
84
|
/**
|
|
49
85
|
* WHAT THE INSTALL AND QUICKSTART SAY ABOUT DESKTOP'S TOOL PERMISSION
|
|
50
86
|
* (2026-10-02). Measured in a Desktop chat: its tools still asked before each
|
|
@@ -232,6 +268,21 @@ export const HOST_WORDING: Readonly<Record<string, HostWording>> = {
|
|
|
232
268
|
pausedRefusal: (at) =>
|
|
233
269
|
`Counterparts is paused for Claude Desktop's chats. Nothing is recorded or read here until it is resumed — call \`scope\` with mode \`resume\`, or run \`${at.entryCommand("--resume")}\`.`,
|
|
234
270
|
},
|
|
271
|
+
// claude.ai has no app to reopen and no `/mcp`: the server behind the
|
|
272
|
+
// connector is a process somebody started, and a newer build loads when it
|
|
273
|
+
// is started again.
|
|
274
|
+
[CLAUDE_AI_HOST]: {
|
|
275
|
+
reconnect: "Restart the Counterparts server behind this connector to load it.",
|
|
276
|
+
reconnectFirst: "Restart the Counterparts server behind this connector",
|
|
277
|
+
scopeOff:
|
|
278
|
+
"claude.ai's chats are no longer recorded or read. Every other tool will refuse until it is turned back on — including in a new chat, which is the point.",
|
|
279
|
+
scopeOn:
|
|
280
|
+
"Recorded. This takes effect immediately, for every tool in every claude.ai chat. Nothing is collected from before now: claude.ai keeps no transcript here, so only what is written through the tools is remembered.",
|
|
281
|
+
offRefusal: (at) =>
|
|
282
|
+
`Counterparts is off for claude.ai's chats. Nothing is recorded or read here — call \`scope\` with mode \`on\`, or run \`${at.hereCommand("--on")}\`.`,
|
|
283
|
+
pausedRefusal: (at) =>
|
|
284
|
+
`Counterparts is paused for claude.ai's chats. Nothing is recorded or read here until it is resumed — call \`scope\` with mode \`resume\`, or run \`${at.entryCommand("--resume")}\`.`,
|
|
285
|
+
},
|
|
235
286
|
};
|
|
236
287
|
|
|
237
288
|
/** The words for `host`, or the default host's when it has none of its own. */
|
|
@@ -75,7 +75,7 @@ import { capabilities, TUNABLES } from "./config.js";
|
|
|
75
75
|
import type { AdapterConfig, CapabilityReport } from "./config.js";
|
|
76
76
|
import { countTranslated, readHandleResolutions, translateExpansions } from "./expansions.js";
|
|
77
77
|
import type { ExpansionsRead } from "./expansions.js";
|
|
78
|
-
import { DEFAULT_HOST } from "./hosts.js";
|
|
78
|
+
import { CLAUDE_AI_HOST, DEFAULT_HOST } from "./hosts.js";
|
|
79
79
|
import { pruneLog } from "./log/index.js";
|
|
80
80
|
import {
|
|
81
81
|
SCOPE_EVENT,
|
|
@@ -100,6 +100,7 @@ import {
|
|
|
100
100
|
manifestVersionOnDisk,
|
|
101
101
|
markSinceSeen,
|
|
102
102
|
NIGHT_RUNNER_PREFIX,
|
|
103
|
+
NON_INTERACTIVE_ENTRYPOINTS,
|
|
103
104
|
readSession,
|
|
104
105
|
readWriteUpProgress,
|
|
105
106
|
recordSession,
|
|
@@ -679,6 +680,7 @@ export class Lifecycle implements HostLifecycle {
|
|
|
679
680
|
live: isLive(r, now),
|
|
680
681
|
endedAt: r.endedAt,
|
|
681
682
|
model: r.model ?? null,
|
|
683
|
+
headless: r.entrypoint !== undefined && NON_INTERACTIVE_ENTRYPOINTS.has(r.entrypoint),
|
|
682
684
|
}));
|
|
683
685
|
},
|
|
684
686
|
};
|
|
@@ -782,7 +784,7 @@ export class Lifecycle implements HostLifecycle {
|
|
|
782
784
|
if (offer.due) {
|
|
783
785
|
return {
|
|
784
786
|
kind: "offer",
|
|
785
|
-
text: offerLine(offer.state),
|
|
787
|
+
text: offerLine(offer.state, { web: this.host === CLAUDE_AI_HOST }),
|
|
786
788
|
commit: () => {
|
|
787
789
|
noteOffered(store, { on, session: input.sessionId, state: false });
|
|
788
790
|
this.emit("adapter.meet.offered", { state: offer.state });
|
|
@@ -408,8 +408,11 @@ actually wrote (chapter), the written self page or the version a write to it pro
|
|
|
408
408
|
per call and writes that session's record through the shared lifecycle
|
|
409
409
|
(`lifecycle.ts`, host `claude-desktop`), and returns the wake SessionStart composes,
|
|
410
410
|
the clock, today's plain reminders (claimed), the day's dream line only when it is an
|
|
411
|
-
ask (a headless `auto` offer is left unclaimed for Claude Code),
|
|
412
|
-
|
|
411
|
+
ask (a headless `auto` offer is left unclaimed for Claude Code), a morning share
|
|
412
|
+
another session left untold — carried once, right after the session line, when the
|
|
413
|
+
reflecting session has let go of it (`sessions.ts#reflectorDone`: no record, ended,
|
|
414
|
+
quiet past the TTL, or a hookless chat's, which never ends; 2026-10-26, OL1a) — the
|
|
415
|
+
update and doctor notices as plain lines, and the write-up pointer measured against
|
|
413
416
|
`TOOL_RESULT_CHARS`; it starts the worker. It never asks the first-launch question,
|
|
414
417
|
never touches primacy, and never starts the headless nightly run. It sits under the
|
|
415
418
|
schema gate like every tool.
|
|
@@ -702,7 +705,27 @@ Working defaults, held lightly; the revisit (a few days of daily use) checks the
|
|
|
702
705
|
boundary that withheld a night from a non-owner was retired 2026-10-21, §5 G6.)
|
|
703
706
|
Nights share the by-id answer's room (`RECALL_ID_RESULT_CHARS`, weighed as `boundById`
|
|
704
707
|
weighs): one past it waits by id in `waiting`, as a memory does. An unknown night id is
|
|
705
|
-
`handle-unknown`. Under observer recall stands down, as for a memory.
|
|
708
|
+
`handle-unknown`. Under observer recall stands down, as for a memory. Every dream in
|
|
709
|
+
`nights` carries `label: "[dream]"` and `dreamed: "dreamed, not lived: …"` (D1,
|
|
710
|
+
2026-10-27), and opening one notes it recalled (a `dream.recalled` event, so it keeps its
|
|
711
|
+
reach — `dream/recalled.ts`); no memory is credited.
|
|
712
|
+
- **[M]** A QUESTION reaches dreams by what they were about (OL1b 2026-10-26, extended by
|
|
713
|
+
D1 2026-10-27; `nights.ts#nightsForQuestion`, dream CONTRACT rule 2 and G6): beside the
|
|
714
|
+
answer in `nights`, and in the answer's own words — `[dream] <title> · drm_… · dreamed
|
|
715
|
+
<date> · <why>`; for a question that names dreaming, with an excerpt, after the answer's
|
|
716
|
+
head and before its results, and the "[dream] = dreamed, not lived" gloss once at its
|
|
717
|
+
end. A question naming dreaming: its content words or their
|
|
718
|
+
meaning (`DREAM_RECALL_NAMED_FLOOR`), and the newest journaled dream — first when it asks
|
|
719
|
+
when — among its recent dreams, faded or not. Any other question: meaning alone, at
|
|
720
|
+
`DREAM_RECALL_MEANING_BAR`, at most one, only a dream still within its reach, shown as
|
|
721
|
+
one line (no excerpt, no gloss) AFTER the results; none without an embedder. The folder
|
|
722
|
+
rule goes by where the dream ran (`dreams.scope`), not what it is about: a dream run in a
|
|
723
|
+
folder set off or paused is not read from another by a question or "last dream",
|
|
724
|
+
filtered before the lookback limit; a `drm_` id opens anywhere. A session with a dream
|
|
725
|
+
begun (the dream's own background agent) gets no dreams beside its answers. The durable
|
|
726
|
+
`mcp.recall` row carries `dreams` (id, why, meaning score) and its `chars` is the answer
|
|
727
|
+
as shipped. A dream that would carry the result past its ceiling stays out and the
|
|
728
|
+
answer is not cut for it.
|
|
706
729
|
- **Deleted promises (Mike, 10-03):** "effort lowers the bar but never removes the hard
|
|
707
730
|
gates: a memory the conversation did not reach stays dark"; "the lower-confidence tier is
|
|
708
731
|
labeled"; "a question about time is answered with the session it means first, marked
|
|
@@ -379,3 +379,14 @@ A doctor line — "N held this week, M settled after" — is the obvious caller;
|
|
|
379
379
|
belonged to another lane when the guard landed, so it was left for that lane to add. The
|
|
380
380
|
number to watch is `settledAfter / held`: high means the 0.30 bar holds back real
|
|
381
381
|
corrections, and it is the evidence for moving it.
|
|
382
|
+
|
|
383
|
+
## 13. A hookless client on the default host gets Claude Code's dreaming words — OPEN 2026-10-26
|
|
384
|
+
|
|
385
|
+
`server-words.ts#settingSaidFor` (and `dreamLaunchHowFor` / `reflectLaunchHowFor`) give
|
|
386
|
+
claude.ai and Desktop their own words and every other host Claude Code's. A client that
|
|
387
|
+
reaches a default-host server with no hooks behind it (Cursor, a bare MCP client) is
|
|
388
|
+
told "the first session starts the nightly run … in the background", which nothing there
|
|
389
|
+
does, and to hand the prompt to a background Agent tool it may not have. This was so on
|
|
390
|
+
master before OL1d (review of #650 noted it; not fixed there). Closing it needs the server
|
|
391
|
+
to know it has no hooks — a session the hooks never recorded is the likely signal — and
|
|
392
|
+
words for "nothing here starts a night; say 'dream' to run it in the chat".
|
|
@@ -1772,3 +1772,152 @@ pinned holds: "by 12/20" asked on 10-09 (this year's), on 05-01 (last year's), "
|
|
|
1772
1772
|
and the tagging child is allowed the dream tool alone (`seat.ts#SEAT_TOOLS.tags`). Three
|
|
1773
1773
|
optional fields (`tagged`, `merges`, `kinds`); no privilege row (a nightly child's step).
|
|
1774
1774
|
The run's id comes from `COUNTERPARTS_NIGHT_RUN`, else `session:<id>:<date>`.
|
|
1775
|
+
|
|
1776
|
+
## 2026-10-26 — the night's share reaches the next chat on a hookless host (OL1a)
|
|
1777
|
+
|
|
1778
|
+
The claude.ai trial (12:48): a routine reflected and left a share; the next chat's wake did not carry
|
|
1779
|
+
it. **The trace** (before any change): the only carries were Claude Code's — `hooks.ts#dreamLines`
|
|
1780
|
+
on a prompt (when the reflecting session's record is ended or quiet past `SESSION_TTL_MS`) and
|
|
1781
|
+
`nightHandBack` for Claude Code's own spawned run. `wakeTool` never looked for a share, so on a
|
|
1782
|
+
claude.ai-only store nothing ever carried one. Beneath that, the guess in the brief: a hookless
|
|
1783
|
+
session is never ended (its record is started at `wake` and refreshed by each call that names it,
|
|
1784
|
+
`touchDesktopSession`; nothing writes an end), so Claude Code's rule alone would have held a
|
|
1785
|
+
routine's share for four hours after its last call.
|
|
1786
|
+
|
|
1787
|
+
**The fix:** `sessions.ts#reflectorDone` — no record, ended, quiet past the TTL, or a hookless
|
|
1788
|
+
chat's session (`isChatHost`; a pseudo-scope for a record with no host), which counts as ended
|
|
1789
|
+
once its reflection finished (the only kind `pendingShare` offers). `wakeShareLine` carries with
|
|
1790
|
+
it (the atomic `carryLine` claim) right after the session line — nothing in `wakeTool` trims (the
|
|
1791
|
+
briefing is composed to its budget first; the write-up pointer gives way), but a host that cuts a
|
|
1792
|
+
long tool result cuts from the end, and a claimed share must not be what falls off (review: a wake
|
|
1793
|
+
at its budget still carries the whole share, tested). Claude Code's `dreamLines` is untouched: its
|
|
1794
|
+
prompt still waits for the reflector to end or go quiet, a hookless one included — on Mike's store
|
|
1795
|
+
a Desktop chat that reflected in-chat tells its share itself seconds later, and a terminal prompt
|
|
1796
|
+
must not claim it in between. Whether a Claude Code prompt should also take a routine's share at
|
|
1797
|
+
once is open until a store is really shared between a routine host and Claude Code (stage 3).
|
|
1798
|
+
On a store shared with Claude Code's headless run, a hookless wake may now claim the night's share
|
|
1799
|
+
before `nightHandBack` does; the claim is atomic, so it is carried once, and the dream's line still
|
|
1800
|
+
lands in Claude Code. Tests: `test/hookless-share-carry.test.ts` (the HTTP door; the hook).
|
|
1801
|
+
|
|
1802
|
+
**Open, with a recommendation:** a routine's own `wake` is a wake like any other (never told apart
|
|
1803
|
+
by client name), so with no chat since the last night it claims that night's share in the routine,
|
|
1804
|
+
where no one reads it. Small harm (the newer share still reaches the next chat; before this the
|
|
1805
|
+
older one never carried either). Recommended: a wake argument the night prompt passes to skip the
|
|
1806
|
+
carry, on the claude-ai surface's lane; until then accepted, and documented by a test. Also
|
|
1807
|
+
accepted: in-chat dreaming on a hookless host, where another chat waking between `finish` and
|
|
1808
|
+
`told` would carry the share the reflecting chat is about to tell (rare; told twice at worst).
|
|
1809
|
+
|
|
1810
|
+
## 2026-10-26 — claude.ai's `dream` and `reflect` name the night routine (OL1c)
|
|
1811
|
+
|
|
1812
|
+
From #647's review: on claude.ai there is no dream line and no background agent, yet `dream`'s
|
|
1813
|
+
shared words said to launch only "after the owner said dream … to the day's dream line", to hand
|
|
1814
|
+
the prompt "to a background agent", and "Do NOT run the dream yourself in this conversation" —
|
|
1815
|
+
the opposite of what the routine's own prompt (night prompt v2, `trial.sh prompt`) tells the run
|
|
1816
|
+
to do. One surface only holds once those stop fighting. `CLAUDE_AI_WORDS` now carries `dream`
|
|
1817
|
+
(summary, admission, negatives) and `reflect` (summary, admission): the night routine the person
|
|
1818
|
+
set up calls them and follows the launch prompt itself in that same run; in an ordinary
|
|
1819
|
+
conversation, `launch` only when the person asks, and its prompt is then followed there.
|
|
1820
|
+
|
|
1821
|
+
**The negative example's mechanism:** `CLAUDE_AI_WORDS` gained an optional `negativeExamples`
|
|
1822
|
+
(a whole replacement list), spread by `withClaudeAiWords` like the other two fields. It is
|
|
1823
|
+
host-scoped already — `toolListFor` keys on the server's host, never a client's name — and adds
|
|
1824
|
+
no `ToolSpec` field or new path. Only `dream` uses it: its first two negatives were false here
|
|
1825
|
+
(rewritten: no dream unasked; never save what a dream did as something that happened, since on
|
|
1826
|
+
claude.ai memory forms only from writes); the `propose` guard stays verbatim. `reflect`'s
|
|
1827
|
+
negatives already fit. Privileges and annotations stay every host's. The surface test holds that
|
|
1828
|
+
every replaced negative still says "Do NOT", and that Claude Code's and Desktop's `dream` /
|
|
1829
|
+
`reflect` descriptions are the shared ones, byte for byte (also over Desktop's door).
|
|
1830
|
+
Tests: `test/claude-ai-surface.test.ts` "dream and reflect name the routine" — tools/list as
|
|
1831
|
+
claude.ai, and the night prompt v2's steps over the HTTP door (night wake, launch, writer, begin,
|
|
1832
|
+
journal, reflect begin/finish), none refused.
|
|
1833
|
+
|
|
1834
|
+
**The launch result's `how` too.** Once claude.ai's description said "follow its prompt there",
|
|
1835
|
+
the `launch` RESULT's `how` ("Hand `prompt` to a background agent (the Agent tool)") would have
|
|
1836
|
+
contradicted it in a chat where the person asks to dream. So on claude.ai alone (`server.host ===
|
|
1837
|
+
CLAUDE_AI_HOST`, not `chatWordsFor`, which falls back to Desktop's words for every other host,
|
|
1838
|
+
Claude Code included) `dream` and `reflect` `launch` return `CLAUDE_AI_DREAM_LAUNCH_HOW` /
|
|
1839
|
+
`CLAUDE_AI_REFLECT_LAUNCH_HOW` (`server-words.ts`): follow it here; a share left in the night
|
|
1840
|
+
routine waits for the next conversation. Every other host's `how` is unchanged (tested over
|
|
1841
|
+
Desktop's door).
|
|
1842
|
+
|
|
1843
|
+
**Open, with a recommendation:** Desktop has no background agent either; its dream note says
|
|
1844
|
+
"follow the prompt the launch returns yourself, here", but its `dream` description and `how`
|
|
1845
|
+
still name the background agent, as on master. Recommended: give Desktop the same treatment in
|
|
1846
|
+
its own small PR, after a look at its live use.
|
|
1847
|
+
|
|
1848
|
+
## OL1d: "no dreams" means no dreams, words by host (2026-10-26)
|
|
1849
|
+
|
|
1850
|
+
- **Off now refuses the dream `launch` on every host** (`dreaming-off`). The Claude Code headless night builds its
|
|
1851
|
+
prompt from the store (night-run.ts) and never calls launch.
|
|
1852
|
+
- **…and `writer`/`begin` called without one (review of #650).** Over the HTTP door a caller could skip the gated
|
|
1853
|
+
launch and call `begin` straight away (a v2 claude.ai routine, told "if a tool refuses, go on", would). Under off
|
|
1854
|
+
they refuse with the same `dreaming-off` line unless today's day row is `launched` (a launch, or the hook's
|
|
1855
|
+
headless start — a run under way finishes) or the server carries the night's own mark (`server.nightRun()`: a
|
|
1856
|
+
child's `NIGHT_CHILD_ENV` or the catch-up's `NIGHT_RUN_ENV`, which has no child mark). Gated before
|
|
1857
|
+
`claimNightWriter`/`closeNightWriter`, so a refusal writes nothing. `part`/`propose`/`journal` are keyed to an
|
|
1858
|
+
open dream and stay ungated. Tested through the door on claude.ai, Desktop and Claude Code, launched-then-off, and
|
|
1859
|
+
the night's dream child, writer child and catch-up with no row.
|
|
1860
|
+
- **Edges left, flagged:** (a) a launch at 23:58 and a `begin` after midnight under off reads the new day's row and
|
|
1861
|
+
is refused; accepting yesterday's `launched` row would reopen the gate for a routine the next night, so it was
|
|
1862
|
+
left. (b) A dream begun yesterday and resumed today under off without a launch is refused the same way.
|
|
1863
|
+
- **Reflect `begin` stays ungated.** "Part of a night" has no clean server-side mark: the `night: true` wake is not
|
|
1864
|
+
recorded on the session, and a reflect with a `dream` under off is either impossible now (that dream could not
|
|
1865
|
+
have begun) or a left-behind run finishing (decision D). So a standalone reflect on the person's word stays open
|
|
1866
|
+
(the flag below), and a v2 routine that called reflect `begin` after the refused dream would still reflect. The
|
|
1867
|
+
v3 night prompt (trial.sh) stops at the refused launch.
|
|
1868
|
+
- **Words follow the session being served (review of #650).** The `setting` result and the dream/reflect launch
|
|
1869
|
+
`how` read `placeHost` (`callAs !== null ? DEFAULT_HOST : host`), so Desktop's Code tab gets Claude Code's words
|
|
1870
|
+
byte for byte (tested). Tool descriptions are per server, not per call, and cannot follow `callAs`: the Code tab
|
|
1871
|
+
sees Desktop's descriptions, as before.
|
|
1872
|
+
- **Nothing in mcp/ or remote/ starts a night.** Only claude-code/hooks.ts#startNightRun (and the CLI catch-up)
|
|
1873
|
+
does. Hookless wake leaves headless offers unclaimed; claude.ai wake has no dream line. Tested: `auto` on claude.ai
|
|
1874
|
+
spawns only the worker.
|
|
1875
|
+
- **The Desktop dream/reflect description and launch `how` no longer name a background agent** (closes the open item
|
|
1876
|
+
above). Claude Code words are byte-identical.
|
|
1877
|
+
- **Flags, recommendations only:** under off, a standalone reflect `launch` on the person's word stays available
|
|
1878
|
+
(awake, not a dream), while the night's reflection stops with the night. On claude.ai, `ask` behaves like `auto`
|
|
1879
|
+
(it has no dream line); no new value was added.
|
|
1880
|
+
|
|
1881
|
+
## 2026-10-27 — an old window meeting an upgraded memory (U1a)
|
|
1882
|
+
|
|
1883
|
+
- **Reconnect loops for the plugin.** Claude Code keeps a plugin's previous version folder (for 14 days,
|
|
1884
|
+
`.orphaned_at`), and an open window's hooks and server keep its path until `/reload-plugins`. So the schema gate's
|
|
1885
|
+
"Run /mcp and Reconnect" restarts the same old code there. Unmeasured in a throwaway home, but the docs and
|
|
1886
|
+
`plugin-run.sh` (keyed by version) both point that way. The npm route keeps Reconnect: its install is replaced in
|
|
1887
|
+
place.
|
|
1888
|
+
- **Reload vs update is read from `installed_plugins.json`** (`plugin.ts#recordedForThisCopy`: the highest `x.y.z` of
|
|
1889
|
+
the running copy's own `counterparts@<marketplace>` record for this folder, `-<sha>` dropped). Reload when it is
|
|
1890
|
+
newer than this server AND at least as new as the version that wrote the memory, when that is known (review of
|
|
1891
|
+
#666: a record of 0.3.38 under a memory 0.3.39 upgraded would reload into code that still refuses). Anything else
|
|
1892
|
+
(a newer npm or Desktop install wrote the store, a `--plugin-dir` copy — not where Claude Code installed it, so it
|
|
1893
|
+
has no record of its own — a rollback, no record): update, then reload. A bare reload in those cases would load
|
|
1894
|
+
this same code again.
|
|
1895
|
+
- **Server records carry their route** (`ServerRecord.route`, `codeTab`, review of #666), so the wake's older-windows
|
|
1896
|
+
line gives each window its own step. Records from before this say neither: the hook reads them as its own route,
|
|
1897
|
+
Desktop's server as both routes.
|
|
1898
|
+
- **The prompt's "Counterparts was updated" notice** names the reload for a plugin window too (`decideUpdateNotice`'s
|
|
1899
|
+
`remedy`); npm, and an adapter told no route, keep Reconnect.
|
|
1900
|
+
- **`/reload-plugins` has two limits** (docs, quoted in the design review): a warning instead of a reload when the
|
|
1901
|
+
prompt cache would be re-read (`--force`), and no plugin MCP server restart in non-terminal sessions (Desktop's
|
|
1902
|
+
Code tab, which leads with "start a new session").
|
|
1903
|
+
- **A window left open past the 14-day orphan sweep** loses its old folder outright; the same reload fixes it.
|
|
1904
|
+
- **Not measured:** that Reconnect really restarts the old version.
|
|
1905
|
+
- **Open check (review of #666, item 3; Q11):** "Update now" vs "Update marketplace". Whether Installed → counterparts
|
|
1906
|
+
→ Update now refreshes the marketplace listing first, or answers "already at the latest" with auto-update off, needs
|
|
1907
|
+
a throwaway-home run in interactive Claude Code. Until then `PLUGIN_UPDATE` stays "Update now".
|
|
1908
|
+
(U1b, 2026-10-28: changed to Update marketplace as the design note says, Mike's Q11 "yes"; the throwaway-home
|
|
1909
|
+
run is still not done, so it stays unverified.)
|
|
1910
|
+
|
|
1911
|
+
## 2026-10-27 — the hook and doctor weigh the writer too (F1, after #666)
|
|
1912
|
+
|
|
1913
|
+
- **The writer guard was the server's alone.** `newerStoreStep` says reload only into a record at least as new as the
|
|
1914
|
+
version that upgraded the memory, but only `server.ts#newerStoreRoute` passed a `writer`. The hook and doctor said
|
|
1915
|
+
reload for loaded 0.3.37, record 0.3.38, writer 0.3.39, and the reload would have loaded code that still refuses.
|
|
1916
|
+
- **Read without the store.** In the hook and doctor the store refused to open (`SCHEMA_AHEAD`), so there is no
|
|
1917
|
+
`getMeta`. `store#peekMeta` reads one meta value on its own connection (`wal: false`, one SELECT, closed; never
|
|
1918
|
+
throws), and `claude-code/standdown.ts#aheadWriter` applies the server's rule: a version-shaped
|
|
1919
|
+
`self.wake.build`, said only when newer than this copy. The path is the one the refusal named, else the
|
|
1920
|
+
configured store's database (the cache's own `SCHEMA_AHEAD` names no path). Off the npm route only, as the server.
|
|
1921
|
+
- **What it can't see.** A newer writer that migrated the store but hasn't published a wake yet leaves the old stamp
|
|
1922
|
+
(or none), so the words fall back to what they said before: reload when the record is newer. Unmeasured how often
|
|
1923
|
+
a migration lands without a wake following it in the same process.
|