Skip to main content

Class: FactStore

Defined in: packages/agentos/src/cognition/memory/retrieval/fact-graph/FactStore.ts:22

Constructors​

Constructor​

new FactStore(): FactStore

Returns​

FactStore

Methods​

getAllTimeOrdered()​

getAllTimeOrdered(scope, scopeId, subject): Fact[]

Defined in: packages/agentos/src/cognition/memory/retrieval/fact-graph/FactStore.ts:90

Return ALL facts for a subject (across predicates), time-sorted ascending. Used for temporal queries where history matters.

Parameters​

scope​

string

scopeId​

string

subject​

string

Returns​

Fact[]


getLatest()​

getLatest(scope, scopeId, subject, predicate): Fact | null

Defined in: packages/agentos/src/cognition/memory/retrieval/fact-graph/FactStore.ts:67

Return the latest fact for (subject, predicate) or null. Supports un-canonicalized subject input (canonicalized internally). Returns null for predicates outside the closed schema.

Parameters​

scope​

string

scopeId​

string

subject​

string

predicate​

string

Returns​

Fact | null


upsert()​

upsert(scope, scopeId, facts): void

Defined in: packages/agentos/src/cognition/memory/retrieval/fact-graph/FactStore.ts:41

Insert facts. Facts with predicates outside the closed schema are silently dropped (matches the FactExtractor contract). Subjects are canonicalized; the stored form carries the canonical subject. Per-(subject, predicate) entries stay time-sorted ascending so getLatest is O(1) and getAllTimeOrdered is O(n).

Parameters​

scope​

string

scopeId​

string

facts​

readonly Fact[]

Returns​

void