counterparts 0.3.25 → 0.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/package.json +1 -1
- package/src/adapters/fired.ts +7 -0
- package/src/adapters/mcp/facts.ts +26 -3
- package/src/adapters/mcp/server-session-end.ts +1 -1
- package/src/adapters/mcp/server-words.ts +1 -1
- package/src/core/counterpart-types.ts +2 -2
- package/src/core/counterpart.ts +40 -40
- package/src/core/handoff/CONTRACT.md +17 -12
- package/src/core/handoff/NOTES.md +30 -0
- package/src/core/handoff/index.ts +75 -81
- package/src/core/handoff/last-here.ts +54 -15
- package/src/core/recall/standing.ts +26 -1
- package/src/core/self/NOTES.md +21 -0
- package/src/core/self/briefing-room.ts +2 -2
- package/src/core/self/briefing.ts +25 -5
- package/src/core/self/identity.ts +93 -15
- package/src/core/self/index.ts +8 -1
- package/src/core/self/tunables.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.26 — 2026-10-18
|
|
4
|
+
|
|
5
|
+
The wake leads with what is live. "Still open" puts the questions touched in the last two weeks first and counts how many of the rest have gone untouched; a stale handoff says how stale it is in one sentence, and when every handoff listed is stale only the newest shows whole; the Yesterday line names the other folders worked in instead of counting them; and a session still open from an earlier day says its start with the date. Doctor reads mood matching, switched off since 10-10, as disabled rather than amber. No store-format change (store v13, cache v6) and no wiring change: nothing to run after upgrading from 0.3.25, and `counterparts connect` is not needed.
|
|
6
|
+
|
|
7
|
+
- **"Still open" shows what is live first.** Open questions touched in the last two weeks come
|
|
8
|
+
before the ones nobody has touched since, a plain one before one that may be out of date,
|
|
9
|
+
and the count says how many of the rest are weeks old.
|
|
10
|
+
- **A handoff says how stale it is in one sentence.** "2 days old; since then: a newer
|
|
11
|
+
chapter here; written on 0.3.24, 0.3.25 now". When every handoff in a folder is stale, the
|
|
12
|
+
wake shows the newest and lists the others by id.
|
|
13
|
+
- **The Yesterday line names the other folders worked in**, rather than counting "sessions in
|
|
14
|
+
other projects", and only the folders the "Today, elsewhere" line may name.
|
|
15
|
+
- **"Today, elsewhere" dates a session that started on an earlier day.** A session opened
|
|
16
|
+
the day before and still live read `open since 09:08 (live)`, a clock that looked like a
|
|
17
|
+
time later today; it now reads `open since 10-16 09:08 (live)`.
|
|
18
|
+
- **Doctor's Fired line reads mood matching as `disabled`** while both mood weights are 0
|
|
19
|
+
(stood down by decision since 10-10), instead of amber "gone quiet". Turning the weights
|
|
20
|
+
back up restores the ordinary grading.
|
|
21
|
+
- **Facts: a coarse event date only partly inside the time asked says so.** A month, year
|
|
22
|
+
or range that straddles the window reads `happened 2023-04 · may be inside the time
|
|
23
|
+
asked`, where a bare month beside a day window read as outside it. Held lightly.
|
|
24
|
+
|
|
3
25
|
## 0.3.25 — 2026-10-16
|
|
4
26
|
|
|
5
27
|
A chapter of the journal is now stood for by one short summary memory instead of a full copy: the `chapter` tool takes a `summary`, the engine writes a short one from the chapter's opening lines when the session gives none, and summaries fade like any other memory while the chapter itself keeps every word. The nightly reflection can propose closing items that have sat in "Still open" for days, and nothing closes until you say yes. The wake is shorter and lists more: long items as one line each, the tags on one line, today's date said once, "Coming up" only what is due today, and the self page written to about 4,600 bytes. Recall reads "in the last month" and "the past 3 months" as rolling windows, and facts' event dates carry their weekday. The plugin's sidebar says where you left off, can be clicked again in a few small ways, and the build from Anthropic's directory stands down beside the npm install. No store-format change (store v13, cache v6) and no wiring change: nothing to run after upgrading from 0.3.24, and `counterparts connect` is not needed.
|
package/package.json
CHANGED
package/src/adapters/fired.ts
CHANGED
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
* came and went unanswered is the finding, and stays one.
|
|
62
62
|
*/
|
|
63
63
|
import { TUNABLES as ENCODE } from "../core/encode/tunables.js";
|
|
64
|
+
import { TUNABLES as RECALL } from "../core/recall/tunables.js";
|
|
64
65
|
import {
|
|
65
66
|
DATE_FROM_META,
|
|
66
67
|
DATE_LINEAGE_MAX,
|
|
@@ -469,6 +470,12 @@ export const MECHANISMS: readonly Mechanism[] = [
|
|
|
469
470
|
module: "recall/mood.ts",
|
|
470
471
|
evidence: { kind: "event", names: ["recall.decision"], positive: "moodMatched" },
|
|
471
472
|
since: "2026-09-26",
|
|
473
|
+
// Off since 2026-10-10 (review 02 C3: both weights 0, code kept). Read,
|
|
474
|
+
// not retyped, as the classifier's row above: doctor read its silence as
|
|
475
|
+
// "gone quiet" on the owner's store, 2026-10-18.
|
|
476
|
+
...(RECALL.MOOD_SAME_WEIGHT > 0 || RECALL.MOOD_CROSS_WEIGHT > 0
|
|
477
|
+
? {}
|
|
478
|
+
: { disabled: "mood matching is off (both mood weights 0 in recall/tunables.ts, since 2026-10-10) — a named decision, not a fault" }),
|
|
472
479
|
},
|
|
473
480
|
{
|
|
474
481
|
id: "salience",
|
|
@@ -1105,7 +1105,30 @@ function channelWords(semantic: SemanticSource): string | null {
|
|
|
1105
1105
|
}
|
|
1106
1106
|
|
|
1107
1107
|
/** The labeled lines of one result. */
|
|
1108
|
-
|
|
1108
|
+
/**
|
|
1109
|
+
* " · may be inside the time asked" for an event date coarser than the window
|
|
1110
|
+
* (a month, a year, a range) that only partly overlaps it. Checked against the
|
|
1111
|
+
* window as asked (`said`), not the stretched one the filter uses: a
|
|
1112
|
+
* neighbouring month touches "last month" only through the stretch, and is
|
|
1113
|
+
* not inside it. Such a fact is
|
|
1114
|
+
* kept by the window, but read beside a day window ("04-30..05-30") a bare
|
|
1115
|
+
* "2023-04" looked outside it, and the reader left the snake plant out of
|
|
1116
|
+
* "plants I got in the last month" (bench 3a704032, 2026-10-18).
|
|
1117
|
+
*
|
|
1118
|
+
* Benchmark-motivated and held lightly (Mike, 2026-10-18): kept because the
|
|
1119
|
+
* label is true for a real user too. Revisit around 2026-10-25: drop it if
|
|
1120
|
+
* live use shows it as noise.
|
|
1121
|
+
*/
|
|
1122
|
+
function partlyInWindow(occurredOn: string | null, window: DayWindow | null): string {
|
|
1123
|
+
if (occurredOn === null || window === null) return "";
|
|
1124
|
+
const c = parseCalendarDate(occurredOn);
|
|
1125
|
+
if (c === null || c.precision === "day") return "";
|
|
1126
|
+
const overlaps = c.first <= window.to && c.last >= window.from;
|
|
1127
|
+
const contained = c.first >= window.from && c.last <= window.to;
|
|
1128
|
+
return overlaps && !contained ? " · may be inside the time asked" : "";
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
function itemLines(m: FactItem, i: number, today: string, excerptChars: number, time: string | undefined, window: DayWindow | null): string[] {
|
|
1109
1132
|
const out: string[] = [];
|
|
1110
1133
|
const mark = m.journal ? "[journal] " : "";
|
|
1111
1134
|
const ch = m.chapter === undefined ? "" : ` (chapter ${String(m.chapter.n)} of ${String(m.chapter.of)})`;
|
|
@@ -1118,7 +1141,7 @@ function itemLines(m: FactItem, i: number, today: string, excerptChars: number,
|
|
|
1118
1141
|
const occurred =
|
|
1119
1142
|
m.occurredOn === null
|
|
1120
1143
|
? "no event date"
|
|
1121
|
-
: `${m.status === "planned" || m.status === "proposed" || m.status === "asked" ? "for" : "happened"} ${shortDateWithWeekday(m.occurredOn, today)}`;
|
|
1144
|
+
: `${m.status === "planned" || m.status === "proposed" || m.status === "asked" ? "for" : "happened"} ${shortDateWithWeekday(m.occurredOn, today)}${partlyInWindow(m.occurredOn, window)}`;
|
|
1122
1145
|
out.push(` ${said} · ${status} · ${occurred}`);
|
|
1123
1146
|
const where = m.where === null ? "" : ` in ${m.where}`;
|
|
1124
1147
|
const who = m.who === null ? "" : ` · ${m.who}`;
|
|
@@ -1289,7 +1312,7 @@ function renderAt(r: FactsResult, today: string, excerpt: number): string {
|
|
|
1289
1312
|
const times = sameDayTimes(r.memories);
|
|
1290
1313
|
r.memories.forEach((m, i) => {
|
|
1291
1314
|
lines.push("");
|
|
1292
|
-
lines.push(...itemLines(m, first + i + 1, today, excerpt, times.get(m.id)));
|
|
1315
|
+
lines.push(...itemLines(m, first + i + 1, today, excerpt, times.get(m.id), r.time?.said ?? r.time?.window ?? null));
|
|
1293
1316
|
});
|
|
1294
1317
|
lines.push("");
|
|
1295
1318
|
const foot: string[] = [];
|
|
@@ -569,7 +569,7 @@ export function writeHandoffField(server: McpServer, raw: unknown): Record<strin
|
|
|
569
569
|
session: server.session,
|
|
570
570
|
model: server["sessionModel"]() ?? null,
|
|
571
571
|
// The release this server is running (2026-10-01): the wake says
|
|
572
|
-
// "written
|
|
572
|
+
// "written on 0.3.9, 0.3.10 now" once a newer one is (`staleWords`).
|
|
573
573
|
build: server["identity"]?.build.version ?? installedVersion(),
|
|
574
574
|
});
|
|
575
575
|
}
|
|
@@ -19,7 +19,7 @@ export const SERVER_NAME = "counterparts";
|
|
|
19
19
|
* host decides whether to trust what follows. Read from a constant rather than
|
|
20
20
|
* from disk so the server opens no file to answer its first message.
|
|
21
21
|
*/
|
|
22
|
-
export const SERVER_VERSION = "0.3.
|
|
22
|
+
export const SERVER_VERSION = "0.3.26";
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* THE ONE LINE EVERY TOOL ANSWERS WITH when the store on disk is a schema AHEAD
|
|
@@ -382,8 +382,8 @@ export interface WakeHere {
|
|
|
382
382
|
readonly session?: string | null;
|
|
383
383
|
/**
|
|
384
384
|
* The Counterparts version installed now, as the host adapter reads it
|
|
385
|
-
* (2026-10-01): a handoff written by an older one says "written
|
|
386
|
-
* 0.3.10
|
|
385
|
+
* (2026-10-01): a handoff written by an older one says "written on 0.3.9,
|
|
386
|
+
* 0.3.10 now" (the words since 2026-10-18). Absent: no such words.
|
|
387
387
|
*/
|
|
388
388
|
readonly installed?: string | null;
|
|
389
389
|
/**
|
package/src/core/counterpart.ts
CHANGED
|
@@ -121,12 +121,12 @@ import {
|
|
|
121
121
|
staleWords,
|
|
122
122
|
} from "./handoff/index.js";
|
|
123
123
|
import type { Handoff, HandoffRefusal, HandoffWrite, PointerSince } from "./handoff/index.js";
|
|
124
|
-
import { CLAIM_CHAPTER, askFromStretch, chapterClaims, claimUnwritten, sessionStretch, sessionsHere
|
|
124
|
+
import { CLAIM_CHAPTER, askFromStretch, chapterClaims, claimUnwritten, sessionStretch, sessionsHere } from "./coverage/index.js";
|
|
125
125
|
import { LAST_HERE_LIFE_DAYS, LAST_HERE_NOROOM_EVENT, chaptersBySession, chaptersHere, chaptersOn, elsewhereLine, lastHereLadder, sinceElsewhereLines, stampWords, todayElsewhereLines, YESTERDAY_UNDATED_AT_START, yesterdayLine, yesterdayShorter } from "./handoff/last-here.js";
|
|
126
126
|
import type { ChapterHere, LastHere, SinceElsewhere, TodayElsewhere } from "./handoff/last-here.js";
|
|
127
127
|
import { LAST_EXCHANGE_LINE_MAX_BYTES, exchangeLikely, lastExchange, lastExchangeLine, withExchange } from "./handoff/last-exchange.js";
|
|
128
128
|
import type { LastExchange } from "./handoff/last-exchange.js";
|
|
129
|
-
import { addDays, isDay, localStamp, localStampAfter, startOfLocalDay, yearOf } from "./time.js";
|
|
129
|
+
import { addDays, daysBetween, isDay, localDate, localStamp, localStampAfter, startOfLocalDay, yearOf } from "./time.js";
|
|
130
130
|
import type { Recurrence } from "./time.js";
|
|
131
131
|
import { EPISODE_REGROWN_REASON, leftAs } from "./leaving.js";
|
|
132
132
|
import type { LeftAs } from "./leaving.js";
|
|
@@ -1033,7 +1033,7 @@ export class Counterpart {
|
|
|
1033
1033
|
const scope = here?.scope?.trim() ?? "";
|
|
1034
1034
|
if (scope.length === 0 || !result.ok) return result;
|
|
1035
1035
|
// ONE chapter walk for the whole delivery (the line, its no-room row, and
|
|
1036
|
-
// each handoff's "a newer chapter here
|
|
1036
|
+
// each handoff's "since then: a newer chapter here"): a session start waits on it.
|
|
1037
1037
|
let chapters: Map<string, ChapterHere> = new Map();
|
|
1038
1038
|
let allHere: ReturnType<Counterpart["chaptersHereFor"]> = [];
|
|
1039
1039
|
try {
|
|
@@ -1048,7 +1048,7 @@ export class Counterpart {
|
|
|
1048
1048
|
ladder = this.handoffs.pointerChoices(
|
|
1049
1049
|
scope,
|
|
1050
1050
|
undefined,
|
|
1051
|
-
(h
|
|
1051
|
+
(h) => this.handoffSince(h, scope, here, allHere),
|
|
1052
1052
|
here?.session ?? null,
|
|
1053
1053
|
);
|
|
1054
1054
|
} catch {
|
|
@@ -1412,7 +1412,9 @@ export class Counterpart {
|
|
|
1412
1412
|
* line's gate — a copy marked about me, us or the owner, and that
|
|
1413
1413
|
* directory's scope setting on (`WakeHere.exportsFrom`; no way to ask, or a
|
|
1414
1414
|
* chapter whose row recorded no directory, and it is not named). One this
|
|
1415
|
-
* session's own directory wrote is named as before. The rest are
|
|
1415
|
+
* session's own directory wrote is named as before. The rest are said by
|
|
1416
|
+
* folder, where "Today, elsewhere" may name it, and otherwise not at all
|
|
1417
|
+
* (2026-10-18; a bare count from 2026-10-11).
|
|
1416
1418
|
* Without `reader` — the turn-end's and `rebrief`'s published render, which
|
|
1417
1419
|
* no one session reads — the line is store-wide, as it was.
|
|
1418
1420
|
*/
|
|
@@ -1423,12 +1425,26 @@ export class Counterpart {
|
|
|
1423
1425
|
const fromDay = Math.max(0, this.store.livedDay() - LAST_HERE_LIFE_DAYS + 1);
|
|
1424
1426
|
const all = chaptersOn(this.store, date, { fromDay });
|
|
1425
1427
|
const day = reader === undefined ? all : all.filter((c) => this.nameableHere(c.scope ?? null, c.aboutMe === true, reader.here));
|
|
1426
|
-
|
|
1428
|
+
// The ones left out, BY FOLDER (2026-10-18, the wake-polish builder):
|
|
1429
|
+
// only a folder the "Today, elsewhere" line may name (`elsewhereGate`)
|
|
1430
|
+
// — the rest are not said, as that line does not say them.
|
|
1431
|
+
const places = new Map<string, number>();
|
|
1432
|
+
if (reader !== undefined && day.length < all.length) {
|
|
1433
|
+
const gate = this.elsewhereGate(reader.here);
|
|
1434
|
+
const kept = new Set(day.map((c) => c.id));
|
|
1435
|
+
for (const c of all) {
|
|
1436
|
+
const scope = c.scope ?? null;
|
|
1437
|
+
if (kept.has(c.id) || scope === null || gate === null || !gate.named(scope)) continue;
|
|
1438
|
+
const key = gate.norm(scope);
|
|
1439
|
+
places.set(key, (places.get(key) ?? 0) + 1);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
const elsewhere = [...places].map(([scope, sessions]) => ({ scope, sessions }));
|
|
1427
1443
|
// Undated at a session start, read under its `Now:` line (2026-10-16).
|
|
1428
1444
|
const dated = reader === undefined || !YESTERDAY_UNDATED_AT_START;
|
|
1429
|
-
const line = yesterdayLine(day, date, undefined,
|
|
1445
|
+
const line = yesterdayLine(day, date, undefined, elsewhere, dated);
|
|
1430
1446
|
if (line === null) return {};
|
|
1431
|
-
const shorter = yesterdayShorter(day, date,
|
|
1447
|
+
const shorter = yesterdayShorter(day, date, elsewhere, dated);
|
|
1432
1448
|
return shorter.length === 0 ? { yesterday: line } : { yesterday: line, yesterdayShorter: shorter };
|
|
1433
1449
|
} catch {
|
|
1434
1450
|
return {};
|
|
@@ -1472,47 +1488,22 @@ export class Counterpart {
|
|
|
1472
1488
|
|
|
1473
1489
|
/**
|
|
1474
1490
|
* HOW CURRENT THIS DIRECTORY'S POINTER IS, at delivery (2026-09-30): when
|
|
1475
|
-
* it was written, in the store's zone, and
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1478
|
-
*
|
|
1479
|
-
* says the date alone, as it always did.
|
|
1480
|
-
* that holds several (`newest` false) is asked only when it was written: it
|
|
1481
|
-
* never prints the rest, so the span read is skipped.
|
|
1491
|
+
* it was written, in the store's zone, and why it may be out of date
|
|
1492
|
+
* (`handoffStale`) — one sentence, for each handoff shown (2026-10-18; the
|
|
1493
|
+
* work since and how much of it was written up left the wake line that day,
|
|
1494
|
+
* for doctor and `counterparts coverage` to say). Null when the write time
|
|
1495
|
+
* is unknown: the line then says the date alone, as it always did.
|
|
1482
1496
|
*/
|
|
1483
1497
|
private handoffSince(
|
|
1484
1498
|
h: Handoff,
|
|
1485
1499
|
scope: string,
|
|
1486
|
-
newest = true,
|
|
1487
1500
|
here?: WakeHere,
|
|
1488
1501
|
allHere?: ReturnType<Counterpart["chaptersHereFor"]>,
|
|
1489
1502
|
): PointerSince | null {
|
|
1490
1503
|
const writtenAt = this.handoffs.writtenAt(h);
|
|
1491
1504
|
if (writtenAt === null) return null;
|
|
1492
1505
|
const zone = this.store.zone();
|
|
1493
|
-
|
|
1494
|
-
if (!newest) return { written: localStamp(writtenAt, zone), after: null, stale };
|
|
1495
|
-
const work = workSince(this.spans, scope, writtenAt, { writer: h.session });
|
|
1496
|
-
if (!work.overFloor || work.firstAt === null || work.lastAt === null) {
|
|
1497
|
-
return { written: localStamp(writtenAt, zone), after: null, stale };
|
|
1498
|
-
}
|
|
1499
|
-
// A clock time alone while the day is the one before it; the day as well
|
|
1500
|
-
// when it is not.
|
|
1501
|
-
return {
|
|
1502
|
-
written: localStamp(writtenAt, zone),
|
|
1503
|
-
stale,
|
|
1504
|
-
after: {
|
|
1505
|
-
from: localStampAfter(work.firstAt, writtenAt, zone),
|
|
1506
|
-
to: localStampAfter(work.lastAt, work.firstAt, zone),
|
|
1507
|
-
writtenUp: work.unwritten === 0,
|
|
1508
|
-
// How far, when not wholly (2026-09-30): the latest claim's time,
|
|
1509
|
-
// spelled as `to` is, and what made it.
|
|
1510
|
-
upTo: work.writtenUpTo === null ? null : localStampAfter(work.writtenUpTo, work.firstAt, zone),
|
|
1511
|
-
by: work.writtenUpBy,
|
|
1512
|
-
unwritten: work.unwritten,
|
|
1513
|
-
unwrittenAfter: work.unwrittenAfter,
|
|
1514
|
-
},
|
|
1515
|
-
};
|
|
1506
|
+
return { written: localStamp(writtenAt, zone), stale: this.handoffStale(h, scope, writtenAt, here, allHere) };
|
|
1516
1507
|
}
|
|
1517
1508
|
|
|
1518
1509
|
/**
|
|
@@ -1548,7 +1539,16 @@ export class Counterpart {
|
|
|
1548
1539
|
} catch {
|
|
1549
1540
|
newerChapter = false;
|
|
1550
1541
|
}
|
|
1551
|
-
|
|
1542
|
+
// How old, in calendar days of the store's zone (2026-10-18): what a
|
|
1543
|
+
// person means by "two days old", which lived days are not.
|
|
1544
|
+
let age: number | null = null;
|
|
1545
|
+
try {
|
|
1546
|
+
const zone = this.store.zone();
|
|
1547
|
+
age = daysBetween(localDate(writtenAt, zone), localDate(this.store.now(), zone));
|
|
1548
|
+
} catch {
|
|
1549
|
+
age = null;
|
|
1550
|
+
}
|
|
1551
|
+
return staleWords({ writtenWith, installed: here?.installed ?? null, newerChapter, age });
|
|
1552
1552
|
} catch {
|
|
1553
1553
|
return null;
|
|
1554
1554
|
}
|
|
@@ -152,12 +152,11 @@ the fortnight: one to three lines, no row and no durable event (§5 G11).
|
|
|
152
152
|
session" for the reader's own, and the model when the host recorded one), that
|
|
153
153
|
several live handoffs are shown newest first with at most `HANDOFF_WAKE_SHOWN` in full
|
|
154
154
|
and the rest named by id, that a
|
|
155
|
-
pointer states when it was written (since 2026-09-30 to the minute
|
|
156
|
-
the
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
up as of 16:20", or "not yet written up" only when no claim stands on any of it), the
|
|
155
|
+
pointer states when it was written (since 2026-09-30 to the minute; from 2026-09-30 to
|
|
156
|
+
2026-10-18 the newest also said when work here ran after it and how far that was written
|
|
157
|
+
up — "work here 16:01–17:53 since, written up to 17:48 (chapter), 3 pieces after" — which
|
|
158
|
+
the wake-polish builder took off the line on 2026-10-18 as unparseable; doctor and
|
|
159
|
+
`counterparts coverage` say it, from `coverage/#workSince`), the
|
|
161
160
|
first sentence of at least
|
|
162
161
|
`EXCERPT_MIN_SENTENCE` characters of its first line of SUBSTANCE (headings and a leading
|
|
163
162
|
list marker are skipped) and its id,
|
|
@@ -192,13 +191,19 @@ the fortnight: one to three lines, no row and no durable event (§5 G11).
|
|
|
192
191
|
and NEVER a confidential one (the episode or any copy). A confidential chapter is
|
|
193
192
|
"last here" to the owner only (review of #311).
|
|
194
193
|
|
|
195
|
-
12. **[M] A handoff says when it may be out of date** (2026-10-01
|
|
196
|
-
|
|
194
|
+
12. **[M] A handoff says when it may be out of date** (2026-10-01; one sentence since
|
|
195
|
+
2026-10-18, `staleWords`). Beside who and when, at delivery, each handoff shown: how old
|
|
196
|
+
it is in calendar days of the store's zone (from one day on), "since then: a newer
|
|
197
|
+
chapter here" when a session other than its writer wrote a chapter in this directory
|
|
198
|
+
after it, and "written on 0.3.9, 0.3.10 now" when the release that wrote it — stamped on
|
|
197
199
|
the row (`build`) since 2026-10-01, else the release its session opened with, from the
|
|
198
|
-
host's registry — is older than the one installed now
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
host's registry — is older than the one installed now. Neither, and nothing is said (an
|
|
201
|
+
old handoff that is not stale says its date). Both from records that exist; nothing
|
|
202
|
+
judges whether what it waited on happened. **When every handoff the block would list in
|
|
203
|
+
full is stale** (2026-10-18, lightly held), the block lists the newest in full and the
|
|
204
|
+
rest by id ("+3 older here: …"); the boundary's reserve is still sized to the whole
|
|
205
|
+
ladder (`pointerLadder`'s `collapseStale: false`). The Stop ask names `retireHandoff`
|
|
206
|
+
for any handoff here whose work is done, whoever left it.
|
|
202
207
|
|
|
203
208
|
12. **[A] The "Yesterday" line is composed here, carried by the wake** (2026-10-01, wake
|
|
204
209
|
build 3). `last-here.ts#chaptersOn` reads, per episode, the chapters WRITTEN on a date
|
|
@@ -527,3 +527,33 @@ real Stop hook on a written transcript:
|
|
|
527
527
|
only ever read from a turn-end that held a conversation span.
|
|
528
528
|
- An exact repeat of earlier words is not captured twice (layer-2 dedup), so the "last"
|
|
529
529
|
message can be the earlier copy.
|
|
530
|
+
|
|
531
|
+
## 14. The wake polish: one staleness sentence, one handoff when all are stale, Yesterday by folder (2026-10-18)
|
|
532
|
+
|
|
533
|
+
From random-6c's 10-17 wake (`~/counterparts-notes/2026-10-17-wake-feedback.md`, items 3
|
|
534
|
+
and 4); the wake-polish builder, lightly held.
|
|
535
|
+
|
|
536
|
+
- **Staleness as one sentence** (`staleWords`): `2 days old; since then: a newer chapter
|
|
537
|
+
here; written on 0.3.24, 0.3.25 now`. The release is said as what it was and what it is,
|
|
538
|
+
not "installed since": a session that installs a release and writes its handoff before
|
|
539
|
+
restarting is still running the old one (it happened on 10-16), so "before 0.3.25 was
|
|
540
|
+
installed" was not true of its handoff.
|
|
541
|
+
Age is calendar days in the store's zone (`daysBetween` of the two local dates), what a
|
|
542
|
+
person means by "two days old"; lived days would undercount a week away.
|
|
543
|
+
- **The work-since accounting left the line.** `handoffSince` no longer calls `workSince`;
|
|
544
|
+
`PointerSince.after` and `writtenUpWords` are gone. The reserve shrank with it: the widest
|
|
545
|
+
single block 503 → 428 bytes, `HANDOFF_RESERVE_MAX_BYTES` 1,963 → 1,946 (the older entries'
|
|
546
|
+
sentence is longer than their old words, the newest's shorter).
|
|
547
|
+
- **All stale, one shown.** `pointerLadder` starts at one shown when every one it would list
|
|
548
|
+
in full carries a staleness sentence. The reserve sizing passes `collapseStale: false`:
|
|
549
|
+
`WIDEST_POINTER_SINCE` is always stale, and a reserve sized to the collapsed block would
|
|
550
|
+
leave a fresh morning's three without room.
|
|
551
|
+
- **Yesterday by folder** (`last-here.ts#yesterdayLine`'s `places`): the chapters a session
|
|
552
|
+
start may not name by title are said as `and 2 sessions in ~/random` — only for a folder
|
|
553
|
+
`elsewhereGate.named` lets the "Today, elsewhere" line name (scope `on`, not this one, not
|
|
554
|
+
the store's own), and not at all otherwise, as that line does not say them. A chapter
|
|
555
|
+
whose row recorded no directory is not said either. Three room tests' fixtures had relied
|
|
556
|
+
on the old bare count to fill the line; they now write their chapters in the session's
|
|
557
|
+
own directory, so the line has the titles their names promised.
|
|
558
|
+
|
|
559
|
+
Undo: `git revert` of the PR; nothing is stored differently.
|
|
@@ -115,12 +115,14 @@ export const HANDOFF_EXCERPT_BYTES = 160;
|
|
|
115
115
|
* (2026-09-30), and 1,646 since each says why it may be out of date — an
|
|
116
116
|
* older release wrote it, or a newer chapter was written here (2026-10-01).
|
|
117
117
|
* 1,963 since a "since" line can follow it (2026-10-09): three plans at the
|
|
118
|
-
* title cap and a count, 317 bytes on the widest block (1,646).
|
|
118
|
+
* title cap and a count, 317 bytes on the widest block (1,646). 1,946 since
|
|
119
|
+
* each says its staleness as one sentence and the newest no longer counts the
|
|
120
|
+
* work since it (2026-10-18, the wake-polish builder).
|
|
119
121
|
* In practice the share rule binds first: at the 9,000 bytes the owner's hosts
|
|
120
122
|
* report, no reserve can pass 1,125, so a block that wide is carried with two
|
|
121
123
|
* shown rather than three.
|
|
122
124
|
*/
|
|
123
|
-
export const HANDOFF_RESERVE_MAX_BYTES =
|
|
125
|
+
export const HANDOFF_RESERVE_MAX_BYTES = 1946;
|
|
124
126
|
|
|
125
127
|
/**
|
|
126
128
|
* Slack on top of the block that actually exists, so a reserve taken at one
|
|
@@ -220,7 +222,7 @@ export const HANDOFF_META_MODEL = "model";
|
|
|
220
222
|
export const HANDOFF_META_WRITTEN_AT = "writtenAt";
|
|
221
223
|
/**
|
|
222
224
|
* The Counterparts version the writing process was running (2026-10-01), so
|
|
223
|
-
* the wake can say a handoff was "written
|
|
225
|
+
* the wake can say a handoff was "written on 0.3.9, 0.3.10 now" (`staleWords`).
|
|
224
226
|
* Absent on a row written before then, which falls back to the version the
|
|
225
227
|
* writing session OPENED with, from the host's registry (`WakeHere`).
|
|
226
228
|
*/
|
|
@@ -648,22 +650,39 @@ export function versionOlder(a: string | null | undefined, b: string | null | un
|
|
|
648
650
|
}
|
|
649
651
|
|
|
650
652
|
/**
|
|
651
|
-
* WHY A HANDOFF MAY BE OUT OF DATE,
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
*
|
|
653
|
+
* WHY A HANDOFF MAY BE OUT OF DATE, as ONE PLAIN SENTENCE (2026-10-18, the
|
|
654
|
+
* wake-polish builder, lightly held; first built 2026-10-01 for random-f2's
|
|
655
|
+
* item 1): how old it is, and what has happened since —
|
|
656
|
+
*
|
|
657
|
+
* `2 days old; since then: a newer chapter here; written on 0.3.24, 0.3.25 now`
|
|
658
|
+
*
|
|
659
|
+
* "A newer chapter here" when a session other than its writer wrote a chapter
|
|
660
|
+
* in this directory after it; the release when the process that wrote it ran
|
|
661
|
+
* an older one than is installed now. The release is said as what it was and
|
|
662
|
+
* what it is, not as "installed since": a session that installed the new
|
|
663
|
+
* release and wrote its handoff before restarting was still on the old one.
|
|
664
|
+
* `age` is calendar days, in the store's zone, from the day it was written to
|
|
665
|
+
* the day it is read; said from one day on. Computed at delivery from records
|
|
666
|
+
* that already exist; nothing judges whether what it waited on happened. Null
|
|
667
|
+
* when neither holds — a handoff that is only old says its date, as before.
|
|
668
|
+
* (Before 2026-10-18 the words were "before 0.3.10 was installed, and a newer
|
|
669
|
+
* chapter here since", and the newest added the work since it with how much
|
|
670
|
+
* of that was written up; random-6c's 10-17 wake found the line unparseable.)
|
|
657
671
|
*/
|
|
658
672
|
export function staleWords(opts: {
|
|
659
673
|
readonly writtenWith?: string | null;
|
|
660
674
|
readonly installed?: string | null;
|
|
661
675
|
readonly newerChapter?: boolean;
|
|
676
|
+
readonly age?: number | null;
|
|
662
677
|
}): string | null {
|
|
678
|
+
const release = versionOlder(opts.writtenWith, opts.installed);
|
|
679
|
+
if (!release && opts.newerChapter !== true) return null;
|
|
663
680
|
const parts: string[] = [];
|
|
664
|
-
|
|
665
|
-
if (
|
|
666
|
-
|
|
681
|
+
const age = opts.age ?? null;
|
|
682
|
+
if (age !== null && Number.isFinite(age) && age >= 1) parts.push(`${String(Math.floor(age))} ${age < 2 ? "day" : "days"} old`);
|
|
683
|
+
if (opts.newerChapter === true) parts.push("since then: a newer chapter here");
|
|
684
|
+
if (release) parts.push(`written on ${opts.writtenWith as string}, ${opts.installed as string} now`);
|
|
685
|
+
return parts.join("; ");
|
|
667
686
|
}
|
|
668
687
|
|
|
669
688
|
/**
|
|
@@ -752,30 +771,13 @@ export function excerpt(body: string, capBytes = HANDOFF_EXCERPT_BYTES): string
|
|
|
752
771
|
/**
|
|
753
772
|
* HOW CURRENT THE POINTER IS (2026-09-30), computed at delivery by whoever
|
|
754
773
|
* splices it: when it was written, as a person reads it in the store's zone,
|
|
755
|
-
* and
|
|
756
|
-
*
|
|
757
|
-
*
|
|
774
|
+
* and why it may be out of date (`staleWords`). Since 2026-10-18 it no longer
|
|
775
|
+
* carries the work done here after it and how much of that is written up:
|
|
776
|
+
* doctor and `counterparts coverage` say that, and the wake line could not.
|
|
758
777
|
*/
|
|
759
778
|
export interface PointerSince {
|
|
760
779
|
/** `09-29 12:47`. */
|
|
761
780
|
readonly written: string;
|
|
762
|
-
/** `from` and `to` as the caller spells them: `13:02`, or `09-30 13:02`
|
|
763
|
-
* when the day is not the one before it. */
|
|
764
|
-
readonly after: {
|
|
765
|
-
readonly from: string;
|
|
766
|
-
readonly to: string;
|
|
767
|
-
readonly writtenUp: boolean;
|
|
768
|
-
/**
|
|
769
|
-
* HOW FAR it is written up when it is not wholly (2026-09-30): the time of
|
|
770
|
-
* the latest claim on that work, spelled as `to` is, and what made it
|
|
771
|
-
* (`chapter`, `memories`, …). Absent or null: nothing of it is written up.
|
|
772
|
-
*/
|
|
773
|
-
readonly upTo?: string | null;
|
|
774
|
-
readonly by?: string | null;
|
|
775
|
-
/** Pieces of that work not written up, and how many of them came after `upTo`. */
|
|
776
|
-
readonly unwritten?: number;
|
|
777
|
-
readonly unwrittenAfter?: number;
|
|
778
|
-
} | null;
|
|
779
781
|
/** Why it may be out of date (`staleWords`), or null/absent. */
|
|
780
782
|
readonly stale?: string | null;
|
|
781
783
|
}
|
|
@@ -783,22 +785,18 @@ export interface PointerSince {
|
|
|
783
785
|
/** The widest `PointerSince` the words can take — what the reserve is sized to. */
|
|
784
786
|
export const WIDEST_POINTER_SINCE: PointerSince = {
|
|
785
787
|
written: "12-31 23:59",
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
by: "nothing new",
|
|
793
|
-
unwritten: 9999,
|
|
794
|
-
unwrittenAfter: 0,
|
|
795
|
-
},
|
|
796
|
-
stale: staleWords({ writtenWith: "0", installed: "9".repeat(HANDOFF_VERSION_MAX_CHARS), newerChapter: true }),
|
|
788
|
+
stale: staleWords({
|
|
789
|
+
writtenWith: "8".repeat(HANDOFF_VERSION_MAX_CHARS),
|
|
790
|
+
installed: "9".repeat(HANDOFF_VERSION_MAX_CHARS),
|
|
791
|
+
newerChapter: true,
|
|
792
|
+
age: 9999,
|
|
793
|
+
}),
|
|
797
794
|
};
|
|
798
795
|
|
|
799
796
|
/** The widest stamp an OLDER entry of a several-handoff block can carry —
|
|
800
|
-
* what the reserve sizes the entries after the newest to.
|
|
801
|
-
|
|
797
|
+
* what the reserve sizes the entries after the newest to. Since 2026-10-18
|
|
798
|
+
* the same words as the newest's. */
|
|
799
|
+
const WIDEST_OLDER_SINCE: PointerSince = WIDEST_POINTER_SINCE;
|
|
802
800
|
|
|
803
801
|
/**
|
|
804
802
|
* A model id as a person says it: `claude-opus-5-5` → `Opus 5.5`, with a
|
|
@@ -852,25 +850,10 @@ export function sessionWords(session: string | null, model: string | null, reade
|
|
|
852
850
|
/** Who wrote a row filed under the unbound server's id, in words. */
|
|
853
851
|
export const UNIDENTIFIED_SESSION_WORDS = "a session that hadn't been identified yet";
|
|
854
852
|
|
|
855
|
-
/**
|
|
856
|
-
*
|
|
857
|
-
*
|
|
858
|
-
|
|
859
|
-
* told the next session there was nothing to read (the continuity test).
|
|
860
|
-
*/
|
|
861
|
-
function writtenUpWords(after: NonNullable<PointerSince["after"]>): string {
|
|
862
|
-
if (after.writtenUp) return "written up since";
|
|
863
|
-
if (after.upTo === undefined || after.upTo === null || after.upTo.length === 0) return "not yet written up";
|
|
864
|
-
const n = after.unwritten ?? 0;
|
|
865
|
-
const tail = n === 0 ? "" : `, ${String(n)} ${n === 1 ? "piece" : "pieces"} ${after.unwrittenAfter === n ? "after" : "not yet"}`;
|
|
866
|
-
// "Nothing new" wrote nothing up: it said there was nothing to (review of
|
|
867
|
-
// #300 MINOR-7).
|
|
868
|
-
if (after.by === "nothing new") return `nothing new to write up as of ${after.upTo}${tail}`;
|
|
869
|
-
return `written up to ${after.upTo}${after.by ? ` (${after.by})` : ""}${tail}`;
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
/** When it was written, and — for the newest — how current it is. */
|
|
873
|
-
function whenWords(h: Handoff, since: PointerSince | null, author: string | null = null): string {
|
|
853
|
+
/** When it was written, by whom, and — when it may be out of date — why, in
|
|
854
|
+
* one sentence: after a dash inside the single pointer's parentheses, in
|
|
855
|
+
* parentheses of its own in a several-handoff entry. */
|
|
856
|
+
function whenWords(h: Handoff, since: PointerSince | null, author: string | null = null, nested = false): string {
|
|
874
857
|
const by = author === null ? "" : ` by ${author}`;
|
|
875
858
|
if (since === null || since.written.length === 0) {
|
|
876
859
|
const on = /^\d{4}-\d{2}-\d{2}$/.test(h.writtenOn.trim()) ? h.writtenOn.trim() : "an unrecorded date";
|
|
@@ -878,10 +861,8 @@ function whenWords(h: Handoff, since: PointerSince | null, author: string | null
|
|
|
878
861
|
}
|
|
879
862
|
// WHY IT MAY BE OUT OF DATE (2026-10-01), right after who and when, so it
|
|
880
863
|
// is read before the handoff's own first sentence.
|
|
881
|
-
const stale = since.stale === undefined || since.stale === null ? "" :
|
|
882
|
-
|
|
883
|
-
if (since.after === null) return written;
|
|
884
|
-
return `${written}; work here ${since.after.from}\u2013${since.after.to} since, ${writtenUpWords(since.after)}`;
|
|
864
|
+
const stale = since.stale === undefined || since.stale === null ? "" : nested ? ` \u2014 ${since.stale}` : ` (${since.stale})`;
|
|
865
|
+
return `written ${since.written}${by}${stale}`;
|
|
885
866
|
}
|
|
886
867
|
|
|
887
868
|
/** The pointer's first line: when it was written, by whom, how current it is,
|
|
@@ -893,7 +874,7 @@ export function pointerLine(
|
|
|
893
874
|
since: PointerSince | null = null,
|
|
894
875
|
author: string | null = null,
|
|
895
876
|
): string {
|
|
896
|
-
return `Where I left off in this directory (${whenWords(h, since, author)}): ${excerpt(h.body, capBytes)}`;
|
|
877
|
+
return `Where I left off in this directory (${whenWords(h, since, author, true)}): ${excerpt(h.body, capBytes)}`;
|
|
897
878
|
}
|
|
898
879
|
|
|
899
880
|
/** The pointer's second line: the door to the whole of it, and its life. */
|
|
@@ -938,10 +919,8 @@ export function pointerBlock(
|
|
|
938
919
|
* Every line flattened, for `pointerBlock`'s reason; no `- ` bullet, because
|
|
939
920
|
* the pointer is furniture and a bullet is what an element looks like.
|
|
940
921
|
*
|
|
941
|
-
* `since[i]` is how current the i-th one is
|
|
942
|
-
*
|
|
943
|
-
* handoffs are that work — and the words would cost a line's worth of bytes
|
|
944
|
-
* each to say so.
|
|
922
|
+
* `since[i]` is how current the i-th one is: each says its own staleness
|
|
923
|
+
* sentence (`staleWords`, 2026-10-18).
|
|
945
924
|
*/
|
|
946
925
|
export function pointerBlockMany(
|
|
947
926
|
hs: readonly Handoff[],
|
|
@@ -962,8 +941,7 @@ export function pointerBlockMany(
|
|
|
962
941
|
`Where the work in this directory was left off \u2014 ${live.length} handoffs, one per session, newest first:`,
|
|
963
942
|
];
|
|
964
943
|
live.slice(0, shown).forEach((h, i) => {
|
|
965
|
-
const
|
|
966
|
-
const since = raw === null || i === 0 ? raw : { written: raw.written, after: null, stale: raw.stale ?? null };
|
|
944
|
+
const since = opts.since?.[i] ?? null;
|
|
967
945
|
const when = whenWords(h, since);
|
|
968
946
|
lines.push(`${i + 1}) From ${authorWords(h, reader)}, ${since === null ? `on ${when}` : when}: ${excerpt(h.body)} (${h.id})`);
|
|
969
947
|
});
|
|
@@ -1006,6 +984,15 @@ export function pointerLadder(
|
|
|
1006
984
|
readonly lifeDays?: number;
|
|
1007
985
|
/** What was planned here since the newest (`Handoffs#plansSince`). */
|
|
1008
986
|
readonly plans?: PlansSince | null;
|
|
987
|
+
/**
|
|
988
|
+
* WHEN EVERY ONE IT WOULD LIST IS STALE, LIST ONE (2026-10-18, the
|
|
989
|
+
* wake-polish builder, lightly held): the newest in full and the rest by
|
|
990
|
+
* id ("+3 older here: …"), not three stale handoffs a line each. On by
|
|
991
|
+
* default; the boundary's reserve sizing turns it off, because the
|
|
992
|
+
* widest words it sizes to are always stale and a fresh morning's three
|
|
993
|
+
* need their room (`Handoffs#liveBlockBytesByScope`).
|
|
994
|
+
*/
|
|
995
|
+
readonly collapseStale?: boolean;
|
|
1009
996
|
} = {},
|
|
1010
997
|
): { block: string; shown: readonly Handoff[]; plans: readonly string[] }[] {
|
|
1011
998
|
const lifeDays = opts.lifeDays ?? HANDOFF_LIFE_DAYS;
|
|
@@ -1014,8 +1001,15 @@ export function pointerLadder(
|
|
|
1014
1001
|
if (first === undefined) return [];
|
|
1015
1002
|
const single = pointerBlock(first, day, lifeDays, opts.since?.[0] ?? null, opts.reader ?? null);
|
|
1016
1003
|
const out: { block: string; shown: readonly Handoff[]; several: boolean }[] = [];
|
|
1004
|
+
const widest = Math.min(HANDOFF_WAKE_SHOWN, live.length);
|
|
1005
|
+
const allStale =
|
|
1006
|
+
opts.collapseStale !== false &&
|
|
1007
|
+
live.slice(0, widest).every((_, i) => {
|
|
1008
|
+
const st = opts.since?.[i]?.stale;
|
|
1009
|
+
return st !== undefined && st !== null && st.length > 0;
|
|
1010
|
+
});
|
|
1017
1011
|
if (live.length > 1) {
|
|
1018
|
-
for (let k =
|
|
1012
|
+
for (let k = allStale ? 1 : widest; k >= 1; k--) {
|
|
1019
1013
|
const block = pointerBlockMany(live, day, { ...opts, shown: k });
|
|
1020
1014
|
if (block !== null) out.push({ block, shown: live.slice(0, k), several: true });
|
|
1021
1015
|
}
|
|
@@ -1262,7 +1256,7 @@ export class Handoffs {
|
|
|
1262
1256
|
// What was planned here since the newest, as it stands now (2026-10-09):
|
|
1263
1257
|
// sized to the line that exists, as the rest of the block is.
|
|
1264
1258
|
const plans = hs[0] === undefined ? null : this.plansSince(scope, hs[0]);
|
|
1265
|
-
const rungs = pointerLadder(hs, d, { since, plans }).map((rung) => byteLengthOf(rung.block));
|
|
1259
|
+
const rungs = pointerLadder(hs, d, { since, plans, collapseStale: false }).map((rung) => byteLengthOf(rung.block));
|
|
1266
1260
|
if (rungs.length > 0) out.set(scope, rungs);
|
|
1267
1261
|
}
|
|
1268
1262
|
return out;
|
|
@@ -1348,8 +1342,8 @@ export class Handoffs {
|
|
|
1348
1342
|
// into the wake. Left out rather than stored as null, so a row says
|
|
1349
1343
|
// nothing it does not know.
|
|
1350
1344
|
...(isModelId(input.model) ? { [HANDOFF_META_MODEL]: input.model } : {}),
|
|
1351
|
-
// The release that wrote it (2026-10-01): what "written
|
|
1352
|
-
//
|
|
1345
|
+
// The release that wrote it (2026-10-01): what "written on 0.3.9, 0.3.10
|
|
1346
|
+
// now" compares (`staleWords`). Left out when the caller knew none.
|
|
1353
1347
|
...(isVersion(input.build) ? { [HANDOFF_META_BUILD]: input.build } : {}),
|
|
1354
1348
|
};
|
|
1355
1349
|
// THIS SESSION'S row here, and only its own (2026-09-30): a different
|
|
@@ -1481,8 +1475,8 @@ export class Handoffs {
|
|
|
1481
1475
|
* EVERY BLOCK THIS WAKE MAY SPLICE, widest first (`pointerLadder`), or none.
|
|
1482
1476
|
* Pure — it writes nothing, so a caller that finds no room can drop it
|
|
1483
1477
|
* without having claimed it was shown. `since` is how current each shown one
|
|
1484
|
-
* is (`PointerSince`), asked with `newest`
|
|
1485
|
-
*
|
|
1478
|
+
* is (`PointerSince`), asked with `newest` (since 2026-10-18 every one
|
|
1479
|
+
* shown prints the same words, so the caller may ignore it). `reader` is the waking
|
|
1486
1480
|
* session, so its own handoff reads "by this session".
|
|
1487
1481
|
*/
|
|
1488
1482
|
pointerChoices(
|
|
@@ -424,16 +424,48 @@ export function chaptersOn(store: Store, date: string, opts: { fromDay?: number
|
|
|
424
424
|
* would not. No model run: titles and ids only. Null when that day has no
|
|
425
425
|
* chapter.
|
|
426
426
|
*
|
|
427
|
-
* `
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
427
|
+
* `places` (2026-10-18, the wake-polish builder, lightly held; a bare count
|
|
428
|
+
* of "sessions in other projects" from 2026-10-11): that day's episodes the
|
|
429
|
+
* caller left out of `day` because their directory's chapters may not be
|
|
430
|
+
* named here (`Counterpart#yesterdayFor`'s gate), BY FOLDER — "and 2 sessions
|
|
431
|
+
* in ~/random" — never by title or id. A folder name is not content: the
|
|
432
|
+
* caller lists only the folders the "Today, elsewhere" line may name (the
|
|
433
|
+
* scope setting on; not this one, not the store's own), and the rest are not
|
|
434
|
+
* said at all, as that line does not say them. When they are all there is,
|
|
435
|
+
* the line is the folders alone.
|
|
431
436
|
*/
|
|
432
|
-
export
|
|
437
|
+
export interface YesterdayPlace {
|
|
438
|
+
readonly scope: string;
|
|
439
|
+
readonly sessions: number;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/** How many folders the Yesterday line names; the rest are counted (`+2
|
|
443
|
+
* more`). As many as "Today, elsewhere" names (`TODAY_ELSEWHERE_MAX_DIRS`). */
|
|
444
|
+
export const YESTERDAY_PLACES_SHOWN = 5;
|
|
445
|
+
|
|
446
|
+
/** `3 sessions in ~/random (2), ~/deadfront`, or null for none. */
|
|
447
|
+
function placesWords(places: readonly YesterdayPlace[]): string | null {
|
|
448
|
+
const real = places.filter((p) => p.sessions > 0 && p.scope.trim().length > 0);
|
|
449
|
+
if (real.length === 0) return null;
|
|
450
|
+
const sorted = [...real].sort((a, b) => b.sessions - a.sessions || (a.scope < b.scope ? -1 : a.scope > b.scope ? 1 : 0));
|
|
451
|
+
const total = sorted.reduce((n, p) => n + p.sessions, 0);
|
|
452
|
+
const shown = sorted.slice(0, YESTERDAY_PLACES_SHOWN).map((p) => `${placeWords(p.scope)}${p.sessions > 1 && sorted.length > 1 ? ` (${String(p.sessions)})` : ""}`);
|
|
453
|
+
const more = sorted.length - shown.length;
|
|
454
|
+
return `${total === 1 ? "a session" : `${String(total)} sessions`} in ${shown.join(", ")}${more > 0 ? `, +${String(more)} more` : ""}`;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export function yesterdayLine(
|
|
458
|
+
day: readonly ChaptersOnDate[],
|
|
459
|
+
date: string,
|
|
460
|
+
titles = YESTERDAY_SHOWN,
|
|
461
|
+
places: readonly YesterdayPlace[] = [],
|
|
462
|
+
dated = true,
|
|
463
|
+
): string | null {
|
|
433
464
|
const head = dated ? `Yesterday, ${stampWords(date.slice(5))}:` : "Yesterday:";
|
|
465
|
+
const where = placesWords(places);
|
|
434
466
|
if (day.length === 0) {
|
|
435
|
-
if (
|
|
436
|
-
return flatten(`${head} ${
|
|
467
|
+
if (where === null) return null;
|
|
468
|
+
return flatten(`${head} ${where}.`);
|
|
437
469
|
}
|
|
438
470
|
// The first `YESTERDAY_SHOWN` are named, the first `titles` of them by
|
|
439
471
|
// title and id and the rest by id alone — pointers instead of titles
|
|
@@ -442,8 +474,10 @@ export function yesterdayLine(day: readonly ChaptersOnDate[], date: string, titl
|
|
|
442
474
|
const shown = day.slice(0, named).map((c, i) => {
|
|
443
475
|
return c.title === null || i >= titles ? c.id : `"${excerpt(c.title, YESTERDAY_TITLE_BYTES)}" (${c.id})`;
|
|
444
476
|
});
|
|
445
|
-
const rest = day.length - shown.length
|
|
446
|
-
|
|
477
|
+
const rest = day.length - shown.length;
|
|
478
|
+
const more = rest > 0 ? `; and ${String(rest)} more` : "";
|
|
479
|
+
const elsewhere = where === null ? "" : rest > 0 ? `; ${where}` : `; and ${where}`;
|
|
480
|
+
return flatten(`${head} ${shown.join("; ")}${more}${elsewhere}.`);
|
|
447
481
|
}
|
|
448
482
|
|
|
449
483
|
/**
|
|
@@ -466,13 +500,13 @@ export const YESTERDAY_UNDATED_AT_START = true;
|
|
|
466
500
|
* the count past them is the whole line's. The wake steps down these to make
|
|
467
501
|
* room for what ranks above the line (`self/briefing.ts#ROOM_ORDER`): the
|
|
468
502
|
* Arriving lane and "Still open"'s first item; the count is honest because it
|
|
469
|
-
* is counted here, where the chapters are. `
|
|
503
|
+
* is counted here, where the chapters are. `places` as `yesterdayLine`'s.
|
|
470
504
|
*/
|
|
471
|
-
export function yesterdayShorter(day: readonly ChaptersOnDate[], date: string,
|
|
505
|
+
export function yesterdayShorter(day: readonly ChaptersOnDate[], date: string, places: readonly YesterdayPlace[] = [], dated = true): string[] {
|
|
472
506
|
const out: string[] = [];
|
|
473
|
-
let last = yesterdayLine(day, date, YESTERDAY_SHOWN,
|
|
507
|
+
let last = yesterdayLine(day, date, YESTERDAY_SHOWN, places, dated);
|
|
474
508
|
for (let n = Math.min(YESTERDAY_SHOWN, day.length) - 1; n >= 0; n--) {
|
|
475
|
-
const line = yesterdayLine(day, date, n,
|
|
509
|
+
const line = yesterdayLine(day, date, n, places, dated);
|
|
476
510
|
if (line === null || last === null || line.length >= last.length) continue;
|
|
477
511
|
out.push(line);
|
|
478
512
|
last = line;
|
|
@@ -584,13 +618,18 @@ export function todayElsewhereLines(
|
|
|
584
618
|
(a.scope < b.scope ? -1 : a.scope > b.scope ? 1 : 0),
|
|
585
619
|
);
|
|
586
620
|
const clock = (at: number): string => localStamp(at, zone).split(" ")[1] ?? "";
|
|
621
|
+
// A session that started on an earlier day and is still active today
|
|
622
|
+
// (2026-10-18, random-6c's wake: "open since 09:08" for a start the day
|
|
623
|
+
// before) says its start with the day. `lastAt` is today's, by the caller.
|
|
624
|
+
const start = (firstAt: number, lastAt: number | null): string =>
|
|
625
|
+
lastAt !== null && localDate(firstAt, zone) !== localDate(lastAt, zone) ? localStamp(firstAt, zone) : clock(firstAt);
|
|
587
626
|
const one = (d: TodayElsewhere, chapters: boolean): string => {
|
|
588
627
|
const when =
|
|
589
628
|
d.firstAt === null
|
|
590
629
|
? ""
|
|
591
630
|
: d.live
|
|
592
|
-
? ` open since ${
|
|
593
|
-
: ` ${
|
|
631
|
+
? ` open since ${start(d.firstAt, d.lastAt)} (live)`
|
|
632
|
+
: ` ${start(d.firstAt, d.lastAt)}–${clock(d.lastAt ?? d.firstAt)}`;
|
|
594
633
|
const chapter = !chapters || d.chapter === null ? "" : ` — ${chapterWords(d.chapter)}`;
|
|
595
634
|
const count = d.memories === 0 ? "" : `, ${String(d.memories)} ${d.memories === 1 ? "memory" : "memories"}`;
|
|
596
635
|
return `${placeWords(d.scope)}${when}${chapter}${count}`;
|
|
@@ -51,6 +51,31 @@ function ids(list: readonly string[]): string {
|
|
|
51
51
|
return list.slice(0, STANDING_MAX_POINTERS).map((x) => `[${x}]`).join(", ");
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/** `id` is the OLDER of a standing unsettled pair (`Unsettled — may be out of date`). */
|
|
55
|
+
function unsettledIn(store: StandingStore, id: string, pairs: readonly ContradictionRow[]): boolean {
|
|
56
|
+
return pairs.some((p) => p.via === null && p.state === "unsettled" && p.a === id && live(store, p.a) && live(store, p.b));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* THE ONES AMONG `ids` THAT A LANE WOULD SHOW AS "Unsettled — may be out of
|
|
61
|
+
* date" (2026-10-18, the wake-polish builder): one read of their pairs, for a
|
|
62
|
+
* ranking that puts them after the rest ("Still open", `self/identity.ts`).
|
|
63
|
+
* The same rule `standingOf` labels by. Empty when none, or unreadable.
|
|
64
|
+
*/
|
|
65
|
+
export function unsettledAmong(store: StandingStore, ids: readonly string[]): Set<string> {
|
|
66
|
+
const out = new Set<string>();
|
|
67
|
+
if (ids.length === 0) return out;
|
|
68
|
+
try {
|
|
69
|
+
const all = store.contradictionsOf(ids);
|
|
70
|
+
for (const id of ids) {
|
|
71
|
+
if (unsettledIn(store, id, all.get(id) ?? [])) out.add(id);
|
|
72
|
+
}
|
|
73
|
+
} catch {
|
|
74
|
+
return new Set();
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
|
|
54
79
|
/**
|
|
55
80
|
* The standing of one memory, or null when it has none. `byId`: the caller
|
|
56
81
|
* asked for this memory by its address, so a replaced row says so too.
|
|
@@ -80,7 +105,7 @@ export function standingOf(
|
|
|
80
105
|
} else if (p.how === "open") {
|
|
81
106
|
disagrees.push(other);
|
|
82
107
|
}
|
|
83
|
-
} else if (
|
|
108
|
+
} else if (unsettledIn(store, id, [p])) {
|
|
84
109
|
unsettled.push(p.b);
|
|
85
110
|
}
|
|
86
111
|
}
|
package/src/core/self/NOTES.md
CHANGED
|
@@ -2211,3 +2211,24 @@ Lightly held, Mike's call of 2026-10-16 ("we'll see how it looks tomorrow").
|
|
|
2211
2211
|
wake at another add it.
|
|
2212
2212
|
- **Numbers.** A copy of the owner's store at 9,000: 3 items before, 4 after with the
|
|
2213
2213
|
5,525-byte page, 9 with a page at 4,600. `test/wake-trims.test.ts` at production scale: 5 → 14.
|
|
2214
|
+
|
|
2215
|
+
## 2026-10-18 — "Still open" leads with what is live (the wake-polish builder, lightly held)
|
|
2216
|
+
|
|
2217
|
+
random-6c's 10-17 wake led "Still open" with two three-week-old questions and counted 57
|
|
2218
|
+
more. The order was person-scoped first, then OLDEST-opened first (behavioral-spec §1 G4:
|
|
2219
|
+
long-held relational debts trim last). It is now `identity.ts#byThreadLive`: untouched for
|
|
2220
|
+
`STILL_OPEN_STALE_DAYS` (14) lived days after every one touched since — "touched" is
|
|
2221
|
+
`max(born, lastUsedDay)`, as #489 D's `staleOpen` reads it (its threshold is 4 lived days,
|
|
2222
|
+
not 14, so the two don't count the same set); then plain before "Unsettled — may be out of date" (`recall/standing.ts#
|
|
2223
|
+
unsettledAmong`, one read of the open candidates' pairs per render); then person-scoped
|
|
2224
|
+
first, which keeps G4 among peers; then the most recently touched. The core memories being
|
|
2225
|
+
reconsidered still lead (`RECONSIDERING_MAX`, not aged: they wait on a decision), but one
|
|
2226
|
+
that is also unsettled takes its turn after the plain ones — its unsettled prefix replaces
|
|
2227
|
+
the "keep or retire it" words. The count line says how many of what it counts are old:
|
|
2228
|
+
`(57 more still open, 12 untouched for 2+ weeks; recall ids …)` (`STALE_OPEN_WORDS`, read
|
|
2229
|
+
back by `countedLanes`). The room is unchanged; only the order and the count's words.
|
|
2230
|
+
|
|
2231
|
+
Measured on the 10-18 snapshot copy (observer): shown before `mem_eef7749259b8` (core,
|
|
2232
|
+
unsettled) and `mem_108281079c41` (born lived day 10); after, `mem_18628b85d486` (core, the
|
|
2233
|
+
plain one in turn) and `mem_9d9af2754e64` (born day 25). Undo: `git revert` of the PR
|
|
2234
|
+
(nothing is stored differently).
|
|
@@ -97,7 +97,7 @@ export function pinnedLines(
|
|
|
97
97
|
for (const lane of LANE_ORDER) {
|
|
98
98
|
const ids = pinned[lane];
|
|
99
99
|
if (ids === undefined || ids.length === 0) continue;
|
|
100
|
-
out[lane] = lane !== "identity" && kept[lane].length === 0 ? collapsedLine(lane, ids, counted) : moreLine(lane, ids, counted?.horizonOverdue);
|
|
100
|
+
out[lane] = lane !== "identity" && kept[lane].length === 0 ? collapsedLine(lane, ids, counted) : moreLine(lane, ids, counted?.horizonOverdue, counted?.threadsStale);
|
|
101
101
|
}
|
|
102
102
|
return out;
|
|
103
103
|
}
|
|
@@ -547,7 +547,7 @@ export function tellLost(ctx: {
|
|
|
547
547
|
for (const lane of MORE_ORDER) {
|
|
548
548
|
const ids = ctx.lost[lane];
|
|
549
549
|
if (ids === undefined || ids.length === 0) continue;
|
|
550
|
-
lines[lane] = lane !== "identity" && ctx.kept[lane].length === 0 ? collapsedLine(lane, ids, ctx.req) : moreLine(lane, ids, ctx.req.horizonOverdue);
|
|
550
|
+
lines[lane] = lane !== "identity" && ctx.kept[lane].length === 0 ? collapsedLine(lane, ids, ctx.req) : moreLine(lane, ids, ctx.req.horizonOverdue, ctx.req.threadsStale);
|
|
551
551
|
const candidate = at(lines);
|
|
552
552
|
if (candidate.bytes > ctx.limit) {
|
|
553
553
|
delete lines[lane];
|
|
@@ -361,11 +361,26 @@ function overdueAmong(lane: LaneName, ids: readonly string[], overdue: readonly
|
|
|
361
361
|
/** The overdue word, and its count line's form when every id is overdue. */
|
|
362
362
|
export const OVERDUE_WORD = "overdue";
|
|
363
363
|
|
|
364
|
-
/**
|
|
364
|
+
/**
|
|
365
|
+
* WHAT "STILL OPEN"'S COUNT SAYS OF ITS OLD ONES (2026-10-18, the wake-polish
|
|
366
|
+
* builder, lightly held): `(56 more still open, 19 untouched for 2+ weeks;
|
|
367
|
+
* recall ids …)` — the threads untouched for `STILL_OPEN_STALE_DAYS` (14)
|
|
368
|
+
* lived days, which rank last (`identity.ts#byThreadLive`). Fourteen lived
|
|
369
|
+
* days are at least two weeks of the calendar: a lived day is a day the
|
|
370
|
+
* memory was used.
|
|
371
|
+
*/
|
|
372
|
+
export const STALE_OPEN_WORDS = "untouched for 2+ weeks";
|
|
373
|
+
|
|
374
|
+
/** `(3 more still open; recall ids: mem_…, mem_…, mem_…)`, `(56 more still
|
|
375
|
+
* open, 19 untouched for 2+ weeks; recall ids: …)`, and for "Coming up"
|
|
365
376
|
* `(2 overdue, 4 more coming up; recall ids: …)` or `(2 overdue; recall ids: …)`. */
|
|
366
|
-
export function moreLine(lane: LaneName, ids: readonly string[], overdue?: readonly string[]): string {
|
|
377
|
+
export function moreLine(lane: LaneName, ids: readonly string[], overdue?: readonly string[], stale?: readonly string[]): string {
|
|
367
378
|
const late = overdueAmong(lane, ids, overdue);
|
|
368
|
-
if (late === 0)
|
|
379
|
+
if (late === 0) {
|
|
380
|
+
const old = lane !== "threads" || stale === undefined || stale.length === 0 ? 0 : ids.filter((id) => stale.includes(id)).length;
|
|
381
|
+
const said = old === 0 ? "" : `, ${String(old)} ${STALE_OPEN_WORDS}`;
|
|
382
|
+
return `(${String(ids.length)} more ${MORE_NOUN[lane]}${said}; ${recallIds(ids)})`;
|
|
383
|
+
}
|
|
369
384
|
const rest = ids.length - late;
|
|
370
385
|
return `(${String(late)} ${OVERDUE_WORD}${rest === 0 ? "" : `, ${String(rest)} more ${MORE_NOUN[lane]}`}; ${recallIds(ids)})`;
|
|
371
386
|
}
|
|
@@ -424,7 +439,8 @@ export function countedLanes(text: string): Partial<Record<LaneName, number>> {
|
|
|
424
439
|
out[collapsed] = Number(/^\D*(\d+) — /.exec(line.slice(heading.length))?.[1] ?? 0);
|
|
425
440
|
continue;
|
|
426
441
|
}
|
|
427
|
-
|
|
442
|
+
// "Still open"'s old ones ride inside the count (2026-10-18): `(56 more still open, 19 untouched for 2+ weeks; …)`.
|
|
443
|
+
const more = new RegExp(`^\\((\\d+) more (.+?)(?:, \\d+ ${STALE_OPEN_WORDS.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})?; recall ids`).exec(line);
|
|
428
444
|
const lane = more === null ? undefined : byNoun.get(more[2] ?? "");
|
|
429
445
|
if (more !== null && lane !== undefined) {
|
|
430
446
|
out[lane] = Number(more[1]);
|
|
@@ -485,7 +501,7 @@ export function collapsedLine(lane: LaneName, ids: readonly string[], counted?:
|
|
|
485
501
|
|
|
486
502
|
/** What "Coming up" counts rather than lists, as a composition's request
|
|
487
503
|
* carries it (`BriefingRequest.horizonLater`, `.horizonOverdue`). */
|
|
488
|
-
export type HorizonCounted = Pick<BriefingRequest, "horizonLater" | "horizonOverdue">;
|
|
504
|
+
export type HorizonCounted = Pick<BriefingRequest, "horizonLater" | "horizonOverdue" | "threadsStale">;
|
|
489
505
|
|
|
490
506
|
/** The lane a collapsed line (`collapsedLine`) speaks for, or null for any other line. */
|
|
491
507
|
export function collapsedLane(line: string): LaneName | null {
|
|
@@ -731,6 +747,10 @@ export interface BriefingRequest {
|
|
|
731
747
|
/** Those of `horizonLater` past their date (review of #511): the line
|
|
732
748
|
* counts them as overdue. Absent: none said so. */
|
|
733
749
|
readonly horizonOverdue?: readonly string[];
|
|
750
|
+
/** "Still open"'s threads untouched for `STILL_OPEN_STALE_DAYS` lived days
|
|
751
|
+
* (`Lanes.threadsStale`, 2026-10-18): its count line says how many of what
|
|
752
|
+
* it counts are that old. Absent: nothing said. */
|
|
753
|
+
readonly threadsStale?: readonly string[];
|
|
734
754
|
}
|
|
735
755
|
|
|
736
756
|
export interface TrimEvent {
|
|
@@ -46,6 +46,15 @@ export interface Ranked {
|
|
|
46
46
|
readonly tieKey?: string;
|
|
47
47
|
/** Threads only: person-scoped debts trim last (behavioral-spec §1 G4). */
|
|
48
48
|
readonly personScoped: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Threads only (2026-10-18): the lived day it was last TOUCHED — born or
|
|
51
|
+
* used, whichever is later (`physics.lastUsedDay`), as #489 D's
|
|
52
|
+
* `staleOpen` reads "untouched". Absent: its born day.
|
|
53
|
+
*/
|
|
54
|
+
readonly touchedDay?: number;
|
|
55
|
+
/** Threads only (2026-10-18): it would show as "Unsettled — may be out of
|
|
56
|
+
* date" (`recall/standing.ts#unsettledAmong`), so it ranks after the rest. */
|
|
57
|
+
readonly unsettled?: boolean;
|
|
49
58
|
/** Lived day this element last rendered in a wake; -1 never. Identity only. */
|
|
50
59
|
readonly lastRendered: number;
|
|
51
60
|
/** Hints only: why it ranked where it did (`hintReading`). */
|
|
@@ -306,16 +315,56 @@ function byRotation(day: number | undefined): (a: Ranked, b: Ranked) => number {
|
|
|
306
315
|
}
|
|
307
316
|
|
|
308
317
|
/**
|
|
309
|
-
* Threads order
|
|
310
|
-
*
|
|
311
|
-
*
|
|
318
|
+
* Threads order (2026-10-18, the wake-polish builder, lightly held; before
|
|
319
|
+
* it, person-scoped first and then oldest-opened first): WHAT IS LIVE FIRST.
|
|
320
|
+
* The trim eats from the END of the lane, so the order is what shows.
|
|
321
|
+
*
|
|
322
|
+
* 1. touched within `staleDays` lived days before one untouched for longer
|
|
323
|
+
* (`SelfTunables.STILL_OPEN_STALE_DAYS`) — the weeks-old question that
|
|
324
|
+
* nobody closed waits behind this week's;
|
|
325
|
+
* 2. a plain open item before one that is "Unsettled — may be out of date";
|
|
326
|
+
* 3. person-scoped first — long-held relational debts still drop last among
|
|
327
|
+
* their peers (behavioral-spec §1 G4);
|
|
328
|
+
* 4. the most recently touched first, then the most recently born;
|
|
329
|
+
* 5. the words' hash, then the id.
|
|
330
|
+
*
|
|
331
|
+
* Measured on the owner's 10-18 snapshot (self NOTES, 2026-10-18): the old
|
|
332
|
+
* order's plain item was born on lived day 10 of 27; the new one's on day 25.
|
|
312
333
|
*/
|
|
313
|
-
function
|
|
334
|
+
function byThreadLive(day: number, staleDays: number): (a: Ranked, b: Ranked) => number {
|
|
335
|
+
const stale = (r: Ranked): boolean => day - (r.touchedDay ?? r.bornDay) >= staleDays;
|
|
336
|
+
return (a, b) => {
|
|
337
|
+
const sa = stale(a);
|
|
338
|
+
const sb = stale(b);
|
|
339
|
+
if (sa !== sb) return sa ? 1 : -1;
|
|
340
|
+
const ua = a.unsettled === true;
|
|
341
|
+
const ub = b.unsettled === true;
|
|
342
|
+
if (ua !== ub) return ua ? 1 : -1;
|
|
343
|
+
if (a.personScoped !== b.personScoped) return a.personScoped ? -1 : 1;
|
|
344
|
+
const ta = a.touchedDay ?? a.bornDay;
|
|
345
|
+
const tb = b.touchedDay ?? b.bornDay;
|
|
346
|
+
if (ta !== tb) return tb - ta;
|
|
347
|
+
if (a.bornDay !== b.bornDay) return b.bornDay - a.bornDay;
|
|
348
|
+
return byContentThenId(a, b);
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/** The core memories being reconsidered, before their rotation: person-scoped
|
|
353
|
+
* first, then oldest-opened first (the threads order before 2026-10-18). */
|
|
354
|
+
function byOpened(a: Ranked, b: Ranked): number {
|
|
314
355
|
if (a.personScoped !== b.personScoped) return a.personScoped ? -1 : 1;
|
|
315
356
|
if (a.bornDay !== b.bornDay) return a.bornDay - b.bornDay;
|
|
316
357
|
return byContentThenId(a, b);
|
|
317
358
|
}
|
|
318
359
|
|
|
360
|
+
/**
|
|
361
|
+
* Of the open threads, those untouched for `staleDays` lived days or more —
|
|
362
|
+
* what "Still open"'s count line says of what it counts (2026-10-18).
|
|
363
|
+
*/
|
|
364
|
+
function staleAmong(lane: readonly Ranked[], day: number, staleDays: number): string[] {
|
|
365
|
+
return lane.filter((r) => day - (r.touchedDay ?? r.bornDay) >= staleDays).map((r) => r.id);
|
|
366
|
+
}
|
|
367
|
+
|
|
319
368
|
/** Hints order: the hint score (organic strength x habituation), then as `byStrength`. */
|
|
320
369
|
function byHint(a: Ranked, b: Ranked): number {
|
|
321
370
|
const sa = a.hint?.score ?? a.strength;
|
|
@@ -339,6 +388,7 @@ export function rankedAs(s: Scanned, lane: LaneName, hint?: HintReading): Ranked
|
|
|
339
388
|
tieKey: createHash("sha256").update(s.doc.body).digest("hex"),
|
|
340
389
|
personScoped: s.kind === "person",
|
|
341
390
|
lastRendered: s.lastRendered,
|
|
391
|
+
touchedDay: Math.max(s.doc.bornDay, s.physics.lastUsedDay),
|
|
342
392
|
};
|
|
343
393
|
}
|
|
344
394
|
|
|
@@ -364,6 +414,12 @@ export interface Lanes {
|
|
|
364
414
|
later?: readonly string[];
|
|
365
415
|
/** Those of `later` past their date (review of #511): counted as overdue. */
|
|
366
416
|
overdue?: readonly string[];
|
|
417
|
+
/**
|
|
418
|
+
* "STILL OPEN"'S OLD ONES, by id (2026-10-18): open threads untouched for
|
|
419
|
+
* `STILL_OPEN_STALE_DAYS` lived days or more. They rank last, and the
|
|
420
|
+
* lane's count line says how many of what it counts are that old.
|
|
421
|
+
*/
|
|
422
|
+
threadsStale?: readonly string[];
|
|
367
423
|
}
|
|
368
424
|
|
|
369
425
|
/**
|
|
@@ -380,9 +436,11 @@ export interface Lanes {
|
|
|
380
436
|
* craft — skill-kind, not already in identity, above the warm floor. The
|
|
381
437
|
* procedural self is rendered as CONTENT, never a pointer (§1).
|
|
382
438
|
* Empty under `workAtDelivery` (below): composed per directory.
|
|
383
|
-
* threads — `unresolved` memories
|
|
384
|
-
*
|
|
385
|
-
*
|
|
439
|
+
* threads — `unresolved` memories, what is live first (`byThreadLive`,
|
|
440
|
+
* 2026-10-18: the recently touched before the weeks-old, plain
|
|
441
|
+
* before unsettled, person-scoped first among peers); and a core
|
|
442
|
+
* memory being reconsidered (2026-10-11), which waits on a
|
|
443
|
+
* decision and so is listed here, not under identity, first.
|
|
386
444
|
* hints — everything else warm enough to be worth a nudge, by `hintReading`:
|
|
387
445
|
* organic strength x habituation, so one strong memory cannot
|
|
388
446
|
* hold the lane every day (2026-09-26).
|
|
@@ -430,6 +488,10 @@ export function rankLanes(
|
|
|
430
488
|
/** "Coming up"'s later dates (`Lanes.later`, 2026-10-16): counted under
|
|
431
489
|
* that lane, so in no other — as a listed arriving item is in none. */
|
|
432
490
|
readonly later?: readonly string[];
|
|
491
|
+
/** Open ids that would show as "Unsettled — may be out of date"
|
|
492
|
+
* (`recall/standing.ts#unsettledAmong`, 2026-10-18): ranked after the
|
|
493
|
+
* rest of "Still open", the core memories being reconsidered included. */
|
|
494
|
+
readonly unsettled?: ReadonlySet<string>;
|
|
433
495
|
} = {},
|
|
434
496
|
): Lanes {
|
|
435
497
|
const identity: Ranked[] = [];
|
|
@@ -442,11 +504,16 @@ export function rankLanes(
|
|
|
442
504
|
const horizon = horizonIn.filter((h) => !inIdentity.has(h.id) && !settledOver.has(h.id));
|
|
443
505
|
const arriving = new Set(horizon.map((h) => h.id));
|
|
444
506
|
const later = new Set(opts.later ?? []);
|
|
507
|
+
const unsettled = opts.unsettled ?? new Set<string>();
|
|
508
|
+
const asThread = (s: Scanned): Ranked => {
|
|
509
|
+
const r = rankedAs(s, "threads");
|
|
510
|
+
return unsettled.has(s.id) ? { ...r, unsettled: true } : r;
|
|
511
|
+
};
|
|
445
512
|
|
|
446
513
|
for (const s of scanned) {
|
|
447
514
|
// A core memory being reconsidered waits on a decision: "Still open" (2026-10-11).
|
|
448
515
|
if (s.band === "identity" && s.reconsidering === true) {
|
|
449
|
-
reconsidering.push(
|
|
516
|
+
reconsidering.push(asThread(s));
|
|
450
517
|
continue;
|
|
451
518
|
}
|
|
452
519
|
if (s.band === "identity") {
|
|
@@ -455,7 +522,7 @@ export function rankLanes(
|
|
|
455
522
|
}
|
|
456
523
|
if (arriving.has(s.id) || later.has(s.id) || settledOver.has(s.id)) continue;
|
|
457
524
|
if (s.unresolved) {
|
|
458
|
-
threads.push(
|
|
525
|
+
threads.push(asThread(s));
|
|
459
526
|
continue;
|
|
460
527
|
}
|
|
461
528
|
if (
|
|
@@ -482,16 +549,26 @@ export function rankLanes(
|
|
|
482
549
|
|
|
483
550
|
identity.sort(byRotation(scanned.find((s) => s.day !== undefined)?.day));
|
|
484
551
|
craft.sort(byStrength);
|
|
485
|
-
|
|
552
|
+
const turn = scanned.find((s) => s.day !== undefined)?.day ?? 0;
|
|
553
|
+
threads.sort(byThreadLive(turn, t.STILL_OPEN_STALE_DAYS));
|
|
486
554
|
// A few core memories being reconsidered lead "Still open" (2026-10-11):
|
|
487
555
|
// at most `RECONSIDERING_MAX`, the rest counted with the lane's overflow
|
|
488
|
-
// ("more still open"), one decision at a time.
|
|
556
|
+
// ("more still open"), one decision at a time. Not aged: a core memory
|
|
557
|
+
// waits on a decision however long ago it was touched.
|
|
489
558
|
// They TAKE TURNS by lived day (review of #430): a fixed order would show
|
|
490
559
|
// the same one every wake while the others waited unseen behind it.
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
560
|
+
// One that is also "Unsettled — may be out of date" (2026-10-18) takes its
|
|
561
|
+
// turn only after the plain ones: its prefix replaces the "keep or retire
|
|
562
|
+
// it" words, and the pair it is in has its own answer.
|
|
563
|
+
reconsidering.sort(byOpened);
|
|
564
|
+
const rotate = (pool: readonly Ranked[]): Ranked[] => {
|
|
565
|
+
const k = pool.length === 0 ? 0 : ((turn % pool.length) + pool.length) % pool.length;
|
|
566
|
+
return [...pool.slice(k), ...pool.slice(0, k)];
|
|
567
|
+
};
|
|
568
|
+
const rotated = [...rotate(reconsidering.filter((r) => r.unsettled !== true)), ...rotate(reconsidering.filter((r) => r.unsettled === true))];
|
|
569
|
+
// Which open threads are old, for the count line — before the core
|
|
570
|
+
// memories join the lane: those are not aged.
|
|
571
|
+
const threadsStale = staleAmong(threads, turn, t.STILL_OPEN_STALE_DAYS);
|
|
495
572
|
const shownFlags = Math.min(rotated.length, t.RECONSIDERING_MAX);
|
|
496
573
|
threads.unshift(...rotated.slice(0, shownFlags));
|
|
497
574
|
const flagsWaiting = rotated.slice(shownFlags).map((r) => r.id);
|
|
@@ -514,6 +591,7 @@ export function rankLanes(
|
|
|
514
591
|
...(opts.horizonMore ?? []).filter((id) => !inIdentity.has(id) && !settledOver.has(id) && !arriving.has(id)),
|
|
515
592
|
],
|
|
516
593
|
},
|
|
594
|
+
...(threadsStale.length === 0 ? {} : { threadsStale }),
|
|
517
595
|
};
|
|
518
596
|
}
|
|
519
597
|
|
package/src/core/self/index.ts
CHANGED
|
@@ -192,7 +192,7 @@ import type { SelfTunables } from "./tunables.js";
|
|
|
192
192
|
import { calendarDate } from "./calendar.js";
|
|
193
193
|
import { isDay, yearOf } from "../time.js";
|
|
194
194
|
import { markWakeBehind } from "./behind.js";
|
|
195
|
-
import { pairOrder, standingOf } from "../recall/standing.js";
|
|
195
|
+
import { pairOrder, standingOf, unsettledAmong } from "../recall/standing.js";
|
|
196
196
|
|
|
197
197
|
export * from "./behind.js";
|
|
198
198
|
export * from "./briefing.js";
|
|
@@ -936,6 +936,9 @@ export class Self {
|
|
|
936
936
|
const lanes: Lanes = {
|
|
937
937
|
...rankLanes(scanned, horizon, this.tunables, {
|
|
938
938
|
settledOver: settledOver(this.store),
|
|
939
|
+
// "Still open"'s unsettled ones rank after the rest (2026-10-18): one
|
|
940
|
+
// read of the pairs, for the open candidates only.
|
|
941
|
+
unsettled: unsettledAmong(this.store, scanned.filter((s) => s.unresolved || s.reconsidering === true).map((s) => s.id)),
|
|
939
942
|
coveredByPage: this.pageCovers(scanned),
|
|
940
943
|
workAtDelivery: this.tunables.CRAFT_AT_DELIVERY,
|
|
941
944
|
...(coming.more.length === 0 || req.omit !== undefined ? {} : { horizonMore: coming.more }),
|
|
@@ -1023,6 +1026,7 @@ export class Self {
|
|
|
1023
1026
|
}
|
|
1024
1027
|
const fresh = rankLanes(open, horizon, this.tunables, {
|
|
1025
1028
|
settledOver: settled,
|
|
1029
|
+
unsettled: unsettledAmong(this.store, open.map((s) => s.id)),
|
|
1026
1030
|
workAtDelivery: this.tunables.CRAFT_AT_DELIVERY,
|
|
1027
1031
|
...(coming.more.length === 0 ? {} : { horizonMore: coming.more }),
|
|
1028
1032
|
...(coming.later.length === 0 ? {} : { later: coming.later }),
|
|
@@ -1065,6 +1069,7 @@ export class Self {
|
|
|
1065
1069
|
},
|
|
1066
1070
|
...(coming.later.length === 0 ? {} : { later: coming.later }),
|
|
1067
1071
|
...(coming.overdue.length === 0 ? {} : { overdue: coming.overdue }),
|
|
1072
|
+
...(fresh.threadsStale === undefined ? {} : { threadsStale: fresh.threadsStale }),
|
|
1068
1073
|
};
|
|
1069
1074
|
return this.composeLanes(lanes, docs, sources, {
|
|
1070
1075
|
day,
|
|
@@ -1224,6 +1229,8 @@ export class Self {
|
|
|
1224
1229
|
...(lanes.later === undefined || lanes.later.length === 0 || req.omit !== undefined ? {} : { horizonLater: lanes.later }),
|
|
1225
1230
|
// And which of them are past their date, so it says "overdue" (review of #511).
|
|
1226
1231
|
...(lanes.overdue === undefined || lanes.overdue.length === 0 || req.omit !== undefined ? {} : { horizonOverdue: lanes.overdue }),
|
|
1232
|
+
// And which open threads are weeks old, so "Still open"'s count says so (2026-10-18).
|
|
1233
|
+
...(lanes.threadsStale === undefined || lanes.threadsStale.length === 0 || req.omit !== undefined ? {} : { threadsStale: lanes.threadsStale }),
|
|
1227
1234
|
...(req.elsewhereShorter === undefined || req.elsewhere === undefined || req.omit !== undefined
|
|
1228
1235
|
? {}
|
|
1229
1236
|
: { elsewhereShorter: req.elsewhereShorter }),
|
|
@@ -80,6 +80,17 @@ export interface SelfTunables {
|
|
|
80
80
|
* questions out. CAL.
|
|
81
81
|
*/
|
|
82
82
|
RECONSIDERING_MAX: number;
|
|
83
|
+
/**
|
|
84
|
+
* "STILL OPEN" LEADS WITH WHAT IS LIVE (2026-10-18, the wake-polish
|
|
85
|
+
* builder, lightly held): an open thread untouched — neither born nor used
|
|
86
|
+
* — for this many lived days ranks after every one touched since, and the
|
|
87
|
+
* lane's count line says how many of what it counts are that old ("41
|
|
88
|
+
* untouched for 2+ weeks"). "Untouched" is read as #489 D's `staleOpen`
|
|
89
|
+
* reads it (born or used), but the thresholds differ: the nightly
|
|
90
|
+
* close-offer looks from `REFLECT_TUNABLES.STALE_OPEN_DAYS` (4) and offers
|
|
91
|
+
* at most 5 a night, so it does not count what this counts. CAL.
|
|
92
|
+
*/
|
|
93
|
+
STILL_OPEN_STALE_DAYS: number;
|
|
83
94
|
/** Most warm-shelf hints considered. CAL. */
|
|
84
95
|
HINTS_MAX: number;
|
|
85
96
|
/** Most arriving occasions considered. CAL. */
|
|
@@ -266,6 +277,7 @@ export const SELF_TUNABLES: SelfTunables = {
|
|
|
266
277
|
WORK_HERE_EXCERPT: 60,
|
|
267
278
|
THREADS_MAX: 5,
|
|
268
279
|
RECONSIDERING_MAX: 1,
|
|
280
|
+
STILL_OPEN_STALE_DAYS: 14,
|
|
269
281
|
HINTS_MAX: 8,
|
|
270
282
|
HORIZON_MAX: 6,
|
|
271
283
|
COMING_UP_TODAY_ONLY: true,
|