How It Works
beginnerUnderstand Engramma's 10-phase cognitive cycle — from storing a memory to retrieving it with similarity scores and explanations.
The big picture
When you call /v1/memory/text/store or /v1/memory/text/recall, Engramma doesn't just save or search vectors. It runs a 10-phase cognitive cycle — a pipeline that encodes, routes, scores, strengthens, and explains your memories.
Think of it as the difference between a hard drive (stores bytes) and a brain (processes, connects, and reasons about information).
The 10-phase cycle
Here's what happens every time you interact with Engramma:
Neuromodulation
Encoding
Regime Detection
Plasticity
Storage & Indexing
Semantic Linking
Causal Discovery
Temporal Tracking
Active Inference Retrieval
Consolidation
What you observe as a user
You don't need to understand the internal phases to use Engramma. Here's what you actually see:
| You do... | Engramma does... | You get... |
|---|---|---|
POST /text/store | Phases 1-7 run | pattern_id + usage count |
POST /text/retrieve | Cosine similarity search | Ranked results with similarity scores |
POST /text/recall | Full Active Inference cycle | Higher-quality results with re-ranking |
POST /text/explain | XAI analysis | Human-readable explanation + method + confidence |
POST /consolidation/sleep | Phase 10 runs | Evicted/strengthened counts |
GET /text/stats | Reads current state | Pattern count, embedding dim, storage bytes |
A concrete example
Let's trace what happens when you store and retrieve a memory:
import requests, os
API = "https://api.engramma-memory.com"
HEADERS = {
"X-API-Key": os.environ["ENGRAMMA_API_KEY"],
"Content-Type": "application/json"
}
# Store three related facts
for text in [
"Alice manages the backend team",
"The backend team uses Python and Go",
"Alice prefers async architectures"
]:
requests.post(f"{API}/v1/memory/text/store", headers=HEADERS,
json={"text": text})
# Retrieve — cosine similarity search
resp = requests.post(f"{API}/v1/memory/text/retrieve", headers=HEADERS,
json={"query": "What languages does Alice's team use?", "top_k": 3}
)
results = resp.json()["results"]
print(results[0]["text"]) # "The backend team uses Python and Go"
print(results[0]["similarity"]) # 0.87
# Recall — Active Inference (better at connecting related facts)
resp = requests.post(f"{API}/v1/memory/text/recall", headers=HEADERS,
json={"query": "What languages does Alice's team use?", "top_k": 3}
)
recall = resp.json()["results"]
print(recall[0]["text"]) # "The backend team uses Python and Go"
print(recall[0]["similarity"]) # 0.91 (boosted by co-access patterns)Notice how /text/recall can return higher similarity scores than /text/retrieve for the same query — it applies learned co-access patterns to boost results that are semantically related in context.
Latency
The full cycle completes in milliseconds:
| Operation | Typical latency |
|---|---|
| Store (text) | 3-8 ms |
| Retrieve (top 5) | 2-5 ms |
| Recall (Active Inference) | 5-12 ms |
| Explain | 5-12 ms |
| Consolidation sleep | 50-200 ms (background) |
These numbers scale with your memory count. At 5,000 patterns (Free tier limit), retrieve stays under 5ms.
Two retrieval modes
/text/retrieve | /text/recall | |
|---|---|---|
| Method | Pure cosine similarity | Active Inference + semantic re-ranking |
| Speed | Fastest (2-5ms) | Slightly slower (5-12ms) |
| Accuracy | Good from day 1 | Improves over time |
| Best for | Simple similarity search | Production-quality retrieval |
| When to use | Prototyping, exact matching | Chatbots, knowledge bases, assistants |
What makes this different from embeddings + cosine search
A vector database embeds your text and searches by cosine similarity. That's one operation.
Engramma adds:
- Active Inference retrieval — learned access patterns improve results over time
- Causal links — memories don't exist in isolation, they form a queryable causal graph
- Temporal awareness — the engine notices sequences and predicts next queries
- Regime detection — the engine monitors its own state and adapts behavior
- Consolidation — memory quality improves over time without re-indexing
- Explainability — every retrieval can be explained with method and confidence
Next steps
- Consolidation — How sleep cycles improve memory quality
- Explainability — Understand confidence scores and reasoning
- Quickstart — Try it yourself in 5 minutes