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
|
@@ -407,3 +407,130 @@ too: it is not a claim.
|
|
|
407
407
|
same hits as `matchesIn` with a word-token prefilter (`encode/words.ts#wordTokens`, the
|
|
408
408
|
matcher's own word class) and every candidate confirmed by the one rule — so the
|
|
409
409
|
prefilter can skip work without changing an answer (`test/recall-write-side.test.ts`).
|
|
410
|
+
|
|
411
|
+
## 2026-10-09 — the update guard: a `changed` or `corrected` is read before it moves anything
|
|
412
|
+
|
|
413
|
+
**Why.** §16's arm settles on the writer's word. A 10-02 benchmark read (counterparts-87,
|
|
414
|
+
LongMemEval, a Haiku 4.5 writer) found the `updates` pointing at an unrelated memory in
|
|
415
|
+
about two thirds of 149 sampled pairs — one memory about a mole removal retired a passport
|
|
416
|
+
name change. On the owner's store (Opus) all 10 checked were right. The risk is the weaker
|
|
417
|
+
host model, and the bad moment. The bench harness had dropped such links on its own side
|
|
418
|
+
(`plausiblyRelated`, `tools/longmemeval/store.ts` on `bench/longmemeval`); it drops that
|
|
419
|
+
once this lands.
|
|
420
|
+
|
|
421
|
+
**What.** Contract §5 1b states the rule. `Counterpart#guardUpdate` runs between intake
|
|
422
|
+
and mint, so a hold is a proposal with no `updates`: no `meta.updates` link, no reminder
|
|
423
|
+
carried or moved, no facts inherited, no thread closed, no settle, no pressure, and an
|
|
424
|
+
unrelated pair is never shown as a disagreement. The writer gets the old memory's words
|
|
425
|
+
and the neighbours' ask (`HELD_HINT`); `settle` with `holds`/`over` needs no new code. The
|
|
426
|
+
record is a durable `contradiction.held` row (ids and numbers, no text) and its reader
|
|
427
|
+
`heldCorrections`, which no line calls yet (mcp INTERFACE-GAPS §12).
|
|
428
|
+
|
|
429
|
+
**The calibration** (scratch script, not committed; potion-base-8M, the full index text
|
|
430
|
+
of each memory, cosine). 120 labelled pairs: 31 related and 29 unrelated from the demo
|
|
431
|
+
store's script (the challenges against their beliefs, the current-state correction, later
|
|
432
|
+
notes that change earlier ones on the same subject; unrelated = two notes on different
|
|
433
|
+
subjects, in one tight domain where "rota", "ward" and "shift" are everywhere), and 30 and
|
|
434
|
+
30 hand-written life and work facts (related ones worded differently on purpose — "lives
|
|
435
|
+
in Austin" / "Colorado is home now", "Postgres on RDS" / "migrated the main DB to
|
|
436
|
+
Aurora"; unrelated ones like the mole and the passport). Counts are related passed /
|
|
437
|
+
related held | unrelated passed / unrelated held:
|
|
438
|
+
|
|
439
|
+
| rule | related | unrelated |
|
|
440
|
+
|---|---|---|
|
|
441
|
+
| shared content word (the bench rule) | 46 / 15 | 12 / 47 |
|
|
442
|
+
| meaning ≥ 0.30 (**chosen**) | 50 / 11 | 1 / 58 |
|
|
443
|
+
| meaning ≥ 0.35 | 44 / 17 | 1 / 58 |
|
|
444
|
+
| meaning ≥ 0.40 | 38 / 23 | 0 / 59 |
|
|
445
|
+
| word AND meaning ≥ 0.30 (the brief's "both pass") | 41 / 20 | 1 / 58 |
|
|
446
|
+
| word OR meaning ≥ 0.40 | 50 / 11 | 12 / 47 |
|
|
447
|
+
|
|
448
|
+
The unrelated pairs topped out at 0.29 but one: two demo notes about reading (a solver's
|
|
449
|
+
constraint list, a printed rota) at 0.37, arguably related. Meaning alone holds the fewest
|
|
450
|
+
related pairs at the same one false pass; the words, as a second requirement, only add
|
|
451
|
+
held corrections, and as a second way in they let through every pair that shares a
|
|
452
|
+
common word ("back", "because", "staff"). So meaning decides when there are two vectors
|
|
453
|
+
and the words only when there are not. That is a departure from the brief's "both clearly
|
|
454
|
+
pass", named and held lightly.
|
|
455
|
+
|
|
456
|
+
**Limits seen.** Mean-pooled static vectors dilute: "Mike moved to Denver." / "Mike lives
|
|
457
|
+
in Colorado now." reads 0.68, but "Mike lives in Austin, Texas, in a rented house near
|
|
458
|
+
Zilker Park." / "Moved to Denver last month; Colorado is home now." reads 0.23 and is held.
|
|
459
|
+
Short texts lean on their function words: "The user changed her name on her passport." /
|
|
460
|
+
"The user had a mole removed." reads 0.28 — under the bar, not by much. Renames of a
|
|
461
|
+
technology (React → Svelte 0.17, GitHub Actions → Buildkite 0.27) read as unrelated. A
|
|
462
|
+
writer that is reading its replies settles those itself; a batch writer leaves them held,
|
|
463
|
+
both memories live, which costs a stale memory staying at full strength, never a wrong one
|
|
464
|
+
archived.
|
|
465
|
+
|
|
466
|
+
**Where it does not apply.** `open` (moves nothing). A content match (`content`,
|
|
467
|
+
`content+hint`): the engine's own reading, already held to a score floor. A sweep (no
|
|
468
|
+
`how`). And a close or a redate: an open thread (both documented roads close one, and an
|
|
469
|
+
answer rarely shares its question's words — "which cache?" / "Redis" reads −0.08), a
|
|
470
|
+
reminder field at a memory holding a date, a status unlike the one it had. A field the
|
|
471
|
+
memory has nothing for — `eventDate` on an undated memory, `status` where it had none —
|
|
472
|
+
dates or describes the new memory, so the pair is read. The cost of the open-thread rule:
|
|
473
|
+
a wrong id that happens to name an open thread closes it, `corrected` included — the
|
|
474
|
+
wake's "Still open" lane hands those ids out, so a writer pointing there is usually
|
|
475
|
+
pointing on purpose, and an unanswered thread held open by the guard would be the quieter
|
|
476
|
+
failure (the coordinator's call, 10-09).
|
|
477
|
+
|
|
478
|
+
### Review of #340 (2026-10-09): the false holds, the batch writers, and three ways to hold fewer
|
|
479
|
+
|
|
480
|
+
**Which writers are batch.** The nightly catch-up's child may call `session_end` and
|
|
481
|
+
nothing else (`night-catch-up.ts#CATCH_UP_TOOLS`): it cannot recall, so the only memory
|
|
482
|
+
ids it ever sees are the neighbours its own `session_end` replies list, and it cannot
|
|
483
|
+
`note` a settle even when it reads a hold. So on the owner's store few of its corrections
|
|
484
|
+
are declared by id at all, and those that are point at a neighbour, close to something it
|
|
485
|
+
just wrote. The SessionStart write-up and a live session's `session_end` are written by a
|
|
486
|
+
session that has `recall` and `note` and reads its replies. The benchmark writer calls
|
|
487
|
+
`submitSessionEnd` directly and today drops unrelated links on its own side, by the
|
|
488
|
+
shared-word rule. `writeUp` in the deposit context is not a batch signal: the SessionStart
|
|
489
|
+
write-up sends it too. The only crisp night signal is the runner's `writeup-` session
|
|
490
|
+
prefix, an adapter fact.
|
|
491
|
+
|
|
492
|
+
**The three ways to hold fewer, measured** (the builder's 120 pairs with real subject
|
|
493
|
+
cards: the demo store seeded into a temp dir, and a card for each person, pet, place,
|
|
494
|
+
project and product the hand set names; plus 20 pairs written for this review BEFORE
|
|
495
|
+
scoring, in the owner's style: ten corrections — a PR merged, a default turned on, a
|
|
496
|
+
decision dropped, a release changing hands, a role changing, a vendor replaced — and ten
|
|
497
|
+
wrong pointers between memories of the same project). Related held | unrelated passed:
|
|
498
|
+
|
|
499
|
+
| rule | 120 labelled | owner-style 20 |
|
|
500
|
+
|---|---|---|
|
|
501
|
+
| meaning ≥ 0.30 (the PR) | 11/61 (18%) · 1/59 (2%) | 0/10 · 0/10 |
|
|
502
|
+
| meaning OR a shared subject card | 11/61 · 1/59 | 0/10 · 1/10 |
|
|
503
|
+
| meaning OR a shared content word | 6/61 (10%) · 12/59 (20%) | 0/10 · 1/10 |
|
|
504
|
+
| a shared content word alone (the bench harness today) | 15/61 (25%) · 12/59 | 1/10 · 1/10 |
|
|
505
|
+
|
|
506
|
+
- **A shared subject card rescues none of the eleven.** Thirteen related demo pairs name a
|
|
507
|
+
card in common, and every one already clears 0.30: a rare name weighs heavily in a
|
|
508
|
+
static vector, so a pair that shares one is close in meaning anyway. The held eleven are
|
|
509
|
+
substitutions (React to Svelte, Postgres to Aurora, Austin to Denver), which name no card
|
|
510
|
+
in common. What the pass adds is a way through for two memories that name a hub card
|
|
511
|
+
("Counterparts", 0.27). And on the benchmark stores, 9 cards in 498 stores: idle where
|
|
512
|
+
the weak writer is. Not built.
|
|
513
|
+
- **Guarding only `corrected` lets the default through.** `changed` is what a write gets
|
|
514
|
+
when it sends no `how`, and facts mode folds a `changed`-settled memory under the new
|
|
515
|
+
one as its earlier version (`mcp/facts.ts`), so a wrong `changed` is a wrong answer,
|
|
516
|
+
not a harmless fade. Not built.
|
|
517
|
+
- **Meaning OR words for batch writers** (the coordinator's proposal) halves the false
|
|
518
|
+
holds and lets a fifth of the wrong pointers through ("third", "doctor", "staff",
|
|
519
|
+
"because"). For a writer wrong two times in three (the 10-02 Haiku read), wrong outcomes
|
|
520
|
+
per declared update are about 0.07 under meaning alone and 0.17 under OR; for a writer
|
|
521
|
+
almost always right, 0.17 and 0.10. OR is the better rule only for a strong batch
|
|
522
|
+
writer, and core knows neither which writer is batch nor how strong it is. Not built;
|
|
523
|
+
an owner question on the PR.
|
|
524
|
+
|
|
525
|
+
**Overfit?** The bar sits at the top edge of the unrelated pairs (the highest held one
|
|
526
|
+
reads 0.293), and five related pairs sit within 0.04 above it, so a fresh set will move
|
|
527
|
+
both counts. The owner-style twenty were not tuned to it: all ten corrections passed
|
|
528
|
+
(lowest 0.324, a contractor replaced) and all ten wrong pointers were held (highest
|
|
529
|
+
0.271). The hand-written related pairs were worded to share no word on purpose, so 18% is
|
|
530
|
+
likely the pessimistic end for the owner's own corrections. `heldCorrections`'
|
|
531
|
+
`settledAfter / held` is the number that will say.
|
|
532
|
+
|
|
533
|
+
**Terse closes.** A thread closes on the real table with a "done" the guard would
|
|
534
|
+
otherwise hold, through `note` and through `session_end`
|
|
535
|
+
(`test/update-guard.test.ts`). The tersest a write can be is the content floor's (20
|
|
536
|
+
characters, 3 words): "Done." alone is refused before the guard, as it was before it.
|
|
@@ -301,6 +301,8 @@ export type FadeReason =
|
|
|
301
301
|
| "band-not-episodic"
|
|
302
302
|
| "protected"
|
|
303
303
|
| "in-live-revision-chain"
|
|
304
|
+
/** Physics' sixth gate (a repeating reminder date). The card fade never asks it. */
|
|
305
|
+
| "recurring"
|
|
304
306
|
| "has-live-attached-elements"
|
|
305
307
|
/** The identity core is not a card that fades. */
|
|
306
308
|
| "identity-core"
|
|
@@ -92,7 +92,10 @@ counted by doctor, and said in the next morning share).
|
|
|
92
92
|
- **Ingestion is ordinary and the gates apply**: a first-person reflection is not exempt from
|
|
93
93
|
never durably encoding a credential. [v1 §13 G8]
|
|
94
94
|
- **Add-first regrowth within a bounded window that CLOSES** — a deliberate deviation from
|
|
95
|
-
human reconsolidation, which reopens on every retrieval. [v1 §13 G11–G12]
|
|
95
|
+
human reconsolidation, which reopens on every retrieval. [v1 §13 G11–G12] The new copy
|
|
96
|
+
inherits the links the archived one had learned, through the injected `retarget`
|
|
97
|
+
(`associate.retargetOnSupersede`, 2026-10-09); without it they were stranded on a row
|
|
98
|
+
that conducts nothing.
|
|
96
99
|
- **Named handles are aliases, not a second lookup path** — "the lighthouse conversation" enters
|
|
97
100
|
through the ordinary rarity-weighted name channel. [v1 §9.2]
|
|
98
101
|
- **Lived salience is the only legitimate identity input.** [v1 §14.2, earned 2026-08-24]
|
|
@@ -229,7 +232,8 @@ proposals and their archive; render and delivery telemetry.
|
|
|
229
232
|
with the date it was learned** — `- YYYY-MM-DD · statement`, and
|
|
230
233
|
`- YYYY-MM-DD (of YYYY-MM-DD) · statement` when the content date differs (neutral,
|
|
231
234
|
because the horizon lane's dates are in the future), `- YYYY-MM-DD (due YYYY-MM-DD) ·
|
|
232
|
-
statement` for an arriving occasion (2026-10-01)
|
|
235
|
+
statement` for an arriving occasion (2026-10-01) — `(due YYYY-MM-DD, every May 14)`
|
|
236
|
+
when its date repeats (2026-10-09) — and no prefix when the statement
|
|
233
237
|
already opens with that same date. Leading, not trailing: the age is
|
|
234
238
|
read before the claim, the element's own text still ends the line, and it costs 14 bytes
|
|
235
239
|
at day precision against 21 for a trailing form — counted in the composed budget and in
|
|
@@ -323,7 +327,11 @@ proposals and their archive; render and delivery telemetry.
|
|
|
323
327
|
ifVersion? })` is the only door — the MCP tool, the owner's console and the nightly
|
|
324
328
|
writer all arrive there — and it crosses the same gate battery the journal does, so a
|
|
325
329
|
credential cannot land in the one piece of prose every session reads. **A redaction is
|
|
326
|
-
reported**: accepted is not the same as unaltered, and both doors say so.
|
|
330
|
+
reported**: accepted is not the same as unaltered, and both doors say so. A line of
|
|
331
|
+
the page's own that is a dateline — "Last revised" and a date, standing alone — is left
|
|
332
|
+
out before the caps and the gate see the body (2026-10-09, `page.ts#stripRevisedLines`):
|
|
333
|
+
the wake dates the page, and the revision row counts what went (`datelines`). Prose, a
|
|
334
|
+
list entry, a page's own history and a code block that open with the words stay. Every
|
|
327
335
|
accepted revision leaves a version (`store.revise` archives the prior one first) and a
|
|
328
336
|
durable `self.page.revised` row; every refusal leaves a `self.page.refused` row and a
|
|
329
337
|
named reason; an observer writes neither. The page is `type: "schema"`,
|
|
@@ -336,7 +344,10 @@ proposals and their archive; render and delivery telemetry.
|
|
|
336
344
|
VERSIONS take the ordinary retention, deliberately un-special-cased (owner ruling 1).
|
|
337
345
|
Proved by a test that runs a full cycle and the prune over a store holding a page with
|
|
338
346
|
two versions.
|
|
339
|
-
16. **[M]** **The page is what "Who I am" prints, first and as is
|
|
347
|
+
16. **[M]** **The page is what "Who I am" prints, first and as is** — less any
|
|
348
|
+
dateline of its own ("Last revised" and a date, standing alone), since the wake's
|
|
349
|
+
under it is the page's date (2026-10-09; a page stored before the write-side strip
|
|
350
|
+
printed two) — under
|
|
340
351
|
`PAGE_WAKE_BYTES` clamped to the caller's budget **less `PAGE_FLOOR_RESERVE_BYTES`, the
|
|
341
352
|
furniture the wake wraps it in** — the page is furniture the trim loop cannot pop, so a
|
|
342
353
|
page sized against the whole ceiling puts the composition over it with nothing left to
|
|
@@ -173,7 +173,7 @@ and neither wires it today. Recorded here so the freeze does not become v1's
|
|
|
173
173
|
"documented in three places, enforced in one, consumed by nobody" (scar §2.6). The
|
|
174
174
|
guarantee that this seam is reachable is the coordinator's, not this module's.
|
|
175
175
|
|
|
176
|
-
## 8. The threads lane has no source on a migrated store — nothing carries `unresolved`
|
|
176
|
+
## 8. The threads lane has no source on a migrated store — nothing carries `unresolved` — CLOSED FOR (1) AND (2) 2026-10-01 (`52384b0`, #313)
|
|
177
177
|
|
|
178
178
|
**Owner:** `remember/` (who mints and revises memories) plus `tools/migrate` (what came
|
|
179
179
|
across from v1).
|
|
@@ -210,6 +210,9 @@ ask says to close what got done. `THREADS_MAX` is 5 now. (3) is not built.
|
|
|
210
210
|
the machine's LOCAL calendar day (`calendar.ts`, NOTES §22). What survives is the other
|
|
211
211
|
half named below and in NOTES §22: provenance dates — `learned_on`, the `date` on every
|
|
212
212
|
`adapter.ask` row — are still UTC, and they are `store/`'s and the hooks' to move.
|
|
213
|
+
**That half CLOSED 2026-09-25 by #231 (`ab9b6eb`), noted 2026-10-09:** `Store#today` is
|
|
214
|
+
the person's local date, so `learned_on` is too, and the hook stamps its rows with the
|
|
215
|
+
local date (`bin/hook.ts`). Rows written before then keep their UTC dates.
|
|
213
216
|
|
|
214
217
|
*The entry as it stood before, for the record:*
|
|
215
218
|
|
|
@@ -314,4 +317,6 @@ wake time would put ranking on the wake path, which is meant to compute nothing.
|
|
|
314
317
|
|
|
315
318
|
- **The page writer's `off` mode does not reach the reflection** (2026-09-27): the
|
|
316
319
|
reflection writes the page from the MCP server, which does not read the host
|
|
317
|
-
configuration. Named in dream INTERFACE-GAPS §7.
|
|
320
|
+
configuration. Named in dream INTERFACE-GAPS §7. *(CLOSED 2026-09-27 by #256
|
|
321
|
+
(`39ca6d0`), noted 2026-10-09: the server reads `pageWriter.mode` from the host's
|
|
322
|
+
config, and with `off` the reflection writes no page.)*
|
package/src/core/self/NOTES.md
CHANGED
|
@@ -1549,3 +1549,52 @@ and is not a cost.
|
|
|
1549
1549
|
moments once and `chapterAt` places one memory by the same span rule, so recall can put
|
|
1550
1550
|
hundreds of a subject's memories under their chapters without a `resolveChapter` (and its
|
|
1551
1551
|
per-memory prose reads) for each; a test holds the two to the same answer.
|
|
1552
|
+
|
|
1553
|
+
## 2026-10-09 — a regrown copy keeps its links
|
|
1554
|
+
|
|
1555
|
+
- When a chapter grows, `ingestEpisode` mints the new copy and archives the old one
|
|
1556
|
+
(`episode-regrown`). The old copy's links (the session's contiguity, a co-use, a dream's
|
|
1557
|
+
tie) stayed on the archived row, which conducts nothing: on 10-02 that was 260 of a live
|
|
1558
|
+
store's 1,200 edge rows. `SelfOptions.retarget` now hands each archived copy's links to
|
|
1559
|
+
the new copy, after the archive. It is `associate.retargetOnSupersede`, injected by the
|
|
1560
|
+
composition root as for `schemas/` and `dream/`; absent, nothing is carried, as before.
|
|
1561
|
+
- A retarget that throws costs the links, never the copy: counted on
|
|
1562
|
+
`self.episode.relink.failed`, and the ingestion reports what it always did.
|
|
1563
|
+
- The links stranded before this are carried once at open, in `counterpart.ts`
|
|
1564
|
+
(associate NOTES §15).
|
|
1565
|
+
|
|
1566
|
+
## 2026-10-09 — the page's own "Last revised" line is taken out
|
|
1567
|
+
|
|
1568
|
+
The 10-01 guidance (`PAGE_WRITING_RULE`, above) told both writers to add no revised-on
|
|
1569
|
+
line, and nothing checked it: the wake still printed two date lines under "Who I am" for a
|
|
1570
|
+
page that carried one, and a page that already had it kept it. Now
|
|
1571
|
+
`page.ts#stripRevisedLines` takes the line out in two places: where the wake renders the
|
|
1572
|
+
page (`Self#pageBlock`, so a page stored with the line prints one date from the next
|
|
1573
|
+
render), and at the one write door (`Self#revisePage`, before the caps, the gate and the
|
|
1574
|
+
byte count), so a stored page heals the next time anyone writes it. A line is the page's
|
|
1575
|
+
own when the whole of it opens with "Last revised" past any parentheses, brackets,
|
|
1576
|
+
emphasis, quote marker or dash, and it is at most 160 characters; the words inside a
|
|
1577
|
+
paragraph stay. The blank line it stood behind goes with it. The revision row says how many
|
|
1578
|
+
went (`datelines`), because the owner's console writes through the same door. A page that
|
|
1579
|
+
is nothing but the line is refused as `empty` at write, and printed as it stands at render.
|
|
1580
|
+
The guidance stays: the strip is the check, not a reason to stop asking.
|
|
1581
|
+
|
|
1582
|
+
**Review of #332: only a dateline.** As first built the rule took any short line opening
|
|
1583
|
+
"Last revised" past its wrappers, which took prose ("Last revised my view of …"), a quoted
|
|
1584
|
+
line, a list entry, a code block's line and a page's own history list — at the write door,
|
|
1585
|
+
so the words left the stored page. Now the words must be followed by a date (ISO or numeric,
|
|
1586
|
+
a month's name, or today / tonight / yesterday), straight after or after "on" or a short
|
|
1587
|
+
"by …"; and a line inside a code fence, beside another such line (a history), or an entry
|
|
1588
|
+
beside another entry of a list stays. A lone one, at the head, the foot or between
|
|
1589
|
+
sections, still goes.
|
|
1590
|
+
|
|
1591
|
+
## 2026-10-09 — the Arriving line says how often a repeating date comes round
|
|
1592
|
+
|
|
1593
|
+
A horizon item whose date repeats (`prospective/` NOTES §15) carries `every` beside
|
|
1594
|
+
`due` (`core/briefing.ts#selfRenderer` → `HorizonItem.every` → `Resolved.every`), and
|
|
1595
|
+
`datePrefix` prints `2026-08-25 (due 2026-10-12, every Monday) · `. `due` is this
|
|
1596
|
+
occurrence, never the anchor, so a birthday stated in 1990 reads as due this year. Unlike
|
|
1597
|
+
a one-off date, the parenthesis stays when the occurrence falls on the learned date:
|
|
1598
|
+
"every May 14" is news even then. One change to what the lane selects (review of #339): a
|
|
1599
|
+
DAILY repeat takes no line (`prospective/` NOTES §15) — rendered the evening before, it
|
|
1600
|
+
would read as due yesterday.
|
|
@@ -272,6 +272,12 @@ export interface Resolved {
|
|
|
272
272
|
* place of `(of …)`. Only horizon items carry one.
|
|
273
273
|
*/
|
|
274
274
|
readonly due?: string;
|
|
275
|
+
/**
|
|
276
|
+
* How often an arriving occasion comes round, in words (`HorizonItem.every`,
|
|
277
|
+
* 2026-10-09), printed beside its due date: `(due 2027-05-14, every May 14)`.
|
|
278
|
+
* Only a horizon item that repeats carries one.
|
|
279
|
+
*/
|
|
280
|
+
readonly every?: string;
|
|
275
281
|
/**
|
|
276
282
|
* True when the encode date is only an UPPER BOUND — the element was known BY
|
|
277
283
|
* then, not learned then. Set for migrated elements, whose `learned_on` is
|
|
@@ -471,8 +477,12 @@ export function datePrefix(r: Resolved): string {
|
|
|
471
477
|
// "2026-09-27 · …" while the item was due 2026-10-03, and the learned date
|
|
472
478
|
// alone reads as when it happens.
|
|
473
479
|
if (due !== "") {
|
|
474
|
-
|
|
475
|
-
|
|
480
|
+
// A repeating one says how often beside it (2026-10-09) — even when it is
|
|
481
|
+
// due on the day it was learned, since "every May 14" is news there too.
|
|
482
|
+
const every = (r.every ?? "").trim();
|
|
483
|
+
const often = every === "" ? "" : `, ${every}`;
|
|
484
|
+
if (learned === "") return `due ${due}${often}${DATE_SEP}`;
|
|
485
|
+
if (due !== learned || often !== "") return `${r.boundedDate === true ? DATE_BOUND : ""}${learned} (due ${due}${often})${DATE_SEP}`;
|
|
476
486
|
}
|
|
477
487
|
if (learned === "") return "";
|
|
478
488
|
const happened = (r.happenedOn ?? "").trim();
|
package/src/core/self/index.ts
CHANGED
|
@@ -106,6 +106,7 @@ import {
|
|
|
106
106
|
findSelfPage,
|
|
107
107
|
readSelfPage,
|
|
108
108
|
renderPage,
|
|
109
|
+
stripRevisedLines,
|
|
109
110
|
} from "./page.js";
|
|
110
111
|
import type { SelfPage, SelfPageAuthor } from "./page.js";
|
|
111
112
|
import {
|
|
@@ -198,6 +199,26 @@ export interface SelfEvent {
|
|
|
198
199
|
*/
|
|
199
200
|
export const BRIEFING_KEY = "self.briefing";
|
|
200
201
|
|
|
202
|
+
/**
|
|
203
|
+
* THE IDS THE PUBLISHED BUNDLE LISTS UNDER "Still open:" (review of #332,
|
|
204
|
+
* 2026-10-09): a JSON array, written beside `BRIEFING_KEY` at each publish,
|
|
205
|
+
* so a line the delivery adds — the handoff's "since" line — can leave out
|
|
206
|
+
* what the wake already says is open rather than name it twice. Kept, not
|
|
207
|
+
* ranked, as the identity rotation's ids are.
|
|
208
|
+
*/
|
|
209
|
+
export const THREADS_SHOWN_KEY = "self.threads.shown";
|
|
210
|
+
|
|
211
|
+
/** The ids the published bundle lists under "Still open:" — none when the
|
|
212
|
+
* key is absent (a bundle published before it) or unreadable. Never throws. */
|
|
213
|
+
export function threadsShown(store: Pick<Store, "getMeta">): Set<string> {
|
|
214
|
+
try {
|
|
215
|
+
const raw: unknown = JSON.parse(store.getMeta(THREADS_SHOWN_KEY) ?? "[]");
|
|
216
|
+
return new Set(Array.isArray(raw) ? raw.filter((x): x is string => typeof x === "string") : []);
|
|
217
|
+
} catch {
|
|
218
|
+
return new Set();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
201
222
|
/**
|
|
202
223
|
* The honest bootstrap line, and the ONLY case that may be shown in place of a
|
|
203
224
|
* bundle: no bundle has ever been published. A present-but-damaged bundle is an
|
|
@@ -214,6 +235,13 @@ export interface SelfOptions {
|
|
|
214
235
|
/** Told about each memory an episode ingestion mints, so the composition can
|
|
215
236
|
* credit the cards it names (schemas NOTES §15). */
|
|
216
237
|
onMemoryMinted?: (m: { id: string; title: string | null; body: string; day: number }) => void;
|
|
238
|
+
/**
|
|
239
|
+
* `associate.retargetOnSupersede`, so a regrown copy inherits the links its
|
|
240
|
+
* archived copy had learned (2026-10-09) — the same callback `schemas/` and
|
|
241
|
+
* `dream/` are handed, injected because `self/` may not import `associate/`.
|
|
242
|
+
* Absent: the new copy starts with no links (the behaviour before).
|
|
243
|
+
*/
|
|
244
|
+
retarget?: (oldId: string, newId: string, day: number) => void;
|
|
217
245
|
now?: () => number;
|
|
218
246
|
/**
|
|
219
247
|
* The IANA zone the CALENDAR day is taken in — the ask cap's day and the page
|
|
@@ -234,6 +262,12 @@ export interface HorizonItem {
|
|
|
234
262
|
* learned (2026-10-01). Absent: the line carries the learned date alone.
|
|
235
263
|
*/
|
|
236
264
|
readonly due?: string;
|
|
265
|
+
/**
|
|
266
|
+
* How often it comes round, in words, when the date repeats (`time.ts
|
|
267
|
+
* #readableRecurrence`, 2026-10-09): the line says `(due 2027-05-14, every
|
|
268
|
+
* May 14)`. Absent: a date that happens once.
|
|
269
|
+
*/
|
|
270
|
+
readonly every?: string;
|
|
237
271
|
}
|
|
238
272
|
|
|
239
273
|
export interface BoundaryRequest extends BriefingRequest {
|
|
@@ -489,6 +523,7 @@ export class Self {
|
|
|
489
523
|
private readonly gate: EpisodeGate;
|
|
490
524
|
private readonly onEvent: ((e: SelfEvent) => void) | undefined;
|
|
491
525
|
private readonly onMemoryMinted: SelfOptions["onMemoryMinted"];
|
|
526
|
+
private readonly retarget: SelfOptions["retarget"];
|
|
492
527
|
private readonly now: () => number;
|
|
493
528
|
private readonly zone: string | undefined;
|
|
494
529
|
private readonly ring: SelfEvent[] = [];
|
|
@@ -503,6 +538,7 @@ export class Self {
|
|
|
503
538
|
this.gate = opts.gate ?? NO_GATE;
|
|
504
539
|
this.onEvent = opts.onEvent;
|
|
505
540
|
this.onMemoryMinted = opts.onMemoryMinted;
|
|
541
|
+
this.retarget = opts.retarget;
|
|
506
542
|
this.now = opts.now ?? (() => Date.now());
|
|
507
543
|
this.zone = opts.zone;
|
|
508
544
|
}
|
|
@@ -554,15 +590,20 @@ export class Self {
|
|
|
554
590
|
}
|
|
555
591
|
const base: Resolve = req.resolve ?? ((id) => this.resolveStatement(id, docs, sources));
|
|
556
592
|
// An arriving occasion's due date, beside its learned one (2026-10-01).
|
|
557
|
-
|
|
558
|
-
|
|
593
|
+
// A repeating one says how often, beside it (2026-10-09).
|
|
594
|
+
const dues = new Map<string, { due: string; every?: string }>();
|
|
595
|
+
for (const h of req.horizon ?? []) {
|
|
596
|
+
if (h.due === undefined || h.due.trim() === "") continue;
|
|
597
|
+
const every = h.every?.trim() ?? "";
|
|
598
|
+
dues.set(h.id, every === "" ? { due: h.due.trim() } : { due: h.due.trim(), every });
|
|
599
|
+
}
|
|
559
600
|
const resolve: Resolve =
|
|
560
601
|
dues.size === 0
|
|
561
602
|
? base
|
|
562
603
|
: (id) => {
|
|
563
604
|
const r = base(id);
|
|
564
605
|
const due = dues.get(id);
|
|
565
|
-
return due === undefined ? r : { ...r, due };
|
|
606
|
+
return due === undefined ? r : { ...r, ...due };
|
|
566
607
|
};
|
|
567
608
|
// THE DAY-0 LANE (NOTES §11). The lookup is guarded by the empty lane and by
|
|
568
609
|
// nothing else: it reads prose, and a store with even one identity element
|
|
@@ -817,7 +858,12 @@ export class Self {
|
|
|
817
858
|
*/
|
|
818
859
|
revisePage(body: string, opts: PageWriteOptions): PageRevision {
|
|
819
860
|
const day = opts.day ?? this.store.livedDay();
|
|
820
|
-
|
|
861
|
+
// THE PAGE'S OWN "LAST REVISED" LINE IS LEFT OUT (2026-10-09), before the
|
|
862
|
+
// caps and the gate see it: the wake dates the page, and a stored page that
|
|
863
|
+
// carried one printed two. The revision row counts what went
|
|
864
|
+
// (`datelines`), so a hand-written page edited here says so.
|
|
865
|
+
const own = stripRevisedLines(body.replace(/\r\n/g, "\n").trim());
|
|
866
|
+
const draft = own.body;
|
|
821
867
|
let bytes = byteLength(draft);
|
|
822
868
|
const session = opts.session ?? null;
|
|
823
869
|
const none = {
|
|
@@ -984,6 +1030,7 @@ export class Self {
|
|
|
984
1030
|
created: existing === null,
|
|
985
1031
|
wakeCap: this.tunables.PAGE_WAKE_BYTES,
|
|
986
1032
|
...(warning === null ? {} : { warning }),
|
|
1033
|
+
...(own.stripped === 0 ? {} : { datelines: own.stripped }),
|
|
987
1034
|
},
|
|
988
1035
|
});
|
|
989
1036
|
this.emit("self.page.revised", id, {
|
|
@@ -1259,6 +1306,12 @@ export class Self {
|
|
|
1259
1306
|
this.pageStale(page),
|
|
1260
1307
|
this.tunables.PAGE_STALE_DAYS,
|
|
1261
1308
|
);
|
|
1309
|
+
// THE PAGE'S OWN "LAST REVISED" LINE IS NOT PRINTED (2026-10-09): the
|
|
1310
|
+
// dateline above is the wake's, and a page that carried one of its own
|
|
1311
|
+
// printed two. A page that is nothing else is printed as it is.
|
|
1312
|
+
const own = stripRevisedLines(page.body);
|
|
1313
|
+
const body = own.body.length === 0 ? page.body : own.body;
|
|
1314
|
+
const bodyBytes = byteLength(body);
|
|
1262
1315
|
const room = budgetBytes - PAGE_FLOOR_RESERVE_BYTES;
|
|
1263
1316
|
// A ceiling with no room for the wake's OWN furniture has none for a line
|
|
1264
1317
|
// about the page either, so "Who I am" carries nothing at all rather than a
|
|
@@ -1273,15 +1326,15 @@ export class Self {
|
|
|
1273
1326
|
// forbids, moved from identity to the page (adversarial review MINOR-D).
|
|
1274
1327
|
if (room <= 0) return NO_ROOM;
|
|
1275
1328
|
const cap = Math.min(this.tunables.PAGE_WAKE_BYTES, room);
|
|
1276
|
-
if (cap < PAGE_MIN_RENDER_BYTES &&
|
|
1329
|
+
if (cap < PAGE_MIN_RENDER_BYTES && bodyBytes > cap) {
|
|
1277
1330
|
return {
|
|
1278
|
-
text: pageTooLargeLine(
|
|
1331
|
+
text: pageTooLargeLine(bodyBytes),
|
|
1279
1332
|
dateline: null,
|
|
1280
1333
|
truncated: true,
|
|
1281
|
-
wholeBytes:
|
|
1334
|
+
wholeBytes: bodyBytes,
|
|
1282
1335
|
};
|
|
1283
1336
|
}
|
|
1284
|
-
const rendered = renderPage(
|
|
1337
|
+
const rendered = renderPage(body, cap);
|
|
1285
1338
|
return {
|
|
1286
1339
|
text: rendered.text,
|
|
1287
1340
|
dateline,
|
|
@@ -1375,6 +1428,10 @@ export class Self {
|
|
|
1375
1428
|
}
|
|
1376
1429
|
|
|
1377
1430
|
this.store.setMeta(BRIEFING_KEY, briefing.text);
|
|
1431
|
+
// What this bundle lists as still open, so the delivery's "since" line
|
|
1432
|
+
// does not name it again (review of #332). Written at every publish, an
|
|
1433
|
+
// empty lane included, so it never describes an older bundle.
|
|
1434
|
+
this.store.setMeta(THREADS_SHOWN_KEY, JSON.stringify(briefing.kept.threads));
|
|
1378
1435
|
// The rotation's memory: the identity ids this bundle KEPT, stamped with
|
|
1379
1436
|
// the day. Kept, not ranked — an element the budget trimmed did not render
|
|
1380
1437
|
// and keeps its place at the front of the next rotation.
|
|
@@ -2087,6 +2144,23 @@ export class Self {
|
|
|
2087
2144
|
this.store.archive(stale, "episode-regrown");
|
|
2088
2145
|
archived.push(stale);
|
|
2089
2146
|
}
|
|
2147
|
+
// THE LINKS GO WITH THE WORDS (2026-10-09). An archived copy stops
|
|
2148
|
+
// conducting, so every link it had learned (the session's contiguity, a
|
|
2149
|
+
// co-use, a dream's tie) was stranded on it: 260 of a live store's 1,200
|
|
2150
|
+
// edge rows on 10-02. The new copy inherits them the way a dream merge's
|
|
2151
|
+
// memory inherits its originals' — after the archive, so one stale copy's
|
|
2152
|
+
// tie to another is not carried. A failure costs the links, never the copy.
|
|
2153
|
+
let relinkFailed = 0;
|
|
2154
|
+
for (const stale of archived) {
|
|
2155
|
+
try {
|
|
2156
|
+
this.retarget?.(stale, memoryId, d);
|
|
2157
|
+
} catch {
|
|
2158
|
+
relinkFailed += 1;
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
if (relinkFailed > 0) {
|
|
2162
|
+
this.emit("self.episode.relink.failed", state.episodeId, { memory: memoryId, failed: relinkFailed });
|
|
2163
|
+
}
|
|
2090
2164
|
|
|
2091
2165
|
this.persistState(
|
|
2092
2166
|
{
|
package/src/core/self/page.ts
CHANGED
|
@@ -276,6 +276,94 @@ function byteLengthOf(s: string): number {
|
|
|
276
276
|
return new TextEncoder().encode(s).length;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
// ── the page's own revision line ────────────────────────────────────────────
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* The longest line that can be a page's own revision line. Past it the line
|
|
283
|
+
* is prose that happens to open with the words, and it stays.
|
|
284
|
+
*/
|
|
285
|
+
export const REVISED_LINE_MAX_CHARS = 160;
|
|
286
|
+
|
|
287
|
+
/** A date as a dateline states one: ISO or numeric, a month's name and a day,
|
|
288
|
+
* or the day words the writers used before the 10-01 guidance. */
|
|
289
|
+
const REVISED_DATE = String.raw`(?:(?:\d{4}-\d{1,2}-\d{1,2}|\d{1,2}[/.]\d{1,2}[/.]\d{2,4}|(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\.?\s+(?:\d{4}|\d{1,2}))(?!\d)|(?:\d{1,2}\s+(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*|today|tonight|yesterday)(?![a-z]))`;
|
|
290
|
+
|
|
291
|
+
/** "Last revised", then the date — straight after, or after "on" or a short
|
|
292
|
+
* "by …" (review of #332: without the date, "Last revised my view of …", a
|
|
293
|
+
* quoted line and a list entry were all taken). */
|
|
294
|
+
const REVISED_OPENING = new RegExp(
|
|
295
|
+
String.raw`^last\s+revised\b[\s:,(*_\-–—]*(?:on\s+)?(?:by\s+[^,;:\n]{1,48}?[\s,]+(?:on\s+)?)?${REVISED_DATE}`,
|
|
296
|
+
"iu",
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
/** A Markdown list entry: `- `, `* `, `+ `, `1. ` or `1) `. */
|
|
300
|
+
const LIST_ENTRY = /^\s*(?:[-*+]|\d+[.)])\s+/u;
|
|
301
|
+
|
|
302
|
+
/** A code fence's opening or closing line. */
|
|
303
|
+
const FENCE = /^\s{0,3}(?:```|~~~)/u;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* IS THIS LINE THE PAGE'S OWN "LAST REVISED" LINE (2026-10-09)? A whole line
|
|
307
|
+
* that opens — past any wrapping of parentheses, brackets, emphasis, a quote
|
|
308
|
+
* marker or a dash — with "Last revised" and a date (`REVISED_OPENING`), and
|
|
309
|
+
* is short. A sentence that says the words in the middle of a paragraph is
|
|
310
|
+
* not one, and neither is a line that opens with them and goes on to say
|
|
311
|
+
* something else. Where it stands is `stripRevisedLines`'s to judge.
|
|
312
|
+
*/
|
|
313
|
+
export function isRevisedLine(line: string): boolean {
|
|
314
|
+
const t = line.trim();
|
|
315
|
+
if (t.length === 0 || t.length > REVISED_LINE_MAX_CHARS) return false;
|
|
316
|
+
return REVISED_OPENING.test(t.replace(/^[>(\[*_\s\-–—]+/u, ""));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* THE PAGE WITHOUT ITS OWN "LAST REVISED" LINES (2026-10-09). The wake dates
|
|
321
|
+
* the page (`briefing.ts#pageDateline`), so a page that carries its own line
|
|
322
|
+
* printed two, one under the other. The writers were told not to add one
|
|
323
|
+
* (`writer.ts#PAGE_WRITING_RULE`, 2026-10-01), which is guidance and checks
|
|
324
|
+
* nothing, and a page that already carried the line kept printing it. Taken
|
|
325
|
+
* out where the wake renders the page and where the page is written
|
|
326
|
+
* (`Self#revisePage`), so a stored page heals the next time it is written.
|
|
327
|
+
*
|
|
328
|
+
* A dateline stands alone, so three places keep the line (review of #332):
|
|
329
|
+
* inside a code fence; beside another such line, with no blank between (two
|
|
330
|
+
* in a row are the page's own history); and as an entry of a list, beside
|
|
331
|
+
* another entry. A lone one, at the head, the foot or between sections, goes.
|
|
332
|
+
*
|
|
333
|
+
* Only the line goes, and the blank line it stood behind when it stood
|
|
334
|
+
* between two, so a removed line leaves no gap of two. `stripped` counts what
|
|
335
|
+
* went; with none, the body is returned exactly as it came. Pure.
|
|
336
|
+
*/
|
|
337
|
+
export function stripRevisedLines(body: string): { body: string; stripped: number } {
|
|
338
|
+
const lines = body.split("\n");
|
|
339
|
+
let fenced = false;
|
|
340
|
+
const dateline = lines.map((l) => {
|
|
341
|
+
if (FENCE.test(l)) {
|
|
342
|
+
fenced = !fenced;
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
return !fenced && isRevisedLine(l);
|
|
346
|
+
});
|
|
347
|
+
const beside = (i: number): number[] =>
|
|
348
|
+
[i - 1, i + 1].filter((j) => j >= 0 && j < lines.length && (lines[j] ?? "").trim() !== "");
|
|
349
|
+
const kept = (i: number): boolean =>
|
|
350
|
+
beside(i).some((j) => dateline[j] === true) ||
|
|
351
|
+
(LIST_ENTRY.test(lines[i] ?? "") && beside(i).some((j) => LIST_ENTRY.test(lines[j] ?? "")));
|
|
352
|
+
const out: string[] = [];
|
|
353
|
+
let stripped = 0;
|
|
354
|
+
for (let i = 0; i < lines.length; i++) {
|
|
355
|
+
const line = lines[i] ?? "";
|
|
356
|
+
if (dateline[i] !== true || kept(i)) {
|
|
357
|
+
out.push(line);
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
stripped += 1;
|
|
361
|
+
const before = out[out.length - 1];
|
|
362
|
+
if ((before === undefined || before.trim() === "") && (lines[i + 1] ?? "x").trim() === "") i += 1;
|
|
363
|
+
}
|
|
364
|
+
return stripped === 0 ? { body, stripped: 0 } : { body: out.join("\n").trim(), stripped };
|
|
365
|
+
}
|
|
366
|
+
|
|
279
367
|
// ── what the wake prints ────────────────────────────────────────────────────
|
|
280
368
|
|
|
281
369
|
export interface RenderedPage {
|
|
@@ -17,7 +17,13 @@ Two seams are genuinely stubbed and both are declared: the briefing renderer
|
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
## 1. `store/` — box 3 has no strength column and no box-3 writer (WORKED AROUND)
|
|
20
|
+
## 1. `store/` — box 3 has no strength column and no box-3 writer (WORKED AROUND) — CLOSED 2026-08-25 (noted 2026-10-09)
|
|
21
|
+
|
|
22
|
+
**Closed by the wave-3 seam pass** (`d88f957`, 2026-08-25, SEAMS item J): `cache.sqlite`
|
|
23
|
+
has a `ranking` table that `resetCache` drops with the rest, `Store.setRanking` /
|
|
24
|
+
`ranking` / `rankingAll` read and write it, and `cycle.ts` takes the store as the cache
|
|
25
|
+
(`storeRankingCache`) whenever it supports ranking. `strength-cache.ts` stays, as the
|
|
26
|
+
fallback for a port without `setRanking`. The text below is the gap as filed.
|
|
21
27
|
|
|
22
28
|
**Owner:** `store/`.
|
|
23
29
|
**Needed:** the decay tick materializes `strength(m, d)` and `band(m, d)` into
|
|
@@ -114,7 +120,11 @@ three record types and all three become queryable, which is what the dashboard
|
|
|
114
120
|
|
|
115
121
|
---
|
|
116
122
|
|
|
117
|
-
## 4. The minting seam — `updates:` must actually reach canonical state
|
|
123
|
+
## 4. The minting seam — `updates:` must actually reach canonical state — CLOSED 2026-08-25 (noted 2026-10-09)
|
|
124
|
+
|
|
125
|
+
**Closed by the wave-3 seam pass** (`d88f957`, 2026-08-25): `core/mint.ts` writes the
|
|
126
|
+
RESOLVED id to `doc.meta["updates"]`, and an unresolved declaration writes no key (its
|
|
127
|
+
header names this section). The text below is the gap as filed.
|
|
118
128
|
|
|
119
129
|
**Owner:** whoever mints memories from `remember/`'s proposals.
|
|
120
130
|
**Needed:** CONTRACT §5 G9 — *a memory that declares `updates:` is never merged
|
|
@@ -132,7 +142,12 @@ first.
|
|
|
132
142
|
|
|
133
143
|
---
|
|
134
144
|
|
|
135
|
-
## 5. `physics/` — there is no `consolidationEligibility()`
|
|
145
|
+
## 5. `physics/` — there is no `consolidationEligibility()` — CLOSED 2026-08-25 (noted 2026-10-09)
|
|
146
|
+
|
|
147
|
+
**Closed by the wave-3 seam pass** (`d88f957`, 2026-08-25): `physics/index.ts` exports
|
|
148
|
+
`consolidationEligibility`, and `consolidate.ts` executes it. Since #251 (2026-09-26) it
|
|
149
|
+
is for legacy memories only (a post-upgrade memory is refused `not-legacy`), so the
|
|
150
|
+
criterion written below is no longer the rule. The text below is the gap as filed.
|
|
136
151
|
|
|
137
152
|
**Owner:** `physics/`.
|
|
138
153
|
**Needed:** "memories crossing the physics consolidation criteria get the flag".
|
|
@@ -270,6 +285,10 @@ more than a name match (a person card for the owner, an embedding), that is a
|
|
|
270
285
|
`schemas/` question, and this phase should receive the verdict rather than compute it.
|
|
271
286
|
The owner's demotions arrive through the optional `coreDemoted`; a port without it
|
|
272
287
|
cannot be told "not this one".
|
|
288
|
+
*(Noted 2026-10-09: the first paragraph no longer describes the code. Since store v9
|
|
289
|
+
(`0a3e7e9`, #256, 2026-09-27) `aboutMe` reads the memory's `about` mark (the row's, or the
|
|
290
|
+
document's when the row has none) and no longer reads `owner`; the consolidate phase does
|
|
291
|
+
not call `ownerNames`; the dream and the reflection do, among others.)*
|
|
273
292
|
|
|
274
293
|
|
|
275
294
|
## Demotion has no way back (2026-09-26, working default)
|
package/src/core/sleep/NOTES.md
CHANGED
|
@@ -910,3 +910,14 @@ cursor the way `consolidate` does (`markers.ts`): start strictly after it, wrap,
|
|
|
910
910
|
under `apply`. `dedup` (pairs, rebuilt each run) and `fade` (`schemas/`' own sweep) are
|
|
911
911
|
unchanged; `log` needs none.
|
|
912
912
|
|
|
913
|
+
|
|
914
|
+
## 2026-10-09 — the prune passes physics one more fact: a repeating date
|
|
915
|
+
|
|
916
|
+
`runPrune` now tells `pruneVerdict` whether the row's reminder date still repeats
|
|
917
|
+
(`recurring: store#recurrenceOfRow(row) !== null` — a day `event_date` and a recurrence
|
|
918
|
+
word in its meta, the predicate `recurringMemories` reads), beside `inLiveRevisionChain`.
|
|
919
|
+
Physics refuses such a row by name (`blocked:recurring` on the cycle row, counted by the
|
|
920
|
+
fired view as a real refusal beside `protected`) — only on a night the floor would
|
|
921
|
+
otherwise have let it go (review of #341), so a repeat above the floor counts under
|
|
922
|
+
`above-floor` alone. The phase adds no criterion of its own;
|
|
923
|
+
why the gate exists is physics NOTES 2026-10-09 and prospective NOTES §16.
|