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,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown, one direction only — the EXPORT format.
|
|
3
|
+
*
|
|
4
|
+
* This was `prose.ts#serializeProse`, one half of a round trip: the store wrote
|
|
5
|
+
* a file and parsed it back, and the frontmatter's `payload:` line existed so
|
|
6
|
+
* that a lossy YAML reading could never become the truth. Since the floor
|
|
7
|
+
* (schema v6) the row is the truth and **nothing parses this back**. It is what
|
|
8
|
+
* `counterparts export --markdown` writes, and what the journal's file copy
|
|
9
|
+
* writes (F6/F7) — a copy for the owner and for whatever outlives this program,
|
|
10
|
+
* which is exactly the argument that earned the journal its files
|
|
11
|
+
* (owner, 2026-09-17 §15 item 9: "the self is being recovered from v1 right now
|
|
12
|
+
* because its pages and journal were plain files that outlived their system").
|
|
13
|
+
*
|
|
14
|
+
* The shape is kept byte-for-byte rather than simplified, on purpose. Every
|
|
15
|
+
* `.md` the owner's v2 store ever wrote is in this format, the `payload:` line
|
|
16
|
+
* is what makes such a file re-readable by a future importer without guessing,
|
|
17
|
+
* and G8's omitted-when-absent (a field never used emits no line at all) is a
|
|
18
|
+
* property of the format, not of the writer that is gone.
|
|
19
|
+
*/
|
|
20
|
+
import { StoreError } from "./errors.js";
|
|
21
|
+
import { assertIdWellFormed, assertJsonSafe } from "./prose.js";
|
|
22
|
+
import type { ProseDoc, ProseType } from "./prose.js";
|
|
23
|
+
|
|
24
|
+
const FENCE = "---";
|
|
25
|
+
const PAYLOAD_KEY = "payload";
|
|
26
|
+
|
|
27
|
+
interface Payload {
|
|
28
|
+
id: string;
|
|
29
|
+
type: ProseType;
|
|
30
|
+
title?: string;
|
|
31
|
+
happenedOn?: string;
|
|
32
|
+
learnedOn: string;
|
|
33
|
+
bornDay: number;
|
|
34
|
+
meta: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function toPayload(doc: ProseDoc): Payload {
|
|
38
|
+
const p: Payload = {
|
|
39
|
+
id: doc.id,
|
|
40
|
+
type: doc.type,
|
|
41
|
+
learnedOn: doc.learnedOn,
|
|
42
|
+
bornDay: doc.bornDay,
|
|
43
|
+
meta: doc.meta,
|
|
44
|
+
};
|
|
45
|
+
if (doc.title !== undefined) p.title = doc.title;
|
|
46
|
+
if (doc.happenedOn !== undefined) p.happenedOn = doc.happenedOn;
|
|
47
|
+
return p;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** One human line per present field. Newlines are impossible here: values are scalars. */
|
|
51
|
+
function humanLines(p: Payload): string[] {
|
|
52
|
+
const lines = [`id: ${p.id}`, `type: ${p.type}`];
|
|
53
|
+
if (p.title !== undefined) lines.push(`title: ${oneLine(p.title)}`);
|
|
54
|
+
if (p.happenedOn !== undefined) lines.push(`happened: ${p.happenedOn}`);
|
|
55
|
+
lines.push(`learned: ${p.learnedOn}`, `bornDay: ${p.bornDay}`);
|
|
56
|
+
return lines;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function oneLine(s: string): string {
|
|
60
|
+
return s.replace(/\r?\n/g, " ");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** One memory as markdown: human-legible frontmatter, one machine payload line, the body below the fence. */
|
|
64
|
+
export function renderMarkdown(doc: ProseDoc): string {
|
|
65
|
+
if (typeof doc.body !== "string") {
|
|
66
|
+
throw new StoreError("PROSE_BODY_INVALID", { id: doc.id, reason: "body-not-string" });
|
|
67
|
+
}
|
|
68
|
+
assertIdWellFormed(doc.id);
|
|
69
|
+
const payload = toPayload(doc);
|
|
70
|
+
let json: string;
|
|
71
|
+
try {
|
|
72
|
+
json = JSON.stringify(payload);
|
|
73
|
+
} catch (cause) {
|
|
74
|
+
throw new StoreError("PROSE_META_UNSERIALIZABLE", {
|
|
75
|
+
id: doc.id,
|
|
76
|
+
reason: String((cause as Error).message ?? cause),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (json === undefined || /[\r\n]/.test(json)) {
|
|
80
|
+
// JSON.stringify escapes newlines; a raw one here would mean the payload could
|
|
81
|
+
// not be read back as a single line. Reject loudly, never truncate (G7).
|
|
82
|
+
throw new StoreError("PROSE_META_UNSERIALIZABLE", { id: doc.id, reason: "payload-not-one-line" });
|
|
83
|
+
}
|
|
84
|
+
assertJsonSafe(payload.meta, doc.id, "meta");
|
|
85
|
+
const lines = [...humanLines(payload), `${PAYLOAD_KEY}: ${json}`];
|
|
86
|
+
return `${FENCE}\n${lines.join("\n")}\n${FENCE}\n${doc.body}`;
|
|
87
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The WALKING read — the prose of a row an index is walking past, not of a
|
|
3
|
+
* memory anyone asked for.
|
|
4
|
+
*
|
|
5
|
+
* It exists because five call sites outside `store/` used to read prose by PATH
|
|
6
|
+
* (`readProseFile(store.absolutePath(row.prose_path), id)`), which was the last
|
|
7
|
+
* reason anything above the store knew there was a filesystem under it. Taking
|
|
8
|
+
* them off the layout means giving them a read that keeps the two exemptions
|
|
9
|
+
* they already had — and both of them are exemptions from a GATE, so this is not
|
|
10
|
+
* a convenience and must not sit where a caller finds it by accident.
|
|
11
|
+
*
|
|
12
|
+
* 1. **No archived-read telemetry.** `store.archived.read` answers "did anyone
|
|
13
|
+
* look at archived CONTENT" (CONTRACT §5 G13). `Schemas.load` scans every
|
|
14
|
+
* schema row at every open, so routing it through `Store.read` would file
|
|
15
|
+
* one archived-read per archived schema row per session and invert what the
|
|
16
|
+
* event means. An index build is a look at the address.
|
|
17
|
+
* 2. **No deny-list refusal — the dangerous half, and the reason for this
|
|
18
|
+
* file.** A `dark`-stage removal marks the id and leaves the row, its body
|
|
19
|
+
* included, until the chase, so a refusal here is the next session failing
|
|
20
|
+
* to start rather than one memory hidden. The refusal belongs where the OWNER
|
|
21
|
+
* is answered: `Store.read`, `resolve`, `readVersion` and the render seams.
|
|
22
|
+
*
|
|
23
|
+
* It lives here rather than on `Store` for the reason `chaseRemoved` does
|
|
24
|
+
* (`owner-op-seam.ts`): `Counterpart.store` is public, so a method on
|
|
25
|
+
* `Store.prototype` beside `read` and `readProse` is a removal bypass every
|
|
26
|
+
* adapter and every future contributor gets without asking for it, and §4's
|
|
27
|
+
* "owner-initiated removal is unreachable from any model path" would stop being
|
|
28
|
+
* true of the store's own surface. Reaching this one takes a deliberate import
|
|
29
|
+
* from one of two files — `schemas/index.ts` and `adapters/cli/commands.ts`,
|
|
30
|
+
* four call sites between them — and `test/cli.test.ts` pins that list.
|
|
31
|
+
*
|
|
32
|
+
* **It is still a hole.** One hole, with a name on it, in the seam where it can
|
|
33
|
+
* be seen and one day closed — `schemas/index.ts` skipping removed rows closes
|
|
34
|
+
* it where it actually matters (2026-09-18).
|
|
35
|
+
*/
|
|
36
|
+
import { StoreError } from "./errors.js";
|
|
37
|
+
import { parseMeta } from "./prose.js";
|
|
38
|
+
import { rowTombstoned } from "./operational.js";
|
|
39
|
+
import type { MemoryRow } from "./operational.js";
|
|
40
|
+
import type { ProseDoc } from "./prose.js";
|
|
41
|
+
import type { Store } from "./index.js";
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* `row` is the caller's own `row(id)` when it already has one — every one of
|
|
45
|
+
* these walks reads the row's columns too, and looking it up twice per id
|
|
46
|
+
* measured 54% of a 16,000-row walk (650 ms → 990 ms). That was measured while a
|
|
47
|
+
* file read dominated; since the floor there is no file read at all, so the
|
|
48
|
+
* saved lookup is now MOST of the walk and the parameter stays.
|
|
49
|
+
*
|
|
50
|
+
* **The `id === row.id` check is load-bearing and now stands alone.** It used to
|
|
51
|
+
* be belt and braces over `readProseFile`'s own `expectId`, which compared the
|
|
52
|
+
* file's payload against the id asked for; F3 flagged that deleting the file
|
|
53
|
+
* reader would delete that guard too, and it did. Without this line a caller
|
|
54
|
+
* that passed the wrong row would be handed the wrong memory's body, silently.
|
|
55
|
+
*/
|
|
56
|
+
export function readProseWalking(store: Store, id: string, row?: MemoryRow): ProseDoc {
|
|
57
|
+
const r = row ?? store.row(id);
|
|
58
|
+
if (r === undefined) throw new StoreError("ID_UNKNOWN", { id });
|
|
59
|
+
if (r.id !== id) throw new StoreError("PROSE_PAYLOAD_MISMATCH", { expected: id, found: r.id });
|
|
60
|
+
// The words are the row's own columns. A blank body is the one fault a walk
|
|
61
|
+
// still has to raise rather than paper over: blank BESIDE a blank hash is the
|
|
62
|
+
// owner's removal (the callers skip those by `rowTombstoned` before they get
|
|
63
|
+
// here), and blank beside a real hash is a row whose words went missing.
|
|
64
|
+
if (r.body.length === 0) {
|
|
65
|
+
throw new StoreError("MEMORY_BODY_MISSING", { id, tombstoned: rowTombstoned(r) });
|
|
66
|
+
}
|
|
67
|
+
const doc: ProseDoc = {
|
|
68
|
+
id: r.id,
|
|
69
|
+
type: r.type,
|
|
70
|
+
learnedOn: r.learned_on,
|
|
71
|
+
bornDay: r.birth_day,
|
|
72
|
+
meta: parseMeta(r.meta, r.id),
|
|
73
|
+
body: r.body,
|
|
74
|
+
};
|
|
75
|
+
if (r.title !== null) doc.title = r.title;
|
|
76
|
+
if (r.happened_on !== null) doc.happenedOn = r.happened_on;
|
|
77
|
+
return doc;
|
|
78
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared seam between core modules. Deliberately minimal: fields the physics
|
|
3
|
+
* contract names as inputs (physics/CONTRACT.md §5) plus the kind/band vocabulary.
|
|
4
|
+
* Modules may extend with their own types; nothing here may be broken without a
|
|
5
|
+
* cross-module conversation.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type Kind = "self" | "person" | "entity" | "skill" | "place" | "fact";
|
|
9
|
+
|
|
10
|
+
export type Band = "episodic" | "semantic" | "identity";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Who minted a memory — ENGINE-SET at the mint seam, never claimable by an
|
|
14
|
+
* author or an interpreter (the authorship doctrine, owner ruling 2026-08-29).
|
|
15
|
+
* The first four are `mint.ts`'s `ClaimChannel` vocabulary, persisted;
|
|
16
|
+
* "migrated" is the v1 importer's. An absent value (a pre-v4 row) reads as
|
|
17
|
+
* "unrecorded" — a default here would fabricate provenance.
|
|
18
|
+
*
|
|
19
|
+
* The ARRAY is the totality anchor: a member added here without a live writer
|
|
20
|
+
* fails the member-to-writer test (PR-2 review — "accommodation" shipped
|
|
21
|
+
* writerless once).
|
|
22
|
+
*/
|
|
23
|
+
export const MEMORY_SOURCES = [
|
|
24
|
+
"authored",
|
|
25
|
+
"fallback",
|
|
26
|
+
"episode",
|
|
27
|
+
"accommodation",
|
|
28
|
+
"migrated",
|
|
29
|
+
] as const;
|
|
30
|
+
export type MemorySource = (typeof MEMORY_SOURCES)[number];
|
|
31
|
+
|
|
32
|
+
/** Four dimensions, 0-1, fixed at encoding. novelty is null for a blind write
|
|
33
|
+
* (no schema context existed) — recorded, never defaulted (scar §2.9). */
|
|
34
|
+
export interface Salience {
|
|
35
|
+
novelty: number | null;
|
|
36
|
+
relevance: number;
|
|
37
|
+
emotional: number;
|
|
38
|
+
predictive: number;
|
|
39
|
+
/** The author's claimed aggregate salience, if any — a FLOOR, not a value
|
|
40
|
+
* (physics §5.1). Stored on the row so `sal(m)` stays reproducible from state
|
|
41
|
+
* alone; the dimensions above are never rewritten to satisfy it, and a null
|
|
42
|
+
* novelty is never defaulted to satisfy it. Clamped at the proposal->memory
|
|
43
|
+
* seam by `clampSalienceAtSeam()`, which emits an event on any lift. */
|
|
44
|
+
claimed?: number | null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The physics-relevant state of one memory. Days are lived-day integers
|
|
48
|
+
* (active-day clock, scar E8) — never calendar timestamps. */
|
|
49
|
+
export interface MemoryPhysics {
|
|
50
|
+
kind: Kind;
|
|
51
|
+
salience: Salience;
|
|
52
|
+
birthDay: number;
|
|
53
|
+
uses: number;
|
|
54
|
+
lastUsedDay: number;
|
|
55
|
+
/** How many DISTINCT lived days credited a use. `uses` is a weighted sum
|
|
56
|
+
* (§5.5's tiers) and cannot reconstruct this, and identity promotion is gated
|
|
57
|
+
* on >= N = 3 distinct lived days (§5.3). Incremented only by `creditUse()`.
|
|
58
|
+
* Optional so this stays an extension, not a break; absent reads as 0, which
|
|
59
|
+
* is the promotion-blocking direction. */
|
|
60
|
+
reinforcedDays?: number;
|
|
61
|
+
consolidated: boolean;
|
|
62
|
+
/** Set only by the explicit promotion crossing or revision inheritance (§5.3). */
|
|
63
|
+
promotedIdentity: boolean;
|
|
64
|
+
protected: boolean;
|
|
65
|
+
/** Challenge pressure — a field on the memory, never a second object (§5.6). */
|
|
66
|
+
pressure: number;
|
|
67
|
+
lastChallengedDay: number | null;
|
|
68
|
+
}
|