counterparts 0.3.13 → 0.3.14
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 +160 -0
- package/package.json +1 -1
- package/src/adapters/claude-code/bin/hook.mjs +4 -2
- package/src/adapters/claude-code/bin/hook.ts +11 -4
- package/src/adapters/claude-code/bin/nightly.ts +5 -1
- package/src/adapters/claude-code/bin/runner.ts +11 -3
- package/src/adapters/claude-code/doctor.ts +69 -5
- package/src/adapters/claude-code/embed-client.ts +3 -0
- package/src/adapters/cli/bin/counterparts.mjs +4 -2
- package/src/adapters/cli/bin/counterparts.ts +11 -3
- package/src/adapters/cli/commands.ts +65 -23
- package/src/adapters/cli/index.ts +1 -0
- package/src/adapters/cli/install.ts +22 -9
- package/src/adapters/cli/settle.ts +39 -2
- package/src/adapters/cli/wire.ts +4 -0
- package/src/adapters/config.ts +29 -1
- package/src/adapters/dashboard/NOTES.md +33 -0
- package/src/adapters/dashboard/bin/dashboard.mjs +4 -2
- package/src/adapters/dashboard/bin/dashboard.ts +11 -3
- package/src/adapters/dashboard/index.ts +14 -0
- package/src/adapters/dashboard/source.ts +0 -8
- package/src/adapters/dashboard/web/fired.ts +8 -0
- package/src/adapters/dashboard/web/pages/flow/sections/fired.js +1 -1
- package/src/adapters/dashboard/web/pages/health/sections/cycle.js +7 -10
- package/src/adapters/dashboard/web/pages/memories/memories.css +3 -0
- package/src/adapters/dashboard/web/pages/memories/row.js +5 -2
- package/src/adapters/dashboard/web/pages/memories/sections/hold.js +2 -1
- package/src/adapters/dashboard/web/pages/memories/sections/search.js +19 -3
- package/src/adapters/dashboard/web/server.ts +16 -4
- package/src/adapters/dashboard/web/shared/dates.js +6 -16
- package/src/adapters/dashboard/web/shared/memory-modal.js +21 -8
- package/src/adapters/dashboard/web/views/health.ts +11 -0
- package/src/adapters/dashboard/web/views/mechanism-panel.ts +8 -5
- package/src/adapters/dashboard/web/views/memories.ts +26 -7
- package/src/adapters/dashboard/web/views/memory-words.ts +16 -0
- package/src/adapters/dashboard/web/views/memory.ts +51 -2
- package/src/adapters/dashboard/web/views/mind.ts +31 -6
- package/src/adapters/empty-bunfig.toml +5 -0
- package/src/adapters/fired.ts +6 -2
- package/src/adapters/host-wiring.ts +4 -3
- package/src/adapters/log/index.ts +2 -2
- package/src/adapters/mcp/CONTRACT.md +16 -2
- package/src/adapters/mcp/INTERFACE-GAPS.md +15 -1
- package/src/adapters/mcp/NOTES.md +243 -0
- package/src/adapters/mcp/bin/serve.mjs +4 -2
- package/src/adapters/mcp/bin/serve.ts +11 -4
- package/src/adapters/mcp/facts.ts +72 -4
- package/src/adapters/mcp/meaning.ts +218 -15
- package/src/adapters/mcp/server.ts +1 -1
- package/src/adapters/mcp/tools.ts +81 -57
- package/src/adapters/plugin-run.sh +405 -33
- package/src/adapters/plugin.ts +14 -2
- package/src/adapters/runtime.ts +192 -17
- package/src/adapters/sessions.ts +2 -2
- package/src/core/associate/NOTES.md +10 -0
- package/src/core/bridge.ts +1 -1
- package/src/core/briefing.ts +20 -3
- package/src/core/contradictions.ts +56 -20
- package/src/core/counterpart.ts +39 -17
- package/src/core/dream/CONTRACT.md +4 -12
- package/src/core/dream/INTERFACE-GAPS.md +3 -2
- package/src/core/dream/NOTES.md +10 -0
- package/src/core/dream/index.ts +10 -52
- package/src/core/embed/static.ts +5 -1
- package/src/core/encode/INTERFACE-GAPS.md +2 -1
- package/src/core/encode/NOTES.md +12 -0
- package/src/core/encode/chunk.ts +6 -30
- package/src/core/encode/index.ts +0 -1
- package/src/core/encode/types.ts +1 -13
- package/src/core/handoff/last-here.ts +18 -2
- package/src/core/physics/CONTRACT.md +6 -0
- package/src/core/physics/NOTES.md +33 -2
- package/src/core/physics/index.ts +22 -7
- package/src/core/prospective/CONTRACT.md +3 -1
- package/src/core/prospective/NOTES.md +15 -0
- package/src/core/recall/time-ask.ts +154 -19
- package/src/core/self/CONTRACT.md +23 -3
- package/src/core/self/NOTES.md +64 -0
- package/src/core/self/behind.ts +6 -3
- package/src/core/self/briefing.ts +272 -11
- package/src/core/self/index.ts +50 -4
- package/src/core/sleep/NOTES.md +32 -0
- package/src/core/store/NOTES.md +16 -0
- package/src/core/time.ts +15 -0
|
@@ -37,7 +37,14 @@
|
|
|
37
37
|
* the order of its names, counts only breaking a tie (`subjectOf`, since
|
|
38
38
|
* 2026-10-09; it was the card holding the most) — and the rest are
|
|
39
39
|
* one-liners. The owner's "I" asked about ("what have you been like", in the
|
|
40
|
-
* counterpart's voice) is his own card.
|
|
40
|
+
* counterpart's voice) is his own card. A name asked about that has NO card
|
|
41
|
+
* (2026-10-09) is never passed over in silence for another card: when every
|
|
42
|
+
* card the question names sits in an aside ("what has Han been to Mike"),
|
|
43
|
+
* the answer is the moments that mention it, as typed, and its first line
|
|
44
|
+
* says so ("No card for Han yet; here is what mentions Han"); beside a card
|
|
45
|
+
* asked about or named plainly, the card leads as before and the first line
|
|
46
|
+
* says the name has none (`MeaningResult.noCard`). Naming no card, the
|
|
47
|
+
* question's words and meaning answer it, as before. "us"
|
|
41
48
|
* is the memories marked `about: us`. A question about feeling
|
|
42
49
|
* (`recall/feeling-ask.ts#readFeelingAsk`, ranked) with no card is answered
|
|
43
50
|
* by the stamps that match it — word, core, whose — and, when it names a
|
|
@@ -218,6 +225,14 @@ export interface MeaningResult {
|
|
|
218
225
|
readonly mode: "meaning";
|
|
219
226
|
readonly reason: "answered" | "nothing-came";
|
|
220
227
|
readonly semantic: SemanticSource;
|
|
228
|
+
/**
|
|
229
|
+
* A name the question asks about that has no card, said plainly — the
|
|
230
|
+
* answer's FIRST line (2026-10-09): "No card for Han yet; here is what
|
|
231
|
+
* mentions Han" when the answer follows the name (a `words` lens on it),
|
|
232
|
+
* "… yet; this follows Ilya" when a card asked about alongside it leads.
|
|
233
|
+
* Null when every name asked about has a card.
|
|
234
|
+
*/
|
|
235
|
+
readonly noCard: string | null;
|
|
221
236
|
readonly lens: MeaningLens | null;
|
|
222
237
|
/** The other subjects the question named, as one-liners to ask for. */
|
|
223
238
|
readonly others: readonly { readonly name: string; readonly memories: number }[];
|
|
@@ -462,16 +477,39 @@ export function meaningRecall(ctx: MeaningContext, question: string, opts: { pag
|
|
|
462
477
|
// store is usually the owner's: "what has Ilya been to Mike" answered
|
|
463
478
|
// about Mike.
|
|
464
479
|
const ownerCard = safe(() => findIdentityCore(store), null);
|
|
480
|
+
/** Each word of a live card's name or alias, lower case → the cards it is a word of (read once, when asked). */
|
|
481
|
+
let cardWords: Map<string, string[]> | null = null;
|
|
482
|
+
const cardWord = (word: string): boolean => {
|
|
483
|
+
if (cardWords === null) {
|
|
484
|
+
const index = new Map<string, string[]>();
|
|
485
|
+
for (const e of safe(() => c.schemas.entities(), [] as ReturnType<typeof c.schemas.entities>)) {
|
|
486
|
+
for (const w of new Set([e.name, ...e.aliases].flatMap((t) => tokenize(t)))) index.set(w, [...(index.get(w) ?? []), e.id]);
|
|
487
|
+
}
|
|
488
|
+
cardWords = index;
|
|
489
|
+
}
|
|
490
|
+
// Only a card the asker may see something of: one that holds nothing for
|
|
491
|
+
// him reads as no card, as everywhere else here.
|
|
492
|
+
return (cardWords.get(word) ?? []).some((id) => (cardOf(id)?.ids.length ?? 0) > 0);
|
|
493
|
+
};
|
|
465
494
|
const subject = subjectOf(question, cards, {
|
|
466
495
|
terms: (id) => cardTerms(c, id),
|
|
467
496
|
ownerCard,
|
|
468
497
|
ownerPronoun: feelingAsked || usAsked ? null : asker === "self" ? OWNER_AS_YOU : OWNER_AS_I,
|
|
469
498
|
ownerCardOf: () => (ownerCard === null ? null : cardOf(ownerCard)),
|
|
499
|
+
ownerNames: new Set(ownerNamesLower(c).flatMap((n) => tokenize(n))),
|
|
500
|
+
cardWord,
|
|
470
501
|
});
|
|
471
502
|
const bestCard = subject.card;
|
|
472
503
|
if (bestCard !== null && subject.alike.length > 0) {
|
|
473
504
|
notes.push(`it asks about ${andList([bestCard.name, ...subject.alike])} alike: this follows ${bestCard.name}, named first`);
|
|
474
505
|
}
|
|
506
|
+
// A NAME WITH NO CARD, said first (2026-10-09): asked about alongside a
|
|
507
|
+
// card, the card leads; asked about above every card, what mentions it is
|
|
508
|
+
// the answer (below). Never an answer about another card in silence.
|
|
509
|
+
let noCard: string | null =
|
|
510
|
+
bestCard !== null && subject.bareAlike.length > 0 ? `No card for ${andList(subject.bareAlike)} yet; this follows ${bestCard.name}` : null;
|
|
511
|
+
/** The name with no card the answer follows, when it follows one. */
|
|
512
|
+
const bareName = bestCard === null && !feelingAsked ? subject.bare : null;
|
|
475
513
|
|
|
476
514
|
if (bestCard !== null) {
|
|
477
515
|
lens = { kind: "card", id: bestCard.id, name: bestCard.name };
|
|
@@ -489,6 +527,18 @@ export function meaningRecall(ctx: MeaningContext, question: string, opts: { pag
|
|
|
489
527
|
}
|
|
490
528
|
for (const x of cards) if (x.id !== bestCard.id) others.push({ name: x.name, memories: x.ids.length });
|
|
491
529
|
if (usIds.length > 0) others.push({ name: usName, memories: usIds.length });
|
|
530
|
+
} else if (bareName !== null) {
|
|
531
|
+
// What mentions the name, as typed ("Han", not "han"): its words only.
|
|
532
|
+
// The question's meaning is left out — its vector carries the other
|
|
533
|
+
// names too, and would bring "Mike" back in for "what has Han been to
|
|
534
|
+
// Mike". The cards it named are one-liners to ask for.
|
|
535
|
+
lens = { kind: "words", name: `"${bareName}"` };
|
|
536
|
+
const byWords = holdByWords(store, nameTopic(bareName), usable, hold);
|
|
537
|
+
textMatch = byWords.textMatch;
|
|
538
|
+
lineMatch = byWords.lineMatch;
|
|
539
|
+
notes.push("matched by the name as written, not by meaning");
|
|
540
|
+
for (const x of cards) others.push({ name: x.name, memories: x.ids.length });
|
|
541
|
+
if (usIds.length > 0) others.push({ name: usName, memories: usIds.length });
|
|
492
542
|
} else if (usIds.length > 0) {
|
|
493
543
|
lens = { kind: "us", name: usName };
|
|
494
544
|
for (const id of usIds) hold(id, 1);
|
|
@@ -506,13 +556,19 @@ export function meaningRecall(ctx: MeaningContext, question: string, opts: { pag
|
|
|
506
556
|
const asked = question.replace(/\bsince\b[^?.!;]*/gi, " ");
|
|
507
557
|
const proper = safe(() => askedNames(asked), new Set<string>());
|
|
508
558
|
const owners = new Set(ownerNamesLower(c).flatMap((n) => tokenize(n)));
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
559
|
+
// A name with no card that leads (`subjectOf`'s `bare`) is the topic, as
|
|
560
|
+
// typed: the question's other words include the card it outranked, and
|
|
561
|
+
// "no card names" would then name that card too (review of #347).
|
|
562
|
+
const topic =
|
|
563
|
+
subject.bare !== null
|
|
564
|
+
? nameTopic(subject.bare)
|
|
565
|
+
: contentWords(
|
|
566
|
+
c,
|
|
567
|
+
asked,
|
|
568
|
+
minLen,
|
|
569
|
+
ask.named,
|
|
570
|
+
(w) => isFeelingFrameWord(w, stored, proper) || owners.has(w) || FEELING_FRAME_MORE.has(w),
|
|
571
|
+
);
|
|
516
572
|
const reached = new Map<string, number>();
|
|
517
573
|
if (topic.words.length > 0) {
|
|
518
574
|
holdByWords(store, topic, usable, (id) => {
|
|
@@ -790,10 +846,17 @@ export function meaningRecall(ctx: MeaningContext, question: string, opts: { pag
|
|
|
790
846
|
if (!feltAny) notes.push("no feelings recorded");
|
|
791
847
|
}
|
|
792
848
|
|
|
849
|
+
const nothing = lens === null || (all.length === 0 && faded.length === 0 && readingsAll.length === 0 && openAll.length === 0);
|
|
850
|
+
if (bareName !== null) {
|
|
851
|
+
noCard = nothing
|
|
852
|
+
? `No card for ${bareName} yet, and nothing in memory mentions ${bareName}`
|
|
853
|
+
: `No card for ${bareName} yet; here is what mentions ${bareName}`;
|
|
854
|
+
}
|
|
793
855
|
const result: MeaningResult = {
|
|
794
856
|
mode: "meaning",
|
|
795
|
-
reason:
|
|
857
|
+
reason: nothing ? "nothing-came" : "answered",
|
|
796
858
|
semantic,
|
|
859
|
+
noCard,
|
|
797
860
|
lens,
|
|
798
861
|
others: others.filter((o) => o.memories > 0),
|
|
799
862
|
feeling: feelingAsked && ask !== null ? { words: [...ask.named], whose: ask.whose === null ? null : whose[ask.whose] } : null,
|
|
@@ -1162,6 +1225,8 @@ function refold(arc: readonly MeaningArcLine[], address: string): MeaningArcLine
|
|
|
1162
1225
|
*/
|
|
1163
1226
|
export function renderMeaning(r: MeaningResult): string {
|
|
1164
1227
|
const out: string[] = [];
|
|
1228
|
+
// Said first, before anything about another subject (2026-10-09).
|
|
1229
|
+
if (r.noCard !== null) out.push(`${r.noCard}.`);
|
|
1165
1230
|
if (r.lens === null) {
|
|
1166
1231
|
out.push("Nothing came: the question names no card, asks about no feeling, and none of its words reach a memory.");
|
|
1167
1232
|
out.push("Try a person's or project's name, or facts mode for a single fact.");
|
|
@@ -1337,6 +1402,22 @@ function mentionRank(m: { readonly slot: Slot; readonly pronoun: boolean; readon
|
|
|
1337
1402
|
* his. Anywhere else a pronoun names nothing, so "do you remember
|
|
1338
1403
|
* the budget" is still read by its words. Off (`ownerPronoun` null) for a
|
|
1339
1404
|
* question about feeling, where the pronoun says whose feeling, and for "us".
|
|
1405
|
+
*
|
|
1406
|
+
* A NAME WITH NO CARD (2026-10-09, the 0.3.13 release check): "what has Han
|
|
1407
|
+
* been to Mike", on a store whose one card is Mike's, answered with Mike's
|
|
1408
|
+
* arc and no word about Han. A name the asker capitalised mid-sentence
|
|
1409
|
+
* (`askedNames`) that no card with memories covers — not the owner's, not a
|
|
1410
|
+
* month or a weekday, not a word of a card's longer name, not an acronym — is
|
|
1411
|
+
* read in place like a card's, typed as written, when the question names a
|
|
1412
|
+
* card too (with none named, nothing is answered in its place, and the
|
|
1413
|
+
* question's words and meaning follow it as before). In
|
|
1414
|
+
* an aside it is passed over. When EVERY card the question names sits in an
|
|
1415
|
+
* aside ("been to Mike", "since Driftwood"), it is `bare`: the answer is what
|
|
1416
|
+
* mentions it, said so first. A card asked about or named plainly leads, as
|
|
1417
|
+
* it did before (review of #347: "what did Teodoro say about Postgres" is
|
|
1418
|
+
* Teodoro's, "how did I feel about Han at Driftwood" is Driftwood's), and
|
|
1419
|
+
* `bareAlike` names each such name ranked as high as that card, so the
|
|
1420
|
+
* answer can say it has no card.
|
|
1340
1421
|
*/
|
|
1341
1422
|
function subjectOf(
|
|
1342
1423
|
question: string,
|
|
@@ -1346,8 +1427,16 @@ function subjectOf(
|
|
|
1346
1427
|
readonly ownerCard: string | null;
|
|
1347
1428
|
readonly ownerPronoun: RegExp | null;
|
|
1348
1429
|
readonly ownerCardOf: () => NamedCard | null;
|
|
1430
|
+
/** The owner's names, lower case, word by word: never a name without a card. */
|
|
1431
|
+
readonly ownerNames: ReadonlySet<string>;
|
|
1432
|
+
/**
|
|
1433
|
+
* Is this word (lower case) part of the name or an alias of a card the
|
|
1434
|
+
* asker may see — "Marguerite" of Marguerite Solberg? Never a name
|
|
1435
|
+
* without a card, though `subjectsIn` does not read it as that card.
|
|
1436
|
+
*/
|
|
1437
|
+
readonly cardWord: (word: string) => boolean;
|
|
1349
1438
|
},
|
|
1350
|
-
): { card: NamedCard | null; alike: readonly string[] } {
|
|
1439
|
+
): { card: NamedCard | null; alike: readonly string[]; bare: string | null; bareAlike: readonly string[] } {
|
|
1351
1440
|
const live = cards.filter((x) => x.ids.length > 0);
|
|
1352
1441
|
// Every mention of every card, in the order they are named.
|
|
1353
1442
|
const mentions: { card: NamedCard; at: number; end: number; slot: Slot; pronoun: boolean; lowered: boolean }[] = [];
|
|
@@ -1371,18 +1460,37 @@ function subjectOf(
|
|
|
1371
1460
|
}
|
|
1372
1461
|
}
|
|
1373
1462
|
}
|
|
1374
|
-
if (live.length === 0) return { card: null, alike: [] };
|
|
1375
1463
|
mentions.sort((a, b) => a.at - b.at || b.end - a.end);
|
|
1376
1464
|
const kept: typeof mentions = [];
|
|
1377
1465
|
for (const m of mentions) {
|
|
1378
1466
|
const prev = kept[kept.length - 1];
|
|
1379
1467
|
// A name inside a longer one ("Han" in "Han Seo") is not a mention of its own.
|
|
1380
1468
|
if (prev !== undefined && m.at < prev.end) continue;
|
|
1381
|
-
// Joined to the owner's pronoun ("how have you and Ilya been"), a name
|
|
1382
|
-
// takes the place the grammar gives, not the pronoun's lower rank.
|
|
1383
|
-
if (prev !== undefined && JOINED.test(question.slice(prev.end, m.at))) m.slot = prev.slot;
|
|
1384
1469
|
kept.push(m);
|
|
1385
1470
|
}
|
|
1471
|
+
// The names no card covers, between and around the cards' own.
|
|
1472
|
+
const uncarded = uncardedNames(question, kept, o.ownerNames, o.cardWord);
|
|
1473
|
+
// Joined to the name before it ("X and Y", "X, Y"), a name takes that one's
|
|
1474
|
+
// place — and joined to the owner's pronoun ("how have you and Ilya been"),
|
|
1475
|
+
// the place the grammar gives, not the pronoun's lower rank. Cards and
|
|
1476
|
+
// names with no card alike: "how have Han and Ilya been" asks about both.
|
|
1477
|
+
const inOrder: { at: number; end: number; slot: Slot }[] = [...kept, ...uncarded].sort((a, b) => a.at - b.at);
|
|
1478
|
+
for (let i = 1; i < inOrder.length; i += 1) {
|
|
1479
|
+
const prev = inOrder[i - 1] as { at: number; end: number; slot: Slot };
|
|
1480
|
+
const m = inOrder[i] as { at: number; end: number; slot: Slot };
|
|
1481
|
+
if (JOINED.test(question.slice(prev.end, m.at))) m.slot = prev.slot;
|
|
1482
|
+
}
|
|
1483
|
+
// In an aside a name with no card is passed over; the first named breaks a tie.
|
|
1484
|
+
// With no card named at all, none is: nothing would be answered in its
|
|
1485
|
+
// place, and the question's own words and meaning already follow it — "what
|
|
1486
|
+
// did I learn about Postgres indexing" stays a question about indexing too
|
|
1487
|
+
// (review of #347).
|
|
1488
|
+
const bare = (kept.length === 0 ? [] : uncarded)
|
|
1489
|
+
.map((b) => ({ ...b, rank: mentionRank({ slot: b.slot, pronoun: false, lowered: false }) }))
|
|
1490
|
+
.filter((b) => b.slot !== "aside");
|
|
1491
|
+
const bareBest = bare.reduce((r, b) => Math.max(r, b.rank), Number.NEGATIVE_INFINITY);
|
|
1492
|
+
const bareFirst = bare.find((b) => b.rank === bareBest)?.name ?? null;
|
|
1493
|
+
if (live.length === 0) return { card: null, alike: [], bare: bareFirst, bareAlike: [] };
|
|
1386
1494
|
const place = new Map<string, { rank: number; at: number; length: number }>();
|
|
1387
1495
|
for (const m of kept) {
|
|
1388
1496
|
const had = place.get(m.card.id);
|
|
@@ -1393,6 +1501,12 @@ function subjectOf(
|
|
|
1393
1501
|
const placeOf = (x: NamedCard) => place.get(x.id) ?? { rank: -1, at: Number.POSITIVE_INFINITY, length: 0 };
|
|
1394
1502
|
const best = Math.max(...live.map((x) => placeOf(x).rank));
|
|
1395
1503
|
let field = live.filter((x) => placeOf(x).rank === best);
|
|
1504
|
+
// A name with no card leads only when every card named sits in an aside
|
|
1505
|
+
// ("what has Han been to Mike"). A card asked about or named plainly leads
|
|
1506
|
+
// as before, and the name is said to have none (review of #347).
|
|
1507
|
+
if (bareFirst !== null && kept.every((m) => m.slot === "aside")) {
|
|
1508
|
+
return { card: null, alike: [], bare: bareFirst, bareAlike: [] };
|
|
1509
|
+
}
|
|
1396
1510
|
if (field.length > 1 && o.ownerCard !== null) field = field.filter((x) => x.id !== o.ownerCard);
|
|
1397
1511
|
field.sort((a, b) => {
|
|
1398
1512
|
const pa = placeOf(a);
|
|
@@ -1400,7 +1514,96 @@ function subjectOf(
|
|
|
1400
1514
|
return pa.at - pb.at || pb.length - pa.length || b.ids.length - a.ids.length || a.name.localeCompare(b.name);
|
|
1401
1515
|
});
|
|
1402
1516
|
const [card, ...rest] = field;
|
|
1403
|
-
return {
|
|
1517
|
+
return {
|
|
1518
|
+
card: card ?? null,
|
|
1519
|
+
alike: rest.map((x) => x.name),
|
|
1520
|
+
bare: null,
|
|
1521
|
+
// Each name with no card asked about as high as the card that leads, or higher.
|
|
1522
|
+
bareAlike: bare.filter((b) => b.rank >= best).map((b) => b.name),
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
/** Month and weekday names: capitalised, and a time, never a subject. */
|
|
1527
|
+
const CALENDAR_NAMES = new Set([
|
|
1528
|
+
"january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december",
|
|
1529
|
+
"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday",
|
|
1530
|
+
]);
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* Words a question is built from, never a name: one of them capitalised
|
|
1534
|
+
* mid-sentence means the question was typed in Title Case ("What Has Changed
|
|
1535
|
+
* Since Monday"), which capitalises nothing in particular (review of #347).
|
|
1536
|
+
* Not "will", "may" or "can", which are names too.
|
|
1537
|
+
*/
|
|
1538
|
+
const TITLE_CASE_TELLS = new Set([
|
|
1539
|
+
"has", "have", "had", "is", "are", "was", "were", "been", "did", "does",
|
|
1540
|
+
"the", "of", "to", "in", "on", "at", "for", "with", "about", "from", "into", "than", "and", "or", "since",
|
|
1541
|
+
"what", "how", "when", "why", "where", "who", "this", "that", "it", "you", "your", "we", "our",
|
|
1542
|
+
"they", "their", "his", "her", "him", "them",
|
|
1543
|
+
]);
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* The names the asker capitalised mid-sentence (`askedNames`) that no kept
|
|
1547
|
+
* card mention covers — "Han", or "Han Seo" for two in a row — with where
|
|
1548
|
+
* each sits. Not the owner's name, not a month or a weekday ("since March"
|
|
1549
|
+
* is a time), and not a word of a card's longer name ("Marguerite" when
|
|
1550
|
+
* Marguerite Solberg has a card: there IS a card). Not an acronym or a word
|
|
1551
|
+
* with a digit ("API", "Q3"): a thing's label, not a name. Nothing in a
|
|
1552
|
+
* question typed in Title Case. A possessive is dropped ("Han's" names Han).
|
|
1553
|
+
*/
|
|
1554
|
+
function uncardedNames(
|
|
1555
|
+
question: string,
|
|
1556
|
+
taken: readonly { readonly at: number; readonly end: number }[],
|
|
1557
|
+
ownerNames: ReadonlySet<string>,
|
|
1558
|
+
cardWord: (word: string) => boolean,
|
|
1559
|
+
): { name: string; at: number; end: number; slot: Slot }[] {
|
|
1560
|
+
const proper = safe(() => askedNames(question), new Set<string>());
|
|
1561
|
+
if (proper.size === 0) return [];
|
|
1562
|
+
if ([...proper].some((w) => TITLE_CASE_TELLS.has(w))) return [];
|
|
1563
|
+
const out: { name: string; at: number; end: number; slot: Slot }[] = [];
|
|
1564
|
+
let run: { at: number; end: number; parts: string[]; closed: boolean } | null = null;
|
|
1565
|
+
const flush = (): void => {
|
|
1566
|
+
const r = run as { at: number; end: number; parts: string[]; closed: boolean } | null;
|
|
1567
|
+
if (r !== null) out.push({ name: r.parts.join(" "), at: r.at, end: r.end, slot: slotAt(question, r.at) });
|
|
1568
|
+
run = null;
|
|
1569
|
+
};
|
|
1570
|
+
for (const m of question.matchAll(/[A-Za-z0-9][A-Za-z0-9'’]*/g)) {
|
|
1571
|
+
const tok = m[0];
|
|
1572
|
+
const at = m.index;
|
|
1573
|
+
const end = at + tok.length;
|
|
1574
|
+
const word = tok.replace(/['’]s?$/, "");
|
|
1575
|
+
const low = word.toLowerCase();
|
|
1576
|
+
const isName =
|
|
1577
|
+
/^[A-Z]/.test(tok) &&
|
|
1578
|
+
proper.has(tok.toLowerCase().replace(/['’]/g, "")) &&
|
|
1579
|
+
!/\d/.test(word) &&
|
|
1580
|
+
!/^[A-Z][A-Z]/.test(word) &&
|
|
1581
|
+
!CALENDAR_NAMES.has(low) &&
|
|
1582
|
+
!ownerNames.has(low) &&
|
|
1583
|
+
!taken.some((t) => at < t.end && end > t.at) &&
|
|
1584
|
+
!tokenize(word).some((w) => cardWord(w));
|
|
1585
|
+
const current = run as { at: number; end: number; parts: string[]; closed: boolean } | null;
|
|
1586
|
+
if (isName && current !== null && !current.closed && /^[ \t]+$/.test(question.slice(current.end, at))) {
|
|
1587
|
+
current.parts.push(word);
|
|
1588
|
+
current.end = end;
|
|
1589
|
+
current.closed = word !== tok;
|
|
1590
|
+
continue;
|
|
1591
|
+
}
|
|
1592
|
+
flush();
|
|
1593
|
+
if (isName) run = { at, end, parts: [word], closed: word !== tok };
|
|
1594
|
+
}
|
|
1595
|
+
flush();
|
|
1596
|
+
return out;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
/** A name with no card as a topic, as typed ("Han", not "han"): its words only. */
|
|
1600
|
+
function nameTopic(name: string): TopicWords {
|
|
1601
|
+
const typed = name.split(/\s+/).filter((w) => w.length > 0);
|
|
1602
|
+
return {
|
|
1603
|
+
words: typed.map((w) => w.toLowerCase()),
|
|
1604
|
+
names: new Map(typed.map((w) => [w.toLowerCase(), nameRegex(w, "gu")])),
|
|
1605
|
+
shown: [name],
|
|
1606
|
+
};
|
|
1404
1607
|
}
|
|
1405
1608
|
|
|
1406
1609
|
/** The place a name at `index` sits in: about, aside, or plain. */
|
|
@@ -153,7 +153,7 @@ export const SERVER_NAME = "counterparts";
|
|
|
153
153
|
* host decides whether to trust what follows. Read from a constant rather than
|
|
154
154
|
* from disk so the server opens no file to answer its first message.
|
|
155
155
|
*/
|
|
156
|
-
export const SERVER_VERSION = "0.3.
|
|
156
|
+
export const SERVER_VERSION = "0.3.14";
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
159
|
* THE ONE LINE EVERY TOOL ANSWERS WITH when the store on disk is a schema AHEAD
|
|
@@ -373,14 +373,20 @@ const REMIND_PROPERTY = {
|
|
|
373
373
|
'Optional, with eventDate: how it comes back. "plain" when you judge it genuinely matters for remembering to DO something — a real deadline, an important date — or when the person says it matters ("don\'t let me forget to pay taxes before Oct 15th!"): on the day it is said plainly, once, to them in their terminal and to you in context (a month or range: its first day and its last). Otherwise "quiet", the default: it can surface as a footnote around the date, at most twice — giving it a date is itself what makes it eligible, whatever its salience.',
|
|
374
374
|
} as const;
|
|
375
375
|
|
|
376
|
-
/**
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
376
|
+
/**
|
|
377
|
+
* The date field's own privilege — how to CALL it — kept apart from the two
|
|
378
|
+
* about what a reminder then does, so `note` can lead with it (inside the
|
|
379
|
+
* host's 2,048-character cut, `renderDescription`).
|
|
380
|
+
*/
|
|
381
|
+
const EVENT_DATE_FIELD_PRIVILEGE: Privilege = {
|
|
382
|
+
claim:
|
|
383
|
+
"`eventDate` is a FIELD, never read out of your text: it is checked by the one module that reads dates, and an unreadable one is refused by name before anything is stored.",
|
|
384
|
+
mechanizedBy:
|
|
385
|
+
"src/adapters/mcp/server.ts#readReminder -> src/core/remember/proposals.ts#intake (EVENT_DATE_UNREADABLE) -> src/core/time.ts#parseCalendarDate",
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
/** The two privileges `note` and `session_end` share about what a reminder does. */
|
|
389
|
+
const REMINDER_PRIVILEGES: readonly Privilege[] = [
|
|
384
390
|
{
|
|
385
391
|
claim:
|
|
386
392
|
'A "plain" reminder is said at most once per beat — on its day, or on the first and the last day of a month or range — and never under observer stance; a "quiet" one is only ever a cue, capped at the footnote tier and spent at most twice per window. A recurring date counts each time it comes round as its own, and each time it is said or surfaced counts once as a use of the memory; while it repeats, the nightly prune keeps it, and it comes round on its date even when it has faded.',
|
|
@@ -458,22 +464,21 @@ const NOTE: ToolSpec = {
|
|
|
458
464
|
"Do NOT call it to store a credential, key or token 'for later' — the gate redacts it and the note is refused as empty.",
|
|
459
465
|
"Do NOT use `feelingsNow` for a feeling in this moment about something new — that is `feelings` on the note that remembers it — nor to restate how an old memory felt: only when it feels DIFFERENT now.",
|
|
460
466
|
],
|
|
467
|
+
// How to call it first: a host that loads this tool up front serves only the
|
|
468
|
+
// first 2,048 characters of the description (`renderDescription`).
|
|
461
469
|
privileges: [
|
|
462
470
|
{
|
|
463
471
|
claim:
|
|
464
|
-
"
|
|
465
|
-
mechanizedBy:
|
|
472
|
+
"`updates` is a FIELD, not prose: name the id of the memory this revises and the engine resolves it, writes the resolved id, and leaves the note unlinked rather than refusing it when the address does not hold.",
|
|
473
|
+
mechanizedBy:
|
|
474
|
+
"src/core/remember/updates.ts#resolveUpdates -> src/core/mint.ts#mintProposal (UPDATES_META_KEY)",
|
|
466
475
|
},
|
|
476
|
+
EVENT_DATE_FIELD_PRIVILEGE,
|
|
467
477
|
{
|
|
468
478
|
claim:
|
|
469
479
|
"A salience you claim is a FLOOR, not a value: it can raise how strongly this is held, never lower it, and every lift is recorded.",
|
|
470
480
|
mechanizedBy: "src/core/physics/index.ts#clampSalienceAtSeam",
|
|
471
481
|
},
|
|
472
|
-
{
|
|
473
|
-
claim:
|
|
474
|
-
"Credentials are redacted before anything is stored, and a note that was nothing but a credential is refused outright.",
|
|
475
|
-
mechanizedBy: "src/core/encode/secrets.ts + src/core/encode/floor.ts#contentFloor",
|
|
476
|
-
},
|
|
477
482
|
{
|
|
478
483
|
claim:
|
|
479
484
|
"Claim nothing and this still counts as something: an unclaimed note gets an ordinary default floor, not zero. An explicit claim, however low, is kept as you wrote it.",
|
|
@@ -488,6 +493,16 @@ const NOTE: ToolSpec = {
|
|
|
488
493
|
claim: "A stub is refused: a note has to say something.",
|
|
489
494
|
mechanizedBy: "src/core/encode/floor.ts#contentFloor",
|
|
490
495
|
},
|
|
496
|
+
{
|
|
497
|
+
claim:
|
|
498
|
+
"It takes the same road as ambient memory: one write chokepoint, the full gate battery, no exceptions for being asked politely.",
|
|
499
|
+
mechanizedBy: "src/core/counterpart.ts#deposit -> bridge.batteryGate()",
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
claim:
|
|
503
|
+
"Credentials are redacted before anything is stored, and a note that was nothing but a credential is refused outright.",
|
|
504
|
+
mechanizedBy: "src/core/encode/secrets.ts + src/core/encode/floor.ts#contentFloor",
|
|
505
|
+
},
|
|
491
506
|
{
|
|
492
507
|
claim: "The same content twice is refused, not stored twice.",
|
|
493
508
|
mechanizedBy: "src/core/remember/proposals.ts#submitProposal (content-idempotency ledger)",
|
|
@@ -497,13 +512,7 @@ const NOTE: ToolSpec = {
|
|
|
497
512
|
"Your own words ride the buffer as their own span, so the end-of-session sweep does not mint them a second time.",
|
|
498
513
|
mechanizedBy: "src/core/counterpart.ts#captureJot -> SubmitContext.ownSpanHash",
|
|
499
514
|
},
|
|
500
|
-
|
|
501
|
-
claim:
|
|
502
|
-
"`updates` is a FIELD, not prose: name the id of the memory this revises and the engine resolves it, writes the resolved id, and leaves the note unlinked rather than refusing it when the address does not hold.",
|
|
503
|
-
mechanizedBy:
|
|
504
|
-
"src/core/remember/updates.ts#resolveUpdates -> src/core/mint.ts#mintProposal (UPDATES_META_KEY)",
|
|
505
|
-
},
|
|
506
|
-
...DATE_PRIVILEGES,
|
|
515
|
+
...REMINDER_PRIVILEGES,
|
|
507
516
|
WRITE_FACTS_PRIVILEGE,
|
|
508
517
|
{
|
|
509
518
|
claim: "Under observer stance nothing is written and the refusal says so.",
|
|
@@ -596,12 +605,14 @@ const RECALL: ToolSpec = {
|
|
|
596
605
|
"Do NOT pass a question and ids together, or ids you have not seen in a result: ids is the follow-up to a list, not a second way to search.",
|
|
597
606
|
"Do NOT send a question without a mode: there is no default, and the call is refused with the two modes named.",
|
|
598
607
|
],
|
|
608
|
+
// How to call it first — the three kinds of ask — inside the host's
|
|
609
|
+
// 2,048-character cut (`renderDescription`).
|
|
599
610
|
privileges: [
|
|
600
611
|
{
|
|
601
612
|
claim:
|
|
602
|
-
"A
|
|
613
|
+
"A question needs mode: \"facts\" or \"meaning\". Each is its own path, with its own ranking and its own answer, returned as labeled lines in `answer`; tuning one does not change the other.",
|
|
603
614
|
mechanizedBy:
|
|
604
|
-
"src/adapters/mcp/
|
|
615
|
+
"src/adapters/mcp/server.ts#recallTool (mode-required, mode-unknown) + src/adapters/mcp/facts.ts#factsRecall + src/adapters/mcp/meaning.ts#meaningRecall",
|
|
605
616
|
},
|
|
606
617
|
{
|
|
607
618
|
claim:
|
|
@@ -610,9 +621,14 @@ const RECALL: ToolSpec = {
|
|
|
610
621
|
},
|
|
611
622
|
{
|
|
612
623
|
claim:
|
|
613
|
-
|
|
624
|
+
`Pass ids to read those memories whole. It takes up to ${RECALL_MAX_IDS}, each resolved as an exact address with the same confidentiality boundary; a long body comes in parts, and ids past the result's room wait, named. Ids and a handle take no mode.`,
|
|
625
|
+
mechanizedBy: "src/adapters/mcp/deliberate.ts#expandIds (RECALL_MAX_IDS, expandHandle per id) + src/adapters/mcp/deliberate.ts#boundById (RECALL_BODY_CHARS parts, RECALL_ID_RESULT_CHARS)",
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
claim:
|
|
629
|
+
"A search strengthens nothing — a memory you were only shown in a list is no stronger for having been listed. OPENING one, by id or by title handle, is using it, and so is QUOTING the words a question's answer showed you in your reply: either is credited at the session boundary, once per lived day. The tool never writes a memory; what it writes is bookkeeping — which memory a title reached, which memories an answer showed this session, and one count row per call.",
|
|
614
630
|
mechanizedBy:
|
|
615
|
-
"src/adapters/mcp/
|
|
631
|
+
"src/adapters/mcp/facts.ts#factsRecall (reads only) + src/adapters/expansions.ts#recordHandleResolution -> src/adapters/lifecycle.ts#creditAtBoundary -> src/core/recall/reference.ts (expansion and quote) + src/adapters/mcp/server.ts#noteAsked -> src/core/counterpart.ts#noteAsked / creditReferences (asked records) -> src/core/recall/index.ts#resolveUse (once per lived day)",
|
|
616
632
|
},
|
|
617
633
|
{
|
|
618
634
|
claim: `Facts mode considers every memory the question's words reach, every memory linked to a person or project it names, and the ${String(FACTS_MEANING_CAP)} closest by meaning — and, for a question that is only a time, everything in that window. A memory matched more ways ranks higher; it ranks by how strongly it matched, and newer comes first only on a tie.`,
|
|
@@ -630,7 +646,7 @@ const RECALL: ToolSpec = {
|
|
|
630
646
|
},
|
|
631
647
|
{
|
|
632
648
|
claim:
|
|
633
|
-
"Each fact says who said it (\"you said\" is the owner, \"I said\" is you, or \"inferred\"), what kind of thing it is (done, planned, proposed, asked), when it happened (or \"no event date\"), when and where it was learned, and whether it is CURRENT. A field the writer did not record says so (\"speaker unknown\"). Earlier versions are folded under the current one with their dates; a corrected one
|
|
649
|
+
"Each fact says who said it (\"you said\" is the owner, \"I said\" is you, or \"inferred\"), what kind of thing it is (done, planned, proposed, asked), when it happened (or \"no event date\"), when and where it was learned, and whether it is CURRENT. A field the writer did not record says so (\"speaker unknown\"). Earlier versions are folded under the current one with their dates; a corrected one was wrong and is never a result, but is named under it as \"corrected (was wrong)\" with its id, to open by id.",
|
|
634
650
|
mechanizedBy: "src/adapters/mcp/facts.ts#factItem (occurred_on, said_by, status; versions rows + contradictions pairs) + src/adapters/mcp/deliberate.ts#provenanceParts",
|
|
635
651
|
},
|
|
636
652
|
{
|
|
@@ -649,11 +665,6 @@ const RECALL: ToolSpec = {
|
|
|
649
665
|
"An answer is bounded and never ships every body at full length: a short fact comes whole, a long one as an excerpt, and the whole answer stays under the result's room. An answer the host truncates is not a smaller answer, it is no answer.",
|
|
650
666
|
mechanizedBy: "src/adapters/mcp/facts.ts#renderFacts (RECALL_EXCERPT_CHARS, RECALL_RESULT_CHARS)",
|
|
651
667
|
},
|
|
652
|
-
{
|
|
653
|
-
claim:
|
|
654
|
-
`Pass ids to read those memories whole. It takes up to ${RECALL_MAX_IDS}, each resolved as an exact address with the same confidentiality boundary; a long body comes in parts, and ids past the result's room wait, named. Ids and a handle take no mode.`,
|
|
655
|
-
mechanizedBy: "src/adapters/mcp/deliberate.ts#expandIds (RECALL_MAX_IDS, expandHandle per id) + src/adapters/mcp/deliberate.ts#boundById (RECALL_BODY_CHARS parts, RECALL_ID_RESULT_CHARS)",
|
|
656
|
-
},
|
|
657
668
|
{
|
|
658
669
|
claim:
|
|
659
670
|
"Confidential material is returned only in the owner's own session: a direct lookup says it is withholding, a list simply does not contain it.",
|
|
@@ -765,17 +776,15 @@ const SESSION_END: ToolSpec = {
|
|
|
765
776
|
"Do NOT call it for another session's id, or for an id you guessed at: pass the id the end-of-session ask named, and nothing else. The one exception is `writeUp`, and only for the ended session a session-start write-up pointer named.",
|
|
766
777
|
"Do NOT summarize the conversation; a transcript is not a memory. Write what was LEARNED.",
|
|
767
778
|
],
|
|
779
|
+
// How to call it first, inside the host's 2,048-character cut
|
|
780
|
+
// (`renderDescription`); the salience claims stay inside it
|
|
781
|
+
// (`test/stop-ask-quiet.test.ts`).
|
|
768
782
|
privileges: [
|
|
769
783
|
{
|
|
770
784
|
claim:
|
|
771
785
|
"It is bound to ONE session for the life of this server: the one the host named at launch, or — when the host could not name one — the first session id you pass that this machine's hooks have recorded as live, in this project. A second, different id is refused.",
|
|
772
786
|
mechanizedBy: "src/adapters/mcp/server.ts#requireBoundSession",
|
|
773
787
|
},
|
|
774
|
-
{
|
|
775
|
-
claim:
|
|
776
|
-
"The id you pass is checked against host state you cannot write — the hooks' own live-session registry — and a claim that is unknown there, ended, silent too long, or running in another project is refused with which of the four it was.",
|
|
777
|
-
mechanizedBy: "src/adapters/sessions.ts#readSession + isLive + sameScope",
|
|
778
|
-
},
|
|
779
788
|
{
|
|
780
789
|
claim:
|
|
781
790
|
"`updates` is a FIELD on an entry, not prose: name the id of the memory that entry revises and the engine resolves it, writes the resolved id, and leaves the entry unlinked rather than refusing it when the address does not hold.",
|
|
@@ -783,28 +792,40 @@ const SESSION_END: ToolSpec = {
|
|
|
783
792
|
"src/core/remember/updates.ts#resolveUpdates -> src/core/mint.ts#mintProposal (UPDATES_META_KEY)",
|
|
784
793
|
},
|
|
785
794
|
{
|
|
786
|
-
claim: "
|
|
787
|
-
mechanizedBy: "src/core/
|
|
795
|
+
claim: "A salience you claim is a floor, clamped, and every lift is recorded.",
|
|
796
|
+
mechanizedBy: "src/core/physics/index.ts#clampSalienceAtSeam",
|
|
788
797
|
},
|
|
789
798
|
{
|
|
790
799
|
claim:
|
|
791
|
-
"
|
|
792
|
-
mechanizedBy: "src/core/
|
|
800
|
+
"An entry that claims no salience gets an ordinary default floor rather than zero, and each entry may score relevance, emotional and predictive itself.",
|
|
801
|
+
mechanizedBy: "src/core/mint.ts#mintProposal -> src/core/physics/index.ts#clampSalienceAtSeam",
|
|
793
802
|
},
|
|
794
803
|
{
|
|
795
|
-
claim:
|
|
796
|
-
|
|
804
|
+
claim:
|
|
805
|
+
"An EMPTY `memories` array is a real answer, not an error: nothing worth keeping here. It mints nothing, is recorded against this session as answered, and counts what this session said so far as written up, whatever happens to a `handoff` sent with it — the handoff's own outcome rides beside the answer. Only a call that leaves `memories` out and lands no handoff is refused.",
|
|
806
|
+
mechanizedBy:
|
|
807
|
+
"src/adapters/mcp/server.ts#sessionEndTool (nothing-new, handoff-only) -> src/adapters/sessions.ts#markNothingNew, src/core/coverage/index.ts#claimUnwritten",
|
|
797
808
|
},
|
|
798
809
|
{
|
|
799
810
|
claim:
|
|
800
|
-
"
|
|
801
|
-
mechanizedBy: "src/
|
|
811
|
+
"The id you pass is checked against host state you cannot write — the hooks' own live-session registry — and a claim that is unknown there, ended, silent too long, or running in another project is refused with which of the four it was.",
|
|
812
|
+
mechanizedBy: "src/adapters/sessions.ts#readSession + isLive + sameScope",
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
claim: "Each entry takes the same road as ambient memory, gate battery included.",
|
|
816
|
+
mechanizedBy: "src/core/counterpart.ts#submitSessionEnd -> bridge.batteryGate()",
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
claim:
|
|
820
|
+
"The authorship record is set by the engine: what you write is recorded as authored, and nothing a transcript sweep produces can claim to be.",
|
|
821
|
+
mechanizedBy: "src/core/counterpart.ts#deposit (channel: authored, engine-set)",
|
|
802
822
|
},
|
|
803
823
|
{
|
|
804
824
|
claim: "Credentials are redacted and empty entries are refused, per entry, without failing the batch.",
|
|
805
825
|
mechanizedBy: "src/core/encode/secrets.ts + src/adapters/mcp/server.ts#sessionEndTool (per-entry isolation)",
|
|
806
826
|
},
|
|
807
|
-
|
|
827
|
+
EVENT_DATE_FIELD_PRIVILEGE,
|
|
828
|
+
...REMINDER_PRIVILEGES,
|
|
808
829
|
WRITE_FACTS_PRIVILEGE,
|
|
809
830
|
{
|
|
810
831
|
claim: "Under observer stance nothing is written and the refusal says so.",
|
|
@@ -835,12 +856,6 @@ const SESSION_END: ToolSpec = {
|
|
|
835
856
|
"The handoff is refused past its size limit rather than cut, and passes the same gate battery, because what is cut at write time is the only copy.",
|
|
836
857
|
mechanizedBy: "src/core/handoff/index.ts#Handoffs.write (HANDOFF_MAX_BYTES, gate-refused)",
|
|
837
858
|
},
|
|
838
|
-
{
|
|
839
|
-
claim:
|
|
840
|
-
"An EMPTY `memories` array is a real answer, not an error: nothing worth keeping here. It mints nothing, is recorded against this session as answered, and counts what this session said so far as written up, whatever happens to a `handoff` sent with it — the handoff's own outcome rides beside the answer. Only a call that leaves `memories` out and lands no handoff is refused.",
|
|
841
|
-
mechanizedBy:
|
|
842
|
-
"src/adapters/mcp/server.ts#sessionEndTool (nothing-new, handoff-only) -> src/adapters/sessions.ts#markNothingNew, src/core/coverage/index.ts#claimUnwritten",
|
|
843
|
-
},
|
|
844
859
|
{
|
|
845
860
|
claim:
|
|
846
861
|
"`writeUp` writes up a session that ended here before it was written up, and ONLY the one a session-start pointer named for THIS session. With no `memories` it returns that session's next part (what was said to it, up to ~24 KB); with `memories` it answers the part you fetched — recorded as this session's, through the same road as every entry, and `[]` is a real answer (nothing worth keeping). When the last part comes back the ended session is marked written up. A live session, an unknown one, one from another project, one that owes nothing or is already written up, and one you were not pointed at are each refused by name, and nothing is written.",
|
|
@@ -1383,6 +1398,11 @@ const REFLECT: ToolSpec = {
|
|
|
1383
1398
|
"It is shown only what could surface in this session anyway (recall's gates), and it can cite, feel or mark only memories it was shown.",
|
|
1384
1399
|
mechanizedBy: "src/core/dream/reflect.ts#Reflections.showable + #Reflections.finish (shown ids)",
|
|
1385
1400
|
},
|
|
1401
|
+
{
|
|
1402
|
+
claim:
|
|
1403
|
+
"`settle` settles two memories it was shown — changed, corrected or open — only with a plain reason, and the record names the reflection; it can be undone like any settle.",
|
|
1404
|
+
mechanizedBy: "src/core/dream/reflect.ts#Reflections.settle -> src/core/contradictions.ts#settle",
|
|
1405
|
+
},
|
|
1386
1406
|
{
|
|
1387
1407
|
claim:
|
|
1388
1408
|
"A memory it cites comes back — a return that slows its fading and counts toward the core's lanes — at most once a lived day, and once a week from reflections; it promotes nothing itself.",
|
|
@@ -1408,11 +1428,6 @@ const REFLECT: ToolSpec = {
|
|
|
1408
1428
|
"Every word it writes is scanned for credentials first; its hand-back carries the mark capture refuses, so the share is told in the session's own words rather than filed from the tool's.",
|
|
1409
1429
|
mechanizedBy: "src/core/dream/reflect.ts#Reflections.words + src/core/dream/mark.ts#DREAM_MARK -> src/core/remember/spans.ts#enters",
|
|
1410
1430
|
},
|
|
1411
|
-
{
|
|
1412
|
-
claim:
|
|
1413
|
-
"`settle` settles two memories it was shown — changed, corrected or open — only with a plain reason, and the record names the reflection; it can be undone like any settle.",
|
|
1414
|
-
mechanizedBy: "src/core/dream/reflect.ts#Reflections.settle -> src/core/contradictions.ts#settle",
|
|
1415
|
-
},
|
|
1416
1431
|
],
|
|
1417
1432
|
inputSchema: {
|
|
1418
1433
|
type: "object",
|
|
@@ -1597,6 +1612,15 @@ export function toolSpec(name: string, desktop = false): ToolSpec | undefined {
|
|
|
1597
1612
|
* examples, then the privileges — each one a claim that has a `mechanizedBy`
|
|
1598
1613
|
* row behind it. Nothing here is free-form: adding a sentence means adding a
|
|
1599
1614
|
* registry entry, which means naming the code that enforces it.
|
|
1615
|
+
*
|
|
1616
|
+
* The order is what a model reads when a host serves only the start (2026-10-09).
|
|
1617
|
+
* Claude Code keeps the first 2,048 characters of a tool description when the
|
|
1618
|
+
* tool is loaded up front — tool search off, a custom base URL or proxy, a model
|
|
1619
|
+
* without tool search — and the whole of it (to 16,384) only through tool
|
|
1620
|
+
* search; the field descriptions in the schema are served whole either way. So
|
|
1621
|
+
* the summary, the admission test and every negative example come before the
|
|
1622
|
+
* list, and each list leads with the claims that say how to call the tool
|
|
1623
|
+
* (`test/description-cut.test.ts` holds both).
|
|
1600
1624
|
*/
|
|
1601
1625
|
export function renderDescription(spec: ToolSpec): string {
|
|
1602
1626
|
const lines: string[] = [spec.summary, "", `When: ${spec.admission}`];
|