counterparts 0.3.37 → 0.3.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +188 -0
- package/README.md +2 -1
- package/docs/QUICKSTART.md +14 -8
- package/docs/module-map.md +4 -2
- package/package.json +9 -1
- package/src/adapters/claude-code/CONTRACT.md +26 -4
- package/src/adapters/claude-code/NOTES.md +116 -0
- package/src/adapters/claude-code/bin/hook.ts +70 -6
- package/src/adapters/claude-code/bin/nightly.ts +2 -0
- package/src/adapters/claude-code/bin/runner.ts +64 -2
- package/src/adapters/claude-code/child-error.ts +211 -0
- package/src/adapters/claude-code/child.ts +29 -10
- package/src/adapters/claude-code/doctor-checkout.ts +4 -2
- package/src/adapters/claude-code/doctor-host.ts +31 -0
- package/src/adapters/claude-code/doctor-meaning.ts +200 -0
- package/src/adapters/claude-code/doctor-modes.ts +115 -0
- package/src/adapters/claude-code/doctor-open.ts +12 -2
- package/src/adapters/claude-code/doctor-self-page.ts +2 -0
- package/src/adapters/claude-code/doctor-write-ups.ts +84 -19
- package/src/adapters/claude-code/doctor.ts +199 -23
- package/src/adapters/claude-code/hooks.ts +162 -11
- package/src/adapters/claude-code/index.ts +15 -0
- package/src/adapters/claude-code/night-catch-up.ts +25 -5
- package/src/adapters/claude-code/night-run.ts +86 -11
- package/src/adapters/claude-code/stale-windows.ts +160 -0
- package/src/adapters/claude-code/standdown.ts +70 -3
- package/src/adapters/cli/INTERFACE-GAPS.md +14 -0
- package/src/adapters/cli/NOTES.md +25 -0
- package/src/adapters/cli/bin/counterparts.ts +4 -2
- package/src/adapters/cli/commands-dashboard.ts +8 -5
- package/src/adapters/cli/commands-install.ts +12 -14
- package/src/adapters/cli/commands.ts +5 -2
- package/src/adapters/cli/coverage.ts +28 -6
- package/src/adapters/cli/help.ts +6 -1
- package/src/adapters/cli/index.ts +2 -0
- package/src/adapters/cli/install.ts +24 -1
- package/src/adapters/cli/mechanisms.ts +31 -8
- package/src/adapters/cli/rollback.ts +3 -3
- package/src/adapters/cli/snapshot.ts +4 -4
- package/src/adapters/cli/ui.ts +10 -0
- package/src/adapters/cli/uninstall.ts +16 -74
- package/src/adapters/cli/wire.ts +227 -33
- package/src/adapters/config.ts +23 -0
- package/src/adapters/dashboard/bin/dashboard.ts +2 -0
- package/src/adapters/dashboard/registries.ts +1 -1
- package/src/adapters/dashboard/web/mechanisms/index.js +2 -0
- package/src/adapters/dashboard/web/mechanisms/schema/index.js +9 -6
- package/src/adapters/dashboard/web/mechanisms/schema/panel.js +14 -0
- package/src/adapters/dashboard/web/narrate.ts +10 -3
- package/src/adapters/dashboard/web/views/mechanism-panel.ts +44 -0
- package/src/adapters/dashboard/web/views/mechanisms.ts +13 -1
- package/src/adapters/expansions.ts +4 -3
- package/src/adapters/fired.ts +29 -0
- package/src/adapters/host-wiring.ts +56 -1
- package/src/adapters/hosts.ts +51 -0
- package/src/adapters/lifecycle.ts +4 -2
- package/src/adapters/mcp/CONTRACT.md +26 -3
- package/src/adapters/mcp/INTERFACE-GAPS.md +11 -0
- package/src/adapters/mcp/NOTES.md +149 -0
- package/src/adapters/mcp/bin/serve.ts +83 -4
- package/src/adapters/mcp/chat-wake.ts +111 -0
- package/src/adapters/mcp/deliberate.ts +5 -2
- package/src/adapters/mcp/index.ts +3 -1
- package/src/adapters/mcp/nights.ts +434 -9
- package/src/adapters/mcp/protocol.ts +11 -2
- package/src/adapters/mcp/server-args.ts +6 -0
- package/src/adapters/mcp/server-options.ts +19 -2
- package/src/adapters/mcp/server-self-tools.ts +23 -8
- package/src/adapters/mcp/server-session-end.ts +5 -3
- package/src/adapters/mcp/server-words.ts +218 -4
- package/src/adapters/mcp/server.ts +524 -56
- package/src/adapters/mcp/tools.ts +266 -12
- package/src/adapters/mechanism-evidence.ts +90 -15
- package/src/adapters/owned-names.ts +105 -0
- package/src/adapters/plugin.ts +34 -7
- package/src/adapters/private-base.ts +175 -0
- package/src/adapters/private-umask.ts +71 -0
- package/src/adapters/remote/CONTRACT.md +75 -0
- package/src/adapters/remote/INTERFACE-GAPS.md +20 -0
- package/src/adapters/remote/NOTES.md +80 -0
- package/src/adapters/remote/bin/serve-http.ts +258 -0
- package/src/adapters/remote/call-log.ts +206 -0
- package/src/adapters/remote/http.ts +500 -0
- package/src/adapters/sessions.ts +121 -7
- package/src/adapters/snapshots.ts +3 -3
- package/src/adapters/spawn.ts +13 -6
- package/src/adapters/update-check.ts +870 -0
- package/src/adapters/update-words.ts +230 -0
- package/src/core/counterpart-deposit.ts +35 -2
- package/src/core/counterpart-sweep.ts +7 -1
- package/src/core/counterpart-types.ts +7 -0
- package/src/core/counterpart.ts +185 -23
- package/src/core/coverage/CONTRACT.md +12 -5
- package/src/core/coverage/NOTES.md +40 -1
- package/src/core/coverage/index.ts +73 -14
- package/src/core/coverage/tunables.ts +15 -1
- package/src/core/dream/CONTRACT.md +47 -9
- package/src/core/dream/NOTES.md +115 -0
- package/src/core/dream/index.ts +51 -6
- package/src/core/dream/recalled.ts +90 -0
- package/src/core/dream/reflect.ts +156 -25
- package/src/core/dream/tunables.ts +61 -0
- package/src/core/handoff/CONTRACT.md +8 -1
- package/src/core/handoff/NOTES.md +52 -0
- package/src/core/handoff/last-here.ts +52 -0
- package/src/core/mint.ts +8 -1
- package/src/core/onboarding.ts +35 -8
- package/src/core/recall/CONTRACT.md +11 -0
- package/src/core/reconsolidation.ts +2 -1
- package/src/core/remember/CONTRACT.md +2 -1
- package/src/core/remember/owes.ts +7 -1
- package/src/core/remember/proposals.ts +41 -1
- package/src/core/schemas/CONTRACT.md +4 -2
- package/src/core/self/INTERFACE-GAPS.md +20 -0
- package/src/core/self/briefing.ts +37 -1
- package/src/core/self/identity.ts +54 -4
- package/src/core/self/index.ts +69 -4
- package/src/core/self/work.ts +20 -0
- package/src/core/self/writer.ts +15 -1
- package/src/core/store/CONTRACT.md +28 -2
- package/src/core/store/NOTES.md +97 -2
- package/src/core/store/db.ts +24 -1
- package/src/core/store/index.ts +28 -2
- package/src/core/store/operational.ts +37 -1
- package/src/core/store/pre-migration.ts +6 -2
- package/src/core/store/private.ts +319 -0
- package/src/core/store/shapes.ts +6 -0
- package/src/core/types.ts +28 -0
- package/tools/install-loop/run.sh +3 -0
|
@@ -111,7 +111,7 @@ import { CORE_ASK_LOOKBACK, coreAsks, coreHow, coreSentence, unsettledPairOf } f
|
|
|
111
111
|
import { joinHow, joinProposalOf, joinSentence, pairKey, proposeJoin } from "./project-ask.js";
|
|
112
112
|
import type { JoinProposal } from "./project-ask.js";
|
|
113
113
|
import type { CoreAsk, CoreDecided } from "./core-ask.js";
|
|
114
|
-
import { THREAD_CLOSED_BY_META_KEY, THREAD_REOPENED_BY_META_KEY, UNRESOLVED_META_KEY } from "../mint.js";
|
|
114
|
+
import { settlesWhenOf, THREAD_CLOSED_BY_META_KEY, THREAD_REOPENED_BY_META_KEY, UNRESOLVED_META_KEY } from "../mint.js";
|
|
115
115
|
import type { SettleOutcome } from "../reconsolidation.js";
|
|
116
116
|
|
|
117
117
|
/** Every `reflect` knob, in one place. Working defaults of 2026-09-27; CAL = not yet measured. */
|
|
@@ -238,6 +238,21 @@ export const REFLECT_TUNABLES = {
|
|
|
238
238
|
STALE_OPEN_DAYS: 4,
|
|
239
239
|
STALE_OPEN: 5,
|
|
240
240
|
STALE_OPEN_REST_NIGHTS: 3,
|
|
241
|
+
/**
|
|
242
|
+
* OPEN ITEMS THAT NAME WHAT WOULD SETTLE THEM (2026-10-27, S1; Ames's idea,
|
|
243
|
+
* lightly held): at most this many carried open items with a `settlesWhen`,
|
|
244
|
+
* touched lately or not, shown with it (`settlesOpen`), so the night can
|
|
245
|
+
* close one whose trigger plainly happened — the stale-thread case, where the
|
|
246
|
+
* page moved on and the thread did not. Same doors as `staleOpen`: `closeNow`
|
|
247
|
+
* with a why, `close` to ask. Their closes and asks are on top of
|
|
248
|
+
* `STALE_OPEN`'s. Rotated the same way. CAL.
|
|
249
|
+
*/
|
|
250
|
+
SETTLES_OPEN: 8,
|
|
251
|
+
/**
|
|
252
|
+
* At most this many `settlesOpen` items closed or asked a night (review of
|
|
253
|
+
* #665): on top of `STALE_OPEN`'s, counted apart from them. CAL.
|
|
254
|
+
*/
|
|
255
|
+
SETTLES_CLOSE: 3,
|
|
241
256
|
/** The characters of one self-close's why (2026-10-20); longer is kept to it, and said. */
|
|
242
257
|
CLOSE_WHY_CHARS: 300,
|
|
243
258
|
/** Feelings shown per memory, and the characters of each one's carried_by. */
|
|
@@ -413,7 +428,15 @@ export interface ReflectBundle {
|
|
|
413
428
|
* `reopened`: the owner reopened it after a reflection closed it, so it may
|
|
414
429
|
* only be asked about. Empty when none.
|
|
415
430
|
*/
|
|
416
|
-
readonly staleOpen: readonly { readonly id: string; readonly text: string; readonly untouched: number; readonly reopened?: true }[];
|
|
431
|
+
readonly staleOpen: readonly { readonly id: string; readonly text: string; readonly untouched: number; readonly reopened?: true; readonly settlesWhen?: string }[];
|
|
432
|
+
/**
|
|
433
|
+
* OPEN ITEMS THAT NAME WHAT WOULD SETTLE THEM (2026-10-27, S1): carried open
|
|
434
|
+
* threads with a `settlesWhen`, not already in `staleOpen`, touched lately
|
|
435
|
+
* or not — a line each, the phrase, and how many lived days untouched. The
|
|
436
|
+
* same `closeNow` and `close` take their ids: closed when a memory plainly
|
|
437
|
+
* shows the trigger happened, asked when unsure. Absent when none.
|
|
438
|
+
*/
|
|
439
|
+
readonly settlesOpen?: readonly { readonly id: string; readonly text: string; readonly settlesWhen: string; readonly untouched: number; readonly reopened?: true }[];
|
|
417
440
|
/**
|
|
418
441
|
* NO LONGER CARRIED (2026-10-22, the open-threads brief): how many open
|
|
419
442
|
* threads stopped being carried since the last reflection whose share reached a session —
|
|
@@ -638,12 +661,13 @@ export interface ReflectFinish {
|
|
|
638
661
|
readonly carried_by?: string;
|
|
639
662
|
}[];
|
|
640
663
|
readonly model?: string | null;
|
|
641
|
-
/** Stale open threads it thinks are done (2026-10-16, #489 D): ids from `staleOpen` only. Proposed, never closed here. */
|
|
664
|
+
/** Stale open threads it thinks are done (2026-10-16, #489 D): ids from `staleOpen` or `settlesOpen` (S1) only. Proposed, never closed here. */
|
|
642
665
|
readonly close?: readonly string[];
|
|
643
666
|
/**
|
|
644
667
|
* Stale open threads plainly done (2026-10-20, an experiment): ids from
|
|
645
|
-
* `staleOpen` only, each with `why` (what shows it
|
|
646
|
-
* `shows` (the memory that does). Closed here, and
|
|
668
|
+
* `staleOpen` or `settlesOpen` (S1) only, each with `why` (what shows it
|
|
669
|
+
* done) and, ideally, `shows` (the memory that does). Closed here, and
|
|
670
|
+
* said in the share.
|
|
647
671
|
*/
|
|
648
672
|
readonly closeNow?: readonly { readonly id?: string; readonly why?: string; readonly shows?: string }[];
|
|
649
673
|
/** The session's directory. (It once fed a folder check on closing; that went with the yours/guest split, 2026-10-21.) */
|
|
@@ -668,6 +692,8 @@ export interface SelfClose {
|
|
|
668
692
|
readonly id: string;
|
|
669
693
|
readonly why: string;
|
|
670
694
|
readonly shows?: string;
|
|
695
|
+
/** A settles close on weak evidence (review of #665): what was weak, said in the share. */
|
|
696
|
+
readonly weak?: string;
|
|
671
697
|
}
|
|
672
698
|
|
|
673
699
|
/**
|
|
@@ -893,7 +919,7 @@ export class Reflections {
|
|
|
893
919
|
// offered to mark, an empty list included — until then an empty offer
|
|
894
920
|
// wrote no key, and 10-10 to 10-23 read as silence, not as "offered 0".
|
|
895
921
|
this.store.updateReflection(id, {
|
|
896
|
-
detail: { ...(packed.later.length > 0 ? { parts: packed.later } : {}), fit: fitRecord, lanes, ...(composed.chaptersAs === undefined ? {} : { chaptersAs: composed.chaptersAs }), ...beliefsDetail(composed.beliefs ?? null), ...(composed.spine === undefined ? {} : { spine: composed.spine.map((b) => b.id) }), unmarked: composed.unmarked, ...(composed.staleOpen.length > 0 ? { staleOpen: composed.staleOpen.map((x) => x.id) } : {}), ...(fitted.notCarried.length > 0 ? { notCarried: fitted.notCarried } : {}), ...(composed.reconsidering.length > 0 ? { coreOffered: composed.reconsidering.map((x) => x.id) } : {}) },
|
|
922
|
+
detail: { ...(packed.later.length > 0 ? { parts: packed.later } : {}), fit: fitRecord, lanes, ...(composed.chaptersAs === undefined ? {} : { chaptersAs: composed.chaptersAs }), ...beliefsDetail(composed.beliefs ?? null), ...(composed.spine === undefined ? {} : { spine: composed.spine.map((b) => b.id) }), unmarked: composed.unmarked, ...(composed.staleOpen.length > 0 ? { staleOpen: composed.staleOpen.map((x) => x.id) } : {}), ...((composed.settlesOpen ?? []).length > 0 ? { settlesOpen: (composed.settlesOpen ?? []).map((x) => x.id) } : {}), ...(fitted.notCarried.length > 0 ? { notCarried: fitted.notCarried } : {}), ...(composed.reconsidering.length > 0 ? { coreOffered: composed.reconsidering.map((x) => x.id) } : {}) },
|
|
897
923
|
});
|
|
898
924
|
writeIndex(this.store, "reflection", { ref: id, at: this.store.now(), offered: fitted.offered, looked: [], lineCap: fitted.lineCap, ...(aliases === null ? {} : { aliases: aliases.toJSON() }) });
|
|
899
925
|
this.record("reflection.begun", id, { dream: dreamId, shown: shown.length, ...fitRecord });
|
|
@@ -1113,6 +1139,8 @@ export class Reflections {
|
|
|
1113
1139
|
/** How to answer, in plain words (returned beside the bundle). */
|
|
1114
1140
|
private instructions(id: string, session: string, bundle: ReflectBundle): string {
|
|
1115
1141
|
const who = bundle.owner ?? "the owner";
|
|
1142
|
+
// Stale threads that name what would settle them (S1), for the wording's number.
|
|
1143
|
+
const staleNamed = bundle.staleOpen.filter((x) => x.settlesWhen !== undefined).length;
|
|
1116
1144
|
const L = REFLECT_TUNABLES.LIMITS;
|
|
1117
1145
|
const open = acceptsReflectedFeeling(this.store);
|
|
1118
1146
|
// THE PAGE, LEANING TOWARD WRITING (owner, 2026-09-29): he would like a
|
|
@@ -1202,9 +1230,17 @@ export class Reflections {
|
|
|
1202
1230
|
// CLOSE WHAT IS PLAINLY DONE, ASK THE REST (2026-10-20, an
|
|
1203
1231
|
// experiment agreed with Mike): the clear ones close tonight and
|
|
1204
1232
|
// the share says so; the unsure ones are asked, as before.
|
|
1205
|
-
`- closeNow and close (optional, ids from staleOpen only): staleOpen lists ${String(bundle.staleOpen.length)} open ${bundle.staleOpen.length === 1 ? "thread" : "threads"} nobody has touched for a while (untouched: lived days). Most are open only because nobody closed them. Read one whole with recall first if its line is not enough.`,
|
|
1233
|
+
`- closeNow and close (optional, ids from staleOpen${(bundle.settlesOpen ?? []).length > 0 ? " or settlesOpen" : ""} only): staleOpen lists ${String(bundle.staleOpen.length)} open ${bundle.staleOpen.length === 1 ? "thread" : "threads"} nobody has touched for a while (untouched: lived days). Most are open only because nobody closed them. Read one whole with recall first if its line is not enough.`,
|
|
1206
1234
|
` closeNow: the ones a memory you have read plainly shows finished — each {id, why: what shows it done, in a line, shows: the id of the memory that shows it}. They close tonight; your share says which, and ${who} can have one reopened.`,
|
|
1207
|
-
` close: the ones that look done but you are not sure of — ids only. Nothing closes: your share asks ${who}, and a yes closes them. When in doubt, ask rather than close; never close one just because it is old, and leave out one you have no view on.${bundle.staleOpen.some((x) => x.reopened === true) ? ` One marked reopened was reopened by ${who} after a reflection closed it: ask, never close.` : ""}`,
|
|
1235
|
+
` close: the ones that look done but you are not sure of — ids only. Nothing closes: your share asks ${who}, and a yes closes them. When in doubt, ask rather than close; never close one just because it is old, and leave out one you have no view on.${bundle.staleOpen.some((x) => x.reopened === true) ? ` One marked reopened was reopened by ${who} after a reflection closed it: ask, never close.` : ""}${staleNamed === 0 ? "" : staleNamed === 1 ? " The one with settlesWhen names what would settle it: close it when a memory shows that happened." : " The ones with settlesWhen name what would settle them: close one when a memory shows that happened."}`,
|
|
1236
|
+
]
|
|
1237
|
+
: []),
|
|
1238
|
+
// WHAT WOULD SETTLE IT (2026-10-27, S1; Ames's idea): open items that
|
|
1239
|
+
// name their trigger, touched lately or not — the night closes one whose
|
|
1240
|
+
// trigger plainly happened, through the same doors.
|
|
1241
|
+
...((bundle.settlesOpen ?? []).length > 0
|
|
1242
|
+
? [
|
|
1243
|
+
`- settlesOpen (optional; the same closeNow and close take these ids): ${String((bundle.settlesOpen ?? []).length)} open ${(bundle.settlesOpen ?? []).length === 1 ? "item names" : "items name"} what would settle ${(bundle.settlesOpen ?? []).length === 1 ? "it" : "them"} (settlesWhen) — an answer someone owes, a decision, an event. If a memory you have read plainly shows that it happened (the answer came, the decision was made, the event it waited on is past), closeNow it: {id, why: what happened, shows: the memory that shows it — a later one, not the item itself}. At most ${String(REFLECT_TUNABLES.SETTLES_CLOSE)} of these close or are asked a night. If it may have happened and you are not sure, put its id in close and your share asks ${who}. If nothing shows it, leave it open: a trigger not yet met is no reason to close, and age is none either.${(bundle.settlesOpen ?? []).some((x) => x.reopened === true) ? ` One marked reopened was reopened by ${who}: ask, never close.` : ""}`,
|
|
1208
1244
|
]
|
|
1209
1245
|
: []),
|
|
1210
1246
|
// NO LONGER CARRIED (2026-10-22, the open-threads brief): the count, once, never the list.
|
|
@@ -1822,7 +1858,10 @@ export class Reflections {
|
|
|
1822
1858
|
// in the share with the way back (`reopen`); one the owner reopened is
|
|
1823
1859
|
// only ever asked again. Both ride in the share, so a share already told
|
|
1824
1860
|
// or carried takes neither, and together they keep to `STALE_OPEN`.
|
|
1825
|
-
|
|
1861
|
+
// The open items that named what would settle them (S1, 2026-10-27) take
|
|
1862
|
+
// the same doors, and add their own room to the night's limit.
|
|
1863
|
+
const offeredSettles = stringIds(parseDetail(row.detail)["settlesOpen"]);
|
|
1864
|
+
const offeredStale = new Set([...stringIds(parseDetail(row.detail)["staleOpen"]), ...offeredSettles]);
|
|
1826
1865
|
const priorProposed = stringIds(prior["closeProposed"]);
|
|
1827
1866
|
const priorSelfClosed = selfClosedOf(prior["selfClosed"]);
|
|
1828
1867
|
const proposed = [...priorProposed];
|
|
@@ -1831,7 +1870,12 @@ export class Reflections {
|
|
|
1831
1870
|
const closeNotes: string[] = [];
|
|
1832
1871
|
let askedInstead = 0;
|
|
1833
1872
|
const isClosed = (cid: string): boolean => priorSelfClosed.some((x) => x.id === cid) || toClose.some((x) => x.id === cid);
|
|
1834
|
-
|
|
1873
|
+
// Two allowances, counted apart (review of #665): the stale list's
|
|
1874
|
+
// `STALE_OPEN`, and at most `SETTLES_CLOSE` of the settles list's.
|
|
1875
|
+
const settlesOnly = new Set(offeredSettles.filter((x) => !stringIds(parseDetail(row.detail)["staleOpen"]).includes(x)));
|
|
1876
|
+
const spentOn = (settles: boolean): number =>
|
|
1877
|
+
[...proposed, ...priorSelfClosed.map((x) => x.id), ...toClose.map((x) => x.id)].filter((x) => settlesOnly.has(x) === settles).length;
|
|
1878
|
+
const full = (cid: string): boolean => (settlesOnly.has(cid) ? spentOn(true) >= T.SETTLES_CLOSE : spentOn(false) >= T.STALE_OPEN);
|
|
1835
1879
|
// Still open and showable here: the prose read, as the wake reads it.
|
|
1836
1880
|
const stillOpen = (cid: string): { row: MemoryRow; meta: Record<string, unknown> } | null => {
|
|
1837
1881
|
const r = this.store.row(cid);
|
|
@@ -1865,7 +1909,7 @@ export class Reflections {
|
|
|
1865
1909
|
closeRefused.push({ id: cid, reason: `share-already-${row.share_state}` });
|
|
1866
1910
|
continue;
|
|
1867
1911
|
}
|
|
1868
|
-
if (full()) {
|
|
1912
|
+
if (full(cid)) {
|
|
1869
1913
|
closeRefused.push({ id: cid, reason: "limit" });
|
|
1870
1914
|
continue;
|
|
1871
1915
|
}
|
|
@@ -1904,7 +1948,12 @@ export class Reflections {
|
|
|
1904
1948
|
const shows = showsId.length > 0 && this.store.row(showsId) !== undefined ? showsId : null;
|
|
1905
1949
|
if (showsId.length > 0 && shows === null) closeNotes.push(`${cid}: shows ${showsId} is not a memory, so only the why is kept.`);
|
|
1906
1950
|
if (why.cut) closeNotes.push(`${cid}: its why was kept to its first ${String(T.CLOSE_WHY_CHARS)} characters.`);
|
|
1907
|
-
|
|
1951
|
+
// WEAK EVIDENCE, SAID (review of #665; warn, don't refuse): a settles
|
|
1952
|
+
// close whose `shows` is missing, is the item itself, or is older than
|
|
1953
|
+
// the item still closes, and the share says so, so the owner can reopen.
|
|
1954
|
+
const weak = offeredSettles.includes(cid) ? this.weakShows(open.row, shows) : null;
|
|
1955
|
+
if (weak !== null) closeNotes.push(`${cid}: closed, but ${weak}; the share says so.`);
|
|
1956
|
+
toClose.push({ id: cid, why: why.text.replace(/\s+/g, " "), ...(shows === null ? {} : { shows }), ...(weak === null ? {} : { weak }) });
|
|
1908
1957
|
}
|
|
1909
1958
|
for (const cid of [...new Set(input.close ?? [])]) {
|
|
1910
1959
|
if (typeof cid !== "string") continue;
|
|
@@ -1917,7 +1966,7 @@ export class Reflections {
|
|
|
1917
1966
|
closeRefused.push({ id: cid, reason: `share-already-${row.share_state}` });
|
|
1918
1967
|
continue;
|
|
1919
1968
|
}
|
|
1920
|
-
if (full()) {
|
|
1969
|
+
if (full(cid)) {
|
|
1921
1970
|
closeRefused.push({ id: cid, reason: "limit" });
|
|
1922
1971
|
continue;
|
|
1923
1972
|
}
|
|
@@ -2080,6 +2129,9 @@ export class Reflections {
|
|
|
2080
2129
|
// The stale open list it was shown, and what it proposed closing (2026-10-16).
|
|
2081
2130
|
const offeredStaleList = parseDetail(row.detail)["staleOpen"];
|
|
2082
2131
|
if (Array.isArray(offeredStaleList)) detail["staleOpen"] = offeredStaleList;
|
|
2132
|
+
// And the open items offered for what would settle them (S1): the next nights' rotation reads it.
|
|
2133
|
+
const offeredSettlesList = parseDetail(row.detail)["settlesOpen"];
|
|
2134
|
+
if (Array.isArray(offeredSettlesList)) detail["settlesOpen"] = offeredSettlesList;
|
|
2083
2135
|
// The open threads not carried that night (2026-10-22): the next night counts only what is new.
|
|
2084
2136
|
const notCarriedList = parseDetail(row.detail)["notCarried"];
|
|
2085
2137
|
if (Array.isArray(notCarriedList)) detail["notCarried"] = notCarriedList;
|
|
@@ -3131,6 +3183,8 @@ export class Reflections {
|
|
|
3131
3183
|
// `STALE_OPEN_DAYS` lived days, the longest untouched first, rotated like
|
|
3132
3184
|
// the unmarked offer — a line each, offered to be proposed closed.
|
|
3133
3185
|
const staleOpen = this.staleOpen(id, day, see);
|
|
3186
|
+
// And the open items that name what would settle them (S1, 2026-10-27).
|
|
3187
|
+
const settlesOpen = this.settlesOpen(id, day, see, new Set(staleOpen.map((x) => x.id)));
|
|
3134
3188
|
const uncarried = this.noLongerCarried(id, day);
|
|
3135
3189
|
// THE OFFER'S OWN ROOM (2026-10-11, the about-marks review): exactly what
|
|
3136
3190
|
// the offered ids cost as lines, held back from the shared room — so a
|
|
@@ -3236,7 +3290,8 @@ export class Reflections {
|
|
|
3236
3290
|
wireChars(dreamed?.journal ?? "") +
|
|
3237
3291
|
earlier.reduce((n, e) => n + wireChars(e.entry), 0) +
|
|
3238
3292
|
dreamSaw.reduce((n, s) => n + wireChars(s.text) + 30, 0) +
|
|
3239
|
-
staleOpen.reduce((n, s) => n + wireChars(s.text) + 40, 0) +
|
|
3293
|
+
staleOpen.reduce((n, s) => n + wireChars(s.text) + wireChars(s.settlesWhen ?? "") + 40, 0) +
|
|
3294
|
+
settlesOpen.reduce((n, s) => n + wireChars(s.text) + wireChars(s.settlesWhen) + 40, 0) +
|
|
3240
3295
|
(beliefs === null ? 0 : wireChars(JSON.stringify(beliefs))) +
|
|
3241
3296
|
(spine === null ? 0 : wireChars(JSON.stringify(spine)));
|
|
3242
3297
|
const avail = Math.max(0, T.ROOM_CHARS - spent - REFLECT_FURNITURE);
|
|
@@ -3337,6 +3392,7 @@ export class Reflections {
|
|
|
3337
3392
|
feelingWeeks: weeks === null ? null : { ...weeks, restsOn: weeksRest.filter(kept) },
|
|
3338
3393
|
unmarked: unmarkedIds.filter(kept),
|
|
3339
3394
|
staleOpen,
|
|
3395
|
+
...(settlesOpen.length > 0 ? { settlesOpen } : {}),
|
|
3340
3396
|
...(uncarried.fresh > 0 ? { noLongerCarried: uncarried.fresh } : {}),
|
|
3341
3397
|
// Off, the bundle is as it was before beliefs: no key at all.
|
|
3342
3398
|
...(beliefs === null ? {} : { beliefs }),
|
|
@@ -3743,9 +3799,9 @@ export class Reflections {
|
|
|
3743
3799
|
id: string,
|
|
3744
3800
|
day: number,
|
|
3745
3801
|
see: (mid: string) => { row: MemoryRow; whole: string; line: string } | null,
|
|
3746
|
-
): { id: string; text: string; untouched: number; reopened?: true }[] {
|
|
3802
|
+
): { id: string; text: string; untouched: number; reopened?: true; settlesWhen?: string }[] {
|
|
3747
3803
|
const T = REFLECT_TUNABLES;
|
|
3748
|
-
const found: { id: string; text: string; untouched: number; reopened?: true }[] = [];
|
|
3804
|
+
const found: { id: string; text: string; untouched: number; reopened?: true; settlesWhen?: string }[] = [];
|
|
3749
3805
|
// Only the open threads still carried (2026-10-22, `self/identity.ts#openCarry`,
|
|
3750
3806
|
// the wake's own rule and its one test of what a thread is — not dreamed,
|
|
3751
3807
|
// not settled over, the flag confirmed on the prose): one nobody touched
|
|
@@ -3759,23 +3815,74 @@ export class Reflections {
|
|
|
3759
3815
|
const untouched = day - Math.max(v.row.birth_day, v.row.last_used_day);
|
|
3760
3816
|
if (untouched < T.STALE_OPEN_DAYS) continue;
|
|
3761
3817
|
let reopened = false;
|
|
3818
|
+
let settles: string | null = null;
|
|
3762
3819
|
try {
|
|
3763
3820
|
// Reopened by the owner after a reflection closed it (2026-10-20): it may only be asked about.
|
|
3764
|
-
|
|
3821
|
+
const meta = this.store.readProse(mid).meta;
|
|
3822
|
+
reopened = typeof meta[THREAD_REOPENED_BY_META_KEY] === "string";
|
|
3823
|
+
// What would settle it, when named (S1, 2026-10-27).
|
|
3824
|
+
settles = settlesWhenOf(meta);
|
|
3765
3825
|
} catch {
|
|
3766
3826
|
continue;
|
|
3767
3827
|
}
|
|
3768
|
-
found.push({ id: mid, text: v.line, untouched, ...(reopened ? { reopened: true as const } : {}) });
|
|
3828
|
+
found.push({ id: mid, text: v.line, untouched, ...(reopened ? { reopened: true as const } : {}), ...(settles === null ? {} : { settlesWhen: settles }) });
|
|
3769
3829
|
}
|
|
3830
|
+
found.sort((a, b) => b.untouched - a.untouched || (a.id < b.id ? -1 : 1));
|
|
3831
|
+
return this.rotated(id, "staleOpen", found).slice(0, T.STALE_OPEN);
|
|
3832
|
+
}
|
|
3833
|
+
|
|
3834
|
+
/** What the last few reflections were offered under `key` waits behind the rest (the unmarked offer's rotation). */
|
|
3835
|
+
private rotated<X extends { id: string }>(id: string, key: "staleOpen" | "settlesOpen", found: readonly X[]): X[] {
|
|
3836
|
+
const T = REFLECT_TUNABLES;
|
|
3770
3837
|
const lately = new Set(
|
|
3771
3838
|
this.store
|
|
3772
3839
|
.reflections({ limit: T.STALE_OPEN_REST_NIGHTS + 1 })
|
|
3773
3840
|
.filter((r) => r.id !== id)
|
|
3774
3841
|
.slice(0, T.STALE_OPEN_REST_NIGHTS)
|
|
3775
|
-
.flatMap((r) => stringIds(parseDetail(r.detail)[
|
|
3842
|
+
.flatMap((r) => stringIds(parseDetail(r.detail)[key])),
|
|
3776
3843
|
);
|
|
3844
|
+
return [...found.filter((x) => !lately.has(x.id)), ...found.filter((x) => lately.has(x.id))];
|
|
3845
|
+
}
|
|
3846
|
+
|
|
3847
|
+
/**
|
|
3848
|
+
* OPEN ITEMS THAT NAME WHAT WOULD SETTLE THEM (2026-10-27, S1; Ames's idea:
|
|
3849
|
+
* "an open question needs either a trigger or a decision to let it go"):
|
|
3850
|
+
* the carried open threads (`openCarry`, as `staleOpen` reads them) with a
|
|
3851
|
+
* `meta.settlesWhen`, showable here, not already offered as stale (`skip`),
|
|
3852
|
+
* touched lately or not — a thread whose trigger just happened is usually
|
|
3853
|
+
* not stale. The longest untouched first, rotated like `staleOpen`. At
|
|
3854
|
+
* most `SETTLES_OPEN`. Being offered is not a touch.
|
|
3855
|
+
*/
|
|
3856
|
+
private settlesOpen(
|
|
3857
|
+
id: string,
|
|
3858
|
+
day: number,
|
|
3859
|
+
see: (mid: string) => { row: MemoryRow; whole: string; line: string } | null,
|
|
3860
|
+
skip: ReadonlySet<string>,
|
|
3861
|
+
): { id: string; text: string; settlesWhen: string; untouched: number; reopened?: true }[] {
|
|
3862
|
+
const T = REFLECT_TUNABLES;
|
|
3863
|
+
const found: { id: string; text: string; settlesWhen: string; untouched: number; reopened?: true }[] = [];
|
|
3864
|
+
const carry = openCarry(this.store, day, SELF_TUNABLES.OPEN_CARRY_DAYS, SELF_TUNABLES.OPEN_CARRY_GLIMPSE_TOUCH);
|
|
3865
|
+
for (const mid of carry.carried) {
|
|
3866
|
+
if (skip.has(mid)) continue;
|
|
3867
|
+
let meta: Record<string, unknown>;
|
|
3868
|
+
try {
|
|
3869
|
+
meta = this.store.readProse(mid).meta;
|
|
3870
|
+
} catch {
|
|
3871
|
+
continue;
|
|
3872
|
+
}
|
|
3873
|
+
const settles = settlesWhenOf(meta);
|
|
3874
|
+
if (settles === null) continue;
|
|
3875
|
+
const v = see(mid);
|
|
3876
|
+
if (v === null) continue;
|
|
3877
|
+
// From the lived day AFTER it was written (review of #665): the
|
|
3878
|
+
// conversation that raised it is never its own evidence.
|
|
3879
|
+
if (v.row.birth_day >= day) continue;
|
|
3880
|
+
const untouched = Math.max(0, day - Math.max(v.row.birth_day, v.row.last_used_day));
|
|
3881
|
+
const reopened = typeof meta[THREAD_REOPENED_BY_META_KEY] === "string";
|
|
3882
|
+
found.push({ id: mid, text: v.line, settlesWhen: settles, untouched, ...(reopened ? { reopened: true as const } : {}) });
|
|
3883
|
+
}
|
|
3777
3884
|
found.sort((a, b) => b.untouched - a.untouched || (a.id < b.id ? -1 : 1));
|
|
3778
|
-
return
|
|
3885
|
+
return this.rotated(id, "settlesOpen", found).slice(0, T.SETTLES_OPEN);
|
|
3779
3886
|
}
|
|
3780
3887
|
|
|
3781
3888
|
/**
|
|
@@ -3803,15 +3910,33 @@ export class Reflections {
|
|
|
3803
3910
|
return out.join(" ");
|
|
3804
3911
|
}
|
|
3805
3912
|
|
|
3913
|
+
/**
|
|
3914
|
+
* WHAT WAS WEAK ABOUT A SETTLES CLOSE'S EVIDENCE (review of #665), in the
|
|
3915
|
+
* share's words, or null when `shows` names a memory written after the item:
|
|
3916
|
+
* none named, the item itself, or a memory older than the item (by its
|
|
3917
|
+
* moment when both have one, else its lived day).
|
|
3918
|
+
*/
|
|
3919
|
+
private weakShows(item: MemoryRow, shows: string | null): string | null {
|
|
3920
|
+
if (shows === null) return "I named no memory that shows it";
|
|
3921
|
+
if (shows === item.id) return "the memory I pointed to is the open item itself";
|
|
3922
|
+
const r = this.store.row(shows);
|
|
3923
|
+
if (r === undefined) return "I named no memory that shows it";
|
|
3924
|
+
const older = r.created_at !== null && item.created_at !== null ? r.created_at < item.created_at : r.birth_day < item.birth_day;
|
|
3925
|
+
return older ? "the memory I pointed to is older than the open item" : null;
|
|
3926
|
+
}
|
|
3927
|
+
|
|
3806
3928
|
/**
|
|
3807
3929
|
* THE SHARE'S OPEN-THREAD LINES (2026-10-20), generated like the became-core
|
|
3808
|
-
* line: what it closed itself, each with its why and the way back
|
|
3809
|
-
*
|
|
3930
|
+
* line: what it closed itself, each with its why and the way back — and,
|
|
3931
|
+
* for a settles close on weak evidence (S1), what was weak — then what it
|
|
3932
|
+
* asks about. Null when neither.
|
|
3810
3933
|
*/
|
|
3811
3934
|
private closeSentences(closed: readonly SelfClose[], asked: readonly string[]): string | null {
|
|
3812
3935
|
const lines: string[] = [];
|
|
3813
3936
|
if (closed.length > 0) {
|
|
3814
|
-
const named = closed
|
|
3937
|
+
const named = closed
|
|
3938
|
+
.map((x) => `"${this.handle(x.id)}" (${x.id}) — ${x.why.replace(/[\s.;:,!]+$/u, "")}${x.weak === undefined ? "" : ` (though ${x.weak})`}`)
|
|
3939
|
+
.join("; ");
|
|
3815
3940
|
lines.push(
|
|
3816
3941
|
closed.length === 1
|
|
3817
3942
|
? `I closed one open thread that looked done: ${named}. If it isn't, say so and I'll reopen it.`
|
|
@@ -4318,7 +4443,7 @@ function selfClosedOf(v: unknown): SelfClose[] {
|
|
|
4318
4443
|
const out: SelfClose[] = [];
|
|
4319
4444
|
for (const x of v) {
|
|
4320
4445
|
if (!isRecord(x) || typeof x["id"] !== "string" || typeof x["why"] !== "string") continue;
|
|
4321
|
-
out.push({ id: x["id"], why: x["why"], ...(typeof x["shows"] === "string" ? { shows: x["shows"] } : {}) });
|
|
4446
|
+
out.push({ id: x["id"], why: x["why"], ...(typeof x["shows"] === "string" ? { shows: x["shows"] } : {}), ...(typeof x["weak"] === "string" ? { weak: x["weak"] } : {}) });
|
|
4322
4447
|
}
|
|
4323
4448
|
return out;
|
|
4324
4449
|
}
|
|
@@ -4505,7 +4630,12 @@ function leanReflectLines(b: ReflectBundle, aliases: AliasMap): string[] {
|
|
|
4505
4630
|
out.push(`unmarked: ${list(b.unmarked)}`);
|
|
4506
4631
|
out.push("## staleOpen");
|
|
4507
4632
|
if (b.staleOpen.length === 0) out.push("none");
|
|
4508
|
-
for (const x of b.staleOpen) out.push(`- ${s(x.id)} · untouched ${String(x.untouched)}${x.reopened === true ? " · reopened" : ""} · ${x.text}`);
|
|
4633
|
+
for (const x of b.staleOpen) out.push(`- ${s(x.id)} · untouched ${String(x.untouched)}${x.reopened === true ? " · reopened" : ""} · ${x.text}${x.settlesWhen === undefined ? "" : ` · settlesWhen: ${x.settlesWhen}`}`);
|
|
4634
|
+
// Open items that name what would settle them (S1, 2026-10-27); no heading when none.
|
|
4635
|
+
if ((b.settlesOpen ?? []).length > 0) {
|
|
4636
|
+
out.push("## settlesOpen");
|
|
4637
|
+
for (const x of b.settlesOpen ?? []) out.push(`- ${s(x.id)} · untouched ${String(x.untouched)}${x.reopened === true ? " · reopened" : ""} · ${x.text} · settlesWhen: ${x.settlesWhen}`);
|
|
4638
|
+
}
|
|
4509
4639
|
if (b.noLongerCarried !== undefined) out.push(`noLongerCarried: ${String(b.noLongerCarried)}`);
|
|
4510
4640
|
if (b.beliefs !== undefined && b.beliefs !== null) {
|
|
4511
4641
|
out.push(`## beliefs (births ${String(b.beliefs.births)})`);
|
|
@@ -4530,6 +4660,7 @@ export function reflectBundleIds(b: ReflectBundle): string[] {
|
|
|
4530
4660
|
...Object.keys(b.memories),
|
|
4531
4661
|
// Named outside `memories`: the open threads offered to close, and what a dream's belief candidate cites.
|
|
4532
4662
|
...b.staleOpen.map((x) => x.id),
|
|
4663
|
+
...(b.settlesOpen ?? []).map((x) => x.id),
|
|
4533
4664
|
...(b.beliefs?.candidates ?? []).flatMap((c) => c.sources),
|
|
4534
4665
|
...b.chapters.map((c) => c.id),
|
|
4535
4666
|
];
|
|
@@ -11,6 +11,18 @@ export const DREAM_TUNABLES = {
|
|
|
11
11
|
* (undreamed, within reach) — a dream with nothing to replay is not
|
|
12
12
|
* worth his minutes. CAL. */
|
|
13
13
|
MIN_NEW: 3,
|
|
14
|
+
/**
|
|
15
|
+
* OWED WRITE-UPS COUNT AS NEW (S2, 2026-10-26; lightly held): when the gate
|
|
16
|
+
* says "too little new" and a night would start for its catch-up alone, each
|
|
17
|
+
* session from an earlier day still owing a write-up counts as one new
|
|
18
|
+
* memory toward `MIN_NEW` — the catch-up runs first in the night, so what it
|
|
19
|
+
* writes is in the dream's queue by the time the dream begins. A person who
|
|
20
|
+
* only checks in (a few short sessions a day, a remember or two) otherwise
|
|
21
|
+
* never gets a whole night. Read by the host (`claude-code/hooks.ts#
|
|
22
|
+
* catchUpWhenOwed`), which knows what is owed; a first day stays catch-up
|
|
23
|
+
* only (there is no night behind it to dream on). Revert: false.
|
|
24
|
+
*/
|
|
25
|
+
OWED_COUNTS_AS_NEW: true,
|
|
14
26
|
/** A store that has never dreamed reads its journal this many lived days back. */
|
|
15
27
|
FIRST_DREAM_DAYS: 7,
|
|
16
28
|
/**
|
|
@@ -345,6 +357,55 @@ export const DREAM_TUNABLES = {
|
|
|
345
357
|
PROJECT_JOIN_EXPIRE_DAYS: 3,
|
|
346
358
|
/** Reflections a pair is not asked about again after it was. CAL. */
|
|
347
359
|
PROJECT_JOIN_REST: 7,
|
|
360
|
+
|
|
361
|
+
// ── remembering a dream (D1, 2026-10-27) ─────────────────────────────────
|
|
362
|
+
/**
|
|
363
|
+
* A DREAM IS RECALLED BY WHAT IT WAS ABOUT (D1, 2026-10-27; Mike: "if humans
|
|
364
|
+
* remember it then so should counterparts, humans talk a lot about what they
|
|
365
|
+
* dreamed and think about it during the day"). A question that does NOT
|
|
366
|
+
* name dreaming reaches a journal only by MEANING, at or above this cosine
|
|
367
|
+
* (the higher of the question against the title and against each passage of
|
|
368
|
+
* the journal, `DREAM_RECALL_PASSAGE_CHARS` long), and at most
|
|
369
|
+
* `DREAM_RECALL_UNNAMED_MAX` of them. CAL on potion-base-8M@256, 10-27
|
|
370
|
+
* (NOTES "D1"): "keys" 0.74 and "locked doors" 0.47 against the ring-of-keys
|
|
371
|
+
* dream; the nearest ordinary misses 0.41 ("where did I leave my car keys"
|
|
372
|
+
* against a work dream) and 0.35 ("what did I say about my sister"). With
|
|
373
|
+
* no embedder, such a question reaches no dream (words alone pulled work
|
|
374
|
+
* dreams beside 6 of 8 ordinary questions, review of #645).
|
|
375
|
+
*/
|
|
376
|
+
DREAM_RECALL_MEANING_BAR: 0.45,
|
|
377
|
+
/** The most dreams a question that does not name dreaming carries. */
|
|
378
|
+
DREAM_RECALL_UNNAMED_MAX: 1,
|
|
379
|
+
/**
|
|
380
|
+
* A question that DOES name dreaming ("did you dream about the greenhouse?")
|
|
381
|
+
* reaches a journal by a shared content word (as since OL1b) or by the
|
|
382
|
+
* meaning of its content words once the dream words and the asking are out
|
|
383
|
+
* (`nights.ts#dreamlessQuestion`), at or above this cosine. Lower than the
|
|
384
|
+
* unnamed bar: the question already asks for a dream. CAL on
|
|
385
|
+
* potion-base-8M@256, 10-27: "greenhouse seedlings" 0.48 against its own
|
|
386
|
+
* dream, 0.14 against the keys dream; "keys" 0.74 / 0.20; "release" 0.51
|
|
387
|
+
* against a work dream, 0.12 against the keys dream.
|
|
388
|
+
*/
|
|
389
|
+
DREAM_RECALL_NAMED_FLOOR: 0.3,
|
|
390
|
+
/** How much of a journal one vector reads: under the static table's 512-token cap (~2,000 characters). */
|
|
391
|
+
DREAM_RECALL_PASSAGE_CHARS: 1_500,
|
|
392
|
+
/**
|
|
393
|
+
* FADING (D1, 2026-10-27; coordinator: "fast unless used, the way a human
|
|
394
|
+
* dream is gone by lunch unless someone tells it"). A question that does not
|
|
395
|
+
* name dreaming reaches a journal by what it was about only while the
|
|
396
|
+
* lived day is within its REACH of its last touch — the day it was dreamed, or the last lived day it was
|
|
397
|
+
* recalled or retold (`dream/recalled.ts`). The reach starts at this many
|
|
398
|
+
* lived days (the day after a dream is still in reach; the one after that
|
|
399
|
+
* is not) and is multiplied by `DREAM_RECALL_REACH_GROWTH` for every lived
|
|
400
|
+
* day it was touched, up to `DREAM_RECALL_REACH_MAX_DAYS`: spaced use keeps
|
|
401
|
+
* a dream, as it keeps a memory. A faded dream stays in the journal: a question
|
|
402
|
+
* that names dreaming, "last dream" and its id still reach it. Read at use.
|
|
403
|
+
*/
|
|
404
|
+
DREAM_RECALL_REACH_DAYS: 1,
|
|
405
|
+
/** The reach's growth for each lived day a dream was recalled or retold. CAL. */
|
|
406
|
+
DREAM_RECALL_REACH_GROWTH: 3,
|
|
407
|
+
/** The longest a dream's reach grows. CAL. */
|
|
408
|
+
DREAM_RECALL_REACH_MAX_DAYS: 90,
|
|
348
409
|
} as const;
|
|
349
410
|
|
|
350
411
|
export type DreamAction = keyof typeof DREAM_TUNABLES.LIMITS;
|
|
@@ -179,7 +179,14 @@ the fortnight: one to three lines, no row and no durable event (§5 G11).
|
|
|
179
179
|
HERE when its row's `origin_scope` says so (set at birth since 2026-09-30); with none,
|
|
180
180
|
when this directory's coverage file holds its chapter claim; failing both, when its
|
|
181
181
|
session's turn-ends are filed here — no new row type and no write. A removed row is
|
|
182
|
-
not read. A
|
|
182
|
+
not read. A LATER SESSION WITH NO CHAPTER (S2, 2026-10-26): when the folder's newest
|
|
183
|
+
session (not the reader, inside the same fortnight, with words still held here or a
|
|
184
|
+
memory of its own) is newer than every chapter here and wrote none anywhere, the line
|
|
185
|
+
names it first — "Last here: session …, <when>, no chapter — "<its newest memory>"
|
|
186
|
+
(mem_…)." (a night's write-up of it, or a note it made — filed in THIS folder only: a
|
|
187
|
+
session at work in two folders never has the other folder's memory quoted here, S2
|
|
188
|
+
review), or "…, no chapter, not written up yet." — and the newest chapter after it as "Before it" (`laterHereLadder`); the
|
|
189
|
+
narrowest rung is the session alone. A chapter puts the wake BEHIND (`self/behind.ts`, trigger `write-up`), so the
|
|
183
190
|
turn-end worker's refresh reserves the line's room on a store whose lanes fill the
|
|
184
191
|
ceiling. It is spliced above the handoff pointer and shares its reserve and share rule
|
|
185
192
|
(§6); the handoff is carried first. It is not a handoff: nothing retires it, and a
|
|
@@ -657,3 +657,55 @@ Undo: `git revert` of the PR; nothing is stored differently.
|
|
|
657
657
|
- The "Last said here" line and the recall handle are no longer owner-only: any
|
|
658
658
|
session in the folder gets them (the yours/guest split was removed). The line is
|
|
659
659
|
still not given under observer, whose handle stands down.
|
|
660
|
+
|
|
661
|
+
## 2026-10-26 — "Last here" names a later session with no chapter (S2)
|
|
662
|
+
|
|
663
|
+
The Dana week (0.3.36): a meeting chapter on day 1, then short sessions with none, and "Last
|
|
664
|
+
here" named the day-1 meeting until day 6 — true of the chapter, false as an account of who was
|
|
665
|
+
last here. A check-in rarely writes a chapter, so for the new first audience it was most days.
|
|
666
|
+
Now the newest session here, when it is newer than every chapter here and wrote none, is
|
|
667
|
+
named first; its newest live memory stands for what it was about (the night's second-hand
|
|
668
|
+
write-up of it, or a note it made in the moment — the smaller of the two true things, beside
|
|
669
|
+
"Last said here", which quotes its last words while they are inside a day), and the chapter is
|
|
670
|
+
"Before it". A session with nothing to show (only a turn-end filed here, no words held, no
|
|
671
|
+
memory) is passed over, at most `LATER_HERE_TRIED` (3) looked at. `chaptersHereFor` is
|
|
672
|
+
unchanged, so recall's "the most recent session" and the no-room row still mean the chapter.
|
|
673
|
+
H0 `checkins`: "Last here" named nothing all week before; after, every morning names the
|
|
674
|
+
previous check-in.
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
## 2026-10-26 — review of #636's follow-ups: headless runs, the line's room with no chapter
|
|
678
|
+
|
|
679
|
+
- **A session nobody attended is not the line's.** `WakeSession.headless` is the host's word
|
|
680
|
+
(Claude Code: the registry's `entrypoint` in `NON_INTERACTIVE_ENTRYPOINTS`, `sdk-cli` for
|
|
681
|
+
`claude -p`, the SDKs). The later-session walk passes one over before its `LATER_HERE_TRIED`
|
|
682
|
+
count, so a run of them cannot hide the person's session behind them. A session the registry
|
|
683
|
+
no longer knows (records are pruned at 7 days, the line's fortnight is 14) reads as a
|
|
684
|
+
person's: noise at worst, the direction `fired.ts#presentDays` takes too.
|
|
685
|
+
- **The reserve no longer waits for a chapter.** `handoffRoom` sized the line only when the
|
|
686
|
+
fortnight held a chapter; a later session with none now gets the same room, under the same
|
|
687
|
+
share rule. The boundary has no registry, so the reserve is a bound and counts a headless
|
|
688
|
+
session too. Measured at 9,000 B on a full-lanes fixture: the line had fitted before anyway,
|
|
689
|
+
in the slack of other reserves (the preface's worst case is 293 B against ~110 used, and an
|
|
690
|
+
unused "Last said here" bound), so this mostly stops it borrowing that room. When the line
|
|
691
|
+
is dropped, its no-room row now names the later session, not the older chapter or nothing.
|
|
692
|
+
- `sessionsHere(scope)` is read once per scope for the chapters and the later session both.
|
|
693
|
+
|
|
694
|
+
## 2026-10-26 — the later session's quote is never the night's (L2)
|
|
695
|
+
|
|
696
|
+
- **Night output is filed under the session the night launched in**, not the sessions it
|
|
697
|
+
read: a dream's gist, fold or merge (`origin_ref dream:…`) and a reflection's entry
|
|
698
|
+
(`reflection:…`). The S2 tier-2 week showed chapterless sessions quoted as "Reflected: …" /
|
|
699
|
+
"Dreamed: …" (d3s1, d4s2, d6s1). `laterHere` now passes over `isNightRow` rows, the same
|
|
700
|
+
test the privacy read uses, so the quote is the session's own note or its write-up (filed
|
|
701
|
+
under the session it writes up), else "not written up yet". The folder-only rule stands.
|
|
702
|
+
- **A session with only night rows and no words still held is passed over**, as one with
|
|
703
|
+
nothing captured always was ("something to show for it"); before, it was named with the
|
|
704
|
+
night's quote. Kept: a dream filed under it is nothing it said.
|
|
705
|
+
- A reflection a session makes by hand (the `reflect` tool) is filed the same way and is
|
|
706
|
+
skipped too: the rows carry no mark of who launched them. Telling the two apart would need
|
|
707
|
+
one (the reflection row's `dream_id` is the nearest); left for a later read of whether
|
|
708
|
+
hand reflections happen enough to matter.
|
|
709
|
+
- Harness (finding 6): night children's tokens are tallied by act (`recordUsage(output, act)`),
|
|
710
|
+
each night's asks carry their child's tokens, and `renderWeek` prints them per night, so a
|
|
711
|
+
model-seat week can say what each catch-up cost.
|
|
@@ -329,6 +329,58 @@ export function lastHereBlock(
|
|
|
329
329
|
return lines.map(flatten).join("\n");
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
+
/**
|
|
333
|
+
* A SESSION HERE NEWER THAN EVERY CHAPTER HERE, with none of its own (S2,
|
|
334
|
+
* 2026-10-26): what "Last here" names first when the folder's newest session
|
|
335
|
+
* left no chapter. Short check-ins rarely write one, and until this the line
|
|
336
|
+
* kept naming an older chapter — the Dana week's day-1 meeting, until day 6 —
|
|
337
|
+
* as if nothing had happened since.
|
|
338
|
+
*/
|
|
339
|
+
/** How many later sessions with no chapter are looked at, newest first, for
|
|
340
|
+
* one with something to show (words still held, or a memory). */
|
|
341
|
+
export const LATER_HERE_TRIED = 3;
|
|
342
|
+
|
|
343
|
+
export interface LaterHere {
|
|
344
|
+
readonly session: string;
|
|
345
|
+
/** `Oct 26 21:00–21:06`: when it was here. */
|
|
346
|
+
readonly when: string;
|
|
347
|
+
/**
|
|
348
|
+
* Its newest live memory — the night's second-hand write-up of it, or a
|
|
349
|
+
* note it made in the moment — by title (or first sentence) and id; null
|
|
350
|
+
* when nothing from it is written yet. Never a dream's or a reflection's
|
|
351
|
+
* own output, though a night files those under the session it launched in
|
|
352
|
+
* (L2, 2026-10-26). The id is the door to the rest.
|
|
353
|
+
*/
|
|
354
|
+
readonly memory: { readonly id: string; readonly title: string } | null;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* THE LINE FOR A LATER SESSION, widest first (`lastHereLadder`'s shape): the
|
|
359
|
+
* session with its newest memory and the chapter before it by title (`Before
|
|
360
|
+
* it:`, left out when the wake's body already names it, `named`), then the
|
|
361
|
+
* session alone. It says only what is true of it: no chapter, and what of it
|
|
362
|
+
* is written up — "Last said here" beside it quotes its last words while they
|
|
363
|
+
* are inside a day. Pure.
|
|
364
|
+
*/
|
|
365
|
+
export function laterHereLadder(
|
|
366
|
+
later: LaterHere,
|
|
367
|
+
before: LastHere | null,
|
|
368
|
+
reader: string | null = null,
|
|
369
|
+
said?: (id: string) => boolean,
|
|
370
|
+
): string[] {
|
|
371
|
+
const what =
|
|
372
|
+
later.memory === null
|
|
373
|
+
? ", no chapter, not written up yet."
|
|
374
|
+
: `, no chapter — "${excerpt(later.memory.title, LAST_HERE_TITLE_BYTES)}" (${later.memory.id}).`;
|
|
375
|
+
const head = flatten(`Last here: ${sessionWords(later.session, null, reader)}, ${later.when}${what}`);
|
|
376
|
+
const out: string[] = [];
|
|
377
|
+
if (before !== null && said?.(before.chapter.id) !== true) {
|
|
378
|
+
out.push(`${head}\n${flatten(`Before it: ${sessionWords(before.chapter.session, before.chapter.model, reader)}, ${before.when} ${named(before.chapter)}.`)}`);
|
|
379
|
+
}
|
|
380
|
+
out.push(head);
|
|
381
|
+
return out;
|
|
382
|
+
}
|
|
383
|
+
|
|
332
384
|
/** How many of yesterday's chapters the "Yesterday" line names by title. */
|
|
333
385
|
export const YESTERDAY_SHOWN = 4;
|
|
334
386
|
|
package/src/core/mint.ts
CHANGED
|
@@ -53,7 +53,7 @@ import { CUE_MODE_META, DATE_FROM_META, RECURRING_META } from "./prospective/ind
|
|
|
53
53
|
import type { Proposal } from "./remember/index.js";
|
|
54
54
|
import { isDay, isRecurrence, localDate } from "./time.js";
|
|
55
55
|
import type { AboutMark, AboutSetter, Store } from "./store/index.js";
|
|
56
|
-
import { SECOND_HAND_META_KEY, WRITTEN_UP_BY_META_KEY } from "./types.js";
|
|
56
|
+
import { SECOND_HAND_META_KEY, SETTLES_WHEN_META_KEY, settlesWhenOf, WRITTEN_UP_BY_META_KEY } from "./types.js";
|
|
57
57
|
import type { Band, Salience } from "./types.js";
|
|
58
58
|
|
|
59
59
|
/** The canonical prose meta key. One spelling, read by `sleep/dedup.ts`. */
|
|
@@ -64,6 +64,8 @@ export const UPDATES_META_KEY = "updates";
|
|
|
64
64
|
export const CLAIMED_DEFAULT_META_KEY = "claimedDefault";
|
|
65
65
|
/** An open loop is an ordinary memory with a flag (`remember/` CONTRACT §4). */
|
|
66
66
|
export const UNRESOLVED_META_KEY = "unresolved";
|
|
67
|
+
/** What would settle an open item (2026-10-27, S1): `types.ts#SETTLES_WHEN_META_KEY`. */
|
|
68
|
+
export { SETTLES_WHEN_META_KEY, settlesWhenOf };
|
|
67
69
|
/**
|
|
68
70
|
* WHO CLOSED AN OPEN THREAD, when the nightly reflection did (2026-10-20, an
|
|
69
71
|
* experiment): `{reflection, why, shows?}` — the reflection's id, what shows it
|
|
@@ -223,6 +225,11 @@ export function mintProposal(store: Store, proposal: Proposal, opts: MintOptions
|
|
|
223
225
|
meta["updatesMethod"] = proposal.updates?.method ?? "declared";
|
|
224
226
|
}
|
|
225
227
|
if (proposal.unresolved) meta[UNRESOLVED_META_KEY] = true;
|
|
228
|
+
// WHAT WOULD SETTLE IT (2026-10-27, S1), beside the flag only, in the same
|
|
229
|
+
// bag: no schema bump.
|
|
230
|
+
if (proposal.unresolved && typeof proposal.settlesWhen === "string" && proposal.settlesWhen.length > 0) {
|
|
231
|
+
meta[SETTLES_WHEN_META_KEY] = proposal.settlesWhen;
|
|
232
|
+
}
|
|
226
233
|
if (proposal.aliases.length > 0) meta["aliases"] = [...proposal.aliases];
|
|
227
234
|
if (proposal.feeling !== null) meta["feeling"] = proposal.feeling.feeling;
|
|
228
235
|
// A capped claim's RAW value survives in prose meta: the cap is doctrine,
|