Skip to content

recall

The recall operation retrieves memories by cue, applying one or more strategies. Strategies can be combined: similarity search finds semantically related content; temporal finds recent or time-ordered memories; causal traverses graph edges; analogical finds structurally similar patterns.

ProtocolService/MethodEndpoint
gRPCMemoryService.Recall
RESTPOST/v1/recall
FieldTypeRequiredDefaultDescription
cuestringYesQuery text or context used to drive retrieval.
strategiesarrayYesOne or more strategy configs: similarity, temporal, causal, analogical.
top_kintNo10Maximum number of results per strategy.
entity_idstringNoNoneScope recall to this entity.
scoring_weightsobjectNo0.5/0.2/0.2/0.1Override composite scoring weights. Fields: w_relevance, w_recency, w_importance, w_reinforcement.
cue_contextstringNoNoneAdditional context to disambiguate the cue. Appended to the cue during embedding but not stored.
ef_searchintNo50HNSW search quality parameter (similarity strategy). Higher values increase accuracy at the cost of latency.
time_rangeobjectNoNone (unbounded)Temporal bounds as { "start": <timestamp>, "end": <timestamp> }. When omitted, temporal recall returns all memories newest-first up to top_k.
seed_memory_idstringNoNone (auto-detect)Starting memory ID for causal graph traversal. When omitted, the engine finds the best seed by embedding the cue.
max_depthintNo5 (bounded at 10)Maximum hops for causal graph traversal.
edge_typesarrayNoNone (all types)Filter causal traversal to specific edge types (e.g. ["CausedBy"]).
analogical_alphafloatNo0.5Balance between embedding similarity and structural similarity for analogical recall. 0.0 = pure structural, 1.0 = pure embedding.
tenant_idstringNoDerived from API key or "default"Tenant scope for data isolation. Normally derived from the API key by the server. Override only when running without authentication or for cross-tenant administrative operations.

Note: For REST, tenant_id is derived from the Authorization header — not passed in the request body. For gRPC, it can be set explicitly in the request message but is overridden by the API key’s tenant when auth is enabled.

Only cue and strategies are required. All other fields use smart defaults suitable for most workloads.

scoring_weights example:

{
"w_relevance": 1.0,
"w_recency": 0.0,
"w_importance": 0.0,
"w_reinforcement": 0.0
}

This ranks results purely by semantic similarity. See Composite Scoring for the full formula and tuning guide.

FieldTypeDescription
resultsarrayEach result contains memory, score (composite), relevance, and strategy_details.
results[].scorefloatComposite score: weighted blend of relevance, recency, importance, and reinforcement.
results[].relevancefloatRaw cosine similarity between the query embedding and the memory embedding (0.0 – 1.0).
results[].strategy_detailsarrayPer-strategy metadata. For similarity: relevance (raw cosine similarity) and distance. For temporal: timestamp and rank. For causal: depth, edge_type, seed_id. For analogical: embedding_similarity and structural_similarity.
strategy_errorsarrayOptional errors from individual strategies (e.g., causal graph empty).

All examples assume the HEBBS_API_KEY environment variable is set. See Authentication.

Terminal window
curl -s -X POST http://localhost:6381/v1/recall \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $HEBBS_API_KEY" \
-d '{"cue": "Acme meeting", "strategies": ["similarity"]}' | jq .
Terminal window
curl -s -X POST http://localhost:6381/v1/recall \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $HEBBS_API_KEY" \
-d '{
"cue": "Acme meeting",
"strategies": ["similarity"],
"scoring_weights": {
"w_relevance": 1.0,
"w_recency": 0.0,
"w_importance": 0.0,
"w_reinforcement": 0.0
}
}' | jq .
Terminal window
curl -s -X POST http://localhost:6381/v1/recall \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $HEBBS_API_KEY" \
-d '{
"cue": "latest updates",
"strategies": ["similarity"],
"scoring_weights": {
"w_relevance": 0.2,
"w_recency": 0.8,
"w_importance": 0.0,
"w_reinforcement": 0.0
}
}' | jq .

Each strategy accepts optional tuning parameters. The defaults are designed for broad, accurate recall — most users will never need to change them.

Embedding-based semantic search using the HNSW index.

ParameterDefaultDescription
ef_search50Number of candidates HNSW evaluates. Higher = more accurate, slower. Good accuracy/latency tradeoff for most datasets.

Time-ordered retrieval. Returns memories newest-first by default.

ParameterDefaultDescription
time_rangeNone (unbounded){ "start": <timestamp>, "end": <timestamp> }. When omitted, returns all memories newest-first up to top_k.

Graph traversal from a seed memory following causal edges.

ParameterDefaultDescription
seed_memory_idNone (auto-detect)Starting node for traversal. When omitted, the engine embeds the cue and picks the closest memory as the seed.
max_depth5 (bounded at 10)Maximum hops from the seed.
edge_typesNone (all types)Restrict traversal to specific edge types (e.g. ["CausedBy", "FollowedBy"]).

Structural pattern matching across domains.

ParameterDefaultDescription
analogical_alpha0.5Blending weight: 0.0 = pure structural similarity, 1.0 = pure embedding similarity. The default gives equal weight to both.

These examples show per-strategy tuning parameters. For basic usage, see Default recall above.

Start the graph walk from a known memory instead of auto-detecting:

Terminal window
curl -s -X POST http://localhost:6381/v1/recall \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $HEBBS_API_KEY" \
-d '{
"cue": "What led to the pricing pushback?",
"strategies": ["causal"],
"seed_memory_id": "01KK3S0KXYE22EFF489YRTH559",
"max_depth": 8,
"edge_types": ["CausedBy"]
}' | jq .

Favor structural similarity over embedding similarity:

Terminal window
curl -s -X POST http://localhost:6381/v1/recall \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $HEBBS_API_KEY" \
-d '{
"cue": "Have we seen similar pricing dynamics?",
"strategies": ["analogical"],
"analogical_alpha": 0.2
}' | jq .

Restrict to a specific window:

Terminal window
curl -s -X POST http://localhost:6381/v1/recall \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $HEBBS_API_KEY" \
-d '{
"cue": "customer interactions",
"strategies": ["temporal"],
"entity_id": "customer-42",
"time_range": {
"start": 1709251200000000,
"end": 1711929600000000
}
}' | jq .