Skip to content

types

type MemoryStatus = typeof MemoryStatus.Type;

The status a memory file carries in memhtml-status.


type MemoryType = typeof MemoryType.Type;

type ParaBucket = typeof ParaBucket.Type;

type TaskStatus = typeof TaskStatus.Type;

type WritableMemoryType = typeof WritableMemoryType.Type;
const Confidence: Number;

Confidence, unitless in [0, 1]. 1.0 is an unqualified assertion.


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.


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.


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.


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.


const MemoryStatus: Literals<readonly ["active", "archived"]>;

The status a memory file carries in memhtml-status.


const MemoryType: Literals<readonly ["episodic", "semantic", "procedural", "agent_insight", "user_preference", "error_pattern", "verdict", "precedent", "arc", "task"]>;

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.


const ParaBucket: Literals<readonly ["projects", "areas", "resources", "archive"]>;

const PERSON_ENTITY_PREFIX: "person:";

The person: entity prefix, which routes a semantic memory to resources/people/.


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.


const TaskStatus: Literals<readonly ["todo", "doing", "blocked", "done"]>;

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.


const WritableMemoryType: Literals<readonly ["episodic", "semantic", "procedural", "agent_insight", "user_preference", "error_pattern", "verdict", "precedent", "task"]>;
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.

string

boolean


function isTaskStatus(value): value is "todo" | "doing" | "blocked" | "done";

True when a string is in the closed task-status vocabulary. Narrows an untrusted value.

string

value is “todo” | “doing” | “blocked” | “done”


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.

| "task" | "episodic" | "semantic" | "procedural" | "agent_insight" | "user_preference" | "error_pattern" | "verdict" | "precedent" | "arc"

type is “task” | “episodic” | “semantic” | “procedural” | “agent_insight” | “user_preference” | “error_pattern” | “verdict” | “precedent”


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.

string

string


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.

string

string


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.

string

{
entityName: string;
entityType: string;
}
readonly entityName: string;

Everything after the first separator, colons included.

readonly entityType: string;

The prefix before the first separator.


undefined