---
title: types
---

## Type Aliases

### MemoryStatus

```ts
type MemoryStatus = typeof MemoryStatus.Type;
```

The status a memory file carries in `memhtml-status`.

***

### MemoryType

```ts
type MemoryType = typeof MemoryType.Type;
```

***

### ParaBucket

```ts
type ParaBucket = typeof ParaBucket.Type;
```

***

### TaskStatus

```ts
type TaskStatus = typeof TaskStatus.Type;
```

***

### WritableMemoryType

```ts
type WritableMemoryType = typeof WritableMemoryType.Type;
```

## Variables

### Confidence

```ts
const Confidence: Number;
```

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

***

### ENTITY\_SEPARATOR

```ts
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

```ts
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

```ts
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](/api/contracts/types/#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

```ts
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

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

The status a memory file carries in `memhtml-status`.

***

### MemoryType

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

***

### PARA\_BUCKETS

```ts
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

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

***

### PERSON\_ENTITY\_PREFIX

```ts
const PERSON_ENTITY_PREFIX: "person:";
```

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

***

### TASK\_STATUSES

```ts
const TASK_STATUSES: readonly ["todo", "doing", "blocked", "done"];
```

A task's own status, carried in `memhtml-task-status`, a SEPARATE axis from
[MemoryStatus](/api/contracts/types/#memorystatus-1), 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

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

***

### WRITABLE\_MEMORY\_TYPES

```ts
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

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

## Functions

### isPersonEntity()

```ts
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

##### entity

`string`

#### Returns

`boolean`

***

### isTaskStatus()

```ts
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

##### value

`string`

#### Returns

value is "todo" | "doing" | "blocked" | "done"

***

### isWritableMemoryType()

```ts
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

##### type

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

#### Returns

type is "task" | "episodic" | "semantic" | "procedural" | "agent\_insight" | "user\_preference" | "error\_pattern" | "verdict" | "precedent"

***

### normalizeEntityName()

```ts
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

##### name

`string`

#### Returns

`string`

***

### normalizeEntityRef()

```ts
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

##### entity

`string`

#### Returns

`string`

***

### parseEntity()

```ts
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

##### entity

`string`

#### Returns

##### Type Literal

```ts
{
  entityName: string;
  entityType: string;
}
```

###### entityName

```ts
readonly entityName: string;
```

Everything after the first separator, colons included.

###### entityType

```ts
readonly entityType: string;
```

The prefix before the first separator.

***

`undefined`