Type Aliases
Section titled “Type Aliases”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.
EdgeClass
Section titled “EdgeClass”type EdgeClass = typeof EdgeClass.Type;EdgeProvenance
Section titled “EdgeProvenance”type EdgeProvenance = typeof EdgeProvenance.Type;EdgeRel
Section titled “EdgeRel”type EdgeRel = typeof EdgeRel.Type;MemoryRel
Section titled “MemoryRel”type MemoryRel = typeof MemoryRel.Type;PersonRel
Section titled “PersonRel”type PersonRel = typeof PersonRel.Type;ProvenanceRel
Section titled “ProvenanceRel”type ProvenanceRel = typeof ProvenanceRel.Type;TaskRel
Section titled “TaskRel”type TaskRel = typeof TaskRel.Type;Variables
Section titled “Variables”ALL_RELS
Section titled “ALL_RELS”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.
EDGE_CLASSES
Section titled “EDGE_CLASSES”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.
EDGE_PROVENANCES
Section titled “EDGE_PROVENANCES”const EDGE_PROVENANCES: readonly ["authored", "sleep", "import"];Where an edge came from. derived edges are only ever sleep-provenanced.
EdgeClass
Section titled “EdgeClass”const EdgeClass: Literals<readonly ["memory", "person", "provenance", "task"]>;EdgeProvenance
Section titled “EdgeProvenance”const EdgeProvenance: Literals<readonly ["authored", "sleep", "import"]>;EdgeRel
Section titled “EdgeRel”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"]>;MEMORY_RELS
Section titled “MEMORY_RELS”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.
MemoryRel
Section titled “MemoryRel”const MemoryRel: Literals<readonly ["supersedes", "contradicts", "caused_by", "leads_to", "part_of", "relates_to", "example_of", "supports", "laterally_related"]>;PERSON_RELS
Section titled “PERSON_RELS”const PERSON_RELS: readonly ["about_person", "authored_by"];The two person rels, pointing at resources/people/*.
PersonRel
Section titled “PersonRel”const PersonRel: Literals<readonly ["about_person", "authored_by"]>;PROVENANCE_RELS
Section titled “PROVENANCE_RELS”const PROVENANCE_RELS: readonly ["from_session"];The one provenance rel, linking a memory to the session that produced it.
ProvenanceRel
Section titled “ProvenanceRel”const ProvenanceRel: Literals<readonly ["from_session"]>;REL_TOKEN_PREFIX
Section titled “REL_TOKEN_PREFIX”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.
TASK_RELS
Section titled “TASK_RELS”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.
TaskRel
Section titled “TaskRel”const TaskRel: Literals<readonly ["blocks", "subtask_of"]>;Functions
Section titled “Functions”isEdgeRel()
Section titled “isEdgeRel()”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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”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”
isWellFormedEdge()
Section titled “isWellFormedEdge()”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.
Parameters
Section titled “Parameters”derived
Section titled “derived”boolean = Schema.Boolean
dstPath
Section titled “dstPath”string = Schema.String
edgeClass
Section titled “edgeClass”"memory" | "person" | "provenance" | "task" = EdgeClass
provenance
Section titled “provenance”"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
srcPath
Section titled “srcPath”string = Schema.String
strength
Section titled “strength”number = ...
Returns
Section titled “Returns”boolean
relClassFor()
Section titled “relClassFor()”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.
Parameters
Section titled “Parameters”| "supersedes"
| "contradicts"
| "caused_by"
| "leads_to"
| "part_of"
| "relates_to"
| "example_of"
| "supports"
| "laterally_related"
| "about_person"
| "authored_by"
| "from_session"
| "blocks"
| "subtask_of"
Returns
Section titled “Returns”"memory" | "person" | "provenance" | "task"
relForToken()
Section titled “relForToken()”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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”| "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
relsForClass()
Section titled “relsForClass()”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.
Parameters
Section titled “Parameters”edgeClass
Section titled “edgeClass”"memory" | "person" | "provenance" | "task"
Returns
Section titled “Returns”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")[]
relTokenFor()
Section titled “relTokenFor()”function relTokenFor(rel): string;The HTML <link rel> token for a rel.
Parameters
Section titled “Parameters”| "supersedes"
| "contradicts"
| "caused_by"
| "leads_to"
| "part_of"
| "relates_to"
| "example_of"
| "supports"
| "laterally_related"
| "about_person"
| "authored_by"
| "from_session"
| "blocks"
| "subtask_of"
Returns
Section titled “Returns”string