---
title: edges
---

## Type Aliases

### Edge

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

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

***

### EdgeProvenance

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

***

### EdgeRel

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

***

### MemoryRel

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

***

### PersonRel

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

***

### ProvenanceRel

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

***

### TaskRel

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

## Variables

### ALL\_RELS

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

***

### Edge

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

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

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

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

***

### EdgeClass

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

***

### EdgeProvenance

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

***

### EdgeRel

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

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

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

***

### PERSON\_RELS

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

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

***

### PersonRel

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

***

### PROVENANCE\_RELS

```ts
const PROVENANCE_RELS: readonly ["from_session"];
```

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

***

### ProvenanceRel

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

***

### REL\_TOKEN\_PREFIX

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

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

```ts
const TaskRel: Literals<readonly ["blocks", "subtask_of"]>;
```

## Functions

### isEdgeRel()

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

##### rel

`string`

#### 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()

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

##### edge

###### derived

`boolean` = `Schema.Boolean`

###### dstPath

`string` = `Schema.String`

###### edgeClass

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

###### provenance

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

###### 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"` = `EdgeRel`

###### srcPath

`string` = `Schema.String`

###### strength

`number` = `...`

#### Returns

`boolean`

***

### relClassFor()

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

The class a rel belongs to. Total over [ALL\_RELS](/api/contracts/edges/#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

##### 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"`

#### Returns

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

***

### relForToken()

```ts
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](/api/contracts/edges/#reltokenfor) on its image.

#### Parameters

##### token

`string`

#### 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()

```ts
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](/api/contracts/edges/#relclassfor), as a set.

#### Parameters

##### edgeClass

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

#### 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()

```ts
function relTokenFor(rel): string;
```

The HTML `<link rel>` token for a rel.

#### Parameters

##### 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"`

#### Returns

`string`