Memory Core
intermediateStore, retrieve, recall, explain, predict, and manage memories. The primary endpoints for memory operations.
Store
/v1/memory/storeStore a new memory. The engine automatically encodes it, selects the optimal pathway, and indexes it for retrieval.
textstringrequiredThe text content to memorize. Max 10,000 characters.
importancenumberDefault: 0.5Importance weight (0.0 to 1.0). High-importance memories resist pruning during consolidation.
metadataobjectArbitrary key-value pairs for filtering and organization.
protectedbooleanDefault: falseIf true, this memory cannot be pruned or merged during consolidation.
{
"id": "mem_abc123",
"text": "Paris is the capital of France",
"stored_at": "2026-01-15T10:30:00Z",
"importance": 0.5,
"tier": "hot",
"pathway": "exact",
"metadata": {}
}import os
from engramma_cloud import EngrammaClient
client = EngrammaClient(api_key=os.environ["ENGRAMMA_API_KEY"])
result = client.store(
"Paris is the capital of France",
importance=0.8,
metadata={"category": "geography", "source": "textbook"}
)
print(f"Stored: {result.id} via {result.pathway}")Batch store
/v1/memory/batch-storeStore multiple memories in a single request. More efficient than individual stores for bulk imports.
memoriesarrayrequiredArray of memory objects. Each object has text, optional importance, metadata, and protected fields. Max 100 items per batch.
{
"stored": 5,
"ids": [
"mem_001",
"mem_002",
"mem_003",
"mem_004",
"mem_005"
],
"errors": []
}results = client.batch_store([
{"text": "Python was created by Guido van Rossum", "importance": 0.6},
{"text": "JavaScript was created by Brendan Eich", "importance": 0.6},
{"text": "Go was created at Google in 2009", "importance": 0.5},
])
print(f"Stored {results.stored} memories")
print(f"IDs: {results.ids}")Batch store is atomic per-item: if one memory fails validation, the others still succeed. Check the errors array for partial failures.
Retrieve
/v1/memory/retrieveRetrieve memories relevant to a query. The Confidence Router selects the optimal pathway (Exact, Energy, or Attention) automatically.
querystringrequiredThe query text. What are you trying to remember?
top_kintegerDefault: 5Maximum number of results to return (1-50).
thresholdnumberDefault: 0.0Minimum confidence score (0.0 to 1.0). Results below this threshold are excluded.
metadata_filterobjectFilter results by metadata. Supports exact match and operators.
pathwaystringForce a specific pathway: exact, energy, or attention. Omit to let the Confidence Router decide.
{
"results": [
{
"id": "mem_abc123",
"text": "Paris is the capital of France",
"confidence": 0.94,
"pathway": "exact",
"stored_at": "2026-01-15T10:30:00Z",
"importance": 0.8,
"metadata": {
"category": "geography"
}
},
{
"id": "mem_def456",
"text": "France has 67 million inhabitants",
"confidence": 0.71,
"pathway": "energy",
"stored_at": "2026-01-14T08:00:00Z",
"importance": 0.5,
"metadata": {
"category": "geography"
}
}
],
"pathway_used": "exact",
"query_time_ms": 12
}results = client.retrieve(
"What is the capital of France?",
top_k=3,
threshold=0.5,
metadata_filter={"category": "geography"}
)
for r in results:
print(f"[{r.confidence:.2f}|{r.pathway}] {r.text}")Recall
/v1/memory/recallRecall memories through natural language. Unlike retrieve, recall uses the full cognitive cycle including causal reasoning to find contextually relevant memories.
querystringrequiredNatural language question or context description.
depthstringDefault: standardRecall depth: shallow (fast, similarity only), standard (includes causal links), or deep (full reasoning chain).
include_causalbooleanDefault: trueWhether to follow causal links when recalling.
{
"memories": [
{
"id": "mem_abc123",
"text": "Paris is the capital of France",
"confidence": 0.94,
"pathway": "exact",
"causal_links": [
{
"target_id": "mem_def456",
"relationship": "context",
"strength": 0.72
}
]
}
],
"reasoning_chain": [
"Query matches stored fact directly (exact pathway)",
"Causal link found: France population data provides context"
],
"depth_used": "standard",
"query_time_ms": 28
}memories = client.recall(
"Tell me about France",
depth="deep",
include_causal=True
)
for m in memories:
print(f"{m.text}")
for link in m.causal_links:
print(f" → linked to {link.target_id} ({link.relationship})")Similarity
/v1/memory/similarityFind memories similar to a given memory. Useful for deduplication checks and exploring neighborhoods.
memory_idstringrequiredThe ID of the reference memory.
top_kintegerDefault: 5Number of similar memories to return.
thresholdnumberDefault: 0.3Minimum similarity score.
{
"reference": "mem_abc123",
"similar": [
{
"id": "mem_ghi789",
"text": "The capital city of France is Paris, known as the City of Light",
"similarity": 0.91,
"overlap_type": "semantic_duplicate"
}
]
}Stats
/v1/memory/statsGet statistics about your memory space: total patterns, tier distribution, health metrics.
{
"total_patterns": 1247,
"tiers": {
"hot": 312,
"warm": 645,
"cold": 290
},
"avg_importance": 0.52,
"avg_confidence": 0.73,
"causal_links": 834,
"last_consolidation": "2026-01-14T03:00:00Z",
"storage_mb": 45.2,
"health_score": 0.87
}stats = client.stats()
print(f"Total patterns: {stats.total_patterns}")
print(f"Health: {stats.health_score:.0%}")
print(f"Tiers: {stats.tiers.hot} hot / {stats.tiers.warm} warm / {stats.tiers.cold} cold")Important memories
/v1/memory/importantList the most important memories, ranked by importance score. Useful for reviewing what the system considers critical.
top_kintegerDefault: 10Number of important memories to return (1-100).
min_importancenumberDefault: 0.7Minimum importance threshold.
{
"memories": [
{
"id": "mem_abc123",
"text": "Production database credentials are in Vault at /secret/prod/db",
"importance": 0.99,
"protected": true,
"access_count": 47,
"last_accessed": "2026-01-20T09:15:00Z"
}
]
}Predict
/v1/memory/predictUse causal links to predict outcomes based on stored memories. Three levels of causal reasoning are available.
conditionstringrequiredThe condition or scenario to reason about.
levelstringDefault: interventionCausal level: association (correlation), intervention (what-if), or counterfactual (what would have been).
{
"condition": "What happens if we double the traffic?",
"level": "intervention",
"predictions": [
{
"outcome": "Latency increases by ~40% based on historical pattern",
"confidence": 0.82,
"supporting_memories": [
"mem_abc123",
"mem_def456"
],
"causal_chain": [
"traffic_increase → queue_depth_increase → latency_increase"
]
}
]
}prediction = client.predict(
condition="What happens if we double the traffic?",
level="intervention"
)
for p in prediction.predictions:
print(f"Outcome: {p.outcome}")
print(f"Confidence: {p.confidence:.2f}")
print(f"Chain: {' → '.join(p.causal_chain)}")Explain
/v1/memory/explainGet a human-readable explanation of why a specific memory was retrieved or how it connects to a query.
memory_idstringrequiredThe memory to explain.
querystringThe query context. If provided, explains why this memory is relevant to the query.
detailstringDefault: simpleDetail level: simple (one sentence), detailed (paragraph), or technical (full breakdown with scores).
{
"memory_id": "mem_abc123",
"explanation": {
"simple": "This memory directly answers your question about the capital of France.",
"detailed": "The memory 'Paris is the capital of France' was retrieved because it contains an exact semantic match for your query. The Confidence Router selected the Exact pathway with 94% confidence. This memory also has a causal link to population data about France, providing additional context.",
"technical": {
"pathway": "exact",
"confidence": 0.94,
"pathway_scores": {
"exact": 0.94,
"energy": 0.67,
"attention": 0.72
},
"factors": [
{
"name": "semantic_similarity",
"score": 0.96,
"weight": 0.4
},
{
"name": "recency",
"score": 0.8,
"weight": 0.2
},
{
"name": "importance",
"score": 0.8,
"weight": 0.2
},
{
"name": "access_frequency",
"score": 0.65,
"weight": 0.2
}
]
}
}
}explanation = client.explain(
memory_id="mem_abc123",
query="What is the capital of France?",
detail="technical"
)
print(explanation.simple)
print(f"Pathway: {explanation.technical.pathway}")
print(f"Confidence: {explanation.technical.confidence}")
for factor in explanation.technical.factors:
print(f" {factor.name}: {factor.score:.2f} (weight: {factor.weight})")Forget
/v1/memory/{memory_id}Permanently delete a specific memory. This is irreversible.
memory_idstringrequiredThe ID of the memory to delete (path parameter).
{
"deleted": true,
"id": "mem_abc123",
"causal_links_removed": 3
}result = client.forget("mem_abc123")
print(f"Deleted: {result.id}")
print(f"Causal links removed: {result.causal_links_removed}")Forgetting a memory also removes all causal links that reference it. This can affect the quality of predictions and recall for related memories.
Next steps
- Memory Text — Text-specific operations and semantic search
- Engine Advanced — Consolidation, diagnostics, explorer
- Errors — Error handling and troubleshooting