Skip to content

edges

type Edge = typeof Edge.Type;

One edge. derived separates a sleep-mined suspicion from an authored assertion: the retention contested_status signal counts only derived: false contradictions, so an uncorroborated machine guess can never evict a memory.

strength is unitless in [0, 1]; an authored edge is 1.0 and a mined one carries its cosine. srcPath/dstPath are repo-root-relative with no leading slash.


type EdgeClass = typeof EdgeClass.Type;

type EdgeProvenance = typeof EdgeProvenance.Type;

type EdgeRel = typeof EdgeRel.Type;

type MemoryRel = typeof MemoryRel.Type;

type PersonRel = typeof PersonRel.Type;

type ProvenanceRel = typeof ProvenanceRel.Type;

type TaskRel = typeof TaskRel.Type;
const ALL_RELS: readonly ["supersedes", "contradicts", "caused_by", "leads_to", "part_of", "relates_to", "example_of", "supports", "laterally_related", "about_person", "authored_by", "from_session", "blocks", "subtask_of"];

Every rel across all four classes. The edges.rel column’s full vocabulary.


const Edge: Struct<{
derived: Boolean;
dstPath: String;
edgeClass: Literals<readonly ["memory", "person", "provenance", "task"]>;
provenance: Literals<readonly ["authored", "sleep", "import"]>;
rel: Literals<readonly ["supersedes", "contradicts", "caused_by", "leads_to", "part_of", "relates_to", "example_of", "supports", "laterally_related", "about_person", "authored_by", "from_session", "blocks", "subtask_of"]>;
srcPath: String;
strength: Number;
}>;

One edge. derived separates a sleep-mined suspicion from an authored assertion: the retention contested_status signal counts only derived: false contradictions, so an uncorroborated machine guess can never evict a memory.

strength is unitless in [0, 1]; an authored edge is 1.0 and a mined one carries its cosine. srcPath/dstPath are repo-root-relative with no leading slash.


const EDGE_CLASSES: readonly ["memory", "person", "provenance", "task"];

The four non-mixing edge classes. The class is what keeps a person or task edge out of PageRank, MMR, and the retention bridge count. Every memory-graph query filters edge_class = 'memory', and the SQL CHECK constraint refuses a rel that belongs to another class.


const EDGE_PROVENANCES: readonly ["authored", "sleep", "import"];

Where an edge came from. derived edges are only ever sleep-provenanced.


const EdgeClass: Literals<readonly ["memory", "person", "provenance", "task"]>;

const EdgeProvenance: Literals<readonly ["authored", "sleep", "import"]>;

const EdgeRel: Literals<readonly ["supersedes", "contradicts", "caused_by", "leads_to", "part_of", "relates_to", "example_of", "supports", "laterally_related", "about_person", "authored_by", "from_session", "blocks", "subtask_of"]>;

const MEMORY_RELS: readonly ["supersedes", "contradicts", "caused_by", "leads_to", "part_of", "relates_to", "example_of", "supports", "laterally_related"];

The nine memory rels. supersedes and contradicts are penalty-bearing: they gate the retention contested_status signal, so sleep promotes a corroborated one into both files rather than leaving it in the rebuildable index.


const MemoryRel: Literals<readonly ["supersedes", "contradicts", "caused_by", "leads_to", "part_of", "relates_to", "example_of", "supports", "laterally_related"]>;

const PERSON_RELS: readonly ["about_person", "authored_by"];

