Type Aliases
Section titled “Type Aliases”MemoryStatus
Section titled “MemoryStatus”type MemoryStatus = typeof MemoryStatus.Type;The status a memory file carries in memhtml-status.
MemoryType
Section titled “MemoryType”type MemoryType = typeof MemoryType.Type;ParaBucket
Section titled “ParaBucket”type ParaBucket = typeof ParaBucket.Type;TaskStatus
Section titled “TaskStatus”type TaskStatus = typeof TaskStatus.Type;WritableMemoryType
Section titled “WritableMemoryType”type WritableMemoryType = typeof WritableMemoryType.Type;Variables
Section titled “Variables”Confidence
Section titled “Confidence”const Confidence: Number;Confidence, unitless in [0, 1]. 1.0 is an unqualified assertion.
ENTITY_SEPARATOR
Section titled “ENTITY_SEPARATOR”const ENTITY_SEPARATOR: ":" = ":";A type:name entity reference, e.g. service:checkout-api, person:sanju. The
prefix before the first colon is the entity type; everything after is the name, which
may itself contain colons.
Importance
Section titled “Importance”const Importance: Int;Importance, 1-10 inclusive, 1-based ordinal on a display scale, never an arithmetic
input on its own. The retention scorer divides it by 10 to reach [0, 1] before it
meets any other signal.
MEMORY_TYPES
Section titled “MEMORY_TYPES”const MEMORY_TYPES: readonly ["episodic", "semantic", "procedural", "agent_insight", "user_preference", "error_pattern", "verdict", "precedent", "arc", "task"];The memory type vocabulary, closed. Ten values, restated by the files.memory_type
CHECK constraint in SQL.
arc is in the vocabulary but absent from WRITABLE_MEMORY_TYPES: an arc is
synthesized by the sleep cycle from many memories, so an agent naming one directly
would be asserting a conclusion the corpus has not yet earned.
task is ONE axis with the other nine rather than a parallel kind column, because
three overlapping type vocabularies is what made
the predecessor memory system’s classification unanswerable. A task is a memory type whose
retrieval, dedup, and curation treatment a filter states, not a second axis. Tasks are
default-excluded from search and skipped by sleep. See @memhtml/index‘s assembleScope
and the sleep phases’ excludeTypes.
MemoryPath
Section titled “MemoryPath”const MemoryPath: String;A repo-root-relative path to a memory file, e.g. areas/oncall/rollback-order.html.
No leading slash: this is the git-tree form, the files.path primary key, and the id
of a memory. <link href> values carry the same path with a leading /. That is a
document-reference form, converted at the HTML boundary, never stored here.
MemoryStatus
Section titled “MemoryStatus”const MemoryStatus: Literals<readonly ["active", "archived"]>;The status a memory file carries in memhtml-status.
MemoryType
Section titled “MemoryType”const MemoryType: Literals<readonly ["episodic", "semantic", "procedural", "agent_insight", "user_preference", "error_pattern", "verdict", "precedent", "arc", "task"]>;PARA_BUCKETS
Section titled “PARA_BUCKETS”const PARA_BUCKETS: readonly ["projects", "areas", "resources", "archive"];PARA’s four buckets, closed and ordered. archive is a bucket rather than a status
because eviction is a git mv. The path itself records the state, so git log --follow reads through it and diff -M reports the move as R100.
ParaBucket
Section titled “ParaBucket”const ParaBucket: Literals<readonly ["projects", "areas", "resources", "archive"]>;PERSON_ENTITY_PREFIX
Section titled “PERSON_ENTITY_PREFIX”const PERSON_ENTITY_PREFIX: "person:";The person: entity prefix, which routes a semantic memory to resources/people/.
TASK_STATUSES
Section titled “TASK_STATUSES”const TASK_STATUSES: readonly ["todo", "doing", "blocked", "done"];A task’s own status, carried in memhtml-task-status, a SEPARATE axis from
MemoryStatus, which stays active | archived for every type including task.
Two axes rather than four memhtml-status values because active/archived is what every
archive, correction, and publish path switches on, and a fifth value there would silently
change the meaning of each of them. Finishing a task stamps done AND archives the file
through the same archiveMemory machinery, so done is not a resting state on its own and
“what did I finish” is answered by the archive tree plus git log.
TaskStatus
Section titled “TaskStatus”const TaskStatus: Literals<readonly ["todo", "doing", "blocked", "done"]>;WRITABLE_MEMORY_TYPES
Section titled “WRITABLE_MEMORY_TYPES”const WRITABLE_MEMORY_TYPES: ( | "task" | "episodic" | "semantic" | "procedural" | "agent_insight" | "user_preference" | "error_pattern" | "verdict" | "precedent")[];The nine types memory_write exposes. arc is system-written only, so the tool
parameter enum is narrower than the storage vocabulary by exactly that one value.
WritableMemoryType
Section titled “WritableMemoryType”const WritableMemoryType: Literals<readonly ["episodic", "semantic", "procedural", "agent_insight", "user_preference", "error_pattern", "verdict", "precedent", "task"]>;Functions
Section titled “Functions”isPersonEntity()
Section titled “isPersonEntity()”function isPersonEntity(entity): boolean;True when an entity reference names a person: the person: prefix plus a name that survives
trim().
The trim is what makes this predicate agree with the rest of the person plane. placementFor
routes on it, and the sleep phase that mints the person file and its memhtml-about-person
links keys on entity_name.trim() !== "". A whitespace-only name accepted here would land a
memory in resources/people/ that no phase will ever give a person file to link at — and
slugify maps that name to untitled, which names nobody.
Parameters
Section titled “Parameters”entity
Section titled “entity”string
Returns
Section titled “Returns”boolean
isTaskStatus()
Section titled “isTaskStatus()”function isTaskStatus(value): value is "todo" | "doing" | "blocked" | "done";True when a string is in the closed task-status vocabulary. Narrows an untrusted value.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”value is “todo” | “doing” | “blocked” | “done”
isWritableMemoryType()
Section titled “isWritableMemoryType()”function isWritableMemoryType(type): type is "task" | "episodic" | "semantic" | "procedural" | "agent_insight" | "user_preference" | "error_pattern" | "verdict" | "precedent";True for the nine types an agent may write. Narrows, so a caller can branch on it.
Parameters
Section titled “Parameters”| "task"
| "episodic"
| "semantic"
| "procedural"
| "agent_insight"
| "user_preference"
| "error_pattern"
| "verdict"
| "precedent"
| "arc"
Returns
Section titled “Returns”type is “task” | “episodic” | “semantic” | “procedural” | “agent_insight” | “user_preference” | “error_pattern” | “verdict” | “precedent”
normalizeEntityName()
Section titled “normalizeEntityName()”function normalizeEntityName(name): string;Lowercase, NFC-normalize, collapse internal whitespace, trim. What it means for two entity names to be the SAME name.
It lives in contracts rather than beside a caller because it is a vocabulary rule, and a second copy
of a vocabulary rule fails silently: entity-resolution decides which memhtml-entity metas to
rewrite by comparing a name against this form, so a divergent copy would have the phase canonicalize
files toward a spelling nothing else recognizes, reporting merges no query can reach.
file_entities stores names AS AUTHORED, not in this form, and that is deliberate — the phase finds
its work by reading those rows back, so a projection that pre-normalized would hide every
unnormalized meta from the one pass whose job is to fix it. The two SQL doors fold with lower() on
both sides instead: a narrower fold (SQLite’s lower() is ASCII-only) that cannot disagree with
itself across the JS/SQL seam. Full canonicalization is durable in the TREE, applied by the phase.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”string
normalizeEntityRef()
Section titled “normalizeEntityRef()”function normalizeEntityRef(entity): string;A whole reference in that form: both halves normalized, rejoined, padding around the separator gone.
For callers comparing references in TypeScript — the write path deciding whether a candidate entity is one the corpus already names. The SQL doors do NOT use this; see the seam note above.
Total over unparseable input. A string with no separator normalizes as a whole and is returned without one, so the caller still decides what an untyped reference means rather than receiving a silently invented type.
Parameters
Section titled “Parameters”entity
Section titled “entity”string
Returns
Section titled “Returns”string
parseEntity()
Section titled “parseEntity()”function parseEntity(entity): | { entityName: string; entityType: string;} | undefined;Split an entity reference into its type and name at the first separator. undefined when the
reference has no separator, or when the type or the name on either side of it is empty.
Parameters
Section titled “Parameters”entity
Section titled “entity”string
Returns
Section titled “Returns”Type Literal
Section titled “Type Literal”{ entityName: string; entityType: string;}entityName
Section titled “entityName”readonly entityName: string;Everything after the first separator, colons included.
entityType
Section titled “entityType”readonly entityType: string;The prefix before the first separator.
undefined