Memory & Knowledge Base
Cross-session learning recall — automatic memorization and knowledge retrieval
Krawl maintains a persistent knowledge base across research sessions. Key findings from each research run are automatically extracted and stored, then recalled at the start of future research to avoid re-researching known facts.
How It Works
Automatic Memorization (Post-Research)
After every research session completes:
- The report is sent to Haiku 4.5 (Tier 1, cheap/fast)
- The model extracts 5–15 key facts/findings as structured learnings
- Each learning gets content, topic tags, source query, and source URLs
- Learnings are stored in PostgreSQL, scoped to the API key
Only specific, factual, reusable knowledge is extracted — not vague statements or opinions. Each learning must be self-contained (understandable without the original report context).
Automatic Recall (Pre-Research)
At the start of each research session:
- The query is searched against the knowledge base (up to 15 results)
- Matching memories are formatted into a "What you already know" context block
- This context is injected into the research prompts
The recall prompt instructs the research engine to avoid re-researching known facts and focus on finding new information, updates, or details.
API Endpoints
Search Memories
curl -H "X-API-Key: your-key" \
"https://api.krawl.sh/memory?q=ethereum%20merge&limit=10"Response:
{
"query": "ethereum merge",
"count": 3,
"memories": [
{
"id": "550e8400-...",
"content": "Ethereum transitioned from Proof of Work to Proof of Stake on September 15, 2022, reducing energy consumption by ~99.95%.",
"source_query": "What happened with the Ethereum merge?",
"source_urls": ["https://ethereum.org/en/upgrades/merge/"],
"tags": ["ethereum", "proof-of-stake", "merge"],
"created_at": "2025-01-10T14:30:00Z",
"result_id": "result-uuid-..."
}
]
}Knowledge Base Stats
curl -H "X-API-Key: your-key" \
https://api.krawl.sh/memory/statsDelete a Memory
curl -X DELETE -H "X-API-Key: your-key" \
https://api.krawl.sh/memory/MEMORY_UUIDResponse:
{"deleted": true, "id": "MEMORY_UUID"}SSE Events
memory_recall
Emitted at the start of research when prior memories are found:
{
"memories_count": 5,
"memories": [
{
"content": "Ethereum merged to PoS in Sep 2022",
"tags": ["ethereum", "proof-of-stake"]
}
]
}Memory Entry Structure
Each memory entry contains:
| Field | Type | Description |
|---|---|---|
id | string | UUID |
content | string | The extracted fact/finding (1–2 sentences) |
source_query | string | The original research query that produced this learning |
source_urls | string[] | URLs of sources (up to 10) |
tags | string[] | 1–5 topic tags (lowercase) |
created_at | string | ISO timestamp |
result_id | string|null | ID of the research result that produced this memory |
Scoping
Memories are scoped to the API key. Each API key has its own isolated knowledge base. When MOGRA_API_KEY is not set (no auth), all memories share a global namespace.
Extraction Details
The memory extraction prompt instructs the model to:
- Extract 5–15 key facts per report
- Focus on data points, metrics, dates, names, relationships, and conclusions
- Make each learning self-contained
- Skip vague or opinion-based statements
- Add 1–3 topic tags per learning
The extraction uses the first 8,000 characters of the report to stay within Haiku's optimal context window.