counterparts 0.3.12 → 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 +184 -0
- package/docs/module-map.md +1 -1
- 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 +131 -0
- package/src/adapters/claude-code/bin/hook.ts +35 -2
- package/src/adapters/claude-code/doctor.ts +155 -21
- package/src/adapters/claude-code/hooks.ts +49 -7
- package/src/adapters/claude-code/index.ts +11 -0
- package/src/adapters/claude-code/night-run.ts +133 -12
- 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 +65 -14
- package/src/adapters/cli/dream-core.ts +57 -42
- package/src/adapters/cli/export.ts +320 -21
- 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/dashboard/INTERFACE-GAPS.md +10 -1
- package/src/adapters/dashboard/NOTES.md +79 -0
- package/src/adapters/dashboard/registries.ts +10 -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 +4 -1
- package/src/adapters/dashboard/web/lanes.ts +3 -0
- package/src/adapters/dashboard/web/narrate.ts +30 -2
- package/src/adapters/dashboard/web/pages/flow/sections/fired.js +1 -0
- 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 +1 -1
- package/src/adapters/dashboard/web/views/search.ts +4 -45
- package/src/adapters/dashboard/web/views.ts +2 -2
- package/src/adapters/fired.ts +410 -25
- package/src/adapters/host-wiring.ts +300 -0
- package/src/adapters/lifecycle.ts +14 -0
- package/src/adapters/log/index.ts +2 -0
- package/src/adapters/mcp/CONTRACT.md +33 -3
- package/src/adapters/mcp/INTERFACE-GAPS.md +24 -2
- package/src/adapters/mcp/NOTES.md +136 -0
- package/src/adapters/mcp/bin/serve.ts +30 -0
- package/src/adapters/mcp/facts.ts +13 -1
- package/src/adapters/mcp/meaning.ts +208 -13
- package/src/adapters/mcp/server.ts +87 -15
- package/src/adapters/mcp/stdio.ts +3 -1
- package/src/adapters/mcp/stood-down.ts +51 -0
- package/src/adapters/mcp/tools.ts +27 -7
- package/src/adapters/plugin-run.sh +133 -0
- package/src/adapters/plugin.ts +329 -0
- 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 +451 -18
- package/src/core/dream/CONTRACT.md +5 -2
- package/src/core/dream/INTERFACE-GAPS.md +29 -6
- package/src/core/dream/NOTES.md +21 -0
- package/src/core/dream/index.ts +33 -1
- package/src/core/dream/reflect.ts +20 -5
- package/src/core/encode/INTERFACE-GAPS.md +3 -1
- package/src/core/fit/INTERFACE-GAPS.md +8 -2
- package/src/core/fit/NOTES.md +5 -2
- package/src/core/fit/index.ts +4 -1
- package/src/core/handoff/CONTRACT.md +37 -2
- package/src/core/handoff/INTERFACE-GAPS.md +10 -0
- package/src/core/handoff/NOTES.md +66 -0
- package/src/core/handoff/index.ts +214 -12
- package/src/core/mint.ts +8 -2
- package/src/core/physics/CONTRACT.md +11 -1
- package/src/core/physics/NOTES.md +30 -0
- package/src/core/physics/index.ts +26 -4
- 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 +6 -2
- package/src/core/recall/INTERFACE-GAPS.md +28 -4
- package/src/core/recall/NOTES.md +57 -1
- package/src/core/recall/probe.ts +58 -0
- package/src/core/recall/session.ts +27 -3
- package/src/core/recall/time-ask.ts +116 -18
- package/src/core/remember/CONTRACT.md +4 -1
- package/src/core/remember/INTERFACE-GAPS.md +9 -1
- package/src/core/remember/proposals.ts +38 -5
- package/src/core/revision.ts +5 -0
- package/src/core/schemas/CONTRACT.md +13 -1
- package/src/core/schemas/INTERFACE-GAPS.md +20 -2
- package/src/core/schemas/NOTES.md +127 -0
- package/src/core/schemas/types.ts +2 -0
- package/src/core/self/CONTRACT.md +15 -4
- package/src/core/self/INTERFACE-GAPS.md +7 -2
- package/src/core/self/NOTES.md +49 -0
- package/src/core/self/briefing.ts +12 -2
- package/src/core/self/index.ts +82 -8
- package/src/core/self/page.ts +88 -0
- package/src/core/sleep/INTERFACE-GAPS.md +22 -3
- package/src/core/sleep/NOTES.md +11 -0
- package/src/core/sleep/prune.ts +6 -2
- package/src/core/store/NOTES.md +14 -0
- package/src/core/store/index.ts +107 -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
package/src/core/recall/NOTES.md
CHANGED
|
@@ -695,6 +695,7 @@ titled chapter against an untitled copy can fall under `NEAR_DUPLICATE` anyway.
|
|
|
695
695
|
- **The dashboard**: its ask view had folded the pair the other way since round 3 (the
|
|
696
696
|
memory, with a "from chapter …" link). It now receives the chapter alone and shows it as
|
|
697
697
|
a journal row; `pages/memories/fold.js` still links a copy whose chapter was not shown.
|
|
698
|
+
(2026-10-09: `fold.js` and `/api/chapters` are gone; facts mode folds the pair itself.)
|
|
698
699
|
|
|
699
700
|
## 22. Recall by feeling, deliberate only — 2026-09-30 (U13 items 1 and 2)
|
|
700
701
|
|
|
@@ -754,7 +755,11 @@ never says it.
|
|
|
754
755
|
feelings for, so it ranks nothing. Wrong-core repairs kept the writer's word but not the
|
|
755
756
|
core they named, and an alias kept the wheel word (`touched` → `moved`) — both answer
|
|
756
757
|
through the alias table, not the original input. No stemming (a light one since §25).
|
|
757
|
-
Item 3 (a feeling's journey over time) is still open.
|
|
758
|
+
Item 3 (a feeling's journey over time) is still open. *(2026-10-09: item 3 is answered
|
|
759
|
+
by meaning mode, #322, merged 2026-10-03, in 0.3.12 — outside this module, at the MCP
|
|
760
|
+
layer (`mcp/meaning.ts`, mcp CONTRACT §6e): a person's, a project's or a feeling's
|
|
761
|
+
chapters in time order, each with its feelings by whose, and page 1 keeps the turns
|
|
762
|
+
where a feeling's valence changes sign.)*
|
|
758
763
|
|
|
759
764
|
## 23. The wheel v2 in recall — 2026-09-30
|
|
760
765
|
|
|
@@ -999,3 +1004,54 @@ session.
|
|
|
999
1004
|
## Confidentiality, frozen (2026-10-02, owner)
|
|
1000
1005
|
|
|
1001
1006
|
The confidential class (`store/index.ts#confidentialByMeta`, CONTRACT §9) has no way in. No tool or entrance marks a memory confidential. Only a dream or reflection inheriting it from a source that is already confidential sets it. The owner's live store held 0 of 823 on 2026-10-02. The owner's ruling: freeze it. Keep the gates as they are, add no new plumbing for it, and don't treat it as a reason to block a review. The plan is to review it and remove it later. Privacy that matters is handled elsewhere today: directories opted out of Counterparts entirely, and the gate battery's credential redaction.
|
|
1007
|
+
|
|
1008
|
+
## 28. Shown, and not used (2026-10-09)
|
|
1009
|
+
|
|
1010
|
+
Recall predicts on every turn that what it shows will help the reply, and a miss left no
|
|
1011
|
+
record per memory: the `recall.credit` row named what was credited (`ids`) and expanded
|
|
1012
|
+
(`expandedIds`), not what was quoted but refused, or shown and ignored. The association
|
|
1013
|
+
diagnosis of 10-02 could say the Hebbian path was nearly dark (`quoted` 0 and `expanded`
|
|
1014
|
+
62 over the store's whole life), but not for which memories or which lane.
|
|
1015
|
+
|
|
1016
|
+
- **What is scored.** `Counterpart#creditReferences` takes every memory the session's gate
|
|
1017
|
+
state records as shown (loud, footnoted, or footnoted as a quiet pointer) after the
|
|
1018
|
+
session's `judged` mark. One is used when a reply this boundary expanded or quoted it:
|
|
1019
|
+
the resolver's uses before any refusal, because the prediction is "this will help",
|
|
1020
|
+
not "this will earn credit". The rest are shown and not used. The mark then moves to the
|
|
1021
|
+
session's newest recall turn, so each showing is scored once.
|
|
1022
|
+
- **The mark** is its own gate kind (`judged`, ref `credit`, `session.ts`), written only by
|
|
1023
|
+
the credit pass. `setGateRecords` upserts row by row, so recall's save, which names its
|
|
1024
|
+
own rows, cannot drop it; `loadGateState` skips it as it skips `asked`. Not written
|
|
1025
|
+
under observer.
|
|
1026
|
+
- **The row** carries `shownLoud`, `shownFootnotes`, `shownPointers`, `unusedLoud`,
|
|
1027
|
+
`unusedFootnotes`, `unusedPointers`, `shownNotUsed` (up to 64 ids, oldest showing first),
|
|
1028
|
+
`shownNotUsedTotal` and `judgedThrough`. Footnotes are the cued ones; a pointer counts
|
|
1029
|
+
as a pointer only. `probe-oq4` sums the lanes into a hit rate over the rows that carry
|
|
1030
|
+
them. A per-memory read (`shownNotUsed` joined to the session's `recall.decision` rows,
|
|
1031
|
+
which carry each showing's lane and turn) is left for a later reader; doctor does not
|
|
1032
|
+
read any of it yet.
|
|
1033
|
+
- **Measurement only.** No strength, threshold or ranking reads it.
|
|
1034
|
+
- *Choices and residuals:*
|
|
1035
|
+
- A showing is scored at the first boundary after it. One opened at a later boundary is
|
|
1036
|
+
counted once as not used (its own) and once as used (the later row's `expandedIds`):
|
|
1037
|
+
the score is of the reply it was shown for.
|
|
1038
|
+
- A boundary whose slice holds no reply and no expansion scores nothing and leaves the
|
|
1039
|
+
mark (review of #329): a capture that failed or found nothing new is not a reply
|
|
1040
|
+
that ignored what it was shown. Its showings wait for the next boundary that read a
|
|
1041
|
+
reply.
|
|
1042
|
+
- A session already open when this build arrived has no mark, so its first boundary
|
|
1043
|
+
scores everything that session showed (at most `MAX_SESSION_RECORDS`, at most 64 ids
|
|
1044
|
+
on the row). One over-count, toward more misses.
|
|
1045
|
+
- A mark that cannot be read scores from the session's start; one that cannot be
|
|
1046
|
+
written is scored again next time. Both over-count misses, never under-count.
|
|
1047
|
+
- On a `budget-exceeded` row a quote may have gone unchecked; a reader should leave
|
|
1048
|
+
those rows out.
|
|
1049
|
+
- After a gate reset (`recall.gate.reset`, an unreadable scalar row) the session's turn
|
|
1050
|
+
count starts again at 1 while the mark may sit higher, so its showings go unscored
|
|
1051
|
+
until the turns pass the mark: left out of the rate, not counted as hits. Rare, and
|
|
1052
|
+
the reset is evented.
|
|
1053
|
+
- A footnote can be used only by an expansion: it showed a title, and a title is not
|
|
1054
|
+
quotable (§9.2). The lane split keeps that from reading as a worse prediction.
|
|
1055
|
+
- Ambient recall only. A deliberate answer's memories (`asked`) are not in the gate
|
|
1056
|
+
state's `surfaced`, and are not scored.
|
|
1057
|
+
- Recorded only where the credit pass runs (INTERFACE-GAPS §9).
|
package/src/core/recall/probe.ts
CHANGED
|
@@ -24,6 +24,13 @@
|
|
|
24
24
|
* recorded what was expanded, so nothing is known. Zero and unknown never
|
|
25
25
|
* share a glyph.
|
|
26
26
|
*
|
|
27
|
+
* THE HIT RATE (2026-10-09) rides the same rows: a `recall.credit` row now
|
|
28
|
+
* scores the ambient showings since the session's last boundary that judged —
|
|
29
|
+
* loud, footnoted and pointer, and how many of each no reply expanded or
|
|
30
|
+
* quoted (`shownNotUsed` holds their ids, for a per-memory read later). The
|
|
31
|
+
* probe sums the lanes over the rows that carry the counts. Rows from before
|
|
32
|
+
* carry none and are left out, so the line says how many boundaries it rests on.
|
|
33
|
+
*
|
|
27
34
|
* What this does NOT claim: causation. A session that expanded nothing may
|
|
28
35
|
* have had nothing worth expanding. The probe answers "did the behaviour move
|
|
29
36
|
* when the string moved", which is the question OQ4 asks, and leaves the
|
|
@@ -86,6 +93,24 @@ export interface ProbeReport {
|
|
|
86
93
|
};
|
|
87
94
|
/** Days with decision rows and no credit row, and the footnotes they delivered. */
|
|
88
95
|
readonly unmeasured: { readonly days: number; readonly footnotesDelivered: number };
|
|
96
|
+
/**
|
|
97
|
+
* RECALL'S HIT RATE (2026-10-09): what the boundaries that score their
|
|
98
|
+
* showings say — each ambient showing scored once, at the first boundary
|
|
99
|
+
* after it, as used (expanded or quoted) or not, by lane. Credit rows from
|
|
100
|
+
* before carry no score and are not counted here: `boundaries` 0 is unknown,
|
|
101
|
+
* not a rate of zero.
|
|
102
|
+
*/
|
|
103
|
+
readonly hits: {
|
|
104
|
+
readonly boundaries: number;
|
|
105
|
+
readonly shown: { readonly loud: number; readonly footnotes: number; readonly pointers: number };
|
|
106
|
+
readonly unused: { readonly loud: number; readonly footnotes: number; readonly pointers: number };
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** A finite count off a payload, or null when the row does not carry it. */
|
|
111
|
+
function count(p: Record<string, unknown>, key: string): number | null {
|
|
112
|
+
const v = p[key];
|
|
113
|
+
return typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
89
114
|
}
|
|
90
115
|
|
|
91
116
|
interface Acc {
|
|
@@ -115,6 +140,9 @@ export function probeOQ4(rows: readonly ProbeRow[]): ProbeReport {
|
|
|
115
140
|
let decisions = 0;
|
|
116
141
|
let credits = 0;
|
|
117
142
|
let unparseable = 0;
|
|
143
|
+
let scored = 0;
|
|
144
|
+
const shown = { loud: 0, footnotes: 0, pointers: 0 };
|
|
145
|
+
const unused = { loud: 0, footnotes: 0, pointers: 0 };
|
|
118
146
|
const get = (session: string, date: string | null): Acc => {
|
|
119
147
|
let a = acc.get(session);
|
|
120
148
|
if (a === undefined) {
|
|
@@ -150,6 +178,20 @@ export function probeOQ4(rows: readonly ProbeRow[]): ProbeReport {
|
|
|
150
178
|
credits += 1;
|
|
151
179
|
a.credits += 1;
|
|
152
180
|
for (const id of ids(p["expandedIds"])) a.expanded.add(id);
|
|
181
|
+
// A row scores its showings only when it carries all six counts.
|
|
182
|
+
const lanes = [
|
|
183
|
+
["loud", "shownLoud", "unusedLoud"],
|
|
184
|
+
["footnotes", "shownFootnotes", "unusedFootnotes"],
|
|
185
|
+
["pointers", "shownPointers", "unusedPointers"],
|
|
186
|
+
] as const;
|
|
187
|
+
const got = lanes.map(([, s, u]) => [count(p, s), count(p, u)] as const);
|
|
188
|
+
if (got.every(([s, u]) => s !== null && u !== null)) {
|
|
189
|
+
scored += 1;
|
|
190
|
+
lanes.forEach(([lane], i) => {
|
|
191
|
+
shown[lane] += got[i]?.[0] ?? 0;
|
|
192
|
+
unused[lane] += got[i]?.[1] ?? 0;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
153
195
|
}
|
|
154
196
|
}
|
|
155
197
|
|
|
@@ -210,6 +252,7 @@ export function probeOQ4(rows: readonly ProbeRow[]): ProbeReport {
|
|
|
210
252
|
days: unmeasuredDays.length,
|
|
211
253
|
footnotesDelivered: unmeasuredDays.reduce((n, d) => n + d.footnotesDelivered, 0),
|
|
212
254
|
},
|
|
255
|
+
hits: { boundaries: scored, shown, unused },
|
|
213
256
|
};
|
|
214
257
|
}
|
|
215
258
|
|
|
@@ -235,5 +278,20 @@ export function renderProbe(report: ProbeReport): string[] {
|
|
|
235
278
|
`unmeasured: ${report.unmeasured.days} day(s) with no recall.credit row, ${report.unmeasured.footnotesDelivered} footnotes delivered — "-" is unknown, not zero`,
|
|
236
279
|
);
|
|
237
280
|
}
|
|
281
|
+
lines.push("");
|
|
282
|
+
const h = report.hits;
|
|
283
|
+
if (h.boundaries === 0) {
|
|
284
|
+
lines.push("hit rate: - (no recall.credit row scores what recall showed yet)");
|
|
285
|
+
} else {
|
|
286
|
+
const lane = (name: string, s: number, u: number): string =>
|
|
287
|
+
`${name} ${s - u} of ${s} used${s === 0 ? "" : ` (${(((s - u) / s) * 100).toFixed(1)}%)`}`;
|
|
288
|
+
lines.push(
|
|
289
|
+
`hit rate, over ${h.boundaries} boundar${h.boundaries === 1 ? "y" : "ies"} that scored what recall showed: ${[
|
|
290
|
+
lane("loud", h.shown.loud, h.unused.loud),
|
|
291
|
+
lane("footnotes", h.shown.footnotes, h.unused.footnotes),
|
|
292
|
+
lane("pointers", h.shown.pointers, h.unused.pointers),
|
|
293
|
+
].join(", ")}`,
|
|
294
|
+
);
|
|
295
|
+
}
|
|
238
296
|
return lines;
|
|
239
297
|
}
|
|
@@ -47,7 +47,7 @@ export const GATE_STATE_VERSION = 1;
|
|
|
47
47
|
|
|
48
48
|
/** The `gate_session.kind` vocabulary this module owns. `window` is
|
|
49
49
|
* `prospective/`'s (INTERFACE-GAPS.md §3) and is deliberately not read here. */
|
|
50
|
-
export const GATE_KINDS = ["surfaced", "credited", "scalar", "semantic", "asked"] as const;
|
|
50
|
+
export const GATE_KINDS = ["surfaced", "credited", "scalar", "semantic", "asked", "judged"] as const;
|
|
51
51
|
/**
|
|
52
52
|
* `asked` (Release B, 2026-10-03): a memory a deliberate QUESTION's answer
|
|
53
53
|
* showed with its words, for this session — quotable at the boundary
|
|
@@ -65,6 +65,29 @@ export const ASKED_MAX = 200;
|
|
|
65
65
|
export function askedTurn(nowMs: number): number {
|
|
66
66
|
return Math.floor(nowMs / 1000);
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* `judged` (2026-10-09): how far the boundary's credit pass has scored this
|
|
70
|
+
* session's ambient showings. One row (`ref` `JUDGED_REF`) whose `turn` is the
|
|
71
|
+
* last recall turn a boundary judged, so each showing is scored once, at the
|
|
72
|
+
* first boundary after it: used (expanded or quoted) or shown and not used, on
|
|
73
|
+
* that boundary's `recall.credit` row. Measurement only. Its own kind, written
|
|
74
|
+
* only by the credit pass: recall's save names its own rows and cannot drop
|
|
75
|
+
* this one, and the ambient gate never reads it.
|
|
76
|
+
*/
|
|
77
|
+
export const JUDGED_KIND = "judged";
|
|
78
|
+
export const JUDGED_REF = "credit";
|
|
79
|
+
|
|
80
|
+
/** The last recall turn a boundary judged for this session; 0 when none has
|
|
81
|
+
* (including a session older than the row). */
|
|
82
|
+
export function judgedThrough(store: Store, sessionId: string): number {
|
|
83
|
+
return store.gateRecords(sessionId, JUDGED_KIND).find((r) => r.ref === JUDGED_REF)?.turn ?? 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Move the session's `judged` mark to `turn`. A gate write like any other, so
|
|
87
|
+
* an observer's store refuses it; the caller moves it forward only. */
|
|
88
|
+
export function markJudged(store: Store, sessionId: string, turn: number, day: number): void {
|
|
89
|
+
store.setGateRecords([{ sessionId, kind: JUDGED_KIND, ref: JUDGED_REF, turn, lastDay: day }]);
|
|
90
|
+
}
|
|
68
91
|
/** The one `scalar` row: the fields that are not per-memory. */
|
|
69
92
|
export const SCALAR_REF = "state";
|
|
70
93
|
/** The one `semantic` row: last turn's embedding cue, resolved to neighbours. */
|
|
@@ -144,8 +167,9 @@ interface ScalarPayload {
|
|
|
144
167
|
export function loadGateState(store: Store, sessionId: string, max = Infinity): LoadResult {
|
|
145
168
|
// `asked` rows (a deliberate answer's, 2026-10-03) are not the ambient
|
|
146
169
|
// gate's: a session whose only rows are those has no gate state yet, and
|
|
147
|
-
// must read `absent`, not `unreadable`.
|
|
148
|
-
|
|
170
|
+
// must read `absent`, not `unreadable`. The credit pass's `judged` mark
|
|
171
|
+
// (2026-10-09) is not the gate's either.
|
|
172
|
+
const rows = store.gateRecords(sessionId).filter((r) => r.kind !== ASKED_KIND && r.kind !== JUDGED_KIND);
|
|
149
173
|
if (rows.length === 0) return { state: freshGateState(sessionId), status: "absent" };
|
|
150
174
|
|
|
151
175
|
const scalarRow = rows.find((r) => r.kind === "scalar" && r.ref === SCALAR_REF);
|
|
@@ -12,14 +12,25 @@
|
|
|
12
12
|
*
|
|
13
13
|
* - **days**: "today", "yesterday", "this morning", a clock time
|
|
14
14
|
* (`recency-ask.ts`'s reading, reused), "N days ago", "a few days ago",
|
|
15
|
-
* "the other day", "past N days", "recently"
|
|
15
|
+
* "the other day", "past N days", "recently", "last Saturday" (and "this
|
|
16
|
+
* past Saturday": the most recent Saturday BEFORE today, so asked on a
|
|
17
|
+
* Saturday it is a week ago; 2026-10-09). "This Saturday" and "on
|
|
18
|
+
* Saturday" are not read: either can be the coming one;
|
|
16
19
|
* - **weeks**: "last week" (Monday to Sunday), "this week", "N weeks ago",
|
|
17
20
|
* "the past week";
|
|
18
21
|
* - **months**: "last month", "this month", "in September", "early / mid /
|
|
19
22
|
* late October", "the end of August";
|
|
20
|
-
* - **dates**: `2026-09-21`, `2026-09`, `09-21`, `9/21
|
|
21
|
-
* "September 21st", "21 September"
|
|
22
|
-
*
|
|
23
|
+
* - **dates**: `2026-09-21`, `2026-09`, `09-21`, `9/21` (month first),
|
|
24
|
+
* `9/21/2026`, "Sep 21", "September 21st", "21 September", "September 21,
|
|
25
|
+
* 2026" — a year written with the date is the year meant; without one,
|
|
26
|
+
* `yearFor` picks it. A word in front of a date bounds it (2026-10-09):
|
|
27
|
+
* "since" runs from the date to today (a month too); "before" / "prior to"
|
|
28
|
+
* is every day before it, "after" every day after it, open-ended; "until",
|
|
29
|
+
* "till", "up to", "up until" and "by" every day through it — but a date
|
|
30
|
+
* that names a thing on it ("before the 7/22 flight", "after July 22's
|
|
31
|
+
* standup") keeps its own day under "before" and "after" (review of #338).
|
|
32
|
+
* An open end is `OPEN_START` / `OPEN_END`, and a bounded window never
|
|
33
|
+
* stretches;
|
|
23
34
|
* - **anchors**: an event ("around the cut-over", "during the release") or
|
|
24
35
|
* the last session ("where did we leave off", "last session"). This file
|
|
25
36
|
* only names them; the caller resolves them against the store, because a
|
|
@@ -41,6 +52,11 @@ export const FUZZY_STRETCH_DAYS = 2;
|
|
|
41
52
|
/** Days a near window ("3 days ago", "the other day") widens on each side. */
|
|
42
53
|
export const NEAR_STRETCH_DAYS = 1;
|
|
43
54
|
|
|
55
|
+
/** The first day of a window with no start ("before 7/22"): earlier than any date a row holds. */
|
|
56
|
+
export const OPEN_START = "0001-01-01";
|
|
57
|
+
/** The last day of a window with no end ("after 7/22"): later than any date a row holds. */
|
|
58
|
+
export const OPEN_END = "9999-12-31";
|
|
59
|
+
|
|
44
60
|
/** A stretch of calendar days, `YYYY-MM-DD`, inclusive. */
|
|
45
61
|
export interface DayWindow {
|
|
46
62
|
readonly from: string;
|
|
@@ -86,6 +102,13 @@ const MONTH_NAMES = [
|
|
|
86
102
|
|
|
87
103
|
const MONTH_ALT = MONTH_NAMES.flat().sort((a, b) => b.length - a.length).join("|");
|
|
88
104
|
|
|
105
|
+
/** Sunday first, as `daysBetween("1970-01-04", day) % 7` counts (that day was a Sunday). */
|
|
106
|
+
const WEEKDAY_NAMES = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] as const;
|
|
107
|
+
|
|
108
|
+
/** The words that bound a date in front of it, longest first ("up until" before "until"). */
|
|
109
|
+
const BOUND_ALT = "prior to|up until|up to|before|after|since|until|till|by";
|
|
110
|
+
type Bound = "before" | "after" | "since" | "through";
|
|
111
|
+
|
|
89
112
|
const NUMBER_WORDS: Readonly<Record<string, number>> = {
|
|
90
113
|
a: 1, an: 1, one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, ten: 10,
|
|
91
114
|
eleven: 11, twelve: 12, couple: 2, "a couple": 2, "a couple of": 2, few: 3, "a few": 3,
|
|
@@ -149,8 +172,72 @@ function mondayOf(ymd: string): string {
|
|
|
149
172
|
return addDays(ymd, -(((since % 7) + 7) % 7));
|
|
150
173
|
}
|
|
151
174
|
|
|
175
|
+
/** The most recent `weekday` (0 = Sunday) strictly before `today`: a week back when today is one. */
|
|
176
|
+
function lastWeekday(today: string, weekday: number): string {
|
|
177
|
+
const todays = ((daysBetween("1970-01-04", today) % 7) + 7) % 7;
|
|
178
|
+
const back = (todays - weekday + 7) % 7;
|
|
179
|
+
return addDays(today, -(back === 0 ? 7 : back));
|
|
180
|
+
}
|
|
181
|
+
|
|
152
182
|
function stretched(said: DayWindow, days: number): DayWindow {
|
|
153
|
-
|
|
183
|
+
if (days <= 0) return said;
|
|
184
|
+
// An open end stays open: there is nothing past "every day before" to widen into.
|
|
185
|
+
return {
|
|
186
|
+
from: said.from === OPEN_START ? OPEN_START : addDays(said.from, -days),
|
|
187
|
+
to: said.to === OPEN_END ? OPEN_END : addDays(said.to, days),
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The word in front of a date that bounds it — "before 7/22", "since the
|
|
193
|
+
* 2026-09" — and the phrase through the date as written, to take out of the
|
|
194
|
+
* question whole. Null when the date stands alone ("on 7/22", "7/22").
|
|
195
|
+
*
|
|
196
|
+
* `event` when the date names a thing that happened on it rather than a
|
|
197
|
+
* cutoff: "before the 7/22 flight", "after the July 22 launch" (a "the" in
|
|
198
|
+
* front and a word after it that is not the question going on), "after July
|
|
199
|
+
* 22's standup", "after last Saturday's party" (review of #338, 2026-10-09).
|
|
200
|
+
* "After the 4th of July we sailed" is still a cutoff.
|
|
201
|
+
*/
|
|
202
|
+
function boundOf(text: string, found: string): { bound: Bound; word: string; phrase: string; event: { cue: string; date: string } | null } | null {
|
|
203
|
+
const m = new RegExp(`\\b(${BOUND_ALT})\\s+(the\\s+)?${escape(found)}(['’]s\\b)?`, "i").exec(text);
|
|
204
|
+
if (m === null) return null;
|
|
205
|
+
const word = (m[1] as string).toLowerCase().replace(/\s+/g, " ");
|
|
206
|
+
const bound: Bound =
|
|
207
|
+
word === "before" || word === "prior to" ? "before" : word === "after" ? "after" : word === "since" ? "since" : "through";
|
|
208
|
+
const next = /^\s+([a-z]+)/i.exec(text.slice(m.index + m[0].length))?.[1];
|
|
209
|
+
const possessive = m[3] !== undefined || /['’]s$/i.test(found);
|
|
210
|
+
const named = m[2] !== undefined && next !== undefined && !PHRASE_STOP.has(next.toLowerCase());
|
|
211
|
+
const date = `${found}${m[3] ?? ""}`;
|
|
212
|
+
return { bound, word, phrase: m[0], event: possessive || named ? { cue: `${word} ${m[2] !== undefined ? "the " : ""}${date}`, date } : null };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* A date read off the question — its first and last day, and its stretch
|
|
217
|
+
* standing alone — asked as a whole or bounded by the word in front of it.
|
|
218
|
+
* `cue` is how the header names it, when that is not the text as found.
|
|
219
|
+
*/
|
|
220
|
+
function dated(text: string, found: string, first: string, last: string, stretch: number, today: string, cue = found): TimeAsk {
|
|
221
|
+
const b = boundOf(text, found);
|
|
222
|
+
if (b === null) return ask(cue, { from: first, to: last }, stretch, without(text, found));
|
|
223
|
+
if (b.event !== null) {
|
|
224
|
+
// The date names a thing on that day ("before the 7/22 flight"): the bound
|
|
225
|
+
// keeps that day, where the thing happened, and only the date leaves the
|
|
226
|
+
// question. A cutoff past it would hide the very day asked about.
|
|
227
|
+
const said: DayWindow =
|
|
228
|
+
b.bound === "since" ? { from: first, to: today } : b.bound === "after" ? { from: first, to: OPEN_END } : { from: OPEN_START, to: last };
|
|
229
|
+
return ask(b.event.cue, said, b.bound === "since" ? stretch : 0, without(text, b.event.date));
|
|
230
|
+
}
|
|
231
|
+
const said: DayWindow =
|
|
232
|
+
b.bound === "since"
|
|
233
|
+
? { from: first, to: today }
|
|
234
|
+
: b.bound === "before"
|
|
235
|
+
? { from: OPEN_START, to: addDays(first, -1) }
|
|
236
|
+
: b.bound === "after"
|
|
237
|
+
? { from: addDays(last, 1), to: OPEN_END }
|
|
238
|
+
: { from: OPEN_START, to: last };
|
|
239
|
+
// "since" keeps the stretch it always had; a cutoff the person named is exact.
|
|
240
|
+
return ask(`${b.word} ${cue}`, said, b.bound === "since" ? stretch : 0, without(text, b.phrase));
|
|
154
241
|
}
|
|
155
242
|
|
|
156
243
|
/** A month named without a year: this year's when it has begun, else last year's. */
|
|
@@ -224,35 +311,37 @@ export function readTimeAsk(text: string, clock: { now: number; zone: string }):
|
|
|
224
311
|
}
|
|
225
312
|
|
|
226
313
|
// ── explicit dates ───────────────────────────────────────────────────────
|
|
227
|
-
const since = (found: string): boolean => new RegExp(`\\bsince\\s+${escape(found)}`, "i").test(text);
|
|
228
314
|
const iso = /\b(\d{4})-(\d{2})(?:-(\d{2}))?\b/.exec(text);
|
|
229
315
|
if (iso !== null) {
|
|
230
316
|
const found = iso[0];
|
|
231
317
|
const parsed = parseCalendarDate(found);
|
|
232
318
|
if (parsed !== null) {
|
|
233
|
-
|
|
234
|
-
return ask(since(found) ? `since ${found}` : found, said, parsed.precision === "day" ? 0 : FUZZY_STRETCH_DAYS, without(text, found));
|
|
319
|
+
return dated(text, found, parsed.first, parsed.last, parsed.precision === "day" ? 0 : FUZZY_STRETCH_DAYS, today);
|
|
235
320
|
}
|
|
236
321
|
}
|
|
237
|
-
|
|
322
|
+
// Month first, as a US writer puts it; a year after it is the year meant.
|
|
323
|
+
const short = /\b(\d{1,2})[-/](\d{1,2})(?:[-/](\d{4}))?\b/.exec(text);
|
|
238
324
|
if (short !== null) {
|
|
239
325
|
const m = Number(short[1]);
|
|
240
326
|
const d = Number(short[2]);
|
|
241
|
-
const
|
|
327
|
+
const y = short[3] !== undefined ? Number(short[3]) : m >= 1 && m <= 12 ? yearFor(m, today) : 0;
|
|
328
|
+
const day = m >= 1 && m <= 12 ? `${String(y).padStart(4, "0")}-${pad(m)}-${pad(d)}` : null;
|
|
242
329
|
if (day !== null && parseCalendarDate(day)?.precision === "day") {
|
|
243
|
-
|
|
244
|
-
return ask(since(found) ? `since ${found}` : found, since(found) ? { from: day, to: today } : { from: day, to: day }, 0, without(text, found));
|
|
330
|
+
return dated(text, short[0], day, day, 0, today);
|
|
245
331
|
}
|
|
246
332
|
}
|
|
247
|
-
const named = new RegExp(
|
|
333
|
+
const named = new RegExp(
|
|
334
|
+
`\\b(${MONTH_ALT})\\.?\\s+(\\d{1,2})(?:st|nd|rd|th)?\\b(?:,?\\s+(\\d{4})\\b)?|\\b(\\d{1,2})(?:st|nd|rd|th)?\\s+(?:of\\s+)?(${MONTH_ALT})\\b(?:,?\\s+(\\d{4})\\b)?`,
|
|
335
|
+
"i",
|
|
336
|
+
).exec(text);
|
|
248
337
|
if (named !== null) {
|
|
249
|
-
const month = monthOf((named[1] ?? named[
|
|
250
|
-
const d = Number(named[2] ?? named[
|
|
338
|
+
const month = monthOf((named[1] ?? named[5]) as string);
|
|
339
|
+
const d = Number(named[2] ?? named[4]);
|
|
340
|
+
const year = named[3] ?? named[6];
|
|
251
341
|
if (month !== null) {
|
|
252
|
-
const day = `${String(yearFor(month, today))}-${pad(month)}-${pad(d)}`;
|
|
342
|
+
const day = `${String(year !== undefined ? Number(year) : yearFor(month, today)).padStart(4, "0")}-${pad(month)}-${pad(d)}`;
|
|
253
343
|
if (parseCalendarDate(day)?.precision === "day") {
|
|
254
|
-
|
|
255
|
-
return ask(since(found) ? `since ${found}` : found, since(found) ? { from: day, to: today } : { from: day, to: day }, 0, without(text, found));
|
|
344
|
+
return dated(text, named[0], day, day, 0, today);
|
|
256
345
|
}
|
|
257
346
|
}
|
|
258
347
|
}
|
|
@@ -330,6 +419,15 @@ export function readTimeAsk(text: string, clock: { now: number; zone: string }):
|
|
|
330
419
|
}
|
|
331
420
|
|
|
332
421
|
// ── days ─────────────────────────────────────────────────────────────────
|
|
422
|
+
// "Last Saturday": the most recent one before today — a week back when
|
|
423
|
+
// today is a Saturday — and exact, as a named day is; a word in front bounds
|
|
424
|
+
// it as it bounds a date ("since last Saturday"). Not "the last Saturday",
|
|
425
|
+
// which is the last of something else ("of June") (2026-10-09).
|
|
426
|
+
const weekday = new RegExp(`(?<!\\bthe\\s)\\b(?:last|this past)\\s+(${WEEKDAY_NAMES.join("|")})\\b(?:['’]s\\b)?`, "i").exec(text);
|
|
427
|
+
if (weekday !== null) {
|
|
428
|
+
const day = lastWeekday(today, WEEKDAY_NAMES.indexOf((weekday[1] as string).toLowerCase() as (typeof WEEKDAY_NAMES)[number]));
|
|
429
|
+
return dated(text, weekday[0], day, day, 0, today, weekday[0].replace(/['’]s$/i, ""));
|
|
430
|
+
}
|
|
333
431
|
// Before "yesterday" is read on its own (review of #323).
|
|
334
432
|
const dayBefore = /\bthe day before yesterday\b/i.exec(text);
|
|
335
433
|
if (dayBefore !== null) {
|
|
@@ -212,7 +212,10 @@ INTERFACE-GAPS §2a; this module still never gates and never reads them).
|
|
|
212
212
|
miss falls back to **content matching** against candidate memories — score and margin
|
|
213
213
|
both required, ambiguity refuses, the author's hint is a tiebreak inside the margin and
|
|
214
214
|
can never defeat a refusal, and score/margin/method are logged as provenance
|
|
215
|
-
(scar §2.5). A miss costs nothing durable: the memory still lands.
|
|
215
|
+
(scar §2.5). A miss costs nothing durable: the memory still lands. An id that RESOLVES
|
|
216
|
+
is an address, not yet a licence: whether a `changed` or `corrected` there may move the
|
|
217
|
+
memory it names is the update guard's call, made after this resolution
|
|
218
|
+
(2026-10-09, `schemas/CONTRACT.md` §5 1b).
|
|
216
219
|
11. **[A] The ask's wording is load-bearing and is part of the spec** — first person, the
|
|
217
220
|
author's own voice, what happened and what mattered, how it felt, what was learned
|
|
218
221
|
about the person and about oneself. It sanctions honesty about a routine stretch and
|
|
@@ -297,7 +297,15 @@ proposal and the memory stay the depositor's. The next-session write-up's door p
|
|
|
297
297
|
`false` on an earlier part and the ended session on the last; the instance-level
|
|
298
298
|
shadowing of `SpanBuffer#claimCoverage` it replaced is gone (NOTES §17).
|
|
299
299
|
|
|
300
|
-
## 16. `HeldSession` does not say when a session last answered, or last spoke
|
|
300
|
+
## 16. `HeldSession` does not say when a session last answered, or last spoke — CLOSED 2026-09-30 by replacement, #289 (noted 2026-10-09)
|
|
301
|
+
|
|
302
|
+
**Closed by replacement** (#289, `fc665c2`, merged 2026-09-30): the asked / answered
|
|
303
|
+
predicate and `sessions.ts#openAndAnswered` are gone. What a session owes is
|
|
304
|
+
`core/coverage/`'s ledger (`HeldSession.owes` carries it), which knows per piece whether a
|
|
305
|
+
claim covers it, so words said after an answer are an unwritten stretch with no
|
|
306
|
+
`lastAnswerAt` needed (claude-code INTERFACE-GAPS §17, closed the same way).
|
|
307
|
+
|
|
308
|
+
*The entry as filed, for the record:*
|
|
301
309
|
|
|
302
310
|
**Owner:** `remember/owes.ts#planRetention`. Filed 2026-09-23 (C2 re-review m-E).
|
|
303
311
|
`planRetention` computes the time of every answer it counts (proposal times, handoff rows,
|
|
@@ -23,7 +23,8 @@ import { SETTLE_HOWS } from "../types.js";
|
|
|
23
23
|
import type { Kind, Salience, SettleHow } from "../types.js";
|
|
24
24
|
import { hashText } from "../store/prose.js";
|
|
25
25
|
import type { WriteFacts } from "../store/index.js";
|
|
26
|
-
import { parseCalendarDate } from "../time.js";
|
|
26
|
+
import { isDay, isRecurrence, parseCalendarDate } from "../time.js";
|
|
27
|
+
import type { Recurrence } from "../time.js";
|
|
27
28
|
import { randomBytes } from "node:crypto";
|
|
28
29
|
|
|
29
30
|
// TYPE-ONLY, and the only edge this module has to `encode/`. The gate itself
|
|
@@ -82,6 +83,13 @@ export interface ProposalDraft {
|
|
|
82
83
|
/** Plain or quiet (`prospective/` `CUE_MODE_META`). Only meaningful beside an
|
|
83
84
|
* `eventDate`; without one it is dropped and counted. Default quiet. */
|
|
84
85
|
remind?: "plain" | "quiet";
|
|
86
|
+
/**
|
|
87
|
+
* How often the date comes round, anchored on it (2026-10-09, `meta.recurring`):
|
|
88
|
+
* `daily | weekly | monthly | yearly`. Only a DAY repeats — beside a month,
|
|
89
|
+
* a range or a year it is malformed (`RECURRING_NEEDS_DAY`); without a date
|
|
90
|
+
* it is dropped and counted, as `remind` is.
|
|
91
|
+
*/
|
|
92
|
+
recurring?: Recurrence;
|
|
85
93
|
}
|
|
86
94
|
|
|
87
95
|
export type ProposalSource = "session-end" | "jot";
|
|
@@ -93,6 +101,10 @@ export interface DateIntent {
|
|
|
93
101
|
readonly eventDate: "set" | "cleared" | "absent";
|
|
94
102
|
/** The `remind` the author sent, or null when none was (the draft's quiet is a default). */
|
|
95
103
|
readonly remind: "plain" | "quiet" | null;
|
|
104
|
+
/** The `recurring` the author sent (2026-10-09); `cleared` when it sent
|
|
105
|
+
* `recurring: null` (a revision's "it no longer repeats"); null when it
|
|
106
|
+
* sent nothing. */
|
|
107
|
+
readonly recurring: Recurrence | "cleared" | null;
|
|
96
108
|
}
|
|
97
109
|
|
|
98
110
|
/** What the engine mints. Memory objects only — no operations, by construction. */
|
|
@@ -120,6 +132,9 @@ export interface Proposal {
|
|
|
120
132
|
eventDate: string | null;
|
|
121
133
|
/** Plain or quiet — null exactly when `eventDate` is. */
|
|
122
134
|
remind: "plain" | "quiet" | null;
|
|
135
|
+
/** How often the date comes round (2026-10-09). Absent or null: once. Never
|
|
136
|
+
* set without a DAY `eventDate`. */
|
|
137
|
+
recurring?: Recurrence | null;
|
|
123
138
|
/**
|
|
124
139
|
* What the author SAID about the date, as opposed to what defaulted — read
|
|
125
140
|
* only when this proposal revises a memory (`updates:`), where a date the
|
|
@@ -178,6 +193,10 @@ export type MalformedReason =
|
|
|
178
193
|
| "EVENT_DATE_UNREADABLE"
|
|
179
194
|
/** `remind` is not `plain` or `quiet`. */
|
|
180
195
|
| "REMIND_UNKNOWN"
|
|
196
|
+
/** `recurring` is not `daily`, `weekly`, `monthly` or `yearly` (2026-10-09). */
|
|
197
|
+
| "RECURRING_UNKNOWN"
|
|
198
|
+
/** `recurring` beside an `eventDate` that is not one day: only a day repeats. */
|
|
199
|
+
| "RECURRING_NEEDS_DAY"
|
|
181
200
|
/** `how` is not `changed`, `corrected` or `open`. */
|
|
182
201
|
| "HOW_UNKNOWN";
|
|
183
202
|
|
|
@@ -209,6 +228,7 @@ export const DRAFT_FIELDS = [
|
|
|
209
228
|
"unresolved",
|
|
210
229
|
"eventDate",
|
|
211
230
|
"remind",
|
|
231
|
+
"recurring",
|
|
212
232
|
] as const;
|
|
213
233
|
|
|
214
234
|
export type IntakeResult =
|
|
@@ -308,15 +328,26 @@ export function intake(raw: unknown): IntakeResult {
|
|
|
308
328
|
if (rec["remind"] !== undefined && rec["remind"] !== null) {
|
|
309
329
|
if (rec["remind"] !== "plain" && rec["remind"] !== "quiet") return bad("REMIND_UNKNOWN");
|
|
310
330
|
}
|
|
331
|
+
// HOW OFTEN IT COMES ROUND (2026-10-09): one of four words, and only beside
|
|
332
|
+
// a DAY — a month, a range or a year has no one day to come round on.
|
|
333
|
+
let recurring: Recurrence | undefined;
|
|
334
|
+
if (rec["recurring"] !== undefined && rec["recurring"] !== null) {
|
|
335
|
+
if (!isRecurrence(rec["recurring"])) return bad("RECURRING_UNKNOWN");
|
|
336
|
+
if (eventDate !== undefined && !isDay(eventDate)) return bad("RECURRING_NEEDS_DAY");
|
|
337
|
+
recurring = rec["recurring"];
|
|
338
|
+
}
|
|
311
339
|
|
|
312
340
|
const draft: ProposalDraft = { content: rec["content"] as string };
|
|
313
341
|
if (eventDate !== undefined) {
|
|
314
342
|
draft.eventDate = eventDate;
|
|
315
343
|
draft.remind = rec["remind"] === "plain" ? "plain" : "quiet";
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
//
|
|
319
|
-
dropped
|
|
344
|
+
if (recurring !== undefined) draft.recurring = recurring;
|
|
345
|
+
} else {
|
|
346
|
+
// Plain or quiet says HOW a date comes back, and `recurring` how often;
|
|
347
|
+
// with no date there is nothing to come back, so each is dropped and
|
|
348
|
+
// counted like any field with nowhere to go.
|
|
349
|
+
if (rec["remind"] !== undefined && rec["remind"] !== null) dropped.push("remind");
|
|
350
|
+
if (recurring !== undefined) dropped.push("recurring");
|
|
320
351
|
}
|
|
321
352
|
if (rec["kind"] !== undefined) draft.kind = rec["kind"] as Kind;
|
|
322
353
|
if (typeof rec["title"] === "string") draft.title = rec["title"];
|
|
@@ -340,6 +371,7 @@ export function intake(raw: unknown): IntakeResult {
|
|
|
340
371
|
const dateIntent: DateIntent = {
|
|
341
372
|
eventDate: eventDate !== undefined ? "set" : rec["eventDate"] === null ? "cleared" : "absent",
|
|
342
373
|
remind: rec["remind"] === "plain" || rec["remind"] === "quiet" ? rec["remind"] : null,
|
|
374
|
+
recurring: recurring ?? (rec["recurring"] === null ? "cleared" : null),
|
|
343
375
|
};
|
|
344
376
|
const threadSaid = typeof rec["unresolved"] === "boolean";
|
|
345
377
|
return { ok: true, draft: draft as Required<Pick<ProposalDraft, "content">> & ProposalDraft, dropped, dateIntent, threadSaid };
|
|
@@ -658,6 +690,7 @@ export async function submitProposal(
|
|
|
658
690
|
unresolved: draft.unresolved === true,
|
|
659
691
|
eventDate: draft.eventDate ?? null,
|
|
660
692
|
remind: draft.eventDate === undefined ? null : draft.remind ?? "quiet",
|
|
693
|
+
recurring: draft.eventDate === undefined ? null : draft.recurring ?? null,
|
|
661
694
|
dateIntent: parsed.dateIntent,
|
|
662
695
|
...(parsed.threadSaid ? { threadSaid: true } : {}),
|
|
663
696
|
at: buffer.now(),
|
package/src/core/revision.ts
CHANGED
|
@@ -47,6 +47,11 @@
|
|
|
47
47
|
* `how` and stays a link: a retelling of a transcript does not settle what
|
|
48
48
|
* the experiencer did not.
|
|
49
49
|
*
|
|
50
|
+
* **An authored `changed` or `corrected` arrives here already read**
|
|
51
|
+
* (2026-10-09): `Counterpart#guardUpdate` checks the pair before the mint,
|
|
52
|
+
* and one that looks unrelated is minted with no `updates` at all, so this
|
|
53
|
+
* seam is never called for it (`contradictions.ts#updateRelatedness`).
|
|
54
|
+
*
|
|
50
55
|
* "One declaration adds pressure; the element is superseded only when the bar is
|
|
51
56
|
* crossed; the old version is retained with lineage" (constitution 7) — that is
|
|
52
57
|
* the slow half. A current-state row is the fast half by construction: a "now"
|
|
@@ -106,7 +106,19 @@ name/alias resolution; birth and death telemetry.
|
|
|
106
106
|
SETTLED when an author declared it (2026-09-29, `src/core/contradictions.ts`): `how` is
|
|
107
107
|
`changed` (the default — one strength cut, labelled earlier), `corrected` (archived:
|
|
108
108
|
out of recall, readable by its id) or `open` (both kept); a SWEPT declaration carries no
|
|
109
|
-
`how` and stays a link.
|
|
109
|
+
`how` and stays a link. **Before any of it, an authored `changed` or `corrected` declared
|
|
110
|
+
by id is read against the memory it names** (2026-10-09, the update guard,
|
|
111
|
+
`Counterpart#guardUpdate` → `contradictions.ts#updateRelatedness`): by meaning through the
|
|
112
|
+
embedder (cosine under `UPDATE_COSINE`, 0.30 CAL, looks unrelated), by shared content words
|
|
113
|
+
when there is no embedder. A pair that looks unrelated is HELD — the new memory lands with
|
|
114
|
+
no `updates`, so nothing is linked, carried, closed, settled or pressed; the writer is
|
|
115
|
+
shown the old memory's title and text and asked to settle it itself (`note` settle) if it
|
|
116
|
+
meant to; a `contradiction.held` row records it; no pair is written. A CLOSE OR A REDATE
|
|
117
|
+
goes straight through: the memory named is an open thread, or the write sends a reminder
|
|
118
|
+
field (`eventDate`, a date or null, or `remind`) and it holds a date, or the write sends a
|
|
119
|
+
`status` and it has a different one. `open`, a content match the engine made itself and a
|
|
120
|
+
swept declaration are not read. A batch writer (a write-up, the nightly catch-up) has
|
|
121
|
+
nobody to read the reply, so its hold stays a hold. A **protected** element refuses every one of those paths. Authored
|
|
110
122
|
declarations count for more than swept ones through the PHYSICS alone — a fallback
|
|
111
123
|
challenger's claim was already cut at the minting seam — and no second weighting
|
|
112
124
|
exists here. A CONFIRMATION (the engine matched a restatement rather than an author
|
|
@@ -27,7 +27,13 @@ Three symbols are imported from `encode/`, all leaf files, no cycle:
|
|
|
27
27
|
never become an entity the store indexes. Birth refuses the name outright
|
|
28
28
|
(`name-is-secret`), because unlike an alias, a name has no drop-and-continue.
|
|
29
29
|
|
|
30
|
-
## 1. `store/` has no durable event log — the revision story is session-scoped
|
|
30
|
+
## 1. `store/` has no durable event log — the revision story is session-scoped — CLOSED 2026-08-25 (noted 2026-10-09)
|
|
31
|
+
|
|
32
|
+
**Closed by the wave-3 seam pass** (`d88f957`, SEAMS item K): box 2 has an `events` table
|
|
33
|
+
with its own retention sweep, every pressure increment is appended as a
|
|
34
|
+
`revision.pressure` row with a dedup key, and `story()` reads them back through
|
|
35
|
+
`Store#eventLog` before this session's own ring, so a restart keeps the story. The text
|
|
36
|
+
below is the gap as filed.
|
|
31
37
|
|
|
32
38
|
**Owner:** `store/` (box 2), with `dashboard/` as the consumer.
|
|
33
39
|
**Needed:** contract §5 says every pressure increment is logged and the
|
|
@@ -63,7 +69,7 @@ moment two adapters open the store concurrently it is stale-cache territory.
|
|
|
63
69
|
on write, or first-class `schema_element` columns. A `Store.listByMeta(key,
|
|
64
70
|
value)` is the smallest useful shape.
|
|
65
71
|
|
|
66
|
-
## 3. `recall/` should take its alias map from here — SEAMS §6 wiring
|
|
72
|
+
## 3. `recall/` should take its alias map from here — SEAMS §6 wiring — CLOSED 2026-08-25 (noted 2026-10-09)
|
|
67
73
|
|
|
68
74
|
**Owner:** the coordinator. **Do not edit `recall/`.**
|
|
69
75
|
`recall/INTERFACE-GAPS.md` §2 records that `Turn.aliases?: ReadonlyMap<string,
|
|
@@ -86,6 +92,12 @@ because the shared whole-word matcher is case-insensitive without an option;
|
|
|
86
92
|
**The gap stays open until a test in the composed pipeline proves the map is
|
|
87
93
|
actually passed** — the safety half is unreachable from inside either module.
|
|
88
94
|
|
|
95
|
+
**CLOSED 2026-08-25 (noted 2026-10-09)** by the wave-3 seam pass (`d88f957`):
|
|
96
|
+
`core/retrieval.ts#composeTurn` sets `aliases` from `schemas.aliasMap()`, and
|
|
97
|
+
`test/seams.test.ts` proves it in the composed pipeline ("composed, an ambiguous handle
|
|
98
|
+
sets trains:false and resolveUse REFUSES the credit", and the same turn without the
|
|
99
|
+
wiring trains).
|
|
100
|
+
|
|
89
101
|
## 4. `encode/`'s `SchemaSlice` has no elision count
|
|
90
102
|
|
|
91
103
|
**Owner:** `encode/`.
|
|
@@ -101,6 +113,12 @@ by `renderSchemaContext` the way it already announces the identity-core
|
|
|
101
113
|
truncation. Until then the field is carried and ignored, which is honest but not
|
|
102
114
|
enforced anywhere.
|
|
103
115
|
|
|
116
|
+
*(Noted 2026-10-09: a slice does elide now. Since 2026-08-29 (`e5e6cea`, #6)
|
|
117
|
+
`slices({ excludeProtected: true })` drops protected elements and counts them in
|
|
118
|
+
`elided`, and the composition root emits `counterpart.sweep.cards.elided` with the sum.
|
|
119
|
+
`SchemaSlice` still has no `elided` field and the prompt does not announce it, so the
|
|
120
|
+
real fix above is still open.)*
|
|
121
|
+
|
|
104
122
|
## 5. `self/` must mint the identity core in this module's shape
|
|
105
123
|
|
|
106
124
|
**Owner:** `self/`.
|