counterparts 0.3.19 → 0.3.21
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 +119 -0
- package/README.md +12 -4
- package/docs/module-map.md +6 -0
- package/package.json +1 -1
- package/src/adapters/claude-code/CONTRACT.md +14 -13
- package/src/adapters/claude-code/NOTES.md +29 -0
- package/src/adapters/claude-code/bin/hook.ts +12 -4
- package/src/adapters/claude-code/bin/runner.ts +41 -20
- package/src/adapters/claude-code/doctor.ts +123 -30
- package/src/adapters/claude-code/hooks.ts +70 -86
- package/src/adapters/claude-code/index.ts +0 -3
- package/src/adapters/cli/NOTES.md +8 -0
- package/src/adapters/cli/commands-delete.ts +273 -0
- package/src/adapters/cli/commands-install.ts +29 -10
- package/src/adapters/cli/commands-note.ts +1 -1
- package/src/adapters/cli/commands-readings.ts +4 -2
- package/src/adapters/cli/commands-scope.ts +25 -4
- package/src/adapters/cli/commands-self.ts +4 -1
- package/src/adapters/cli/commands-start-fresh.ts +1 -1
- package/src/adapters/cli/commands.ts +22 -3
- package/src/adapters/cli/help.ts +7 -7
- package/src/adapters/cli/install.ts +4 -2
- package/src/adapters/cli/mechanisms.ts +2 -2
- package/src/adapters/cli/removal.ts +1 -1
- package/src/adapters/config.ts +112 -30
- package/src/adapters/dashboard/CONTRACT.md +14 -0
- package/src/adapters/dashboard/NOTES.md +15 -0
- package/src/adapters/dashboard/activity.ts +1 -1
- package/src/adapters/dashboard/bin/dashboard.ts +3 -3
- package/src/adapters/dashboard/browse.ts +1 -1
- package/src/adapters/dashboard/identity.ts +1 -1
- package/src/adapters/dashboard/registries.ts +14 -14
- package/src/adapters/dashboard/resolve.ts +1 -1
- package/src/adapters/dashboard/status.ts +5 -2
- package/src/adapters/dashboard/web/actions.ts +21 -2
- package/src/adapters/dashboard/web/app.html +1 -1
- package/src/adapters/dashboard/web/flow.ts +1 -1
- package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +2 -2
- package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +1 -1
- package/src/adapters/dashboard/web/mechanisms/decay/index.js +1 -1
- package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +2 -2
- package/src/adapters/dashboard/web/mechanisms/retrieval/panel.js +3 -3
- package/src/adapters/dashboard/web/mechanisms/salience/panel.js +2 -2
- package/src/adapters/dashboard/web/narrate.ts +11 -11
- package/src/adapters/dashboard/web/pages/flow/sections/heatmap.js +1 -1
- package/src/adapters/dashboard/web/pages/health/sections/checks.js +3 -2
- package/src/adapters/dashboard/web/pages/health/sections/cycle.js +5 -5
- package/src/adapters/dashboard/web/pages/health/sections/mechanisms.js +1 -1
- package/src/adapters/dashboard/web/pages/health/sections/wake.js +2 -2
- package/src/adapters/dashboard/web/pages/memories/sections/tools.js +73 -3
- package/src/adapters/dashboard/web/pages/self/sections/dreams.js +2 -2
- package/src/adapters/dashboard/web/pages/self/sections/journal.js +5 -5
- package/src/adapters/dashboard/web/pages/self/sections/page.js +13 -13
- package/src/adapters/dashboard/web/pages/self/sections/settling.js +1 -1
- package/src/adapters/dashboard/web/pages/self/sections/wake.js +7 -7
- package/src/adapters/dashboard/web/server.ts +9 -1
- package/src/adapters/dashboard/web/shared/event-modal.js +1 -1
- package/src/adapters/dashboard/web/shared/memory-card-words.js +1 -1
- package/src/adapters/dashboard/web/shared/memory-modal.js +5 -5
- package/src/adapters/dashboard/web/views/activity.ts +1 -1
- package/src/adapters/dashboard/web/views/dreams.ts +1 -1
- package/src/adapters/dashboard/web/views/health.ts +1 -1
- package/src/adapters/dashboard/web/views/mechanisms.ts +6 -6
- package/src/adapters/dashboard/web/views/mind.ts +21 -9
- package/src/adapters/dashboard/web/views/overview.ts +3 -3
- package/src/adapters/expansions.ts +14 -1
- package/src/adapters/fired.ts +1 -1
- package/src/adapters/lifecycle.ts +25 -4
- package/src/adapters/log/index.ts +21 -0
- package/src/adapters/mcp/CONTRACT.md +1 -1
- package/src/adapters/mcp/server-self-tools.ts +25 -1
- package/src/adapters/mcp/server-words.ts +3 -2
- package/src/adapters/mcp/server.ts +45 -9
- package/src/adapters/mcp/tools.ts +4 -3
- package/src/adapters/plugin.ts +44 -8
- package/src/adapters/sessions.ts +5 -2
- package/src/adapters/snapshots.ts +90 -1
- package/src/adapters/store-id.ts +58 -0
- package/src/core/counterpart-boundary.ts +9 -0
- package/src/core/counterpart.ts +19 -6
- package/src/core/dream/CONTRACT.md +8 -0
- package/src/core/dream/index.ts +15 -2
- package/src/core/handoff/last-here.ts +24 -12
- package/src/core/onboarding.ts +231 -62
- package/src/core/prospective/CONTRACT.md +4 -1
- package/src/core/prospective/index.ts +23 -5
- package/src/core/recall/CONTRACT.md +3 -1
- package/src/core/recall/INTERFACE-GAPS.md +1 -1
- package/src/core/recall/NOTES.md +14 -0
- package/src/core/recall/session.ts +40 -1
- package/src/core/reconsolidation.ts +1 -1
- package/src/core/remember/CONTRACT.md +14 -8
- package/src/core/remember/owes.ts +68 -28
- package/src/core/remember/owner-strike-seam.ts +6 -3
- package/src/core/remember/spans.ts +3 -2
- package/src/core/remember/tunables.ts +18 -5
- package/src/core/remember/write-up-seam.ts +2 -1
- package/src/core/self/CONTRACT.md +25 -9
- package/src/core/self/NOTES.md +6 -0
- package/src/core/self/briefing-delivery.ts +349 -0
- package/src/core/self/briefing-page.ts +315 -0
- package/src/core/self/briefing-room.ts +563 -0
- package/src/core/self/briefing.ts +304 -1156
- package/src/core/self/index.ts +28 -6
- package/src/core/store/NOTES.md +6 -5
- package/src/core/store/index.ts +39 -0
- package/src/core/store/paths.ts +9 -2
- package/src/adapters/claude-code/primacy.ts +0 -162
package/src/core/onboarding.ts
CHANGED
|
@@ -24,6 +24,14 @@
|
|
|
24
24
|
* line needs an EXPLICIT `done` (written by the meeting itself), so an
|
|
25
25
|
* upgraded store never gets one either.
|
|
26
26
|
*
|
|
27
|
+
* THE MEETING HOLDS THE HOUSEKEEPING (round 1, 2026-10-12, from Mike's first
|
|
28
|
+
* fresh-user trial). While it runs in a session (`meetingHold`), that
|
|
29
|
+
* session's end-of-turn write-up ask is not raised and its pacer not moved;
|
|
30
|
+
* its finish step hands the write-up over in the session (`finishText`), and
|
|
31
|
+
* the one Stop after it is paced but silent. No dream starts on a meeting day
|
|
32
|
+
* (`meetingDay`, through the dream gate's `meeting-day`): the first dream
|
|
33
|
+
* waits for the next lived day, and never dreams on half a meeting.
|
|
34
|
+
*
|
|
27
35
|
* Nothing here calls a model, reads a transcript or writes a memory: the
|
|
28
36
|
* memories the meeting leaves are written by the MCP server through the
|
|
29
37
|
* ordinary `remember` door, from the texts this file composes.
|
|
@@ -47,7 +55,7 @@ export const STYLE_CHOICES = ["straight", "think", "friendly", "character", "oth
|
|
|
47
55
|
export type StyleChoice = (typeof STYLE_CHOICES)[number];
|
|
48
56
|
|
|
49
57
|
/** The getting-to-know-you questions whose answers become memories. */
|
|
50
|
-
export const ANSWER_STEPS = ["name", "
|
|
58
|
+
export const ANSWER_STEPS = ["name", "week", "work", "love", "saturday", "started"] as const;
|
|
51
59
|
export type AnswerStep = (typeof ANSWER_STEPS)[number];
|
|
52
60
|
|
|
53
61
|
/** Every step `meet` takes. */
|
|
@@ -65,6 +73,8 @@ export const ONBOARDING_DONE_KEY = "onboarding.done";
|
|
|
65
73
|
export const ONBOARDING_ANSWERS_KEY = "onboarding.answers";
|
|
66
74
|
/** The session the second-session line was shown in; present means it has been. */
|
|
67
75
|
export const ONBOARDING_AHA_KEY = "onboarding.aha";
|
|
76
|
+
/** `{ session, at }`: the last `meet` call (a read or a step), its session and the moment (ms). */
|
|
77
|
+
export const ONBOARDING_ACTIVE_KEY = "onboarding.active";
|
|
68
78
|
|
|
69
79
|
/** The dreaming setting a NEW install starts on (Mike, 2026-10-11). A store with no setting still reads `ask`. */
|
|
70
80
|
export const NEW_INSTALL_DREAMING = "auto";
|
|
@@ -76,7 +86,17 @@ export const NEW_INSTALL_DREAMING = "auto";
|
|
|
76
86
|
* run in the background (`Dreams#offer`).
|
|
77
87
|
*/
|
|
78
88
|
export const NEW_INSTALL_DREAMING_LINE =
|
|
79
|
-
"
|
|
89
|
+
"Daily tidy-up (called dreaming): on. Once a day, your first session starts a short background run that looks over what was saved and lets go of what doesn't matter. Say \"no dreams\" in a session, or run `counterparts dream --setting off`, to turn it off.";
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* THE SAME, FOR THE PLUGIN'S FIRST-RUN LINE (2026-10-12, onboarding round 1,
|
|
93
|
+
* F; shortened the same day from Mike's fresh-user trial): a plugin install
|
|
94
|
+
* has no `counterparts` command, so it is told only what to say, and it rides
|
|
95
|
+
* at the end of one line (`plugin.ts#firstRunLine`), so it is a parenthesis.
|
|
96
|
+
* "called dreaming" stays so "no dreams" names something the line said.
|
|
97
|
+
*/
|
|
98
|
+
export const NEW_INSTALL_DREAMING_LINE_PLUGIN =
|
|
99
|
+
"(Daily tidy-up, called dreaming, is on; say \"no dreams\" to turn it off.)";
|
|
80
100
|
|
|
81
101
|
/**
|
|
82
102
|
* A NEW INSTALL'S STARTING STATE — written by `install`, only into a store it
|
|
@@ -222,12 +242,17 @@ export function settleOffer(store: MetaStore, on: string): MeetState {
|
|
|
222
242
|
}
|
|
223
243
|
|
|
224
244
|
/** A step that moves the state: `later`, `skipped` (don't ask again) or `done`. A finished meeting stays finished. */
|
|
225
|
-
export function recordState(
|
|
245
|
+
export function recordState(
|
|
246
|
+
store: MetaStore,
|
|
247
|
+
step: "later" | "skipped" | "done",
|
|
248
|
+
input: { on: string; session: string; writeUp?: boolean },
|
|
249
|
+
): MeetState {
|
|
226
250
|
const before = meetState(store);
|
|
227
251
|
if (step === "done") {
|
|
228
252
|
store.setMetaMany([
|
|
229
253
|
[ONBOARDING_MEET_KEY, "done"],
|
|
230
|
-
|
|
254
|
+
// `writeUp`: the finish step handed this session its write-up (`meetingHold`).
|
|
255
|
+
[ONBOARDING_DONE_KEY, JSON.stringify({ on: input.on, session: input.session, ...(input.writeUp === true ? { writeUp: true } : {}) })],
|
|
231
256
|
]);
|
|
232
257
|
return "done";
|
|
233
258
|
}
|
|
@@ -236,6 +261,84 @@ export function recordState(store: MetaStore, step: "later" | "skipped" | "done"
|
|
|
236
261
|
return step;
|
|
237
262
|
}
|
|
238
263
|
|
|
264
|
+
// ── the meeting holds the housekeeping (2026-10-12, onboarding round 1, A) ──
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* HOW LONG A MEETING STAYS "RUNNING" after its last `meet` call. Every read
|
|
268
|
+
* and every step refreshes it, so a real meeting never lapses mid-way; a
|
|
269
|
+
* person who was offered the meeting and went on working (nobody called
|
|
270
|
+
* `later`) holds the write-up ask for this long at most, not all session.
|
|
271
|
+
*/
|
|
272
|
+
export const MEET_HOLD_MS = 30 * 60_000;
|
|
273
|
+
|
|
274
|
+
/** Note a `meet` call: its session and the moment (ms). */
|
|
275
|
+
export function noteActive(store: MetaStore, session: string, at: number): void {
|
|
276
|
+
store.setMeta(ONBOARDING_ACTIVE_KEY, JSON.stringify({ session, at }));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* DOES THE MEETING HOLD THIS SESSION'S WRITE-UP ASK? `running`: the meeting
|
|
281
|
+
* is under way here (`offered`, and a `meet` call in this session within
|
|
282
|
+
* `MEET_HOLD_MS`) — the Stop asks nothing and the pacer is not consulted.
|
|
283
|
+
* `finished`: it was finished in this session and its finish step handed the
|
|
284
|
+
* write-up over (`finishText`); the next Stop's ask is that write-up's, so it
|
|
285
|
+
* is paced but not said, once (`coverFinish`). Null otherwise, and on any
|
|
286
|
+
* error: a hold that cannot read never holds.
|
|
287
|
+
*/
|
|
288
|
+
export function meetingHold(store: MetaReader, session: string, now: number): "running" | "finished" | null {
|
|
289
|
+
try {
|
|
290
|
+
if (session.length === 0) return null;
|
|
291
|
+
const state = meetState(store);
|
|
292
|
+
if (state === "offered") {
|
|
293
|
+
const a = readJson(store, ONBOARDING_ACTIVE_KEY);
|
|
294
|
+
const at = a?.["at"];
|
|
295
|
+
if (a !== null && a["session"] === session && typeof at === "number" && now - at >= 0 && now - at <= MEET_HOLD_MS) return "running";
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
if (state === "done") {
|
|
299
|
+
const d = readJson(store, ONBOARDING_DONE_KEY);
|
|
300
|
+
if (d !== null && d["session"] === session && d["writeUp"] === true && d["covered"] !== true) return "finished";
|
|
301
|
+
}
|
|
302
|
+
return null;
|
|
303
|
+
} catch {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** The finished meeting's write-up stood in for one Stop's ask: never again. */
|
|
309
|
+
export function coverFinish(store: MetaStore): void {
|
|
310
|
+
const d = readJson(store, ONBOARDING_DONE_KEY);
|
|
311
|
+
if (d !== null) store.setMeta(ONBOARDING_DONE_KEY, JSON.stringify({ ...d, covered: true }));
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* IS TODAY A MEETING DAY? No dream starts on one (the `Dreams` ctx's `holds`):
|
|
316
|
+
* a new install's first offer day (by the wake's own offer), a later day the
|
|
317
|
+
* meeting was begun and is not finished, and the day it was finished. So the
|
|
318
|
+
* first dream waits for the next lived day and never dreams on half a
|
|
319
|
+
* meeting. A store with no meeting keys (every store from before 0.3.18) is
|
|
320
|
+
* never held, nor one that meets again after a meeting with no done record.
|
|
321
|
+
*/
|
|
322
|
+
export function meetingDay(store: MetaReader, on: string): boolean {
|
|
323
|
+
try {
|
|
324
|
+
const done = readJson(store, ONBOARDING_DONE_KEY);
|
|
325
|
+
if (done !== null && done["on"] === on) return true;
|
|
326
|
+
const state = meetState(store);
|
|
327
|
+
if (state === "done") return false;
|
|
328
|
+
const last = lastOffer(store);
|
|
329
|
+
if (last === null || last.on !== on) return false;
|
|
330
|
+
// A later day's "later" or "don't ask again" lets that day dream; the
|
|
331
|
+
// first offer's day is the store's first day, and holds either way. On a
|
|
332
|
+
// later day only a meeting begun that day holds (`offered`: a `meet` read
|
|
333
|
+
// or step today, the wake having settled an earlier day's to `later`) —
|
|
334
|
+
// not the wake's offer alone, which leaves `not_started` (review of #450:
|
|
335
|
+
// a Claude that never called `meet` cost days 2 and 3 their dream).
|
|
336
|
+
return last.days <= 1 || state === "offered";
|
|
337
|
+
} catch {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
239
342
|
export function recordWhere(store: MetaStore, where: WhereChoice): void {
|
|
240
343
|
store.setMeta(ONBOARDING_WHERE_KEY, where);
|
|
241
344
|
}
|
|
@@ -277,33 +380,45 @@ export const STYLE_LABELS: Readonly<Record<Exclude<StyleChoice, "character" | "o
|
|
|
277
380
|
|
|
278
381
|
/**
|
|
279
382
|
* THE FIXED BUNDLES (the script's research section, agreed with Mike 14:16):
|
|
280
|
-
* four preferences each, about the
|
|
383
|
+
* four preferences each, about the person — how they like to be talked to —
|
|
281
384
|
* never a claim about who Claude is.
|
|
282
385
|
*/
|
|
283
386
|
export const STYLE_BUNDLES: Readonly<Record<Exclude<StyleChoice, "character" | "other">, readonly string[]>> = {
|
|
284
387
|
straight: [
|
|
285
|
-
"
|
|
286
|
-
"
|
|
287
|
-
"
|
|
288
|
-
"
|
|
388
|
+
"replies that lead with the conclusion.",
|
|
389
|
+
"replies short by default, with more depth only when they ask for it.",
|
|
390
|
+
"no preamble and no recap at the end.",
|
|
391
|
+
"blunt feedback, said plainly.",
|
|
289
392
|
],
|
|
290
393
|
think: [
|
|
291
|
-
"
|
|
292
|
-
"
|
|
293
|
-
"
|
|
294
|
-
"
|
|
394
|
+
"to hear the reasoning behind an answer, not just the answer.",
|
|
395
|
+
"options laid out with their trade-offs.",
|
|
396
|
+
"to be asked before big changes are made.",
|
|
397
|
+
"disagreement that comes with its reasons.",
|
|
295
398
|
],
|
|
296
399
|
friendly: [
|
|
297
|
-
"
|
|
298
|
-
"
|
|
299
|
-
"
|
|
300
|
-
"
|
|
400
|
+
"a casual, easy tone.",
|
|
401
|
+
"occasional dry humor.",
|
|
402
|
+
"kind framing, with pushback still said when it is needed.",
|
|
403
|
+
"frustration acknowledged briefly, then moving on.",
|
|
301
404
|
],
|
|
302
405
|
};
|
|
303
406
|
|
|
407
|
+
/**
|
|
408
|
+
* WHO A STYLE MEMORY IS ABOUT, in words the person reads later (2026-10-12,
|
|
409
|
+
* plain words): their name when the meeting knows it, otherwise "They".
|
|
410
|
+
* `likes` is the verb that goes with it.
|
|
411
|
+
*/
|
|
412
|
+
function whoLikes(name: string | null): { who: string; likes: string; wants: string } {
|
|
413
|
+
const n = (name ?? "").trim();
|
|
414
|
+
return n.length > 0 ? { who: n, likes: "likes", wants: "wants" } : { who: "They", likes: "like", wants: "want" };
|
|
415
|
+
}
|
|
416
|
+
|
|
304
417
|
/** THE BASELINE every bundle keeps (no "ruinous empathy"): honest pushback, whatever the style. */
|
|
305
|
-
export
|
|
306
|
-
|
|
418
|
+
export function pushbackBaseline(name: string | null = null): string {
|
|
419
|
+
const w = whoLikes(name);
|
|
420
|
+
return `Whatever the style, ${w.who === "They" ? "they" : w.who} ${w.wants} honest pushback: say plainly when something looks wrong, and don't agree just to be agreeable.`;
|
|
421
|
+
}
|
|
307
422
|
|
|
308
423
|
/** The longest trait or own-words line a style memory takes. */
|
|
309
424
|
export const STYLE_TEXT_MAX = 240;
|
|
@@ -320,8 +435,10 @@ function mark(option: string): string {
|
|
|
320
435
|
*/
|
|
321
436
|
export function styleMemories(
|
|
322
437
|
choice: StyleChoice,
|
|
323
|
-
input: { traits?: readonly string[]; like?: string } = {},
|
|
438
|
+
input: { traits?: readonly string[]; like?: string; name?: string | null } = {},
|
|
324
439
|
): { ok: true; texts: string[]; option: string } | { ok: false; detail: string } {
|
|
440
|
+
const w = whoLikes(input.name ?? null);
|
|
441
|
+
const pushback = pushbackBaseline(input.name ?? null);
|
|
325
442
|
const clean = (input.traits ?? []).map((t) => t.trim().replace(/[.\s]+$/u, "")).filter((t) => t.length > 0);
|
|
326
443
|
if (clean.some((t) => t.length > STYLE_TEXT_MAX)) return { ok: false, detail: `Each trait is one short line (at most ${String(STYLE_TEXT_MAX)} characters).` };
|
|
327
444
|
if (choice === "character") {
|
|
@@ -334,9 +451,9 @@ export function styleMemories(
|
|
|
334
451
|
ok: true,
|
|
335
452
|
option,
|
|
336
453
|
texts: [
|
|
337
|
-
|
|
338
|
-
...clean.map((t) => `From that,
|
|
339
|
-
`${
|
|
454
|
+
`${w.who} ${w.likes} to be talked to a bit like ${like}: a style reference for tone, not a persona to play. ${mark(option)}`,
|
|
455
|
+
...clean.map((t) => `From that, ${w.who === "They" ? "they" : w.who} ${w.likes}: ${t}. ${mark(option)}`),
|
|
456
|
+
`${pushback} ${mark(option)}`,
|
|
340
457
|
],
|
|
341
458
|
};
|
|
342
459
|
}
|
|
@@ -346,19 +463,19 @@ export function styleMemories(
|
|
|
346
463
|
return {
|
|
347
464
|
ok: true,
|
|
348
465
|
option,
|
|
349
|
-
texts: [`How
|
|
466
|
+
texts: [`How ${w.who === "They" ? "they" : w.who} ${w.likes} to be talked to, in their words: "${clean[0] ?? ""}". ${mark(option)}`, `${pushback} ${mark(option)}`],
|
|
350
467
|
};
|
|
351
468
|
}
|
|
352
469
|
const option = STYLE_LABELS[choice];
|
|
353
|
-
return { ok: true, option, texts: [...STYLE_BUNDLES[choice].map((t) => `${t} ${mark(option)}`), `${
|
|
470
|
+
return { ok: true, option, texts: [...STYLE_BUNDLES[choice].map((t) => `${w.who} ${w.likes} ${t} ${mark(option)}`), `${pushback} ${mark(option)}`] };
|
|
354
471
|
}
|
|
355
472
|
|
|
356
473
|
/** A form of address ("your highness"): its own small preference, apart from style. */
|
|
357
|
-
export function addressMemory(answer: string): { ok: true; text: string } | { ok: false; detail: string } {
|
|
474
|
+
export function addressMemory(answer: string, name: string | null = null): { ok: true; text: string } | { ok: false; detail: string } {
|
|
358
475
|
const a = answer.trim();
|
|
359
476
|
if (a.length === 0) return { ok: false, detail: "Step `address` needs `answer`: how they'd like to be addressed." };
|
|
360
477
|
if (a.length > STYLE_TEXT_MAX) return { ok: false, detail: "`answer` is a form of address, a few words." };
|
|
361
|
-
return { ok: true, text:
|
|
478
|
+
return { ok: true, text: `${whoLikes(name).who} ${whoLikes(name).likes} to be addressed as "${a}". ${mark("form of address")}` };
|
|
362
479
|
}
|
|
363
480
|
|
|
364
481
|
// ── the words ────────────────────────────────────────────────────────────────
|
|
@@ -371,43 +488,64 @@ export interface MeetContext {
|
|
|
371
488
|
readonly uninstall: string;
|
|
372
489
|
/** Where the memory lives, as a person would type it (`~/.counterparts`). */
|
|
373
490
|
readonly home: string;
|
|
374
|
-
/** The dreaming setting now: the
|
|
491
|
+
/** The dreaming setting now: the finish's dream sentence depends on it. */
|
|
375
492
|
readonly dreaming: "auto" | "ask" | "off";
|
|
376
493
|
/** Whether a folder question makes sense here (not in a Claude Desktop chat, which has no folder). */
|
|
377
494
|
readonly folders: boolean;
|
|
378
|
-
/**
|
|
379
|
-
readonly
|
|
495
|
+
/** A Claude Code plugin install: the `/counterparts` sidebar exists, and no `counterparts` command does. */
|
|
496
|
+
readonly plugin: boolean;
|
|
380
497
|
/** The meeting's state when the script was asked for (after the read marked it offered). */
|
|
381
498
|
readonly state: MeetState;
|
|
382
499
|
}
|
|
383
500
|
|
|
384
|
-
/**
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
501
|
+
/**
|
|
502
|
+
* PRONOUNS, WITHOUT ASKING (2026-10-12, onboarding round 1, E): one rule, the
|
|
503
|
+
* same words in the meeting, the write-up ask and the dream's prompt.
|
|
504
|
+
*/
|
|
505
|
+
export const PRONOUN_RULE = "Until they say their pronouns, use their name or \"they\".";
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* WHAT IS KEPT, word for word (D): Claude is never to paraphrase retention, so
|
|
509
|
+
* the script hands the exact line, for when they ask. Its facts (Mike,
|
|
510
|
+
* 2026-10-13), the DEFAULTS: 3 days is `remember/tunables.ts#RETENTION_MS`
|
|
511
|
+
* from the latest of last activity, write-up and session end
|
|
512
|
+
* (`remember/owes.ts`); 14 days is `RETENTION_MAX_MS`, the ceiling from the
|
|
513
|
+
* last activity, owed or not; backups never copy `spans/`
|
|
514
|
+
* (`store/paths.ts#LAYOUT`). A configuration may set other numbers
|
|
515
|
+
* (`retention` in claude-code.json); this line says the defaults.
|
|
516
|
+
*/
|
|
517
|
+
export const RETENTION_LINE =
|
|
518
|
+
"Our conversation text is kept only so I can turn it into memories: it's deleted 3 days after I've written it up, and never kept more than 14 days. Backups never include it. Memories stay until they fade or you remove them, and you can delete the conversation text, the backups or the activity log on their own at any time.";
|
|
519
|
+
|
|
520
|
+
/** The first dream, true to the dreaming setting: never today (`meetingDay`). Empty when dreaming is off. */
|
|
521
|
+
function firstDream(dreaming: MeetContext["dreaming"]): string {
|
|
522
|
+
if (dreaming === "off") return "";
|
|
523
|
+
return dreaming === "auto"
|
|
524
|
+
? "Next time you're here on another day, I'll have my first dream: I'll go over what we talked about and start building a sense of who I am with you. (If you'd rather I didn't dream, say 'no dreams'.)"
|
|
525
|
+
: "When you're back on another day, I'll ask to have my first dream: I'll go over what we talked about and start building a sense of who I am with you.";
|
|
392
526
|
}
|
|
393
527
|
|
|
394
528
|
/**
|
|
395
529
|
* THE SCRIPT, as `meet` returns it. Long on purpose — it is a tool result,
|
|
396
530
|
* read only when the meeting happens, never a description in every session's
|
|
397
|
-
* context.
|
|
531
|
+
* context. Round 1 (2026-10-12, Mike's trial): the opening asks once, through
|
|
532
|
+
* the dialog (B); the questions are the research's five, easy to slightly
|
|
533
|
+
* deeper (C); the close is the finish step's (`finishText`, D).
|
|
398
534
|
*/
|
|
399
535
|
export function meetingInstructions(ctx: MeetContext): string {
|
|
400
536
|
const again = ctx.state === "done";
|
|
401
537
|
const lines: string[] = [
|
|
402
538
|
"COUNTERPARTS: THE FIRST MEETING.",
|
|
403
539
|
...(again ? ["You have met already. If they asked to go through it again, follow the steps below; answers they give now are new memories."] : []),
|
|
404
|
-
"How: a conversation, not a form. One question at a time
|
|
405
|
-
|
|
540
|
+
"How: a conversation between a curious colleague and a new one, not a form. One question at a time, and at most one real follow-up on a detail they gave. React with real interest before the next question (enjoy good news with them). Once or twice, share back one short thing of your own, in character, never invented human experience. \"Pass\" is always welcome: write nothing for it and move on, and never re-ask. Never interrogate. No politics, religion, health, money or identity, and never ask for pronouns. " +
|
|
541
|
+
PRONOUN_RULE +
|
|
542
|
+
" Offer, never take over: if they came with work, help with that first.",
|
|
543
|
+
"For a choice, use the host's own question dialog when it has one (in Claude Code: AskUserQuestion); otherwise give the options in plain text. Ask each choice ONCE: the dialog is the question, so don't also ask it in prose.",
|
|
544
|
+
"Pass your session id (the one your wake names) as `session` on every meet call. Until the meeting is finished, the end-of-turn write-up ask and the dream wait; the finish step hands you the write-up.",
|
|
406
545
|
"",
|
|
407
|
-
"1. Introduce yourself
|
|
408
|
-
" \"Hi, I'm Claude, with Counterparts now: a memory that's mine and stays on this computer
|
|
409
|
-
" Want to take about five minutes to get to know each other
|
|
410
|
-
" Choice: Now (about 5 minutes) · Later. Later → meet {step: \"later\"}, then carry on with whatever they want, and don't offer again this session. If they never want it → meet {step: \"skipped\"}.",
|
|
546
|
+
"1. Introduce yourself in one warm line, close to this, and don't ask anything in it:",
|
|
547
|
+
" \"Hi, I'm Claude, with Counterparts now: a memory that's mine and stays on this computer, so I can carry what matters from one session to the next, and grow along with you.\"",
|
|
548
|
+
" Then the choice, asked once: \"Want to take about five minutes to get to know each other?\" Now (about 5 minutes) · Later. Later → meet {step: \"later\"}, then carry on with whatever they want, and don't offer again this session. If they never want it → meet {step: \"skipped\"}.",
|
|
411
549
|
];
|
|
412
550
|
if (ctx.folders) {
|
|
413
551
|
lines.push(
|
|
@@ -422,34 +560,62 @@ export function meetingInstructions(ctx: MeetContext): string {
|
|
|
422
560
|
ctx.name === null
|
|
423
561
|
? " name: \"What should I call you?\" (the answer is just the name)"
|
|
424
562
|
: ` name: already known (${ctx.name}); don't ask it.`,
|
|
425
|
-
"
|
|
426
|
-
"
|
|
427
|
-
"
|
|
428
|
-
|
|
563
|
+
" week: \"What's been the highlight, or the weirdest part, of your week?\"",
|
|
564
|
+
" work: \"What are you working on lately that you're actually enjoying?\"",
|
|
565
|
+
" love: \"What do you love most about what you do?\"",
|
|
566
|
+
" saturday: \"What would a really good Saturday look like for you?\"",
|
|
567
|
+
" started: \"What got you started building things?\" For someone who doesn't build things, ask instead: \"What's something you've been into lately that has nothing to do with work — a show, a game, food, anything?\"",
|
|
568
|
+
" If the answers are one word, swap love or saturday for a lighter one: \"When do you do your best work: morning, night, with music, in silence?\" or \"Coffee, tea, or something stranger while you work?\" (same step).",
|
|
429
569
|
" style: \"How do you like to be talked to?\" Choice: Straight to it · Think it through with me · Friendly and easy · Like a character you love (name one) · or their own words.",
|
|
430
570
|
" → meet {step: \"style\", answer: \"straight\" | \"think\" | \"friendly\"}.",
|
|
431
571
|
" A character: say back the 2 to 4 concrete traits you'd take from them, then meet {step: \"style\", answer: \"character\", like: \"<who>\", traits: [...]}. It is a style reference, never a persona: you stay yourself underneath.",
|
|
432
572
|
" Their own words: meet {step: \"style\", answer: \"other\", traits: [\"<their words>\"]}.",
|
|
433
573
|
" Every style keeps honest pushback. No flirty or romantic presets; free text gets your normal judgment.",
|
|
434
574
|
" A form of address (\"your highness\") is its own: meet {step: \"address\", answer: \"<it>\"}.",
|
|
435
|
-
" outside (only if it's going well): \"What do you do when you're not at the keyboard?\"",
|
|
436
575
|
"",
|
|
437
|
-
`${ctx.folders ? "4" : "3"}.
|
|
438
|
-
|
|
439
|
-
|
|
576
|
+
`${ctx.folders ? "4" : "3"}. When the questions are done (or they want to stop), call meet {step: "done"}: it hands you the write-up and the close.`,
|
|
577
|
+
"",
|
|
578
|
+
"If they ask, now or later (say these, don't paraphrase):",
|
|
579
|
+
` where it lives: everything is in ${ctx.home} on this computer. What's kept: "${RETENTION_LINE}"`,
|
|
580
|
+
` removing it: ${ctx.uninstall}.`,
|
|
581
|
+
...(ctx.plugin ? [" anything else (turn it off, pause it here, forget something, undo a dream): they say it, and you do it with the counterparts tools. Never hand them a `counterparts` command: this install has none."] : []),
|
|
440
582
|
);
|
|
441
583
|
return lines.join("\n");
|
|
442
584
|
}
|
|
443
585
|
|
|
586
|
+
/**
|
|
587
|
+
* WHAT THE FINISH STEP HANDS BACK (2026-10-12, A and D): the write-up, done
|
|
588
|
+
* here in the session rather than by the end-of-turn ask (which the meeting
|
|
589
|
+
* held, `meetingHold`), then a few lines that show memory working at once, then
|
|
590
|
+
* the close — what to do next, not facts. `session` is the id the write-up
|
|
591
|
+
* tools are bound with.
|
|
592
|
+
*/
|
|
593
|
+
export function finishText(ctx: Pick<MeetContext, "name" | "dreaming" | "plugin"> & { session: string }): string {
|
|
594
|
+
const name = ctx.name === null ? "<their name>" : ctx.name;
|
|
595
|
+
const dream = firstDream(ctx.dreaming);
|
|
596
|
+
return [
|
|
597
|
+
"The meeting is finished. In this same reply, in this order:",
|
|
598
|
+
`1) The write-up: hand back anything from the meeting that a meet step did not already save, one idea each, with the counterparts session_end tool, session: ${ctx.session} (the answers and the style are saved already: don't repeat them; often there is nothing more). Then write the first chapter with the counterparts chapter tool, session: ${ctx.session}: a short, true page about meeting them. ${PRONOUN_RULE}`,
|
|
599
|
+
`2) Show memory working: two or three short lines of what you'll carry from today, in your words — "Here's what I'll remember: …".${dream.length === 0 ? "" : ` Then: "${dream}"`}`,
|
|
600
|
+
"3) Close, close to this, and nothing about retention or uninstalling unless they ask:",
|
|
601
|
+
...(ctx.plugin ? [" \"/counterparts shows the memory sidebar on the right, once this window is wide enough. Off, quiet and pause are at its bottom."] : []),
|
|
602
|
+
` ${ctx.plugin ? "" : "\""}Ask me anything about Counterparts, any time.`,
|
|
603
|
+
` Great meeting you, ${name}! What would you like to work on today? Or we can keep chatting — what's been on your mind lately?"`,
|
|
604
|
+
].join("\n");
|
|
605
|
+
}
|
|
606
|
+
|
|
444
607
|
/**
|
|
445
608
|
* THE WAKE'S LINE (hosts with or without the mod): one short instruction,
|
|
446
|
-
* never a takeover. The mod's own prompt ("
|
|
447
|
-
*
|
|
609
|
+
* never a takeover. The mod's own prompt ("Meet your new counterpart." since
|
|
610
|
+
* 2026-10-12; any wording that asks to meet or for an introduction) is the
|
|
611
|
+
* same offer, and the line says so, so the two never make two offers.
|
|
612
|
+
* The offer is ASKED ONCE (B, 2026-10-12): one warm line of introduction, then
|
|
613
|
+
* the choice — the dialog where there is one, never the same question twice.
|
|
448
614
|
*/
|
|
449
615
|
export function offerLine(state: MeetState): string {
|
|
450
616
|
return [
|
|
451
617
|
"<counterparts-meet>",
|
|
452
|
-
`You and the person haven't properly met yet${state === "later" ? " (last time they said later)" : ""}.
|
|
618
|
+
`You and the person haven't properly met yet${state === "later" ? " (last time they said later)" : ""}. Call the counterparts \`meet\` tool first: it has the script and records that the offer was made. At the end of your first reply, never instead of answering them, introduce yourself in one warm line and offer about five minutes to get to know each other — asked once, through the question dialog if the host has one, not also in prose. If their message asks to meet you or asks you to introduce yourself (the counterparts sidebar sends \"Meet your new counterpart.\"), that is this meeting: begin it with that introduction.`,
|
|
453
619
|
"</counterparts-meet>",
|
|
454
620
|
].join("\n");
|
|
455
621
|
}
|
|
@@ -471,14 +637,14 @@ export function onboardingMarker(state: MeetState): string {
|
|
|
471
637
|
|
|
472
638
|
/**
|
|
473
639
|
* THE SECOND SESSION'S MEMORY (the "aha"): due in the first session after the
|
|
474
|
-
* meeting was finished, once. Which memory: the work answer, else
|
|
475
|
-
*
|
|
640
|
+
* meeting was finished, once. Which memory: the work answer, else what they
|
|
641
|
+
* love about it, else the rest. Null when nothing is due.
|
|
476
642
|
*/
|
|
477
643
|
export function ahaDue(
|
|
478
644
|
store: MetaReader,
|
|
479
645
|
session: string,
|
|
480
646
|
usable: (memoryId: string) => boolean = () => true,
|
|
481
|
-
): { memoryId: string; step:
|
|
647
|
+
): { memoryId: string; step: string } | null {
|
|
482
648
|
try {
|
|
483
649
|
if (store.getMeta(ONBOARDING_MEET_KEY)?.trim() !== "done") return null;
|
|
484
650
|
if (store.getMeta(ONBOARDING_AHA_KEY) !== undefined) return null;
|
|
@@ -487,9 +653,12 @@ export function ahaDue(
|
|
|
487
653
|
}
|
|
488
654
|
const done = readJson(store, ONBOARDING_DONE_KEY);
|
|
489
655
|
if (done === null || done["session"] === session || session.length === 0) return null;
|
|
490
|
-
const ids =
|
|
491
|
-
|
|
492
|
-
|
|
656
|
+
const ids = readJson(store, ONBOARDING_ANSWERS_KEY) ?? {};
|
|
657
|
+
// The round-1 steps (2026-10-12), then the steps a 0.3.18/0.3.19 meeting
|
|
658
|
+
// recorded under their old names, so its line still comes.
|
|
659
|
+
for (const step of ["work", "love", "saturday", "started", "week", "loved", "outside", "problem", "peeves"] as const) {
|
|
660
|
+
const raw = ids[step];
|
|
661
|
+
const id = typeof raw === "string" ? raw : undefined;
|
|
493
662
|
// A memory let go since (asked to be forgotten, revised away) is passed over.
|
|
494
663
|
if (id !== undefined && usable(id)) return { memoryId: id, step };
|
|
495
664
|
}
|
|
@@ -48,7 +48,10 @@ clothes. **Hold debts, lose deadlines.**
|
|
|
48
48
|
days leaves after its day rather than riding the grace week as "was due". A plain
|
|
49
49
|
item is not told, nor marked told, at a turn no person started — a subagent's
|
|
50
50
|
hand-back, a task notification, a peer session's message (2026-10-12, the Claude Code
|
|
51
|
-
adapter's prompt hook)
|
|
51
|
+
adapter's prompt hook) — nor at a session start no person made: a compaction, or the
|
|
52
|
+
headless nightly run's child (2026-10-12, `hooks.ts#watchedAtStart`): it waits for the
|
|
53
|
+
next prompt a person types. The nightly run's prompt, and a prompt the host started, is handed no temporal cue at all
|
|
54
|
+
(`recallForTurn`'s `noCues`), so it spends none of the day's fires. The
|
|
52
55
|
telling marks the wake behind (`told`, 2026-10-09), so a wake composed before it is
|
|
53
56
|
re-rendered at the next turn-end rather than the next day. It
|
|
54
57
|
still arrives as a cue, so recall still finds it.
|
|
@@ -400,7 +400,7 @@ export interface HorizonResult {
|
|
|
400
400
|
/**
|
|
401
401
|
* WHAT THE COUNT LEFT OUT (review of #367, 2026-10-10): the arrivals that
|
|
402
402
|
* would have taken a wake line but for `HORIZON_ITEMS`, in the same order.
|
|
403
|
-
* The wake names them by id under the lane ("N more
|
|
403
|
+
* The wake names them by id under the lane ("N more coming up; recall ids:
|
|
404
404
|
* …") so a dated item past the count is never silently missing.
|
|
405
405
|
*/
|
|
406
406
|
readonly more: Arrival[];
|
|
@@ -759,10 +759,28 @@ export class Prospective {
|
|
|
759
759
|
// 13th and the 14th. A plain reminder never loses its place to quiet ones;
|
|
760
760
|
// within a tier the nearest date leads, and the salience order only
|
|
761
761
|
// breaks a tie (`byArrivingOrder`).
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
762
|
+
//
|
|
763
|
+
// WHAT THE LANE LEAVES OUT, SAID ONCE (2026-10-12): one event with the
|
|
764
|
+
// count and ids per reason, so a dated item that arrived and is not under
|
|
765
|
+
// "Arriving:" can be traced to the rule that left it out.
|
|
766
|
+
const excluded = { notDay: [] as string[], daily: [] as string[], told: [] as string[] };
|
|
767
|
+
const offered = considered.arrivals.filter((a) => {
|
|
768
|
+
if (a.precision !== "day") excluded.notDay.push(a.memoryId);
|
|
769
|
+
else if (a.recurring === "daily") excluded.daily.push(a.memoryId);
|
|
770
|
+
else if (this.toldForGood(a, input.at)) excluded.told.push(a.memoryId);
|
|
771
|
+
else return true;
|
|
772
|
+
return false;
|
|
773
|
+
});
|
|
774
|
+
if (excluded.notDay.length + excluded.daily.length + excluded.told.length > 0) {
|
|
775
|
+
this.emit("prospective.horizon.excluded", undefined, {
|
|
776
|
+
notDay: excluded.notDay.length,
|
|
777
|
+
daily: excluded.daily.length,
|
|
778
|
+
told: excluded.told.length,
|
|
779
|
+
notDayIds: excluded.notDay.join(","),
|
|
780
|
+
dailyIds: excluded.daily.join(","),
|
|
781
|
+
toldIds: excluded.told.join(","),
|
|
782
|
+
});
|
|
783
|
+
}
|
|
766
784
|
const ordered = [...offered].sort(byArrivingOrder(input.at));
|
|
767
785
|
const items = ordered.slice(0, this.tunables.HORIZON_ITEMS);
|
|
768
786
|
// Past the count: named by id in the wake, never silently gone (review of #367).
|
|
@@ -170,7 +170,9 @@ reply actually used reconsolidates, where in humans every retrieval does.
|
|
|
170
170
|
cross-session cue carry-over were all inert on the live path** — specified, implemented,
|
|
171
171
|
tested, unreachable. The spec's instruction is to pick one and say so; this contract
|
|
172
172
|
persists it (a few rows under the storage rescope) and marks the call. **Generalized: a
|
|
173
|
-
pure function over caller-owned state is only as real as its caller.**
|
|
173
|
+
pure function over caller-owned state is only as real as its caller.** The one piece of
|
|
174
|
+
it that is the person's own words, the carried cue tokens, is emptied in any session idle
|
|
175
|
+
past the retention ceiling (`clearIdleCarries`, run by the worker; NOTES §6, 2026-10-13).
|
|
174
176
|
- **The activation graph's edge arithmetic may belong in `physics/` and the traversal here** —
|
|
175
177
|
`associate/CONTRACT.md` open question 1, the module map's standing check-in question. Not
|
|
176
178
|
resolved by this contract.
|
|
@@ -5,7 +5,7 @@ entry names the owner, the workaround now in the code, and what the real fix loo
|
|
|
5
5
|
|
|
6
6
|
## 1. `store/` has no meta enumeration or expiry — gate-state rows are unbounded
|
|
7
7
|
|
|
8
|
-
**Closed 2026-09-24** — gate state is the `gate_session` table, one row per record with `last_day` (`store/operational.ts`), swept by `Store#pruneGateSessions
|
|
8
|
+
**Closed 2026-09-24** — gate state is the `gate_session` table, one row per record with `last_day` (`store/operational.ts`), swept by `Store#pruneGateSessions` — which, as of 2026-10-13, nothing on a live path calls. The rows' one piece of typed text, the carried cue tokens, is emptied by `clearIdleCarries` (NOTES §6); the rows themselves are still unbounded.
|
|
9
9
|
|
|
10
10
|
**Owner:** `store/`.
|
|
11
11
|
**Needed:** per-session gate state with a defined store AND lifetime (recall contract §5
|
package/src/core/recall/NOTES.md
CHANGED
|
@@ -76,6 +76,20 @@ every turn, scoped to one session, never emitted as telemetry. The decision reco
|
|
|
76
76
|
every event carry counts and hashes only — a cue token is turn text, and turn text is
|
|
77
77
|
exactly what telemetry may not carry. Revisit if the retention review disagrees.
|
|
78
78
|
|
|
79
|
+
**2026-10-13, the retention review's answer.** "Overwritten every turn" was true of a
|
|
80
|
+
session that keeps talking; a session that ended, or was killed, kept its last turn's
|
|
81
|
+
tokens for as long as its row lived — and `Store#pruneGateSessions`, the sweep meant to
|
|
82
|
+
end that, has no live caller. Policy since PR #468 is that what the person typed is never
|
|
83
|
+
kept past the retention ceiling (`retention.maxDays`, default 14). So the scalar row now
|
|
84
|
+
records when it was saved (`at`, in its JSON — no schema change), and the worker's every
|
|
85
|
+
run calls `clearIdleCarries`, which empties `carriedCues` in every session whose row is
|
|
86
|
+
older than the ceiling (a row with no `at` counts as old, which is what clears existing
|
|
87
|
+
stores). Only the carry: the turn count, refractory and per-memory rows are ids and
|
|
88
|
+
numbers, and stay. Not done at session end: the core boundary runs at every turn, and
|
|
89
|
+
there is no clean end signal; the sweep covers ended and killed sessions alike. The
|
|
90
|
+
other gate kinds hold no typed text: `surfaced`, `credited` and `asked` are memory ids,
|
|
91
|
+
`semantic` is `{id, score}` plus a model name, `judged` is a turn number.
|
|
92
|
+
|
|
79
93
|
## 7. Deliberately NOT built (Amendment 15 — complexity is earned)
|
|
80
94
|
|
|
81
95
|
- **Deliberate recall (§9.1)** — the explicit ask, its lower-confidence labeled tier and
|