counterparts 0.1.0
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/CONSTITUTION.md +68 -0
- package/LICENSE +21 -0
- package/README.md +348 -0
- package/docs/ELI5.md +84 -0
- package/docs/QUICKSTART.md +1258 -0
- package/docs/module-map.md +81 -0
- package/package.json +63 -0
- package/src/adapters/claude-code/CONTRACT.md +606 -0
- package/src/adapters/claude-code/INTERFACE-GAPS.md +655 -0
- package/src/adapters/claude-code/NOTES.md +1055 -0
- package/src/adapters/claude-code/bin/hook.ts +820 -0
- package/src/adapters/claude-code/bin/runner.ts +522 -0
- package/src/adapters/claude-code/config.ts +778 -0
- package/src/adapters/claude-code/credentials.ts +199 -0
- package/src/adapters/claude-code/doctor.ts +2557 -0
- package/src/adapters/claude-code/embed-client.ts +617 -0
- package/src/adapters/claude-code/hooks.ts +2240 -0
- package/src/adapters/claude-code/index.ts +224 -0
- package/src/adapters/claude-code/interpret-client.ts +395 -0
- package/src/adapters/claude-code/page-writer.ts +462 -0
- package/src/adapters/claude-code/primacy.ts +162 -0
- package/src/adapters/claude-code/spawn.ts +241 -0
- package/src/adapters/claude-code/standdown.ts +536 -0
- package/src/adapters/claude-code/transcript.ts +661 -0
- package/src/adapters/claude-code/vectors.ts +415 -0
- package/src/adapters/cli/CONTRACT.md +255 -0
- package/src/adapters/cli/INTERFACE-GAPS.md +350 -0
- package/src/adapters/cli/NOTES.md +936 -0
- package/src/adapters/cli/bin/counterparts.ts +74 -0
- package/src/adapters/cli/commands.ts +6095 -0
- package/src/adapters/cli/export.ts +766 -0
- package/src/adapters/cli/index.ts +103 -0
- package/src/adapters/cli/install.ts +670 -0
- package/src/adapters/cli/removal.ts +1186 -0
- package/src/adapters/cli/repair-dates.ts +659 -0
- package/src/adapters/cli/self-page.ts +229 -0
- package/src/adapters/cli/snapshot.ts +279 -0
- package/src/adapters/cli/start-fresh.ts +1228 -0
- package/src/adapters/config-path.ts +342 -0
- package/src/adapters/dashboard/CONTRACT.md +67 -0
- package/src/adapters/dashboard/INTERFACE-GAPS.md +139 -0
- package/src/adapters/dashboard/NOTES.md +474 -0
- package/src/adapters/dashboard/activity.ts +121 -0
- package/src/adapters/dashboard/ansi.ts +82 -0
- package/src/adapters/dashboard/bin/dashboard.ts +479 -0
- package/src/adapters/dashboard/browse.ts +298 -0
- package/src/adapters/dashboard/identity.ts +182 -0
- package/src/adapters/dashboard/index.ts +183 -0
- package/src/adapters/dashboard/layout.ts +149 -0
- package/src/adapters/dashboard/registries.ts +291 -0
- package/src/adapters/dashboard/resolve.ts +206 -0
- package/src/adapters/dashboard/source.ts +48 -0
- package/src/adapters/dashboard/status.ts +327 -0
- package/src/adapters/dashboard/stories.ts +194 -0
- package/src/adapters/dashboard/web/app.html +1731 -0
- package/src/adapters/dashboard/web/brain.html +463 -0
- package/src/adapters/dashboard/web/fired.ts +31 -0
- package/src/adapters/dashboard/web/flow.ts +457 -0
- package/src/adapters/dashboard/web/narrate.ts +1042 -0
- package/src/adapters/dashboard/web/reveal.ts +135 -0
- package/src/adapters/dashboard/web/server.ts +287 -0
- package/src/adapters/dashboard/web/views.ts +1744 -0
- package/src/adapters/expansions.ts +569 -0
- package/src/adapters/fired.ts +1580 -0
- package/src/adapters/mcp/CONTRACT.md +240 -0
- package/src/adapters/mcp/INTERFACE-GAPS.md +271 -0
- package/src/adapters/mcp/NOTES.md +205 -0
- package/src/adapters/mcp/bin/serve.ts +349 -0
- package/src/adapters/mcp/deliberate.ts +619 -0
- package/src/adapters/mcp/index.ts +101 -0
- package/src/adapters/mcp/protocol.ts +170 -0
- package/src/adapters/mcp/server.ts +1740 -0
- package/src/adapters/mcp/stdio.ts +56 -0
- package/src/adapters/mcp/tools.ts +779 -0
- package/src/adapters/scopes.ts +657 -0
- package/src/adapters/sessions.ts +402 -0
- package/src/adapters/snapshots.ts +1069 -0
- package/src/adapters/stance-env.ts +137 -0
- package/src/core/associate/CONTRACT.md +118 -0
- package/src/core/associate/INTERFACE-GAPS.md +173 -0
- package/src/core/associate/NOTES.md +194 -0
- package/src/core/associate/buffer.ts +66 -0
- package/src/core/associate/edges.ts +188 -0
- package/src/core/associate/index.ts +570 -0
- package/src/core/associate/pending.ts +383 -0
- package/src/core/associate/spread.ts +149 -0
- package/src/core/associate/tunables.ts +123 -0
- package/src/core/bridge.ts +272 -0
- package/src/core/briefing.ts +67 -0
- package/src/core/counterpart.ts +3855 -0
- package/src/core/encode/CONTRACT.md +151 -0
- package/src/core/encode/INTERFACE-GAPS.md +135 -0
- package/src/core/encode/NOTES.md +146 -0
- package/src/core/encode/aliases.ts +71 -0
- package/src/core/encode/battery.ts +284 -0
- package/src/core/encode/chunk.ts +265 -0
- package/src/core/encode/emotion.ts +119 -0
- package/src/core/encode/floor.ts +76 -0
- package/src/core/encode/index.ts +100 -0
- package/src/core/encode/precision.ts +162 -0
- package/src/core/encode/preselect.ts +269 -0
- package/src/core/encode/salience.ts +108 -0
- package/src/core/encode/secrets.ts +265 -0
- package/src/core/encode/tunables.ts +99 -0
- package/src/core/encode/types.ts +286 -0
- package/src/core/encode/words.ts +75 -0
- package/src/core/handoff/CONTRACT.md +199 -0
- package/src/core/handoff/INTERFACE-GAPS.md +166 -0
- package/src/core/handoff/NOTES.md +206 -0
- package/src/core/handoff/index.ts +957 -0
- package/src/core/mint.ts +279 -0
- package/src/core/observer.ts +28 -0
- package/src/core/physics/CONTRACT.md +341 -0
- package/src/core/physics/NOTES.md +155 -0
- package/src/core/physics/clock.ts +51 -0
- package/src/core/physics/index.ts +1054 -0
- package/src/core/prospective/CONTRACT.md +137 -0
- package/src/core/prospective/INTERFACE-GAPS.md +112 -0
- package/src/core/prospective/NOTES.md +160 -0
- package/src/core/prospective/derive.ts +188 -0
- package/src/core/prospective/index.ts +1030 -0
- package/src/core/prospective/tunables.ts +72 -0
- package/src/core/prospective/windows.ts +187 -0
- package/src/core/recall/CONTRACT.md +326 -0
- package/src/core/recall/INTERFACE-GAPS.md +163 -0
- package/src/core/recall/NOTES.md +472 -0
- package/src/core/recall/activate.ts +521 -0
- package/src/core/recall/cues.ts +275 -0
- package/src/core/recall/gate.ts +441 -0
- package/src/core/recall/index.ts +692 -0
- package/src/core/recall/probe.ts +239 -0
- package/src/core/recall/reference.ts +201 -0
- package/src/core/recall/render.ts +285 -0
- package/src/core/recall/session.ts +403 -0
- package/src/core/recall/tunables.ts +329 -0
- package/src/core/remember/CONTRACT.md +293 -0
- package/src/core/remember/INTERFACE-GAPS.md +189 -0
- package/src/core/remember/NOTES.md +373 -0
- package/src/core/remember/fallback.ts +452 -0
- package/src/core/remember/index.ts +103 -0
- package/src/core/remember/owner-strike-seam.ts +479 -0
- package/src/core/remember/proposals.ts +609 -0
- package/src/core/remember/spans.ts +1310 -0
- package/src/core/remember/tunables.ts +111 -0
- package/src/core/remember/updates.ts +198 -0
- package/src/core/retrieval.ts +96 -0
- package/src/core/revision.ts +441 -0
- package/src/core/schemas/CONTRACT.md +190 -0
- package/src/core/schemas/INTERFACE-GAPS.md +172 -0
- package/src/core/schemas/NOTES.md +260 -0
- package/src/core/schemas/aliases.ts +160 -0
- package/src/core/schemas/index.ts +1459 -0
- package/src/core/schemas/tunables.ts +44 -0
- package/src/core/schemas/types.ts +387 -0
- package/src/core/self/CONTRACT.md +459 -0
- package/src/core/self/INTERFACE-GAPS.md +284 -0
- package/src/core/self/NOTES.md +1057 -0
- package/src/core/self/briefing.ts +980 -0
- package/src/core/self/episodes.ts +483 -0
- package/src/core/self/freeze.ts +103 -0
- package/src/core/self/identity.ts +604 -0
- package/src/core/self/index.ts +2130 -0
- package/src/core/self/journal-file.ts +760 -0
- package/src/core/self/page.ts +404 -0
- package/src/core/self/tunables.ts +244 -0
- package/src/core/self/writer.ts +714 -0
- package/src/core/sleep/CONTRACT.md +298 -0
- package/src/core/sleep/INTERFACE-GAPS.md +262 -0
- package/src/core/sleep/NOTES.md +770 -0
- package/src/core/sleep/briefing.ts +86 -0
- package/src/core/sleep/consolidate.ts +241 -0
- package/src/core/sleep/cycle.ts +598 -0
- package/src/core/sleep/decay.ts +237 -0
- package/src/core/sleep/dedup.ts +373 -0
- package/src/core/sleep/index.ts +112 -0
- package/src/core/sleep/log.ts +116 -0
- package/src/core/sleep/markers.ts +164 -0
- package/src/core/sleep/prune.ts +170 -0
- package/src/core/sleep/strength-cache.ts +176 -0
- package/src/core/sleep/tunables.ts +135 -0
- package/src/core/sleep/types.ts +542 -0
- package/src/core/store/CONTRACT.md +446 -0
- package/src/core/store/NOTES.md +1068 -0
- package/src/core/store/cache.ts +709 -0
- package/src/core/store/db.ts +275 -0
- package/src/core/store/errors.ts +134 -0
- package/src/core/store/index.ts +2450 -0
- package/src/core/store/operational.ts +610 -0
- package/src/core/store/owner-op-seam.ts +428 -0
- package/src/core/store/paths.ts +494 -0
- package/src/core/store/prose.ts +165 -0
- package/src/core/store/render.ts +87 -0
- package/src/core/store/walk-seam.ts +78 -0
- package/src/core/types.ts +68 -0
- package/tools/install-loop/run.sh +1063 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# `self/` — interface gaps
|
|
2
|
+
|
|
3
|
+
Things this module needs from a neighbour and worked around instead of editing. Each
|
|
4
|
+
entry names the owner, the workaround now in the code, and what the real fix looks like.
|
|
5
|
+
|
|
6
|
+
## 0. The identity core's home row — `schemas/`'s requirement, ADOPTED with one caveat
|
|
7
|
+
|
|
8
|
+
**Owner:** this module (`schemas/INTERFACE-GAPS.md` §5 filed it here, mid-build).
|
|
9
|
+
**Needed:** `schemas/` refuses to birth `kind: "self"` in two independent layers, so the
|
|
10
|
+
row that says *the self exists as an entity here* can only come from `self/`. Without it,
|
|
11
|
+
its placement rule degrades from `status-on-identity-refused` to `entity-unknown` — the
|
|
12
|
+
wrong refusal, silently, on the guarantee that carries the ~72 KB lesson.
|
|
13
|
+
**Adopted:** `Self.ensureIdentityCore({ name, aliases })` mints exactly the asked-for
|
|
14
|
+
shape — `type: "schema"`, `kind: "self"`, `meta: { role: "entity", name, aliases }` —
|
|
15
|
+
idempotently (a second call returns the existing row; a second core is a category error).
|
|
16
|
+
`boundary({ identityCore })` is the door that reaches it, so it is not a method waiting
|
|
17
|
+
for someone to remember it. `findIdentityCore(store)` is the read.
|
|
18
|
+
|
|
19
|
+
**The caveat, stated so it is not mistaken for agreement on everything:** this module
|
|
20
|
+
mints a PLACE, never a claim, and it does not invent a NAME. `ensureIdentityCore` with a
|
|
21
|
+
blank name returns `reason: "no-name"` and writes nothing — the core's name is the
|
|
22
|
+
owner's, arriving from the adapter at install. Whoever wires the composition root owns
|
|
23
|
+
that string; there is no default and there will not be one.
|
|
24
|
+
|
|
25
|
+
**Two divergences from what §5's wording assumes, both deliberate:**
|
|
26
|
+
|
|
27
|
+
1. **There is no identity *document* here to mint.** Identity STATEMENTS are ordinary
|
|
28
|
+
memories carrying strength (contract §4 drops v1's identity index; module-map ruling 2:
|
|
29
|
+
nothing is born into identity, promotion is N = 3 at consolidation). The schema row is
|
|
30
|
+
one empty home, not the self-schema's content, so `schemas/` will index a place with
|
|
31
|
+
nothing in it — which is what "a newborn schema is empty except its names" says, and
|
|
32
|
+
the right outcome, but not what "self writes its core" might suggest.
|
|
33
|
+
2. **`schemas/` can also answer its question without this row.** `store.list({ band:
|
|
34
|
+
"identity" })` is the index-free way to know whether an id is identity-band, and it
|
|
35
|
+
needs no cross-module minting contract at all. The row is adopted because §5 asked and
|
|
36
|
+
it is cheap; if the seam test ever gets awkward, that read is the simpler fix.
|
|
37
|
+
|
|
38
|
+
**Seam test still owed (the coordinator's, not mine — it must not import `schemas/`):**
|
|
39
|
+
mint through `Self.ensureIdentityCore`, then assert
|
|
40
|
+
`schemas.addCurrentState({ entityId: coreId, ... }).reason === "status-on-identity-refused"`.
|
|
41
|
+
|
|
42
|
+
## 1. The episode input shape is a SEAM, not an import — `remember/` owns authorship
|
|
43
|
+
|
|
44
|
+
**Owner:** `remember/`.
|
|
45
|
+
**Needed:** episodes arrive from the experiencer's authorship path (contract §3: the
|
|
46
|
+
end-of-session write *is* the front door the lived-salience doctrine names). v1's
|
|
47
|
+
self-store tool is superseded by exactly that path, so `self/` has no tool surface and
|
|
48
|
+
depends on someone else handing it prose.
|
|
49
|
+
**Have:** `remember/proposals.ts` exports `ProposalDraft` / `Proposal` with the fields
|
|
50
|
+
this module needs (`content`, `title`, `aliases`, `claimed`, `salience`) plus a great
|
|
51
|
+
many it does not, and the dependency direction is wrong: authorship is upstream of the
|
|
52
|
+
self, so `self/` must not import `remember/` (a test asserts the absence of that import).
|
|
53
|
+
**Workaround:** `episodes.ts` restates the shape it accepts as `EpisodeProposal`
|
|
54
|
+
(`sessionId`, `content`, `title?`, `handles?`, `happenedOn?`, `claimed?`, `salience?`,
|
|
55
|
+
`day?`) with its own `intakeEpisode()` validator returning reasons. `handles` is this
|
|
56
|
+
module's name for what `remember` calls `aliases` — named handles are aliases, not a
|
|
57
|
+
second lookup path (contract §3, §9.2).
|
|
58
|
+
**Real fix (the coordinator's, at the seam pass):** one direction of dependency, declared.
|
|
59
|
+
Either `remember/` calls `Self.appendChapter` / `Self.ingestEpisode` with its own
|
|
60
|
+
`Proposal` narrowed to these fields, or a shared `core/types.ts` grows an
|
|
61
|
+
`AuthoredMemory` both modules read. Until then the two shapes must be kept honest by
|
|
62
|
+
hand, which is the thing this file exists to make visible rather than silent.
|
|
63
|
+
|
|
64
|
+
## 2. `store/` has no metadata index — `unresolved` and `protected` cost a full scan
|
|
65
|
+
|
|
66
|
+
**Owner:** `store/`.
|
|
67
|
+
**Needed:** the threads lane is "memories flagged `unresolved`" and the enumeration is
|
|
68
|
+
"memories flagged `protected`" (contract §5, constitution 16, scar §2.19).
|
|
69
|
+
**Have:** `list({ type, kind, band, archived })` — no `protected` filter, and prose `meta`
|
|
70
|
+
is not queryable at all. `protected` is a real column in box 2; `unresolved` is a prose
|
|
71
|
+
`meta` key.
|
|
72
|
+
**Workaround:** `scanActive()` reads every active memory's prose once per boundary, and
|
|
73
|
+
`enumerate()` reads them again for the protected list. Correct, and O(store) per boundary
|
|
74
|
+
call — acceptable because it runs at a boundary and never at wake, but it is the wrong
|
|
75
|
+
shape at 10⁴ memories.
|
|
76
|
+
|
|
77
|
+
**Amended 2026-09-04:** wake no longer reads *only* one meta row. A wake that is a
|
|
78
|
+
DELIVERY also reads the lived day and one `COUNT(*)` over `memories`, because the delivery
|
|
79
|
+
preface states how big the store is and a bundle rendered at yesterday's boundary cannot
|
|
80
|
+
know that. `Store.countMemories(filter)` is `list()`'s WHERE counted in SQL — deliberately
|
|
81
|
+
not `list().length`, which would materialize every id — and it is the one aggregate on the
|
|
82
|
+
wake path. A read that is not a delivery still pays exactly one meta row.
|
|
83
|
+
**Real fix:** `list({ protected: true })` (the column is already there) and either an
|
|
84
|
+
`unresolved` column or a store-side `meta` index. `episodes.ts`'s `findIngested()` and
|
|
85
|
+
`memoriesForEpisode()` scan for the same reason and would collapse to one indexed query.
|
|
86
|
+
|
|
87
|
+
## 3. `prospective/` does not exist — the horizon is caller-supplied
|
|
88
|
+
|
|
89
|
+
**Owner:** `prospective/`.
|
|
90
|
+
**Needed:** "arriving occasions" is a briefing lane (behavioral-spec §1, contract §5
|
|
91
|
+
INPUTS: *the prospective horizon*).
|
|
92
|
+
**Have:** `Store.prospectiveFor(id)` answers "what windows does THIS memory have"; there
|
|
93
|
+
is no "what is due on day d" read, and no module owning the ordering.
|
|
94
|
+
**Workaround:** `BoundaryRequest.horizon?: HorizonItem[]` — the caller passes ids, in the
|
|
95
|
+
order it wants them, and `self/` ranks nothing: it resolves them at render time like any
|
|
96
|
+
other lane and trims them in `TRIM_ORDER` position. A caller that passes nothing gets an
|
|
97
|
+
empty lane, which is silent by design (an empty horizon is a real state).
|
|
98
|
+
**Real fix:** `prospective.due(day)` returning ordered memory ids, consumed here directly.
|
|
99
|
+
The lane, its heading, and its trim position are already built; only the source is
|
|
100
|
+
borrowed.
|
|
101
|
+
|
|
102
|
+
## 4. The published briefing lives in a `meta` row, not a render file
|
|
103
|
+
|
|
104
|
+
**Owner:** `store/`.
|
|
105
|
+
**Needed:** atomic publish of one text blob that the wake path reads with no computation
|
|
106
|
+
(contract §5 G1, §1 G5 — "an empty or short read is an error, never silently valid").
|
|
107
|
+
**Have:** `setMeta(key, value)`, transactional in box 2 — genuinely atomic, so a
|
|
108
|
+
concurrent reader sees the old bundle or the new one and never an empty string, which is
|
|
109
|
+
the property v1's non-atomic `wake.md` lacked. What it is not is a FILE: the owner cannot
|
|
110
|
+
read their own briefing in an editor, which is a constitution-6 smell ("prose readable in
|
|
111
|
+
any editor"), and box 2 is not where large text belongs.
|
|
112
|
+
**Workaround:** `BRIEFING_KEY = "self.briefing"`, one `setMeta` per boundary, integrity
|
|
113
|
+
verified from the sentinel on read.
|
|
114
|
+
**Real fix (store's call):** a `render/` top-level directory with a `LAYOUT` entry —
|
|
115
|
+
`paths.ts` is store-owned and this module may not edit it — written tmp+rename, with the
|
|
116
|
+
same sentinel check on read. The reader would then be `readFileSync` + `readSentinel`,
|
|
117
|
+
which is the same two lines.
|
|
118
|
+
|
|
119
|
+
## 5. The episode gate is injected, and its default REFUSES
|
|
120
|
+
|
|
121
|
+
**Owner:** `encode/` (the gate battery: secrets, precision, the emotion exemption).
|
|
122
|
+
**Needed:** "ingestion is ordinary and the gates apply — a first-person reflection is not
|
|
123
|
+
exempt from never durably encoding a credential" (contract §3, scar §2.7: episode
|
|
124
|
+
ingestion was v1's most heavily gated surface, 66% of all gate fires).
|
|
125
|
+
**Have:** `encode/battery.ts` exists but its input shape (`GateInput`) is `remember`'s
|
|
126
|
+
proposal-shaped one, and SEAMS.md items 2–3 record that it is still missing channels.
|
|
127
|
+
**Workaround:** `EpisodeGate` — `(text, handles, sessionId) => ok | {gate, reason}` — with
|
|
128
|
+
`NO_GATE` as the default, which REFUSES, exactly as `remember`'s does. An absent gate is
|
|
129
|
+
not an open one, and "NO_GATE_INJECTED" is a loud reason in the ingest result.
|
|
130
|
+
**Real fix:** the coordinator wires `encode`'s battery in at the composition root, and
|
|
131
|
+
this module's default stops being reachable in production. The `self.episode.ingest.refused`
|
|
132
|
+
event already carries the gate name, so the day the battery is wired the telemetry
|
|
133
|
+
distinguishes "refused by the real gate" from "nobody wired one".
|
|
134
|
+
|
|
135
|
+
## 6. `sleep/` expects a `RenderFn`; `Self.boundary` is it, minus the budget
|
|
136
|
+
|
|
137
|
+
**Owner:** the coordinator (both modules were built in parallel and neither imports the
|
|
138
|
+
other — `sleep/briefing.ts` says so in its header, and a test on each side asserts it).
|
|
139
|
+
**Needed:** the re-render must be the cycle's LAST content write, after revision, so it
|
|
140
|
+
sees this boundary's own supersedes, promotions, merges and prunes.
|
|
141
|
+
**Have:** `sleep` injects `RenderFn = (ctx: { store, day, observer }) => { bytes?, elements? }`.
|
|
142
|
+
`Self.boundary({ budgetBytes, day, horizon? })` returns `{ briefing: { bytes, elements }, ... }`,
|
|
143
|
+
so the adapter is a one-liner **except for `budgetBytes`**, which `sleep`'s context does
|
|
144
|
+
not carry and this module refuses to invent (scar §2.18: the ceiling is a host
|
|
145
|
+
capability). The wiring is therefore a closure over the host's reported ceiling:
|
|
146
|
+
|
|
147
|
+
const render: RenderFn = (ctx) =>
|
|
148
|
+
new Self({ store: ctx.store }).boundary({ budgetBytes: host.ceiling, day: ctx.day })
|
|
149
|
+
.briefing;
|
|
150
|
+
|
|
151
|
+
**Real fix:** `budgetBytes` joins `sleep`'s cycle options, sourced from the adapter, so
|
|
152
|
+
the closure is not the only thing standing between a host's real cliff and the render.
|
|
153
|
+
Until then: whoever writes that line owns the number, and a wrong one is visible — an
|
|
154
|
+
under-floor ceiling fires `self.briefing.overbudget` at every boundary.
|
|
155
|
+
|
|
156
|
+
## 7. Reference resolution for confirmations has no caller yet
|
|
157
|
+
|
|
158
|
+
`Self.noteSelfConfirmation` is the freeze seam: whoever decides that a fallback sweep has
|
|
159
|
+
produced a confirmation against an existing element calls it, and it resolves, decides,
|
|
160
|
+
counts and (only in the live arm) reinforces. Deciding *that* — which claim in a sweep is
|
|
161
|
+
a repeat of which element — is `remember/`'s crash-fallback path plus `schemas/`'s dedup,
|
|
162
|
+
and neither wires it today. Recorded here so the freeze does not become v1's
|
|
163
|
+
"documented in three places, enforced in one, consumed by nobody" (scar §2.6). The
|
|
164
|
+
guarantee that this seam is reachable is the coordinator's, not this module's.
|
|
165
|
+
|
|
166
|
+
## 8. The threads lane has no source on a migrated store — nothing carries `unresolved`
|
|
167
|
+
|
|
168
|
+
**Owner:** `remember/` (who mints and revises memories) plus `tools/migrate` (what came
|
|
169
|
+
across from v1).
|
|
170
|
+
**Needed:** the threads lane is "memories flagged `unresolved`", person-scoped first, oldest
|
|
171
|
+
first (contract §5, behavioral-spec §1). It is the lane that says *what we were in the
|
|
172
|
+
middle of*, and it is second only to identity in what a waking session actually uses.
|
|
173
|
+
**Have, measured on the live store 2026-09-04:** of 14,700 migrated memories, **zero** carry
|
|
174
|
+
the `unresolved` flag. v1's open threads did not migrate as threads — they came across as
|
|
175
|
+
ordinary memories — and nothing in v2 sets the flag yet, because opening and closing a
|
|
176
|
+
thread is a lifecycle this module deliberately does not own (NOTES §7). The store holds
|
|
177
|
+
2,862 skill-kind memories, so craft fills the moment it is given room; threads stay dark
|
|
178
|
+
regardless of `THREADS_MAX`, of the identity share, or of any other cap. Said plainly here
|
|
179
|
+
rather than papered over: **the empty "Still open:" lane is a missing source, not a tuning
|
|
180
|
+
problem, and no number in `tunables.ts` will light it.**
|
|
181
|
+
**Workaround:** none, and none is wanted. The lane, its heading, its ordering and its trim
|
|
182
|
+
position exist and are tested; an empty lane renders as no lane at all, which is honest.
|
|
183
|
+
**Real fix, in the order they would land:** (1) whoever mints memories sets `unresolved` on
|
|
184
|
+
the ones that are genuinely open — the end-of-session authorship path is the obvious door,
|
|
185
|
+
since the experiencer knows what it left hanging; (2) something closes them, or they are
|
|
186
|
+
worse than nothing within a week; (3) optionally, a migration pass that re-reads v1's own
|
|
187
|
+
open-thread list and flags the memories it can still resolve — cheap, one-shot, and it is
|
|
188
|
+
the only way the pre-migration years get a threads lane at all.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## The cap has a day again, so the zone question is live again — REOPENED 2026-09-18
|
|
193
|
+
|
|
194
|
+
This closed on 2026-09-17, when the cap became the session's own for the
|
|
195
|
+
session's whole life: no day, so no zone. The cap is now the session's own **per
|
|
196
|
+
calendar day** (`MAX_ASKS_PER_SESSION`, owner's ruling 2026-09-18), and that day
|
|
197
|
+
is `Store#today` — UTC, the same zone as every other `date` in this store, on
|
|
198
|
+
purpose: two clocks in one store is a scar this repo already has a name for.
|
|
199
|
+
|
|
200
|
+
**The consequence, named rather than hidden:** an owner at UTC−6 gets the day's
|
|
201
|
+
allowance back at 18:00 local. A session working through the evening therefore
|
|
202
|
+
starts a fresh six mid-evening rather than at midnight. Nobody has reported
|
|
203
|
+
feeling it, and the pacer still spaces asks at roughly eight turns apart, so the
|
|
204
|
+
visible effect is at most a few more asks in a late session. The fix, if it is
|
|
205
|
+
ever wanted, is a per-owner zone — one clock, read wherever a day is decided —
|
|
206
|
+
and not a second clock bolted on here. **What the zone question also survives
|
|
207
|
+
in** is the `date` stamped on every `adapter.ask` row, which is the number any
|
|
208
|
+
"how often today" reading is grouped by.
|
|
209
|
+
|
|
210
|
+
## The tail verdict and the ask read the same state — CLOSED 2026-09-17
|
|
211
|
+
|
|
212
|
+
This said `noteOrphanTail` had to be handed the same `date` as the ask, or the
|
|
213
|
+
"what did the last ask not cover" telemetry would be computed against a
|
|
214
|
+
different day counter and report a cap for a day that had asks left — the shape
|
|
215
|
+
of finding one bug twice. With the cap on the session, both sides read the
|
|
216
|
+
session's own `asks` and there is no second counter to disagree with. The
|
|
217
|
+
guarantee is unchanged and now free: the tail verdict is the ask's verdict.
|
|
218
|
+
|
|
219
|
+
## 9. The nightly writer's claim wants a compare-and-swap the store does not have (2026-09-20, S2)
|
|
220
|
+
|
|
221
|
+
`writer.ts` claims a night by appending one durable row and then refusing to start a second
|
|
222
|
+
run while it stands. Between the read that finds no claim and the append that writes one
|
|
223
|
+
there is a window — small, but real — in which two hooks on two terminals, or two machines
|
|
224
|
+
against one synced store, can both claim the same night.
|
|
225
|
+
|
|
226
|
+
What would close it is a conditional write: `appendEvent` with a uniqueness constraint on
|
|
227
|
+
`(name, about)`, or a `setMeta` that fails when the key already holds a value. `store/` has
|
|
228
|
+
neither today; `setMeta` is insert-or-replace and `appendEvent` has no unique key but
|
|
229
|
+
`dedup_key`, which silently collapses rather than reporting that it collapsed — "the write
|
|
230
|
+
landed" and "somebody else was here first" are the same return.
|
|
231
|
+
|
|
232
|
+
**Not raised as an ask yet, because the cost of losing the race is small and bounded.** A
|
|
233
|
+
duplicated ask is one extra block beside one wake, inside an allowance that already permits
|
|
234
|
+
two; a duplicated `claude -p` is one extra model call and a second revision that the page's
|
|
235
|
+
own `ifVersion` refuses with a row saying so. The gap is filed rather than fixed so that if
|
|
236
|
+
`store/` ever grows a conditional write — F5's row work is the likely moment — this is one
|
|
237
|
+
of the callers waiting for it.
|
|
238
|
+
|
|
239
|
+
A `dedupKey` that REPORTED the collapse (`appendEvent` returning 0 for "already there"
|
|
240
|
+
rather than a seq) would be enough on its own, and is the smaller of the two asks.
|
|
241
|
+
|
|
242
|
+
## 10. There is no recency to sort a single day by (2026-09-20, S2 review)
|
|
243
|
+
|
|
244
|
+
`writer.ts#dayMemories` orders the day by salience and then by the store's own id order,
|
|
245
|
+
and the contract now says exactly that. What it would rather say is "and then the newest
|
|
246
|
+
first", because within one calendar day salience ties on almost every pair — every row has
|
|
247
|
+
the same `birth_day`, no uses, and identical decay — so the tie-break is what actually
|
|
248
|
+
decides which 40 of 400 the writer sees.
|
|
249
|
+
|
|
250
|
+
Nothing in the `Store` API can break that tie. `learned_on` is a DATE. `birth_day` is the
|
|
251
|
+
lived day. `newId` is six random bytes (`store/index.ts#newId`), so ids carry no time.
|
|
252
|
+
`list()` returns `ORDER BY id`, which is therefore arbitrary-but-stable rather than
|
|
253
|
+
chronological.
|
|
254
|
+
|
|
255
|
+
**The ask, if it is ever wanted:** an ordering key on `MemoryRow` that is monotonic in
|
|
256
|
+
insertion — the rowid `list` already sorts against, exposed; or `list({ order: "minted" })`.
|
|
257
|
+
It is one column that already exists in box 2 and is not published.
|
|
258
|
+
|
|
259
|
+
**Why it is filed rather than pressed.** The property the cut actually needs is that it was
|
|
260
|
+
CHOSEN rather than iteration luck (§1 G3), and a deterministic id order has that. What is
|
|
261
|
+
lost is only that "the end of the day" — often the part a person would most want written
|
|
262
|
+
about — has no better chance than the middle of it. Worth revisiting the first time the
|
|
263
|
+
page reads as if it were written about the wrong half of a day.
|
|
264
|
+
## 11. `store/` has no "give me this row's directory" seam — OPEN 2026-09-20 (F6)
|
|
265
|
+
|
|
266
|
+
`journal-file.ts` reaches `Store.dir` and joins paths under it. That is the owner's
|
|
267
|
+
decision 2 and it is stated at the top of the module rather than hidden, but it
|
|
268
|
+
does mean `self/` now holds a second piece of layout knowledge beside
|
|
269
|
+
`remember/spans.ts`'s: which directory it owns, and that the store classifies it
|
|
270
|
+
(`store/paths.ts#LAYOUT`). Nothing enforces the pairing from this side — a module
|
|
271
|
+
that wrote to a directory the layout does not know would break the store's own
|
|
272
|
+
`assertLayout()` at the next open, loudly, which is the safe direction but is a
|
|
273
|
+
runtime answer to a compile-time question.
|
|
274
|
+
|
|
275
|
+
**What would close it:** a store-owned seam that hands a module its own
|
|
276
|
+
classified subdirectory (`store.ownedDir("journal")`), refusing at the seam what
|
|
277
|
+
`assertLayout` today refuses at the next open. It is the same ask
|
|
278
|
+
`INTERFACE-GAPS #4` makes for the briefing's render file, and the two should be
|
|
279
|
+
answered together rather than twice.
|
|
280
|
+
Recorded against the store, where it would be declared: `store/CONTRACT.md` §7 question 5
|
|
281
|
+
(that module keeps no `INTERFACE-GAPS.md` of its own, so its open asks live in its §7).
|
|
282
|
+
|
|
283
|
+
**What does not need it:** correctness. `journal` was classified before anything
|
|
284
|
+
wrote it (scar §2.11) and a test asserts a snapshot carries the copies.
|