Skip to content

Types Reference

All types are importable from @hebbs/sdk. They are implemented as TypeScript interfaces with readonly fields and enums with string values.

The core data type representing a stored memory.

FieldTypeDescription
idBuffer16-byte unique memory identifier
contentstringThe memory text
importancenumberImportance score (0.0—1.0)
contextRecord<string, unknown>Structured key-value metadata (used by analogical recall for structural matching)
entityIdstring | undefinedEntity scope. undefined if stored without an entity.
createdAtnumberCreation timestamp in microseconds
updatedAtnumberLast modification timestamp in microseconds
lastAccessedAtnumberLast access timestamp in microseconds
accessCountnumberHow many times this memory has been recalled (Hebbian reinforcement)
decayScorenumberCurrent decay score (importance adjusted by time decay)
kindMemoryKindMemory classification (episode, insight, revision)
embeddingnumber[]The embedding vector (empty unless explicitly requested)

Enum classifying the type of memory.

VariantValueDescription
EPISODE'episode'A stored event or observation — the default kind
INSIGHT'insight'Generated by the reflection pipeline from clusters of episodes
REVISION'revision'Created by revise() — supersedes a previous memory
UNSPECIFIED'unspecified'Unknown or not set

A directed relationship between two memories. Used with remember() to create graph edges.

FieldTypeDescription
targetIdBuffer16-byte ID of the target memory
edgeTypeEdgeTypeRelationship classification
confidencenumber | undefinedStrength of the relationship (0.0—1.0). Default: undefined (engine default).
import { EdgeType } from '@hebbs/sdk';
const edge = {
targetId: mem.id,
edgeType: EdgeType.FOLLOWED_BY,
confidence: 0.95,
};

Enum for relationship types between memories. Used in Edge and for filtering causal recall via RecallStrategyConfig.edgeTypes.

VariantValueDescription
CAUSED_BY'caused_by'Target caused this memory
RELATED_TO'related_to'General semantic relationship
FOLLOWED_BY'followed_by'This memory followed the target chronologically
REVISED_FROM'revised_from'Revision lineage (set automatically by revise())
INSIGHT_FROM'insight_from'Insight derived from source memories (set by reflect())
UNSPECIFIED'unspecified'Unknown or not set

Enum for the four recall strategies.

VariantValueDescription
SIMILARITY'similarity'Semantic vector similarity (HNSW index)
TEMPORAL'temporal'Time-proximity ordering (B-tree index)
CAUSAL'causal'Graph traversal following causal edges
ANALOGICAL'analogical'Cross-domain pattern matching (blends embedding + structural similarity)

Per-strategy configuration for advanced recall tuning. See Client Reference for the full parameter table and usage examples.

FieldTypeDefaultDescription
strategystring(required)Strategy name
entityIdstring | undefinedundefinedOverride entity scope for this strategy
topKnumber | undefinedundefinedPer-strategy result limit
efSearchnumber | undefined50HNSW candidate count (similarity)
timeRange[number, number] | undefinedundefined[startUs, endUs] bounds (temporal)
seedMemoryIdBuffer | undefinedundefinedGraph traversal start node (causal)
edgeTypesEdgeType[] | undefinedundefinedRestrict traversal edges (causal)
maxDepthnumber | undefined5Max hops (causal, hard cap: 10)
analogicalAlphanumber | undefined0.5Structural vs. embedding blend (analogical)

Override composite scoring weights for recall() and prime().

FieldTypeDefaultDescription
wRelevancenumber | undefined0.5Weight for semantic relevance (cosine similarity)
wRecencynumber | undefined0.2Weight for temporal recency
wImportancenumber | undefined0.2Weight for stored importance value
wReinforcementnumber | undefined0.1Weight for recall frequency (Hebbian reinforcement)
maxAgeUsnumber | undefinedundefinedMax age for recency decay (microseconds). Server default: 30 days.
reinforcementCapnumber | undefinedundefinedCap for reinforcement scaling. Server default: 100.
const weights: ScoringWeights = {
wRelevance: 0.8,
wRecency: 0.1,
wImportance: 0.05,
wReinforcement: 0.05,
};

Per-strategy metadata for a recall result. Each strategy populates different fields.

FieldTypeDescription
strategystringStrategy name: 'similarity', 'temporal', 'causal', 'analogical'
relevancenumberRaw relevance score for this strategy
distancenumber | undefinedHNSW distance (similarity only)
timestampnumber | undefinedMemory timestamp in microseconds (temporal only)
ranknumber | undefinedOrdering rank in temporal results (temporal only)
depthnumber | undefinedGraph traversal depth from seed (causal only)
embeddingSimilaritynumber | undefinedEmbedding similarity component (analogical only)
structuralSimilaritynumber | undefinedStructural similarity component (analogical only)

A single memory returned from a recall query, with composite score and strategy details.

FieldTypeDescription
memoryMemoryThe recalled memory
scorenumberComposite score (weighted blend of relevance, recency, importance, reinforcement)
strategyDetailsStrategyDetail[]Per-strategy metadata. A memory found by multiple strategies has multiple entries.

Reports a per-strategy error when one strategy fails but others succeed.

FieldTypeDescription
strategystringStrategy that failed
messagestringError message

The complete response from a recall() call.

FieldTypeDescription
resultsRecallResult[]Ranked list of recalled memories (sorted by composite score)
strategyErrorsStrategyError[]Errors from individual strategies, if any (partial success is possible)

Response from a prime() call.

FieldTypeDescription
resultsRecallResult[]Blended temporal + similarity results
temporalCountnumberNumber of results from the temporal component
similarityCountnumberNumber of results from the similarity component

Response from a forget() call.

FieldTypeDescription
forgottenCountnumberNumber of memories erased
cascadeCountnumberNumber of related records (edges, snapshots) cascade-deleted
tombstoneCountnumberNumber of tombstone records created for audit
truncatedbooleanWhether the result set was truncated (large entity deletions)

Response from a reflect() call.

FieldTypeDescription
insightsCreatednumberNumber of new insight memories generated
clustersFoundnumberNumber of memory clusters identified
clustersProcessednumberNumber of clusters processed by the LLM pipeline
memoriesProcessednumberTotal number of source memories analyzed

A push notification received on a subscription stream.

FieldTypeDescription
subscriptionIdnumberID of the subscription that generated this push
memoryMemoryThe surfaced memory
confidencenumberConfidence score for this push (0.0—1.0)
pushTimestampUsnumberServer timestamp when the push was generated (microseconds)
sequenceNumbernumberMonotonically increasing sequence for ordering

Server health information returned by health().

FieldTypeDescription
servingbooleanWhether the server is serving requests
versionstringServer version string (e.g. '0.1.0')
memoryCountnumberTotal memories stored across all entities
uptimeSecondsnumberServer uptime in seconds