engrammemory-ai
v0.2.0
Published
Memory infrastructure for AI agents. Your Qdrant, your hardware, our intelligence.
Downloads
989
Maintainers
Readme
Memory infrastructure for AI agents. Your Qdrant, your hardware, our intelligence.
PyPI · Dashboard · API Docs · Community Edition
npm install engrammemory-aiQuick Start
import { Engram } from 'engrammemory-ai';
const engram = new Engram({
apiKey: 'eng_live_xxx',
qdrantUrl: 'http://localhost:6333'
});
// Store — embedded & deduplicated by Engram, stored in YOUR Qdrant
await engram.store('User prefers TypeScript and dark mode', {
category: 'preference'
});
// Search — three-tier recall (hot → hash → vector)
const results = await engram.search('What does the user prefer?');
for (const r of results) {
console.log(`[${r.tier}] ${r.content} (${r.score.toFixed(2)})`);
}
// Forget
await engram.forget('mem_abc123');CommonJS:
const { Engram } = require('engrammemory-ai');Why Engram?
| | Engram | Mem0 | Supermemory | Zep | |---|---|---|---|---| | Data ownership | Your Qdrant, your hardware | Their cloud | Their cloud | Their cloud | | Three-tier recall | Hot → Hash → Vector | Single-tier | Single-tier | Two-tier | | Stateless intelligence | Embeds + classifies, never stores | Stores everything | Stores everything | Stores everything | | Edge/fleet support | Per-device agents, zone isolation | No | No | Limited | | Local-first + overflow | Store locally, overflow to cloud | Cloud only | Cloud only | Cloud only | | Open community edition | OpenClaw skill, full recall engine | No | Partial | No |
Three-Tier Recall
Every search flows through three tiers automatically:
const results = await engram.search('database config');
for (const r of results) {
console.log(`[${r.tier}] ${r.content} (${r.score.toFixed(2)})`);
// [hot] PostgreSQL 15 with read replicas (0.94) — sub-ms, cached
// [hash] Migrated from MongoDB last quarter (0.81) — O(1) LSH lookup
// [vector] Old DB credentials in vault (0.67) — full ANN fallback
}Auto-Recall for Agent Prompts
// Inject relevant memories into your agent's system prompt
const memories = await engram.recall('User is asking about their database setup');
const systemPrompt = `You know: ${memories.map(m => m.content).join(', ')}`;Multi-Agent / Fleet
const engram = new Engram({
apiKey: 'eng_live_xxx',
project: 'icu-floor-3'
});
// Store with agent tracking
await engram.store('Patient allergic to penicillin', {
category: 'fact',
agent: 'tablet-icu-3a'
});
// Search scoped to project
const results = await engram.search('allergies', {
agent: 'tablet-icu-3a'
});API Reference
Constructor
new Engram({
apiKey: string; // Your Engram API key
qdrantUrl?: string; // Default: "http://localhost:6333"
baseUrl?: string; // Default: "https://api.engrammemory.ai"
collection?: string; // Default: "agent-memory"
project?: string; // Memory isolation namespace
maxRetries?: number; // Default: 3
timeout?: number; // Default: 30000 (ms)
})Methods
| Method | Returns | Description |
|---|---|---|
| store(content, options?) | Promise<StoreResult> | Store a memory (embedded + deduplicated + compressed) |
| search(query, options?) | Promise<SearchResult[]> | Three-tier recall: hot → hash → vector |
| recall(context, options?) | Promise<SearchResult[]> | Auto-inject relevant memories for agent prompts |
| get(memoryId) | Promise<Memory> | Get a specific memory by ID |
| forget(memoryId) | Promise<boolean> | Remove from all three tiers |
| forgetByQuery(query) | Promise<number> | Forget memories matching a search, returns count |
| list(options?) | Promise<Memory[]> | List memories with filtering |
| health() | Promise<HealthStatus> | Check Engram + Qdrant connectivity |
Types
import type { Memory, SearchResult, StoreResult, HealthStatus } from 'engrammemory-ai';| Type | Fields |
|---|---|
| Memory | id, content, category, metadata, createdAt, accessCount |
| SearchResult | id, content, score, tier ("hot" | "hash" | "vector"), category, metadata |
| StoreResult | id, stored, deduplicated |
| HealthStatus | status, qdrantConnected, version |
Exceptions
import { EngramError, AuthenticationError, RateLimitError, NotFoundError, ValidationError } from 'engrammemory-ai';| Exception | HTTP Code | When |
|---|---|---|
| AuthenticationError | 401 | Invalid or missing API key |
| RateLimitError | 429 | Too many requests (auto-retries with Retry-After) |
| NotFoundError | 404 | Memory ID doesn't exist |
| ValidationError | 400/422 | Invalid request body |
| EngramError | Other | Base class for all errors |
Community Edition
Don't need cloud? The community edition runs the full three-tier recall engine locally as an OpenClaw skill with no API dependency.
Links
- Python SDK —
pip install engrammemory-ai - Dashboard
- API Docs
- GitHub
- Community Edition
