Documentation
Everything you need to give your AI agent persistent memory.
Quick Start
MCP Setup (recommended)
For Claude Code, Cursor, and any MCP-compatible client. Two commands, zero config files.
# npm npm install -g engram-sdk && engram init # or Homebrew brew tap tstockham96/engram && brew install engram-sdk engram init
The init wizard detects your editor, prompts for a Gemini API key (free at aistudio.google.com), writes the MCP config, and creates your vault. Restart your editor and your agent has 10 memory tools.
REST API
For Python agents, multi-language setups, or custom integrations.
npm install -g engram-sdk export GEMINI_API_KEY=your-key-here npx engram-serve # ✓ Engram API listening on http://127.0.0.1:3800
MCP Tools
Available automatically after engram init
engram_remembercontent: string, type?: 'episodic' | 'semantic' | 'procedural'Store a memory with automatic entity/topic extraction
engram_recallcontext: string, limit?: numberRetrieve relevant memories using semantic search + spreading activation
engram_briefingnoneGet a structured context summary for session start
engram_consolidatenoneRun sleep-cycle consolidation — distill episodes into knowledge
engram_surfacecontext: stringProactively surface context you didn't ask for
engram_connectsourceId: string, targetId: string, type: stringCreate typed edges between memories (supports, contradicts, elaborates)
engram_forgetid: string, hard?: booleanRemove a memory (soft or hard delete)
engram_entitiesnoneList all tracked entities in the knowledge graph
engram_statsnoneVault statistics — memory count, types, entities, connections
engram_ingesttext: stringAuto-extract memories from a block of text
REST API
Base URL: http://localhost:3800
/v1/memoriesStore a new memory
curl -X POST localhost:3800/v1/memories \
-H 'Content-Type: application/json' \
-d '{"content": "User prefers TypeScript", "type": "episodic"}'{
"id": "a1b2c3d4-...",
"type": "episodic",
"content": "User prefers TypeScript",
"entities": ["User", "TypeScript"],
"topics": ["programming", "preferences"],
"salience": 0.55,
"confidence": 0.8,
"stability": 1.0,
"status": "active"
}/v1/memories/recallRetrieve relevant memories via semantic search + spreading activation
curl 'localhost:3800/v1/memories/recall?context=programming+preferences&limit=5'
{
"memories": [
{
"id": "a1b2c3d4-...",
"content": "User prefers TypeScript",
"type": "episodic",
"salience": 0.55,
"score": 0.87
}
],
"count": 1
}/v1/memories/recallRecall with complex query body (entities, topics, types, temporal focus)
curl -X POST localhost:3800/v1/memories/recall \
-H 'Content-Type: application/json' \
-d '{"context": "language preferences", "entities": ["User"], "limit": 10}'{ "memories": [...], "count": 5 }/v1/memories/:idForget a memory (soft delete by default, ?hard=true for permanent)
curl -X DELETE localhost:3800/v1/memories/a1b2c3d4
{ "deleted": true }/v1/memories/:id/neighborsGet connected memories in the knowledge graph
curl 'localhost:3800/v1/memories/a1b2c3d4/neighbors?depth=2'
{ "memories": [...], "count": 3 }/v1/consolidateRun sleep-cycle consolidation — distill episodes into semantic knowledge
curl -X POST localhost:3800/v1/consolidate
{
"episodesProcessed": 45,
"semanticMemoriesCreated": 8,
"entitiesDiscovered": 12,
"connectionsFormed": 23,
"contradictionsFound": 1,
"memoriesDecayed": 5,
"memoriesArchived": 2
}/v1/briefingStructured context summary for session start (replaces MEMORY.md)
curl localhost:3800/v1/briefing
{
"briefing": "Key context: User is a senior PM...",
"memoriesUsed": 15,
"tokensUsed": 820
}/v1/statsVault statistics
curl localhost:3800/v1/stats
{
"total": 234,
"byType": { "episodic": 180, "semantic": 42, "procedural": 12 },
"entities": 67,
"connections": 145
}/v1/entitiesList all tracked entities
curl localhost:3800/v1/entities
{
"entities": [
{ "name": "Thomas", "memoryCount": 45 },
{ "name": "TypeScript", "memoryCount": 12 }
]
}/healthHealth check
curl localhost:3800/health
{ "status": "ok", "version": "0.1.1" }TypeScript SDK
Import the Vault class directly for zero-network-overhead integration in Node.js agents.
import { Vault } from 'engram-sdk';
const vault = new Vault({
owner: 'my-agent',
dbPath: '~/.engram/my-agent.db'
});
// Store — entities & topics extracted automatically
await vault.remember('User prefers TypeScript over Python');
// Recall — semantic search + spreading activation
const memories = await vault.recall('What languages does the user like?');
console.log(memories[0].content);
// → "User prefers TypeScript over Python"
// Consolidate — distill episodes into knowledge
const report = await vault.consolidate();
console.log(`Created ${report.semanticMemoriesCreated} semantic memories`);
// Briefing — structured summary for session start
const briefing = await vault.briefing();
// Stats
const stats = vault.stats();
console.log(`${stats.total} memories, ${stats.entities} entities`);CLI
engram init Set up for Claude Code / Cursor / MCP clients engram mcp Start the MCP server (stdio transport) engram remember <text> Store a memory engram recall <context> Retrieve relevant memories engram stats Show vault statistics engram entities List known entities engram consolidate Run memory consolidation engram forget <id> [--hard] Forget a memory engram search <query> Full-text search engram export Export entire vault as JSON engram eval Health report & value assessment engram repl Interactive REPL mode engram hosted Start the multi-tenant hosted server Options: --db <path> Database file path --owner <name> Owner identifier --agent <id> Agent ID for source tracking --json Output as JSON
Configuration
Environment Variables
| Variable | Description | Required |
|---|---|---|
| GEMINI_API_KEY | Gemini API key for embeddings + consolidation | Yes |
| ENGRAM_OWNER | Owner identifier for the vault | No |
| ENGRAM_DB | Database file path (default: ~/.engram/default.db) | No |
| PORT | Server port (default: 3800) | No |
| ENGRAM_TELEMETRY | Set to 'off' to disable anonymous telemetry | No |
| DO_NOT_TRACK | Set to '1' to disable telemetry (standard) | No |
File Locations
~/.engram/Vault databases~/.config/engram/gemini-keySaved Gemini API key~/.config/engram/telemetry-idAnonymous telemetry UUID~/.claude/claude_desktop_config.jsonClaude Code MCP config (written by engram init)