The two person rels, pointing at resources/people/*.


const PersonRel: Literals<readonly ["about_person", "authored_by"]>;

const PROVENANCE_RELS: readonly ["from_session"];

The one provenance rel, linking a memory to the session that produced it.


const ProvenanceRel: Literals<readonly ["from_session"]>;

const REL_TOKEN_PREFIX: "memhtml-" = "memhtml-";

A <link rel> token, which is the rel prefixed for the HTML plane. rel tokens cannot hold a colon, so the prefix is hyphenated and the rel’s own underscores become hyphens: laterally_related ⇒ memhtml-laterally-related.


const TASK_RELS: readonly ["blocks", "subtask_of"];

The two task rels, both between two task files.

Their own class for the same reason the person rels have one: task topology is working state, and a blocks edge entering PageRank would let an agent’s to-do list reweight the retention of its knowledge. @memhtml/store’s linkMemories refuses a task rel unless BOTH endpoints are tasks, and the edges CHECK refuses the rel under any other class.


const TaskRel: Literals<readonly ["blocks", "subtask_of"]>;
function isEdgeRel(rel): rel is "supersedes" | "contradicts" | "caused_by" | "leads_to" | "part_of" | "relates_to" | "example_of" | "supports" | "laterally_related" | "about_person" | "authored_by" | "from_session" | "blocks" | "subtask_of";

True when rel is in the closed vocabulary. Narrows an untrusted string.

string

rel is “supersedes” | “contradicts” | “caused_by” | “leads_to” | “part_of” | “relates_to” | “example_of” | “supports” | “laterally_related” | “about_person” | “authored_by” | “from_session” | “blocks” | “subtask_of”


function isWellFormedEdge(edge): boolean;

True when an edge’s declared class matches its rel and it is not a self-loop, the two conditions the edges table’s CHECK constraints enforce, stated once here so a caller can refuse a bad edge before the driver does.

boolean = Schema.Boolean

string = Schema.String

"memory" | "person" | "provenance" | "task" = EdgeClass

"authored" | "sleep" | "import" = EdgeProvenance

| "supersedes" | "contradicts" | "caused_by" | "leads_to" | "part_of" | "relates_to" | "example_of" | "supports" | "laterally_related" | "about_person" | "authored_by" | "from_session" | "blocks" | "subtask_of" = EdgeRel

string = Schema.String

number = ...

boolean


function relClassFor(rel): "memory" | "person" | "provenance" | "task";

The class a rel belongs to. Total over ALL_RELS and injective per class: a rel name appears in exactly one class, which is what lets the class be derived rather than carried alongside the rel and risk disagreeing with it.

| "supersedes" | "contradicts" | "caused_by" | "leads_to" | "part_of" | "relates_to" | "example_of" | "supports" | "laterally_related" | "about_person" | "authored_by" | "from_session" | "blocks" | "subtask_of"

"memory" | "person" | "provenance" | "task"


function relForToken(token):
| "supersedes"
| "contradicts"
| "caused_by"
| "leads_to"
| "part_of"
| "relates_to"
| "example_of"
| "supports"
| "laterally_related"
| "about_person"
| "authored_by"
| "from_session"
| "blocks"
| "subtask_of"
| undefined;

The rel behind a <link rel> token, or undefined when the token is outside the closed vocabulary. Inverse of relTokenFor on its image.

string

| "supersedes" | "contradicts" | "caused_by" | "leads_to" | "part_of" | "relates_to" | "example_of" | "supports" | "laterally_related" | "about_person" | "authored_by" | "from_session" | "blocks" | "subtask_of" | undefined


function relsForClass(edgeClass): readonly (
| "supersedes"
| "contradicts"
| "caused_by"
| "leads_to"
| "part_of"
| "relates_to"
| "example_of"
| "supports"
| "laterally_related"
| "about_person"
| "authored_by"
| "from_session"
| "blocks"
| "subtask_of")[];

The rels of one class. The inverse of relClassFor, as a set.

"memory" | "person" | "provenance" | "task"

readonly ( | "supersedes" | "contradicts" | "caused_by" | "leads_to" | "part_of" | "relates_to" | "example_of" | "supports" | "laterally_related" | "about_person" | "authored_by" | "from_session" | "blocks" | "subtask_of")[]


function relTokenFor(rel): string;

The HTML <link rel> token for a rel.

| "supersedes" | "contradicts" | "caused_by" | "leads_to" | "part_of" | "relates_to" | "example_of" | "supports" | "laterally_related" | "about_person" | "authored_by" | "from_session" | "blocks" | "subtask_of"

string