counterparts 0.3.11 → 0.3.13
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 +326 -0
- package/docs/QUICKSTART.md +5 -0
- package/docs/README.md +2 -2
- package/docs/module-map.md +3 -3
- package/package.json +1 -1
- package/src/adapters/claude-code/CONTRACT.md +36 -10
- package/src/adapters/claude-code/INTERFACE-GAPS.md +116 -16
- package/src/adapters/claude-code/NOTES.md +182 -0
- package/src/adapters/claude-code/bin/hook.ts +46 -12
- package/src/adapters/claude-code/bin/runner.ts +7 -1
- package/src/adapters/claude-code/doctor.ts +632 -18
- package/src/adapters/claude-code/hooks.ts +61 -16
- package/src/adapters/claude-code/index.ts +11 -0
- package/src/adapters/claude-code/night-run.ts +150 -14
- package/src/adapters/claude-code/transcript.ts +268 -1
- package/src/adapters/cli/CONTRACT.md +5 -0
- package/src/adapters/cli/INTERFACE-GAPS.md +8 -4
- package/src/adapters/cli/NOTES.md +111 -0
- package/src/adapters/cli/commands.ts +134 -92
- package/src/adapters/cli/dream-core.ts +57 -42
- package/src/adapters/cli/export.ts +320 -21
- package/src/adapters/cli/help.ts +2 -1
- package/src/adapters/cli/index.ts +1 -0
- package/src/adapters/cli/install.ts +39 -7
- package/src/adapters/cli/mechanisms.ts +7 -1
- package/src/adapters/cli/uninstall.ts +13 -5
- package/src/adapters/cli/wire.ts +189 -63
- package/src/adapters/config.ts +2 -0
- package/src/adapters/dashboard/INTERFACE-GAPS.md +10 -1
- package/src/adapters/dashboard/NOTES.md +79 -0
- package/src/adapters/dashboard/registries.ts +34 -2
- package/src/adapters/dashboard/web/README.md +19 -14
- package/src/adapters/dashboard/web/actions.ts +23 -1
- package/src/adapters/dashboard/web/flow.ts +14 -0
- package/src/adapters/dashboard/web/lanes.ts +10 -0
- package/src/adapters/dashboard/web/narrate.ts +88 -2
- package/src/adapters/dashboard/web/pages/flow/sections/fired.js +1 -0
- package/src/adapters/dashboard/web/pages/health/sections/checks.js +2 -0
- package/src/adapters/dashboard/web/pages/health/sections/wake.js +3 -1
- package/src/adapters/dashboard/web/pages/memories/memories.css +17 -4
- package/src/adapters/dashboard/web/pages/memories/row.js +37 -21
- package/src/adapters/dashboard/web/pages/memories/sections/search.js +279 -60
- package/src/adapters/dashboard/web/pages/memories/state.js +2 -1
- package/src/adapters/dashboard/web/server.ts +0 -5
- package/src/adapters/dashboard/web/shared/memory-marks.css +7 -0
- package/src/adapters/dashboard/web/shared/memory-marks.js +33 -0
- package/src/adapters/dashboard/web/shared/memory-modal.js +5 -3
- package/src/adapters/dashboard/web/views/health.ts +21 -3
- package/src/adapters/dashboard/web/views/search.ts +4 -45
- package/src/adapters/dashboard/web/views.ts +2 -2
- package/src/adapters/fired.ts +430 -28
- package/src/adapters/host-wiring.ts +300 -0
- package/src/adapters/hosts.ts +11 -0
- package/src/adapters/lifecycle.ts +42 -2
- package/src/adapters/log/index.ts +9 -0
- package/src/adapters/mcp/CONTRACT.md +151 -11
- package/src/adapters/mcp/INTERFACE-GAPS.md +24 -2
- package/src/adapters/mcp/NOTES.md +313 -1
- package/src/adapters/mcp/bin/serve.ts +74 -1
- package/src/adapters/mcp/deliberate.ts +169 -651
- package/src/adapters/mcp/facts.ts +1094 -0
- package/src/adapters/mcp/index.ts +25 -7
- package/src/adapters/mcp/meaning.ts +1610 -0
- package/src/adapters/mcp/server.ts +835 -150
- package/src/adapters/mcp/stdio.ts +3 -1
- package/src/adapters/mcp/stood-down.ts +51 -0
- package/src/adapters/mcp/tools.ts +167 -41
- package/src/adapters/plugin-run.sh +133 -0
- package/src/adapters/plugin.ts +329 -0
- package/src/adapters/sessions.ts +18 -4
- package/src/core/associate/CONTRACT.md +2 -1
- package/src/core/associate/INTERFACE-GAPS.md +6 -1
- package/src/core/associate/NOTES.md +45 -0
- package/src/core/briefing.ts +12 -3
- package/src/core/contradictions.ts +184 -0
- package/src/core/counterpart.ts +797 -51
- package/src/core/dream/CONTRACT.md +36 -4
- package/src/core/dream/INTERFACE-GAPS.md +29 -6
- package/src/core/dream/NOTES.md +107 -0
- package/src/core/dream/feeling-weeks.ts +198 -0
- package/src/core/dream/index.ts +109 -18
- package/src/core/dream/reflect.ts +346 -87
- package/src/core/dream/tunables.ts +24 -4
- package/src/core/encode/INTERFACE-GAPS.md +3 -1
- package/src/core/encode/NOTES.md +7 -0
- package/src/core/encode/words.ts +45 -0
- package/src/core/fit/INTERFACE-GAPS.md +8 -2
- package/src/core/fit/NOTES.md +39 -1
- package/src/core/fit/index.ts +40 -0
- package/src/core/handoff/CONTRACT.md +37 -2
- package/src/core/handoff/INTERFACE-GAPS.md +10 -0
- package/src/core/handoff/NOTES.md +72 -0
- package/src/core/handoff/index.ts +214 -12
- package/src/core/handoff/last-here.ts +6 -4
- package/src/core/mint.ts +12 -2
- package/src/core/physics/CONTRACT.md +14 -2
- package/src/core/physics/NOTES.md +33 -1
- package/src/core/physics/index.ts +28 -5
- package/src/core/prospective/CONTRACT.md +45 -6
- package/src/core/prospective/INTERFACE-GAPS.md +4 -0
- package/src/core/prospective/NOTES.md +138 -0
- package/src/core/prospective/derive.ts +33 -5
- package/src/core/prospective/index.ts +90 -5
- package/src/core/prospective/windows.ts +72 -1
- package/src/core/recall/CONTRACT.md +31 -12
- package/src/core/recall/INTERFACE-GAPS.md +28 -4
- package/src/core/recall/NOTES.md +70 -1
- package/src/core/recall/feeling-ask.ts +10 -1
- package/src/core/recall/index.ts +3 -1
- package/src/core/recall/probe.ts +58 -0
- package/src/core/recall/session.ts +46 -2
- package/src/core/recall/time-ask.ts +487 -0
- package/src/core/remember/CONTRACT.md +4 -1
- package/src/core/remember/INTERFACE-GAPS.md +9 -1
- package/src/core/remember/NOTES.md +8 -0
- package/src/core/remember/proposals.ts +47 -5
- package/src/core/revision.ts +18 -1
- package/src/core/schemas/CONTRACT.md +21 -1
- package/src/core/schemas/INTERFACE-GAPS.md +20 -2
- package/src/core/schemas/NOTES.md +144 -0
- package/src/core/schemas/aliases.ts +55 -5
- package/src/core/schemas/index.ts +93 -1
- package/src/core/schemas/types.ts +2 -0
- package/src/core/self/CONTRACT.md +32 -5
- package/src/core/self/INTERFACE-GAPS.md +7 -2
- package/src/core/self/NOTES.md +102 -1
- package/src/core/self/behind.ts +43 -3
- package/src/core/self/briefing.ts +12 -2
- package/src/core/self/chapter-address.ts +254 -0
- package/src/core/self/episodes.ts +27 -0
- package/src/core/self/index.ts +83 -8
- package/src/core/self/page.ts +88 -0
- package/src/core/self/tunables.ts +5 -0
- package/src/core/self/work.ts +35 -2
- package/src/core/self/writer.ts +30 -0
- package/src/core/sleep/INTERFACE-GAPS.md +22 -3
- package/src/core/sleep/NOTES.md +20 -1
- package/src/core/sleep/consolidate.ts +59 -7
- package/src/core/sleep/index.ts +3 -0
- package/src/core/sleep/prune.ts +6 -2
- package/src/core/sleep/types.ts +7 -0
- package/src/core/store/CONTRACT.md +16 -0
- package/src/core/store/NOTES.md +66 -0
- package/src/core/store/feelings.ts +14 -1
- package/src/core/store/index.ts +483 -16
- package/src/core/store/operational.ts +95 -2
- package/src/core/store/owner-op-seam.ts +23 -0
- package/src/core/time.ts +152 -0
- package/tools/install-loop/run.sh +48 -12
- package/src/adapters/dashboard/web/pages/memories/fold.js +0 -53
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
* a fortnight of holidays is not a fortnight of work. An expired handoff stops
|
|
52
52
|
* being shown and stops being written over: the row is simply left to the prune.
|
|
53
53
|
*/
|
|
54
|
-
import type { ProseDoc, Store } from "../store/index.js";
|
|
54
|
+
import type { MemoryStatus, ProseDoc, Store } from "../store/index.js";
|
|
55
55
|
import { isKnownSession, isModelId } from "../types.js";
|
|
56
56
|
|
|
57
57
|
/** The `meta.role` that makes a schema row a handoff. One per scope and session. */
|
|
@@ -110,11 +110,13 @@ export const HANDOFF_EXCERPT_BYTES = 160;
|
|
|
110
110
|
* 1,431 since the newest says how far its work since is written up
|
|
111
111
|
* (2026-09-30), and 1,646 since each says why it may be out of date — an
|
|
112
112
|
* older release wrote it, or a newer chapter was written here (2026-10-01).
|
|
113
|
+
* 1,963 since a "since" line can follow it (2026-10-09): three plans at the
|
|
114
|
+
* title cap and a count, 317 bytes on the widest block (1,646).
|
|
113
115
|
* In practice the share rule binds first: at the 9,000 bytes the owner's hosts
|
|
114
116
|
* report, no reserve can pass 1,125, so a block that wide is carried with two
|
|
115
117
|
* shown rather than three.
|
|
116
118
|
*/
|
|
117
|
-
export const HANDOFF_RESERVE_MAX_BYTES =
|
|
119
|
+
export const HANDOFF_RESERVE_MAX_BYTES = 1963;
|
|
118
120
|
|
|
119
121
|
/**
|
|
120
122
|
* Slack on top of the block that actually exists, so a reserve taken at one
|
|
@@ -986,6 +988,10 @@ export function pointerBlockMany(
|
|
|
986
988
|
* rung is for the one-boundary lag (NOTES §2): a directory's first second
|
|
987
989
|
* author appears at a boundary whose reserve was sized to one handoff, and a
|
|
988
990
|
* shorter pointer that fits beats a fuller one dropped whole.
|
|
991
|
+
*
|
|
992
|
+
* With `plans` (2026-10-09), each of those rungs comes first with the "since"
|
|
993
|
+
* line under it (`sinceLine`), and then the rungs above, unchanged. A rung's
|
|
994
|
+
* `plans` is the ids its line names — none on a rung without one.
|
|
989
995
|
*/
|
|
990
996
|
export function pointerLadder(
|
|
991
997
|
hs: readonly Handoff[],
|
|
@@ -994,22 +1000,114 @@ export function pointerLadder(
|
|
|
994
1000
|
readonly since?: readonly (PointerSince | null)[];
|
|
995
1001
|
readonly reader?: string | null;
|
|
996
1002
|
readonly lifeDays?: number;
|
|
1003
|
+
/** What was planned here since the newest (`Handoffs#plansSince`). */
|
|
1004
|
+
readonly plans?: PlansSince | null;
|
|
997
1005
|
} = {},
|
|
998
|
-
): { block: string; shown: readonly Handoff[] }[] {
|
|
1006
|
+
): { block: string; shown: readonly Handoff[]; plans: readonly string[] }[] {
|
|
999
1007
|
const lifeDays = opts.lifeDays ?? HANDOFF_LIFE_DAYS;
|
|
1000
1008
|
const live = hs.filter((h) => !expired(h, day, lifeDays));
|
|
1001
1009
|
const first = live[0];
|
|
1002
1010
|
if (first === undefined) return [];
|
|
1003
1011
|
const single = pointerBlock(first, day, lifeDays, opts.since?.[0] ?? null, opts.reader ?? null);
|
|
1004
|
-
const out: { block: string; shown: readonly Handoff[] }[] = [];
|
|
1012
|
+
const out: { block: string; shown: readonly Handoff[]; several: boolean }[] = [];
|
|
1005
1013
|
if (live.length > 1) {
|
|
1006
1014
|
for (let k = Math.min(HANDOFF_WAKE_SHOWN, live.length); k >= 1; k--) {
|
|
1007
1015
|
const block = pointerBlockMany(live, day, { ...opts, shown: k });
|
|
1008
|
-
if (block !== null) out.push({ block, shown: live.slice(0, k) });
|
|
1016
|
+
if (block !== null) out.push({ block, shown: live.slice(0, k), several: true });
|
|
1009
1017
|
}
|
|
1010
1018
|
}
|
|
1011
|
-
if (single !== null) out.push({ block: single, shown: [first] });
|
|
1012
|
-
|
|
1019
|
+
if (single !== null) out.push({ block: single, shown: [first], several: false });
|
|
1020
|
+
// SINCE THIS HANDOFF (2026-10-09): every rung once WITH the line, widest
|
|
1021
|
+
// first, then every rung as it was — so a ceiling with no room for the line
|
|
1022
|
+
// carries today's block byte for byte. The line is tried before an older
|
|
1023
|
+
// handoff is kept in full: what was planned here after the newest handoff
|
|
1024
|
+
// is newer than any of them.
|
|
1025
|
+
const plans = opts.plans ?? null;
|
|
1026
|
+
const listed = (plans?.items ?? []).slice(0, SINCE_SHOWN).map((p) => p.id);
|
|
1027
|
+
const withPlans = out.flatMap((rung) => {
|
|
1028
|
+
const line = plans === null ? null : sinceLine(plans, rung.several);
|
|
1029
|
+
return line === null ? [] : [{ block: `${rung.block}\n${line}`, shown: rung.shown, plans: listed }];
|
|
1030
|
+
});
|
|
1031
|
+
return [...withPlans, ...out.map((rung) => ({ block: rung.block, shown: rung.shown, plans: [] as readonly string[] }))];
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
// ── what was planned here since (2026-10-09) ────────────────────────────────
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* THE STATUSES THAT READ AS A PLAN OR A NEXT STEP — the v12 field the writer
|
|
1038
|
+
* fills (`store/index.ts#STATUSES`): `planned` (decided, not yet done),
|
|
1039
|
+
* `proposed` (put forward, not decided) and `asked` (a question or request
|
|
1040
|
+
* still open). Not `done`, and not a memory with no status.
|
|
1041
|
+
*/
|
|
1042
|
+
export const PLAN_STATUSES: readonly MemoryStatus[] = ["planned", "proposed", "asked"];
|
|
1043
|
+
|
|
1044
|
+
/** How many the "since" line names, newest first; the rest are a count. */
|
|
1045
|
+
export const SINCE_SHOWN = 3;
|
|
1046
|
+
|
|
1047
|
+
/** A title's cap in the line, in bytes. The id is the door to the whole memory. */
|
|
1048
|
+
export const SINCE_TITLE_BYTES = 60;
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* WHAT ITS OWN SESSION WROTE THIS SOON AFTER THE HANDOFF IS PART OF THE SAME
|
|
1052
|
+
* ANSWER, not news: the `session_end` call writes its handoff first and its
|
|
1053
|
+
* memories straight after (`mcp/server.ts#sessionEndTool`), and an end-of-
|
|
1054
|
+
* stretch answer may add a note or a chapter in the same turn. Five minutes,
|
|
1055
|
+
* the grace a chapter's span gives the same answer
|
|
1056
|
+
* (`self/chapter-address.ts#CHAPTER_MOMENT_GRACE_MS`). A working default.
|
|
1057
|
+
*/
|
|
1058
|
+
export const SINCE_SAME_ANSWER_MS = 5 * 60_000;
|
|
1059
|
+
|
|
1060
|
+
/** How many candidates one read takes, newest first (`Store#planCandidates`). */
|
|
1061
|
+
export const SINCE_READ = 30;
|
|
1062
|
+
|
|
1063
|
+
/** One memory the "since" line names. */
|
|
1064
|
+
export interface PlanSince {
|
|
1065
|
+
readonly id: string;
|
|
1066
|
+
/** Its title, or its first sentence when it has none, cut to `SINCE_TITLE_BYTES`. */
|
|
1067
|
+
readonly title: string;
|
|
1068
|
+
/** What kind of thing it is, as the line prints it (`planWord`). */
|
|
1069
|
+
readonly word: string;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/** What was planned here since a handoff: the newest first, and how many more. */
|
|
1073
|
+
export interface PlansSince {
|
|
1074
|
+
readonly items: readonly PlanSince[];
|
|
1075
|
+
readonly more: number;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* IS THIS A PLAN OR A NEXT STEP, and the word the line prints for it: its
|
|
1080
|
+
* status when that is one of `PLAN_STATUSES`, else "open" for a memory still
|
|
1081
|
+
* flagged `unresolved` (the word the wake's "Still open:" lane uses). Null
|
|
1082
|
+
* for anything else. Pure.
|
|
1083
|
+
*/
|
|
1084
|
+
export function planWord(status: string | null | undefined, unresolved: boolean): string | null {
|
|
1085
|
+
if (typeof status === "string" && (PLAN_STATUSES as readonly string[]).includes(status)) return status;
|
|
1086
|
+
return unresolved ? "open" : null;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* THE LINE UNDER THE POINTER (2026-10-09): what this directory's sessions
|
|
1091
|
+
* wrote after the newest handoff that reads as a plan or a next step — up to
|
|
1092
|
+
* `SINCE_SHOWN` by title, word and id, newest first, the rest by count.
|
|
1093
|
+
* `several` says the block shows more than one handoff, so the line says
|
|
1094
|
+
* which one it counts from. Flattened, no bullet: the pointer is furniture.
|
|
1095
|
+
* Null with nothing to name. Pure.
|
|
1096
|
+
*/
|
|
1097
|
+
export function sinceLine(plans: PlansSince, several: boolean): string | null {
|
|
1098
|
+
const shown = plans.items.slice(0, SINCE_SHOWN);
|
|
1099
|
+
if (shown.length === 0) return null;
|
|
1100
|
+
const more = plans.more + plans.items.length - shown.length;
|
|
1101
|
+
const lead = several ? "Since the newest handoff here:" : "Since this handoff:";
|
|
1102
|
+
const list = shown.map((p) => `${p.title} (${p.word}, ${p.id})`).join("; ");
|
|
1103
|
+
return flatten(`${lead} ${list}${more > 0 ? `; and ${String(more)} more` : ""}.`);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
/** `/a/b/` and `/a/b` name one directory, as `self/work.ts` reads them. */
|
|
1107
|
+
function scopeSpellings(scope: string): string[] {
|
|
1108
|
+
const trimmed = scope.trim();
|
|
1109
|
+
const bare = trimmed.replace(/\/+$/, "");
|
|
1110
|
+
return bare.length > 0 && bare !== trimmed ? [trimmed, bare] : [trimmed];
|
|
1013
1111
|
}
|
|
1014
1112
|
|
|
1015
1113
|
// ── the module ──────────────────────────────────────────────────────────────
|
|
@@ -1025,6 +1123,25 @@ export interface HandoffsOptions {
|
|
|
1025
1123
|
data?: Record<string, string | number | boolean | null>;
|
|
1026
1124
|
}) => void;
|
|
1027
1125
|
readonly now?: () => number;
|
|
1126
|
+
/**
|
|
1127
|
+
* Whether a confidential memory may be named in the "since" line — the
|
|
1128
|
+
* owner's own session, as a confidential chapter is "last here" to the
|
|
1129
|
+
* owner only (2026-10-09).
|
|
1130
|
+
*/
|
|
1131
|
+
readonly owner?: boolean;
|
|
1132
|
+
/**
|
|
1133
|
+
* The memories a later one settled over (`self/index.ts#settledOver`), which
|
|
1134
|
+
* no wake line shows; asked only when there is something to name. Passed in
|
|
1135
|
+
* by the root, because `handoff/` depends on `store/` and nothing else.
|
|
1136
|
+
*/
|
|
1137
|
+
readonly settled?: () => ReadonlySet<string>;
|
|
1138
|
+
/**
|
|
1139
|
+
* The memories the published wake already lists under "Still open:"
|
|
1140
|
+
* (`self/index.ts#threadsShown`), which the "since" line leaves to that
|
|
1141
|
+
* lane rather than name twice (review of #332). Asked only when there is
|
|
1142
|
+
* something to name; passed in by the root, as `settled` is.
|
|
1143
|
+
*/
|
|
1144
|
+
readonly listed?: () => ReadonlySet<string>;
|
|
1028
1145
|
}
|
|
1029
1146
|
|
|
1030
1147
|
export interface WriteInput {
|
|
@@ -1045,6 +1162,9 @@ export class Handoffs {
|
|
|
1045
1162
|
private readonly observer: boolean;
|
|
1046
1163
|
private readonly onEvent: HandoffsOptions["onEvent"];
|
|
1047
1164
|
private readonly nowFn: () => number;
|
|
1165
|
+
private readonly owner: boolean;
|
|
1166
|
+
private readonly settled: (() => ReadonlySet<string>) | undefined;
|
|
1167
|
+
private readonly listed: (() => ReadonlySet<string>) | undefined;
|
|
1048
1168
|
|
|
1049
1169
|
constructor(opts: HandoffsOptions) {
|
|
1050
1170
|
this.store = opts.store;
|
|
@@ -1052,6 +1172,9 @@ export class Handoffs {
|
|
|
1052
1172
|
this.observer = opts.observer === true;
|
|
1053
1173
|
this.onEvent = opts.onEvent;
|
|
1054
1174
|
this.nowFn = opts.now ?? Date.now;
|
|
1175
|
+
this.owner = opts.owner === true;
|
|
1176
|
+
this.settled = opts.settled;
|
|
1177
|
+
this.listed = opts.listed;
|
|
1055
1178
|
}
|
|
1056
1179
|
|
|
1057
1180
|
private emit(
|
|
@@ -1132,7 +1255,10 @@ export class Handoffs {
|
|
|
1132
1255
|
// Sized to the widest "how current" words the delivery can add, which
|
|
1133
1256
|
// it computes only then — on the newest in full, the rest a stamp.
|
|
1134
1257
|
const since = hs.map((_, i) => (i === 0 ? WIDEST_POINTER_SINCE : WIDEST_OLDER_SINCE));
|
|
1135
|
-
|
|
1258
|
+
// What was planned here since the newest, as it stands now (2026-10-09):
|
|
1259
|
+
// sized to the line that exists, as the rest of the block is.
|
|
1260
|
+
const plans = hs[0] === undefined ? null : this.plansSince(scope, hs[0]);
|
|
1261
|
+
const rungs = pointerLadder(hs, d, { since, plans }).map((rung) => byteLengthOf(rung.block));
|
|
1136
1262
|
if (rungs.length > 0) out.set(scope, rungs);
|
|
1137
1263
|
}
|
|
1138
1264
|
return out;
|
|
@@ -1343,7 +1469,7 @@ export class Handoffs {
|
|
|
1343
1469
|
day?: number,
|
|
1344
1470
|
since?: (h: Handoff, newest: boolean) => PointerSince | null,
|
|
1345
1471
|
reader?: string | null,
|
|
1346
|
-
): { block: string; handoff: Handoff; shown: readonly Handoff[]; live: number } | null {
|
|
1472
|
+
): { block: string; handoff: Handoff; shown: readonly Handoff[]; live: number; plans: readonly string[] } | null {
|
|
1347
1473
|
return this.pointerChoices(scope, day, since, reader)[0] ?? null;
|
|
1348
1474
|
}
|
|
1349
1475
|
|
|
@@ -1360,7 +1486,7 @@ export class Handoffs {
|
|
|
1360
1486
|
day?: number,
|
|
1361
1487
|
since?: (h: Handoff, newest: boolean) => PointerSince | null,
|
|
1362
1488
|
reader?: string | null,
|
|
1363
|
-
): { block: string; handoff: Handoff; shown: readonly Handoff[]; live: number }[] {
|
|
1489
|
+
): { block: string; handoff: Handoff; shown: readonly Handoff[]; live: number; plans: readonly string[] }[] {
|
|
1364
1490
|
const d = day ?? this.store.livedDay();
|
|
1365
1491
|
const hs = this.readAll(scope, d);
|
|
1366
1492
|
const first = hs[0];
|
|
@@ -1372,14 +1498,87 @@ export class Handoffs {
|
|
|
1372
1498
|
return null;
|
|
1373
1499
|
}
|
|
1374
1500
|
});
|
|
1375
|
-
|
|
1501
|
+
const plans = this.plansSince(scope, first);
|
|
1502
|
+
return pointerLadder(hs, d, { since: current, reader: reader ?? null, plans }).map((rung) => ({
|
|
1376
1503
|
block: rung.block,
|
|
1377
1504
|
handoff: first,
|
|
1378
1505
|
shown: rung.shown,
|
|
1379
1506
|
live: hs.length,
|
|
1507
|
+
plans: rung.plans,
|
|
1380
1508
|
}));
|
|
1381
1509
|
}
|
|
1382
1510
|
|
|
1511
|
+
/**
|
|
1512
|
+
* WHAT WAS PLANNED HERE SINCE THIS HANDOFF (2026-10-09): the memories this
|
|
1513
|
+
* directory's sessions wrote by hand after its words were written whose
|
|
1514
|
+
* status is a plan or a next step (`PLAN_STATUSES`) or that are still
|
|
1515
|
+
* flagged `unresolved` — newest first, `SINCE_SHOWN` of them named and the
|
|
1516
|
+
* rest counted. A session that wrote a handoff and later changed the plan
|
|
1517
|
+
* in a note, without rewriting the handoff, left the newer memory quiet:
|
|
1518
|
+
* the pointer was the only place a waking session was told to resume from.
|
|
1519
|
+
*
|
|
1520
|
+
* Its own session's memories count, except what it wrote within
|
|
1521
|
+
* `SINCE_SAME_ANSWER_MS` of the handoff, which is the same answer. Left
|
|
1522
|
+
* out: what a later memory settled over, what the published wake already
|
|
1523
|
+
* lists under "Still open:" (`HandoffsOptions.listed`), a journal chapter's
|
|
1524
|
+
* copy, and a confidential memory unless the owner's (`HandoffsOptions.owner`). The
|
|
1525
|
+
* columns are read first (`Store#planCandidates`), then the prose of what
|
|
1526
|
+
* comes back. Never throws: a store that will not answer names nothing.
|
|
1527
|
+
*/
|
|
1528
|
+
plansSince(scope: string, h: Handoff): PlansSince {
|
|
1529
|
+
const none: PlansSince = { items: [], more: 0 };
|
|
1530
|
+
try {
|
|
1531
|
+
const after = this.writtenAt(h);
|
|
1532
|
+
if (after === null) return none;
|
|
1533
|
+
const ids = this.store.planCandidates({
|
|
1534
|
+
scopes: scopeSpellings(scope),
|
|
1535
|
+
after,
|
|
1536
|
+
statuses: PLAN_STATUSES,
|
|
1537
|
+
limit: SINCE_READ,
|
|
1538
|
+
confidential: this.owner,
|
|
1539
|
+
});
|
|
1540
|
+
if (ids.length === 0) return none;
|
|
1541
|
+
const ask = (f: (() => ReadonlySet<string>) | undefined): ReadonlySet<string> => {
|
|
1542
|
+
try {
|
|
1543
|
+
return f?.() ?? new Set();
|
|
1544
|
+
} catch {
|
|
1545
|
+
return new Set();
|
|
1546
|
+
}
|
|
1547
|
+
};
|
|
1548
|
+
const settled = ask(this.settled);
|
|
1549
|
+
// ONE PLACE FOR AN OPEN QUESTION (review of #332): one the published
|
|
1550
|
+
// wake already lists under "Still open:" is left to that lane. One it
|
|
1551
|
+
// does not — opened since the last boundary, or past the lane's cap,
|
|
1552
|
+
// which takes the oldest first — is named here.
|
|
1553
|
+
const listed = ask(this.listed);
|
|
1554
|
+
const found: PlanSince[] = [];
|
|
1555
|
+
for (const id of ids) {
|
|
1556
|
+
if (settled.has(id) || listed.has(id)) continue;
|
|
1557
|
+
const row = this.store.row(id);
|
|
1558
|
+
if (row === undefined) continue;
|
|
1559
|
+
if (h.session !== null && row.origin_session === h.session && (row.created_at ?? 0) - after <= SINCE_SAME_ANSWER_MS) {
|
|
1560
|
+
continue;
|
|
1561
|
+
}
|
|
1562
|
+
let doc: ProseDoc;
|
|
1563
|
+
try {
|
|
1564
|
+
doc = this.store.readProse(id);
|
|
1565
|
+
} catch {
|
|
1566
|
+
continue;
|
|
1567
|
+
}
|
|
1568
|
+
if (typeof doc.meta["episodeId"] === "string") continue;
|
|
1569
|
+
const word = planWord(row.status ?? null, doc.meta["unresolved"] === true);
|
|
1570
|
+
if (word === null) continue;
|
|
1571
|
+
const title = flatten(doc.title ?? "");
|
|
1572
|
+
const text = excerpt(title.length > 0 ? title : doc.body, SINCE_TITLE_BYTES);
|
|
1573
|
+
if (text.length === 0) continue;
|
|
1574
|
+
found.push({ id, title: text, word });
|
|
1575
|
+
}
|
|
1576
|
+
return { items: found.slice(0, SINCE_SHOWN), more: Math.max(0, found.length - SINCE_SHOWN) };
|
|
1577
|
+
} catch {
|
|
1578
|
+
return none;
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1383
1582
|
/**
|
|
1384
1583
|
* WHEN THIS HANDOFF'S WORDS WERE WRITTEN, epoch ms: its newest
|
|
1385
1584
|
* `handoff.written` row (the log keeps ~90 lived days; a pointer lives 14).
|
|
@@ -1411,7 +1610,7 @@ export class Handoffs {
|
|
|
1411
1610
|
* the ROW's id and the lived day — never the directory, which is a path
|
|
1412
1611
|
* (§5 G10).
|
|
1413
1612
|
*/
|
|
1414
|
-
noteShown(h: Handoff, opts: { bytes: number; session?: string | null; day?: number; among?: number }): void {
|
|
1613
|
+
noteShown(h: Handoff, opts: { bytes: number; session?: string | null; day?: number; among?: number; plans?: number }): void {
|
|
1415
1614
|
if (this.observer) {
|
|
1416
1615
|
this.emit("handoff.observer.standdown", undefined, { site: "noteShown" });
|
|
1417
1616
|
return;
|
|
@@ -1432,6 +1631,9 @@ export class Handoffs {
|
|
|
1432
1631
|
// How many live handoffs the directory held when this one was shown
|
|
1433
1632
|
// (2026-09-30) — absent when it was the only one.
|
|
1434
1633
|
...(opts.among === undefined || opts.among <= 1 ? {} : { among: opts.among }),
|
|
1634
|
+
// How many memories the "since" line named beside it (2026-10-09) —
|
|
1635
|
+
// absent when it named none.
|
|
1636
|
+
...(opts.plans === undefined || opts.plans <= 0 ? {} : { plans: opts.plans }),
|
|
1435
1637
|
},
|
|
1436
1638
|
});
|
|
1437
1639
|
} catch {
|
|
@@ -200,18 +200,20 @@ const MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "
|
|
|
200
200
|
/**
|
|
201
201
|
* EVERY CHAPTER OF AN EPISODE, in order, with the calendar date its engine
|
|
202
202
|
* heading names (`YYYY-MM-DD`, or null for a heading from before headings
|
|
203
|
-
* carried one)
|
|
203
|
+
* carried one), and the heading line itself (v12: a chapter's address
|
|
204
|
+
* resolves to it — `self/chapter-address.ts`). A body with no heading is one
|
|
205
|
+
* chapter with no date and no heading.
|
|
204
206
|
*/
|
|
205
|
-
export function chaptersOf(body: string): { text: string; date: string | null }[] {
|
|
207
|
+
export function chaptersOf(body: string): { text: string; date: string | null; heading: string | null }[] {
|
|
206
208
|
const heads = [...body.matchAll(HEADING)];
|
|
207
|
-
if (heads.length === 0) return [{ text: body, date: null }];
|
|
209
|
+
if (heads.length === 0) return [{ text: body, date: null, heading: null }];
|
|
208
210
|
return heads.map((h, i) => {
|
|
209
211
|
const start = (h.index ?? 0) + h[0].length;
|
|
210
212
|
const next = heads[i + 1];
|
|
211
213
|
const m = /(\d{1,2}) ([A-Za-z]{3}) (\d{4})/.exec(h[0]);
|
|
212
214
|
const month = m === null ? -1 : MONTHS.indexOf((m[2] ?? "").toLowerCase());
|
|
213
215
|
const date = m === null || month < 0 ? null : `${m[3] as string}-${String(month + 1).padStart(2, "0")}-${(m[1] as string).padStart(2, "0")}`;
|
|
214
|
-
return { text: body.slice(start, next === undefined ? undefined : next.index), date };
|
|
216
|
+
return { text: body.slice(start, next === undefined ? undefined : next.index), date, heading: h[0].trim() };
|
|
215
217
|
});
|
|
216
218
|
}
|
|
217
219
|
|
package/src/core/mint.ts
CHANGED
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
* resolution, upstream, and this file does not write a second one.
|
|
50
50
|
*/
|
|
51
51
|
import { TUNABLES as PHYSICS, clampSalienceAtSeam } from "./physics/index.js";
|
|
52
|
-
import { CUE_MODE_META, DATE_FROM_META } from "./prospective/index.js";
|
|
52
|
+
import { CUE_MODE_META, DATE_FROM_META, RECURRING_META } from "./prospective/index.js";
|
|
53
53
|
import type { Proposal } from "./remember/index.js";
|
|
54
|
-
import { localDate } from "./time.js";
|
|
54
|
+
import { isDay, isRecurrence, localDate } from "./time.js";
|
|
55
55
|
import type { Store } from "./store/index.js";
|
|
56
56
|
import { SECOND_HAND_META_KEY, WRITTEN_UP_BY_META_KEY } from "./types.js";
|
|
57
57
|
import type { Band, Salience } from "./types.js";
|
|
@@ -196,6 +196,12 @@ export function mintProposal(store: Store, proposal: Proposal, opts: MintOptions
|
|
|
196
196
|
// PLAIN OR QUIET rides the meta bag beside its date (2026-09-26, no schema
|
|
197
197
|
// bump), under the key its one reader owns.
|
|
198
198
|
if (proposal.eventDate !== null && proposal.remind !== null) meta[CUE_MODE_META] = proposal.remind;
|
|
199
|
+
// HOW OFTEN IT COMES ROUND (2026-10-09), in the same bag for the same
|
|
200
|
+
// reason: no schema bump. Only beside a day — intake refuses it on anything
|
|
201
|
+
// else, and a carried one that no longer fits was dropped by the carry.
|
|
202
|
+
if (proposal.eventDate !== null && isDay(proposal.eventDate) && isRecurrence(proposal.recurring)) {
|
|
203
|
+
meta[RECURRING_META] = proposal.recurring;
|
|
204
|
+
}
|
|
199
205
|
// The memory a revision took its reminder from (`Counterpart#carryReminder`):
|
|
200
206
|
// an id, so what was already said for the same window still counts.
|
|
201
207
|
if (proposal.reminderFrom !== undefined) meta[DATE_FROM_META] = proposal.reminderFrom;
|
|
@@ -230,6 +236,10 @@ export function mintProposal(store: Store, proposal: Proposal, opts: MintOptions
|
|
|
230
236
|
...(proposal.title === null ? {} : { title: proposal.title }),
|
|
231
237
|
// The reminder date, as the author wrote it (schema v7's `event_date`).
|
|
232
238
|
...(proposal.eventDate === null ? {} : { eventDate: proposal.eventDate }),
|
|
239
|
+
// v12: the writer's three fields (when it happened, who said it, what kind).
|
|
240
|
+
...(proposal.facts?.occurredOn === undefined ? {} : { occurredOn: proposal.facts.occurredOn }),
|
|
241
|
+
...(proposal.facts?.saidBy === undefined ? {} : { saidBy: proposal.facts.saidBy }),
|
|
242
|
+
...(proposal.facts?.status === undefined ? {} : { status: proposal.facts.status }),
|
|
233
243
|
meta,
|
|
234
244
|
band: opts.band ?? "episodic",
|
|
235
245
|
...(opts.model === undefined ? {} : { model: opts.model }),
|
|
@@ -189,7 +189,9 @@ band(m, d) = identity if promoted(m) # explicit cr
|
|
|
189
189
|
later, while `CORE_FAST_ACCEPTS_REFLECTED_FEELING` is open (the default, the owner's call
|
|
190
190
|
of 2026-09-27); closed, it reads only feelings felt at the time or written in a
|
|
191
191
|
session, AND its return must be an ordinary use, not a reflection's citation — closed
|
|
192
|
-
means nothing reaches the core on reflection alone (owner ruling D1 on #256).
|
|
192
|
+
means nothing reaches the core on reflection alone (owner ruling D1 on #256). A
|
|
193
|
+
feeling recorded later while AWAKE (`source: awake`, 2026-10-02, `note`'s
|
|
194
|
+
`feelingsNow`) is read the same way as a reflection's: only while the door is open.
|
|
193
195
|
|
|
194
196
|
Emotion counts toward the core ON PURPOSE, through the fast lane (the `promotionBase`
|
|
195
197
|
stopgap of #244 is retired); repetition counts through the slow lane, and only for
|
|
@@ -322,8 +324,18 @@ PRUNE(m,d) iff strength(m,d) < φ = 0.02 # TUNABLE
|
|
|
322
324
|
and (d − last_used_day(m)) ≥ D_floor = 90 # TUNABLE, lived days
|
|
323
325
|
and band(m) == episodic and not protected(m)
|
|
324
326
|
and m is neither successor nor predecessor in a live revision chain
|
|
327
|
+
and m's reminder date does not still repeat # 2026-10-09
|
|
325
328
|
```
|
|
326
329
|
|
|
330
|
+
The sixth gate (`recurring`, the owner's decision of 2026-10-09, held lightly): a memory
|
|
331
|
+
whose `event_date` repeats (`meta.recurring`, prospective §3) is refused by name, as a
|
|
332
|
+
protected one is. Each delivered occurrence counts as a use, which carries a daily,
|
|
333
|
+
weekly or monthly repeat; a yearly one is used once a year, and no single use outlasts
|
|
334
|
+
365 lived days at an ordinary salience. Only the prune: it still decays, its band and
|
|
335
|
+
strength read as before. The caller supplies it (`sleep/prune.ts`, from the row's meta).
|
|
336
|
+
It is an exemption from the floor, so the verdict names it only where the first three
|
|
337
|
+
conditions hold (review of #341); a repeat above the floor is refused `above-floor` alone.
|
|
338
|
+
|
|
327
339
|
A prune is recorded — counts, kind, dates, never a body and never a content hash (scar
|
|
328
340
|
§2.20) — and is the only physics-driven removal. Everything else merely fades: a
|
|
329
341
|
low-strength memory is still present and still retrievable by a strong enough cue.
|
|
@@ -353,7 +365,7 @@ low-strength memory is still present and still retrievable by a strong enough cu
|
|
|
353
365
|
store fact the caller supplies, the refusal is named
|
|
354
366
|
(`revision-successor-never-merged`), and it is checked before hash and cosine.
|
|
355
367
|
9. **[M]** Superseded versions stay resolvable for `H` lived days; nothing here deletes one.
|
|
356
|
-
10. **[M]** Prune is gated on all
|
|
368
|
+
10. **[M]** Prune is gated on all six conditions and is recorded; no model-reachable caller
|
|
357
369
|
can invoke it.
|
|
358
370
|
11. **[A]** The per-kind tables are v1's calibration, not law. They ship with a recorded
|
|
359
371
|
calibration and a fixture-bounded window, or disabled (scar §2.8).
|
|
@@ -407,7 +407,9 @@ Working defaults from the owner's conversation of 2026-09-27, held lightly.
|
|
|
407
407
|
weeks of weekly citing; that is left open on purpose — a memory the waking self keeps
|
|
408
408
|
coming back to every week for a month is the slow lane's own description.
|
|
409
409
|
- **The fast lane and a feeling recorded later.** `MemoryPhysics.feelingPeakLived` is the
|
|
410
|
-
peak without the feelings a reflection recorded later
|
|
410
|
+
peak without the feelings a reflection recorded later — and, since #317 (2026-10-02),
|
|
411
|
+
those an ordinary session recorded looking back (`source: awake`); both are
|
|
412
|
+
`store/feelings.ts#LATER_FEELING_SOURCES` (`Store.row()` computes both peaks).
|
|
411
413
|
`promotionEligibility` reads it unless `ctx.acceptsReflectedFeeling` (else the tunable
|
|
412
414
|
`CORE_FAST_ACCEPTS_REFLECTED_FEELING`) is true. The design review of 2026-09-27 wanted
|
|
413
415
|
it closed; **the owner opened it** the same day: nearly all sessions are straight work
|
|
@@ -469,3 +471,33 @@ and every other reader go through `strength()` and see it without change.
|
|
|
469
471
|
(`dream/reflect.ts`), and doctor counts the memories on this lane ("Recognition"). Not built:
|
|
470
472
|
anything reading recognition for the self page (arcs from uneasy to calm, moments of
|
|
471
473
|
recognition) — that is the page's design note, not a mechanism yet.
|
|
474
|
+
|
|
475
|
+
## 2026-10-09 — a repeating date is not pruned (the sixth gate)
|
|
476
|
+
|
|
477
|
+
The owner's decision on #339's review, held lightly: each occurrence of a repeating
|
|
478
|
+
reminder that is actually said or surfaced counts as a use (`Counterpart#creditOccurrence`
|
|
479
|
+
→ `store.reinforce`, the `surfaced` tier, once per occurrence), and if that cannot carry a
|
|
480
|
+
yearly one across its gap, the prune refuses a live repeat by name. It cannot: one
|
|
481
|
+
surfaced use multiplies S by `1 + 0.5 ln 1.25` ≈ 1.11, so a default-claim memory is back
|
|
482
|
+
under `PHI_PRUNE` in about 170 lived days (a fact) to 270 (a person, with the emotion
|
|
483
|
+
lift), and past the 90-day dwell by then. Measured through the hooks: without the gate,
|
|
484
|
+
`test/recurring-reinforce.test.ts`'s yearly birthday was let go 263 lived days after its
|
|
485
|
+
first May 14. So `pruneVerdict` takes `ctx.recurring` and blocks with `recurring`, the
|
|
486
|
+
way `protected` blocks; `sleep/prune.ts` reads it off the row (`store#recurrenceOfRow`,
|
|
487
|
+
the predicate `recurringMemories` uses). Nothing else moves here: decay, band and strength
|
|
488
|
+
are unchanged, so the memories view still shows a repeat as fading between its dates.
|
|
489
|
+
(Prospective, in the review of #341, stopped refusing a live repeat `faded`, so a QUIET
|
|
490
|
+
yearly that faded by its next date is still cued on it — prospective NOTES §16.) The
|
|
491
|
+
entity-card fade (`schemas/`) and the memories view's `letGoDay` never pass it, so the
|
|
492
|
+
view's "fading" and let-go day for a repeat are what the floor alone would do.
|
|
493
|
+
`fired.ts` counts it with `protected` and `in-live-revision-chain` as a real refusal —
|
|
494
|
+
and so `pruneVerdict` names it only where the floor would otherwise have let the memory
|
|
495
|
+
go (review of #341). It is an exemption from the floor, not a standing rule: named on
|
|
496
|
+
every live repeat every night, a strong daily pill reminder read as a refusal and turned
|
|
497
|
+
the fired view's prune row BLOCKED on a store where nothing was wrong.
|
|
498
|
+
|
|
499
|
+
Why `surfaced` and not `referenced`: an occurrence delivered is a showing, and nothing
|
|
500
|
+
says the reply used it; and `creditReturn` refuses `not-referenced`, so a schedule earns
|
|
501
|
+
no return and a daily `self` reminder cannot walk the slow core lane on the calendar
|
|
502
|
+
alone. The rep arm still climbs where the kind has one (`uses` +0.25 a day: a daily
|
|
503
|
+
`fact` sits at the 0.5 cap after about 17 days) — rehearsal working, not a side effect.
|
|
@@ -101,7 +101,8 @@ export const TUNABLES = {
|
|
|
101
101
|
CORE_FAST_FEELING: 0.6,
|
|
102
102
|
/**
|
|
103
103
|
* Does the fast lane's feeling read feelings a REFLECTION recorded later
|
|
104
|
-
* (v9, `feelings.source = 'reflection'
|
|
104
|
+
* (v9, `feelings.source = 'reflection'`; since 2026-10-02 an awake one too,
|
|
105
|
+
* `'awake'`)? Default OPEN — the owner's call of
|
|
105
106
|
* 2026-09-27, held lightly: nearly all sessions are straight work with
|
|
106
107
|
* little typing, so what matters may never come up in the moment, and a
|
|
107
108
|
* memory has to be able to reach the core on reflection alone. Such a
|
|
@@ -1555,7 +1556,9 @@ export type PruneReason =
|
|
|
1555
1556
|
| "dwell-too-short"
|
|
1556
1557
|
| "band-not-episodic"
|
|
1557
1558
|
| "protected"
|
|
1558
|
-
| "in-live-revision-chain"
|
|
1559
|
+
| "in-live-revision-chain"
|
|
1560
|
+
/** Its reminder date still repeats (`meta.recurring`, 2026-10-09): see `pruneVerdict`. */
|
|
1561
|
+
| "recurring";
|
|
1559
1562
|
|
|
1560
1563
|
/** Counts, kind, dates. NEVER a body and NEVER a content hash (scar §2.20). */
|
|
1561
1564
|
export interface PruneRecord {
|
|
@@ -1572,7 +1575,8 @@ export interface PruneRecord {
|
|
|
1572
1575
|
export interface PruneVerdict {
|
|
1573
1576
|
prune: boolean;
|
|
1574
1577
|
reason: PruneReason;
|
|
1575
|
-
/** Every failing gate, not just the first — all
|
|
1578
|
+
/** Every failing gate, not just the first — all six are named; `recurring`
|
|
1579
|
+
* only where the floor alone would have let the memory go. */
|
|
1576
1580
|
blockedBy: PruneReason[];
|
|
1577
1581
|
strength: number;
|
|
1578
1582
|
band: Band;
|
|
@@ -1581,15 +1585,26 @@ export interface PruneVerdict {
|
|
|
1581
1585
|
}
|
|
1582
1586
|
|
|
1583
1587
|
/**
|
|
1584
|
-
* The ONLY physics-driven removal (§5.8), gated on all
|
|
1588
|
+
* The ONLY physics-driven removal (§5.8), gated on all six conditions. No
|
|
1585
1589
|
* model, on any path, holds delete power — this returns a verdict and a record;
|
|
1586
1590
|
* it deletes nothing itself. Everything else merely fades: a low-strength memory
|
|
1587
1591
|
* is still present and still retrievable by a strong enough cue.
|
|
1592
|
+
*
|
|
1593
|
+
* `ctx.recurring` (2026-10-09, the owner's decision, held lightly): the memory's
|
|
1594
|
+
* reminder date still repeats. Each occurrence it is told or surfaced on counts
|
|
1595
|
+
* as a use (`Counterpart#creditOccurrence`), which carries a daily, weekly or
|
|
1596
|
+
* monthly repeat; a yearly one is used once a year, and no single use outlasts
|
|
1597
|
+
* 365 lived days at an ordinary salience. So a live repeat is refused here by
|
|
1598
|
+
* name, as `protected` is — but only where the floor would otherwise have let
|
|
1599
|
+
* it go, since it is an exemption from the floor and not a standing rule (review
|
|
1600
|
+
* of #341). Only the prune: it still fades, its band and strength read as
|
|
1601
|
+
* before. Prospective does not refuse a live repeat `faded` (review of #341,
|
|
1602
|
+
* `prospective/derive.ts`), so each occurrence is still delivered.
|
|
1588
1603
|
*/
|
|
1589
1604
|
export function pruneVerdict(
|
|
1590
1605
|
m: MemoryPhysics,
|
|
1591
1606
|
d: number,
|
|
1592
|
-
ctx: { inLiveRevisionChain: boolean },
|
|
1607
|
+
ctx: { inLiveRevisionChain: boolean; recurring?: boolean },
|
|
1593
1608
|
shape: DecayShape = TUNABLES.DECAY_SHAPE,
|
|
1594
1609
|
): PruneVerdict {
|
|
1595
1610
|
const s = strength(m, d, shape);
|
|
@@ -1599,8 +1614,16 @@ export function pruneVerdict(
|
|
|
1599
1614
|
if (s >= TUNABLES.PHI_PRUNE) blockedBy.push("above-floor");
|
|
1600
1615
|
if (dwellDays < TUNABLES.D_FLOOR_DAYS) blockedBy.push("dwell-too-short");
|
|
1601
1616
|
if (b !== "episodic") blockedBy.push("band-not-episodic");
|
|
1617
|
+
// The three floor conditions above are arithmetic ("not yet"); the rest are
|
|
1618
|
+
// named rules.
|
|
1619
|
+
const floorLetsGo = blockedBy.length === 0;
|
|
1602
1620
|
if (m.protected) blockedBy.push("protected");
|
|
1603
1621
|
if (ctx.inLiveRevisionChain) blockedBy.push("in-live-revision-chain");
|
|
1622
|
+
// An exemption FROM THE FLOOR, so named only where the floor would have let
|
|
1623
|
+
// the memory go (review of #341): a repeat well above it is held by
|
|
1624
|
+
// `above-floor` and nothing else, and naming `recurring` on every live repeat
|
|
1625
|
+
// every night read as a refusal in the fired view's prune row.
|
|
1626
|
+
if (ctx.recurring === true && floorLetsGo) blockedBy.push("recurring");
|
|
1604
1627
|
const prune = blockedBy.length === 0;
|
|
1605
1628
|
return {
|
|
1606
1629
|
prune,
|
|
@@ -37,6 +37,35 @@ clothes. **Hold debts, lose deadlines.**
|
|
|
37
37
|
or range's last day) it leaves the wake's horizon lane for the rest of its grace
|
|
38
38
|
(2026-09-29): it was said, and "Arriving:" would say it again as still to come. It
|
|
39
39
|
still arrives as a cue, so recall still finds it.
|
|
40
|
+
- **A date can repeat, by the owner's design (2026-10-09, a working default, held
|
|
41
|
+
lightly).** A dated memory may carry `recurring: daily | weekly | monthly | yearly`,
|
|
42
|
+
anchored on its event date and kept in its meta beside `remind` (no schema bump): a
|
|
43
|
+
birthday stored as `1990-05-14` with `yearly` comes back every May 14. Each
|
|
44
|
+
OCCURRENCE is its own window, keyed by its own date (`d:2027-05-14`), so everything
|
|
45
|
+
above that is per window — the fire cap, once per lived day, the plain beat, the
|
|
46
|
+
referenced stop, and what a revision's `lineage` counts — is per occurrence: told once
|
|
47
|
+
each May 14, never once ever, never twice. Two occurrences are never open together: an
|
|
48
|
+
occurrence's window opens no earlier than the day after the last one and closes the day
|
|
49
|
+
before the next one opens (the coming lead wins over the last grace), so a daily date's
|
|
50
|
+
window is its day and a weekly one runs from three days before to three days after.
|
|
51
|
+
A daily one takes no wake line (review of #339): it is every day, not arriving, and a
|
|
52
|
+
wake rendered the evening before would date it yesterday. Only a DAY repeats; a month, a range or a year with `recurring` is refused at the door.
|
|
53
|
+
**A repeat is kept alive by coming round** (owner decision 2026-10-09, held lightly):
|
|
54
|
+
the first DELIVERY of each occurrence — a quiet fire the gate admitted, or a plain line
|
|
55
|
+
the host claimed — counts as one use of the memory (`surfaced`, no return), credited by
|
|
56
|
+
the composition root through the store's reinforce seam; this module answers only
|
|
57
|
+
whether the occurrence is still undelivered (`occurrenceUndelivered`). Never for a
|
|
58
|
+
one-off date or a dropped repeat. And physics' prune refuses a live repeat by name
|
|
59
|
+
(`recurring`), because one use a year does not outlast a yearly gap. Fading is
|
|
60
|
+
unchanged for recall and display, but **a live repeat is not refused `faded`** (review
|
|
61
|
+
of #341, the one carve-out from G10 below): a quiet yearly at the default salience has
|
|
62
|
+
faded by its second date, and "so they stay alive" means each occurrence is delivered by
|
|
63
|
+
its own remind rules (NOTES §16).
|
|
64
|
+
Two calendar rules, counted from the anchor every time so nothing drifts: **monthly on
|
|
65
|
+
the 29th, 30th or 31st falls on the last day of a month too short to have it** (Jan 31
|
|
66
|
+
→ Feb 28, or 29 → Mar 31 → Apr 30), and **yearly on Feb 29 falls on Feb 28 in a common
|
|
67
|
+
year**. Out, loose first: every other week, "the first Monday", and anything finer
|
|
68
|
+
than a day.
|
|
40
69
|
- **Prospectivity is DERIVED, never stored.** [v1] §12 G2 — eligibility is a predicate over
|
|
41
70
|
the event date, the encode date, salience, and flags, so the property expires by itself
|
|
42
71
|
when the window passes: no cleanup pass, no second source of truth, nothing for decay to
|
|
@@ -52,8 +81,8 @@ clothes. **Hold debts, lose deadlines.**
|
|
|
52
81
|
**An explicit date is its own importance signal** (owner decision 2026-09-26, a working
|
|
53
82
|
default): a memory whose author wrote its `eventDate` is exempt from the salience floor,
|
|
54
83
|
which now gates only a date a caller extracted. Decay is not exempted — a dated memory
|
|
55
|
-
faded to `FADED_STRENGTH` refuses as `faded` (G10)
|
|
56
|
-
still refuse.
|
|
84
|
+
faded to `FADED_STRENGTH` refuses as `faded` (G10), unless its date still repeats (§3) —
|
|
85
|
+
and archived, skill and journal still refuse.
|
|
57
86
|
- **Precision is carried by the date's own format**, never rounded, and the ramp differs by
|
|
58
87
|
precision — a stated month *means* early month more than the 29th. [v1] §12 G4. Since
|
|
59
88
|
2026-09-26 there are four shapes (`core/time.ts`): a day, a month, a year (no window), and
|
|
@@ -77,7 +106,9 @@ clothes. **Hold debts, lose deadlines.**
|
|
|
77
106
|
nothing to the old one's spent budget. [v1] §12 G9.
|
|
78
107
|
- **No decay exemption before arrival.** [v1] §12 G10 — a future-dated memory that decays
|
|
79
108
|
into insignificance before its window was an occasion that didn't matter; forgetting it
|
|
80
|
-
is memory working.
|
|
109
|
+
is memory working. One carve-out (review of #341, 2026-10-09): a date that still
|
|
110
|
+
REPEATS is not refused `faded` — the author asked for it to come round, and the owner
|
|
111
|
+
decided repeats stay alive (§3).
|
|
81
112
|
- **Firing state is not canonical memory**, and the write budget is set by that cost:
|
|
82
113
|
losing it risks one extra polite mention, never a memory, so contended writers skip the
|
|
83
114
|
update loudly rather than stall a host-facing path. [v1] §12 G12.
|
|
@@ -94,8 +125,11 @@ clothes. **Hold debts, lose deadlines.**
|
|
|
94
125
|
three unsynchronized writers — a hook, a pre-spawn boundary call, and a lock-holding
|
|
95
126
|
horizon computation — each serializing the whole map, so a stale writer clobbered
|
|
96
127
|
unrelated entries too (scar §2.1). Transactions close the class.
|
|
97
|
-
- **Recurrence
|
|
98
|
-
physics, and scheduling physics is where task-queue
|
|
128
|
+
- **Recurrence was absent until 2026-10-09.** [v1's recorded punt, kept until then]
|
|
129
|
+
"Annual re-arm is scheduling physics, and scheduling physics is where task-queue
|
|
130
|
+
behavior creeps back in." The owner lifted it (§3): a repeating date re-arms nothing
|
|
131
|
+
and stores nothing new — each occurrence is DERIVED from the anchor at read time, under
|
|
132
|
+
every brake a one-off date has. The risk the punt named is still the one to watch.
|
|
99
133
|
- **v1's knob set is not inherited as defaults.** Salience floor, lead days, grace days, cue
|
|
100
134
|
strength, fires per window, horizon lines per wake: each ships with a recorded
|
|
101
135
|
calibration and a fixture-bounded window, or ships disabled (scar §2.8). v1's values are
|
|
@@ -114,7 +148,9 @@ session's affect summary; the observer predicate.
|
|
|
114
148
|
tasks"* (day-dated items only, since 2026-09-26), and/or a temporal cue fed into the
|
|
115
149
|
ordinary turn-time pass; for a PLAIN item, a claimed record the host turns into one line on
|
|
116
150
|
its day (§3's named exception) — records, never words; firing-state transitions;
|
|
117
|
-
telemetry by reference
|
|
151
|
+
telemetry by reference; and for a repeating date, whether an occurrence is still
|
|
152
|
+
undelivered, which the caller turns into one credited use (§3) — this module writes no
|
|
153
|
+
physics.
|
|
118
154
|
|
|
119
155
|
**Guarantees** — **[M]** mechanized, **[A]** advisory:
|
|
120
156
|
|
|
@@ -167,3 +203,6 @@ admission criterion, with a named negative example) · **§2.17** (exit paths ar
|
|
|
167
203
|
4. **Is "plain" the right amount of loud?** (2026-09-26.) Once on the day, twice for a
|
|
168
204
|
month or range, only on the stated span — no lead-day warning, no nag when the day is
|
|
169
205
|
missed. The owner's first weeks of use answer it; nothing here measured it.
|
|
206
|
+
5. **What should repeat beyond a day?** (2026-10-09.) "Every October" (a month, yearly),
|
|
207
|
+
"hourly", every other week, "the first Monday" — each left out, loose first, until a
|
|
208
|
+
real use asks for one.
|