Skip to content

Types Reference

All types are importable from hebbs or hebbs.types. They are implemented as frozen or mutable Python dataclasses with full type annotation support.

The core data type representing a stored memory.

FieldTypeDescription
idbytes16-byte unique memory identifier
contentstrThe memory text
importancefloatImportance score (0.0—1.0)
contextdict[str, Any]Structured key-value metadata (used by analogical recall for structural matching)
entity_idstr | NoneEntity scope. None if stored without an entity.
created_atintCreation timestamp in microseconds
updated_atintLast modification timestamp in microseconds
last_accessed_atintLast access timestamp in microseconds
access_countintHow many times this memory has been recalled (Hebbian reinforcement)
decay_scorefloatCurrent decay score (importance adjusted by time decay)
kindMemoryKindMemory classification (episode, insight, revision)
embeddinglist[float]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
target_idbytes16-byte ID of the target memory
edge_typeEdgeTypeRelationship classification
confidencefloat | NoneStrength of the relationship (0.0—1.0). Default: None (engine default).
from hebbs import Edge, EdgeType
edge = Edge(target_id=mem.id, edge_type=EdgeType.FOLLOWED_BY, confidence=0.95)

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

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
strategystr(required)Strategy name
entity_idstr | NoneNoneOverride entity scope for this strategy
top_kint | NoneNonePer-strategy result limit
ef_searchint | None50HNSW candidate count (similarity)
time_rangetuple[int, int] | NoneNone(start_us, end_us) bounds (temporal)
seed_memory_idbytes | NoneNoneGraph traversal start node (causal)
edge_typeslist[EdgeType] | NoneNoneRestrict traversal edges (causal)
max_depthint | None5Max hops (causal, hard cap: 10)
analogical_alphafloat | None0.5Structural vs. embedding blend (analogical)

Override composite scoring weights for recall() and prime(). Can be passed as a ScoringWeights dataclass or a plain dict.

FieldTypeDefaultDescription
w_relevancefloat0.5Weight for semantic relevance (cosine similarity)
w_recencyfloat0.2Weight for temporal recency
w_importancefloat0.2Weight for stored importance value
w_reinforcementfloat0.1Weight for recall frequency (Hebbian reinforcement)
max_age_usint | NoneNoneMax age for recency decay (microseconds). Server default: 30 days.
reinforcement_capint | NoneNoneCap for reinforcement scaling. Server default: 100.
from hebbs import ScoringWeights
# Dataclass
weights = ScoringWeights(w_relevance=0.8, w_recency=0.1, w_importance=0.05, w_reinforcement=0.05)
# Or as a dict
weights = {"w_relevance": 0.8, "w_recency": 0.1, "w_importance": 0.05, "w_reinforcement": 0.05}

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

FieldTypeDescription
strategystrStrategy name: "similarity", "temporal", "causal", "analogical"
relevancefloatRaw relevance score for this strategy
distancefloat | NoneHNSW distance (similarity only)
timestampint | NoneMemory timestamp in microseconds (temporal only)
rankint | NoneOrdering rank in temporal results (temporal only)
depthint | NoneGraph traversal depth from seed (causal only)
embedding_similarityfloat | NoneEmbedding similarity component (analogical only)
structural_similarityfloat | NoneStructural similarity component (analogical only)

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

FieldTypeDescription
memoryMemoryThe recalled memory
scorefloatComposite score (weighted blend of relevance, recency, importance, reinforcement)
strategy_detailslist[StrategyDetail]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
strategystrStrategy that failed
messagestrError message

The complete response from a recall() call.

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

Response from a prime() call.

FieldTypeDescription
resultslist[RecallResult]Blended temporal + similarity results
temporal_countintNumber of results from the temporal component
similarity_countintNumber of results from the similarity component

Response from a forget() call.

FieldTypeDescription
forgotten_countintNumber of memories erased
cascade_countintNumber of related records (edges, snapshots) cascade-deleted
tombstone_countintNumber of tombstone records created for audit
truncatedboolWhether the result set was truncated (large entity deletions)

Response from a reflect() call.

FieldTypeDescription
insights_createdintNumber of new insight memories generated
clusters_foundintNumber of memory clusters identified
clusters_processedintNumber of clusters processed by the LLM pipeline
memories_processedintTotal number of source memories analyzed

A push notification received on a subscription stream.

FieldTypeDescription
subscription_idintID of the subscription that generated this push
memoryMemoryThe surfaced memory
confidencefloatConfidence score for this push (0.0—1.0)
push_timestamp_usintServer timestamp when the push was generated (microseconds)
sequence_numberintMonotonically increasing sequence for ordering

Server health information returned by health().

FieldTypeDescription
servingboolWhether the server is serving requests
versionstrServer version string (e.g. "0.1.0")
memory_countintTotal memories stored across all entities
uptime_secondsintServer uptime in seconds

All exceptions inherit from HebbsError and are importable from hebbs or hebbs.exceptions.

ExceptiongRPC CodeDescription
HebbsErrorBase exception
HebbsConnectionErrorFailed to connect to the server
HebbsAuthenticationErrorUNAUTHENTICATEDMissing or invalid API key
HebbsPermissionDeniedErrorPERMISSION_DENIEDInsufficient permissions
HebbsNotFoundErrorNOT_FOUNDMemory or resource not found
HebbsInvalidArgumentErrorINVALID_ARGUMENTMalformed request
HebbsTimeoutErrorDEADLINE_EXCEEDEDOperation timed out
HebbsUnavailableErrorUNAVAILABLEServer temporarily unavailable
HebbsInternalErrorINTERNALInternal server error