Your First Memory
beginnerStore, retrieve, and explain your first memory in under 5 minutes. A complete Hello World for Engramma.
What you'll build
A working script that stores a fact, retrieves it with confidence scoring, and explains why it was returned — in 12 lines of code.
Prerequisites
| Requirement | Details |
|---|---|
| Account | Free tier or above (sign up) |
| API key | Generate one in your dashboard |
| SDK | Python (pip install engramma-cloud) or JavaScript (npm install @engramma/sdk) |
| Time | ~5 minutes |
Steps
Install the SDK
Set your API key
Store a memory
Retrieve it
Explain the result
Complete code
import os
from engramma_cloud import EngrammaClient
# Initialize with your API key
client = EngrammaClient(api_key=os.environ["ENGRAMMA_API_KEY"])
# Step 1: Store a memory
result = client.store("The deployment window is Tuesday 2-4pm UTC")
print(f"Stored! Pattern ID: {result.pattern_id}")
# Step 2: Retrieve it with a natural question
results = client.retrieve("When can we deploy?")
print(f"Answer: {results[0].text}")
print(f"Confidence: {results[0].confidence}")
print(f"Pathway: {results[0].pathway}")
# Step 3: Explain why this result was returned
explanation = client.explain(query="When can we deploy?", level="detailed")
print(f"Reasoning: {explanation.summary}")
print(f"Pathway scores: {explanation.pathway_scores}")Expected output
Stored! Pattern ID: pat_7f3a2b
Answer: The deployment window is Tuesday 2-4pm UTC
Confidence: 0.93
Pathway: exact
Reasoning: High-confidence exact match. The query 'deploy' directly maps to a stored fact about deployment windows.
Pathway scores: {'exact': 0.93, 'energy': 0.61, 'attention': 0.48}
What just happened
-
Store — The engine ran the 10-phase cognitive cycle: it encoded your text, assessed importance, and indexed it across all three retrieval pathways.
-
Retrieve — Your question was encoded and routed through the Confidence Router. The Exact pathway won because the query closely matched the stored text.
-
Explain — The engine showed you exactly which pathway scored highest and why that result was selected.
Try storing 3-4 related facts and then asking a question that requires connecting them. You'll see the Attention pathway activate for multi-hop reasoning.
Next steps
- Building a Chatbot — Add persistent memory to a conversational AI
- Memory Types — Understand the three retrieval pathways
- Explainability — Deep dive into confidence scores and explanations