Types Reference
All types are importable from @hebbs/sdk. They are implemented as TypeScript interfaces with readonly fields and enums with string values.
Memory
Section titled “Memory”The core data type representing a stored memory.
| Field | Type | Description |
|---|---|---|
id | Buffer | 16-byte unique memory identifier |
content | string | The memory text |
importance | number | Importance score (0.0—1.0) |
context | Record<string, unknown> | Structured key-value metadata (used by analogical recall for structural matching) |
entityId | string | undefined | Entity scope. undefined if stored without an entity. |
createdAt | number | Creation timestamp in microseconds |
updatedAt | number | Last modification timestamp in microseconds |
lastAccessedAt | number | Last access timestamp in microseconds |
accessCount | number | How many times this memory has been recalled (Hebbian reinforcement) |
decayScore | number | Current decay score (importance adjusted by time decay) |
kind | MemoryKind | Memory classification (episode, insight, revision) |
embedding | number[] | The embedding vector (empty unless explicitly requested) |
MemoryKind
Section titled “MemoryKind”Enum classifying the type of memory.
| Variant | Value | Description |
|---|---|---|
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.
| Field | Type | Description |
|---|---|---|
targetId | Buffer | 16-byte ID of the target memory |
edgeType | EdgeType | Relationship classification |
confidence | number | undefined | Strength 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,};EdgeType
Section titled “EdgeType”Enum for relationship types between memories. Used in Edge and for filtering causal recall via RecallStrategyConfig.edgeTypes.
| Variant | Value | Description |
|---|---|---|
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 |
RecallStrategy
Section titled “RecallStrategy”Enum for the four recall strategies.
| Variant | Value | Description |
|---|---|---|
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) |
RecallStrategyConfig
Section titled “RecallStrategyConfig”Per-strategy configuration for advanced recall tuning. See Client Reference for the full parameter table and usage examples.
| Field | Type | Default | Description |
|---|---|---|---|
strategy | string | (required) | Strategy name |
entityId | string | undefined | undefined | Override entity scope for this strategy |
topK | number | undefined | undefined | Per-strategy result limit |
efSearch | number | undefined | 50 | HNSW candidate count (similarity) |
timeRange | [number, number] | undefined | undefined | [startUs, endUs] bounds (temporal) |
seedMemoryId | Buffer | undefined | undefined | Graph traversal start node (causal) |
edgeTypes | EdgeType[] | undefined | undefined | Restrict traversal edges (causal) |
maxDepth | number | undefined | 5 | Max hops (causal, hard cap: 10) |
analogicalAlpha | number | undefined | 0.5 | Structural vs. embedding blend (analogical) |
ScoringWeights
Section titled “ScoringWeights”Override composite scoring weights for recall() and prime().
| Field | Type | Default | Description |
|---|---|---|---|
wRelevance | number | undefined | 0.5 | Weight for semantic relevance (cosine similarity) |
wRecency | number | undefined | 0.2 | Weight for temporal recency |
wImportance | number | undefined | 0.2 | Weight for stored importance value |
wReinforcement | number | undefined | 0.1 | Weight for recall frequency (Hebbian reinforcement) |
maxAgeUs | number | undefined | undefined | Max age for recency decay (microseconds). Server default: 30 days. |
reinforcementCap | number | undefined | undefined | Cap for reinforcement scaling. Server default: 100. |
const weights: ScoringWeights = { wRelevance: 0.8, wRecency: 0.1, wImportance: 0.05, wReinforcement: 0.05,};StrategyDetail
Section titled “StrategyDetail”Per-strategy metadata for a recall result. Each strategy populates different fields.
| Field | Type | Description |
|---|---|---|
strategy | string | Strategy name: 'similarity', 'temporal', 'causal', 'analogical' |
relevance | number | Raw relevance score for this strategy |
distance | number | undefined | HNSW distance (similarity only) |
timestamp | number | undefined | Memory timestamp in microseconds (temporal only) |
rank | number | undefined | Ordering rank in temporal results (temporal only) |
depth | number | undefined | Graph traversal depth from seed (causal only) |
embeddingSimilarity | number | undefined | Embedding similarity component (analogical only) |
structuralSimilarity | number | undefined | Structural similarity component (analogical only) |
RecallResult
Section titled “RecallResult”A single memory returned from a recall query, with composite score and strategy details.
| Field | Type | Description |
|---|---|---|
memory | Memory | The recalled memory |
score | number | Composite score (weighted blend of relevance, recency, importance, reinforcement) |
strategyDetails | StrategyDetail[] | Per-strategy metadata. A memory found by multiple strategies has multiple entries. |
StrategyError
Section titled “StrategyError”Reports a per-strategy error when one strategy fails but others succeed.
| Field | Type | Description |
|---|---|---|
strategy | string | Strategy that failed |
message | string | Error message |
RecallOutput
Section titled “RecallOutput”The complete response from a recall() call.
| Field | Type | Description |
|---|---|---|
results | RecallResult[] | Ranked list of recalled memories (sorted by composite score) |
strategyErrors | StrategyError[] | Errors from individual strategies, if any (partial success is possible) |
PrimeOutput
Section titled “PrimeOutput”Response from a prime() call.
| Field | Type | Description |
|---|---|---|
results | RecallResult[] | Blended temporal + similarity results |
temporalCount | number | Number of results from the temporal component |
similarityCount | number | Number of results from the similarity component |
ForgetResult
Section titled “ForgetResult”Response from a forget() call.
| Field | Type | Description |
|---|---|---|
forgottenCount | number | Number of memories erased |
cascadeCount | number | Number of related records (edges, snapshots) cascade-deleted |
tombstoneCount | number | Number of tombstone records created for audit |
truncated | boolean | Whether the result set was truncated (large entity deletions) |
ReflectResult
Section titled “ReflectResult”Response from a reflect() call.
| Field | Type | Description |
|---|---|---|
insightsCreated | number | Number of new insight memories generated |
clustersFound | number | Number of memory clusters identified |
clustersProcessed | number | Number of clusters processed by the LLM pipeline |
memoriesProcessed | number | Total number of source memories analyzed |
SubscribePush
Section titled “SubscribePush”A push notification received on a subscription stream.
| Field | Type | Description |
|---|---|---|
subscriptionId | number | ID of the subscription that generated this push |
memory | Memory | The surfaced memory |
confidence | number | Confidence score for this push (0.0—1.0) |
pushTimestampUs | number | Server timestamp when the push was generated (microseconds) |
sequenceNumber | number | Monotonically increasing sequence for ordering |
HealthStatus
Section titled “HealthStatus”Server health information returned by health().
| Field | Type | Description |
|---|---|---|
serving | boolean | Whether the server is serving requests |
version | string | Server version string (e.g. '0.1.0') |
memoryCount | number | Total memories stored across all entities |
uptimeSeconds | number | Server uptime in seconds |