Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/memory / / SemanticMemoryStoreExt

Interface: SemanticMemoryStoreExt

Defined in: packages/memory/src/internal/storage-adapter.ts:109

Extension of the typed SemanticMemoryStore with optional embedding-aware helpers + lifecycle helpers that storage adapters may expose.

Stable

Extends

Methods

count()?

ts
optional count(scope): Promise<number>;

Defined in: packages/memory/src/internal/storage-adapter.ts:158

Count the recall-eligible facts for the scope (CE-5) - a COUNT(*) with the default recall filters (live, non-archived, non-quarantined), never materialising rows. Powers honest metadata() counts.

Parameters

ParameterType
scopeSessionScope

Returns

Promise&lt;number&gt;


forget()

ts
forget(
   id, 
   reason?, 
scope?): Promise<void>;

Defined in: packages/core/dist/contracts/memory-store.d.ts

Soft-delete a fact. W-154: when scope is supplied, adapters that support tenant isolation MUST treat a fact outside the scope as a deterministic no-op (0 rows changed) - defense in depth so a leaked / cross-user id reaching a mutator cannot touch another user's memory. Omitting scope preserves the historical unscoped behaviour (trusted internal callers: consolidator, erasure cascades). The parameter is additive - existing adapter implementations with the narrower arity remain structurally compatible.

Parameters

ParameterType
idstring
reason?string
scope?SessionScope

Returns

Promise&lt;void&gt;

Inherited from

SemanticMemoryStore.forget


get()?

ts
optional get(id): Promise<Fact | null>;

Defined in: packages/memory/src/internal/storage-adapter.ts:138

Lookup a single fact by id (returns null when absent or soft-deleted).

Parameters

ParameterType
idstring

Returns

Promise&lt;Fact | null&gt;


historyOf()?

ts
optional historyOf(scope, factId): Promise<readonly Fact[]>;

Defined in: packages/memory/src/internal/storage-adapter.ts:184

Walk the bi-temporal supersede chain that factId belongs to and return every fact in it, oldest → newest (by validFrom), including superseded / soft-deleted rows so callers can answer "how did this fact change over time". Scope-guarded and cycle-safe; returns [] for an unknown id. Powers SemanticMemory.history (P0-2). The default @graphorin/store-sqlite adapter implements it.

Parameters

ParameterType
scopeSessionScope
factIdstring

Returns

Promise&lt;readonly Fact[]&gt;


linkPendingSupersede()?

ts
optional linkPendingSupersede(newId, oldId): Promise<void>;

Defined in: packages/memory/src/internal/storage-adapter.ts:174

W-019: record a PENDING supersede link - set newId.supersedes = oldId WITHOUT closing the old fact's validity interval. Used when a supersede's successor lands quarantined: the old fact must stay in default recall until the successor is validated, at which point SemanticMemory.validate completes the closure via SemanticMemoryStore.supersede. No schema change - the supersedes column already exists.

Parameters

ParameterType
newIdstring
oldIdstring

Returns

Promise&lt;void&gt;


purge()?

ts
optional purge(
   id, 
   reason?, 
scope?): Promise<void>;

Defined in: packages/memory/src/internal/storage-adapter.ts:164

Hard-delete a fact (GDPR path). The audit log row is preserved but the row itself + every per-embedder vec0 entry is removed. Distinct from SemanticMemoryStore.forget (soft-delete).

Parameters

ParameterType
idstring
reason?string
scope?SessionScope

Returns

Promise&lt;void&gt;


remember()

ts
remember(fact): Promise<void>;

Defined in: packages/core/dist/contracts/memory-store.d.ts

Parameters

ParameterType
factFact

Returns

Promise&lt;void&gt;

Inherited from

SemanticMemoryStore.remember


rememberWithEmbedding()?

ts
optional rememberWithEmbedding(fact, options): Promise<void>;

Defined in: packages/memory/src/internal/storage-adapter.ts:110

Parameters

ParameterType
factFact
optionsEmbeddedWriteOptions

Returns

Promise&lt;void&gt;


ts
search(scope, opts): Promise<readonly MemoryHit<Fact>[]>;

Defined in: packages/core/dist/contracts/memory-store.d.ts

Parameters

ParameterType
scopeSessionScope
optsMemorySearchOptions

Returns

Promise<readonly MemoryHit&lt;Fact&gt;[]>

Inherited from

SemanticMemoryStore.search


searchVector()?

ts
optional searchVector(
   scope, 
   embedding, 
   embedderId, 
   topK, 
   asOf?, 
   includeQuarantined?, 
   includeSuperseded?, 
owner?): Promise<readonly MemoryHit<Fact>[]>;

Defined in: packages/memory/src/internal/storage-adapter.ts:111

Parameters

ParameterTypeDescription
scopeSessionScope-
embeddingFloat32Array-
embedderIdstring-
topKnumber-
asOf?stringPoint-in-time filter applied after KNN: only facts whose validity interval contains asOf (ISO-8601) survive. P0-2.
includeQuarantined?booleanInclude quarantined facts in the KNN result (validation / inspector path). Default reads exclude them. P1-4.
includeSuperseded?booleanInclude superseded / validity-expired facts. Default reads evaluate validity at NOW (memory-retrieval-01).
owner?| MemoryOwner | readonly MemoryOwner[]Retrieval-time principal filter (D3). Rows with no stored owner are treated as 'user'. Absent ⇒ no owner filter.

Returns

Promise<readonly MemoryHit&lt;Fact&gt;[]>


setStatus()?

ts
optional setStatus(
   factId, 
   status, 
   reason?, 
scope?): Promise<void>;

Defined in: packages/memory/src/internal/storage-adapter.ts:147

Set a fact's retrieval-trust status and write a memory_history audit row (P1-4). Promotes a quarantined fact to active (the validation path) or re-quarantines an active one. Never touches content / embedding / tombstone - quarantine is a retrieval gate. Powers SemanticMemory.validate; the default @graphorin/store-sqlite adapter implements it.

Parameters

ParameterType
factIdstring
statusMemoryStatus
reason?string
scope?SessionScope

Returns

Promise&lt;void&gt;


supersede()

ts
supersede(
   oldId, 
   newFact, 
reason?): Promise<void>;

Defined in: packages/core/dist/contracts/memory-store.d.ts

Parameters

ParameterType
oldIdstring
newFactFact
reason?string

Returns

Promise&lt;void&gt;

Inherited from

SemanticMemoryStore.supersede