@hbarefoot/engram 1.0.0 โ†’ 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,535 +1,284 @@
1
- # Engram
1
+ # ๐Ÿง  Engram
2
2
 
3
- > **Persistent memory for AI agents - SQLite for agent state**
3
+ [![CI](https://github.com/HBarefoot/engram/actions/workflows/ci.yml/badge.svg)](https://github.com/HBarefoot/engram/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/@hbarefoot/engram)](https://www.npmjs.com/package/@hbarefoot/engram)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen)](https://nodejs.org)
7
+ [![MCP](https://img.shields.io/badge/MCP-compatible-blue)](https://modelcontextprotocol.io)
4
8
 
5
- Engram is a production-ready memory system that gives AI agents persistent, searchable memory across conversations. Think of it as SQLite for agent state - simple, fast, and reliable.
9
+ **Give your AI agents persistent memory. Zero cloud. Zero API keys. Two-minute setup.**
6
10
 
7
- [![Node.js Version](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen)](https://nodejs.org/)
8
- [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
-
10
- ## Features
11
-
12
- - ๐Ÿง  **Hybrid Memory Retrieval** - Combines semantic similarity, recency, confidence, and access patterns
13
- - ๐Ÿ” **Full-Text Search** - SQLite FTS5 for fast keyword search
14
- - ๐ŸŽฏ **Vector Embeddings** - Local embeddings with Xenova/all-MiniLM-L6-v2 (~23MB)
15
- - ๐Ÿ” **Secret Detection** - Automatic detection and redaction of API keys and credentials
16
- - ๐Ÿงน **Auto-Consolidation** - Duplicate detection, contradiction flagging, confidence decay
17
- - ๐Ÿ“Š **Web Dashboard** - Modern React UI for visualizing and managing memories
18
- - ๐Ÿ”Œ **MCP Server** - Model Context Protocol integration for Claude Desktop/Code
19
- - ๐Ÿš€ **REST API** - Full-featured HTTP API with CORS support
20
- - ๐Ÿ“ฆ **Zero Config** - Works out of the box with sensible defaults
21
-
22
- ## Quick Start
23
-
24
- ### Installation
11
+ Engram is a local-first memory server that lets AI agents like Claude, Cursor, Cline, and Windsurf remember things across sessions. It runs entirely on your machine โ€” no external services, no data leaving your device, no monthly bills.
25
12
 
26
13
  ```bash
27
- # Clone the repository
28
- git clone https://github.com/your-username/engram.git
29
- cd engram
30
-
31
- # Install dependencies
32
- npm install
33
-
34
- # Start the server
35
- npm start
14
+ npm install -g @hbarefoot/engram
15
+ engram start
36
16
  ```
37
17
 
38
- The REST API will be available at `http://localhost:3838` and the dashboard at `http://localhost:5173`.
39
-
40
- ### Basic Usage
18
+ That's it. Your AI agent now has long-term memory.
41
19
 
42
- ```bash
43
- # Store a memory
44
- engram remember "User prefers Fastify over Express for APIs" --category preference
45
-
46
- # Search for memories
47
- engram recall "What framework does the user prefer?"
20
+ ---
48
21
 
49
- # List all memories
50
- engram list
22
+ ## Why Engram?
51
23
 
52
- # Check system status
53
- engram status
54
- ```
24
+ Most AI memory solutions require cloud infrastructure, API keys, and external vector databases. Engram takes a different approach:
55
25
 
56
- ## Usage Modes
26
+ | | **Engram** | **Mem0** | **Zep** |
27
+ |---|---|---|---|
28
+ | **Setup time** | 2 minutes | Requires API keys + cloud setup | Requires Docker + API keys |
29
+ | **Dependencies** | None โ€” SQLite + local embeddings | OpenAI API, vector DB (Qdrant/Pinecone) | PostgreSQL, OpenAI API |
30
+ | **Data location** | Your machine only | Cloud (or self-hosted with infra) | Cloud (or self-hosted with infra) |
31
+ | **Cost** | Free forever | Pay per API call | Pay per API call |
32
+ | **Privacy** | Complete โ€” nothing leaves your device | Data sent to external APIs | Data sent to external APIs |
33
+ | **MCP native** | โœ… First-class | โŒ REST only | โŒ REST only |
57
34
 
58
- ### 1. CLI (Command Line Interface)
35
+ Engram is built for developers who want AI memory without the overhead.
59
36
 
60
- Perfect for quick interactions and scripting:
37
+ ---
61
38
 
62
- ```bash
63
- # Remember something
64
- node bin/engram.js remember "Project uses PostgreSQL 15" --category fact --entity postgresql
39
+ ## Features
65
40
 
66
- # Search with options
67
- node bin/engram.js recall "database" --limit 3 --threshold 0.5
41
+ - ๐Ÿ”’ **Fully Local** โ€” SQLite database + local embeddings ([all-MiniLM-L6-v2](https://huggingface.co/Xenova/all-MiniLM-L6-v2), 23 MB). No network calls, ever
42
+ - ๐Ÿค– **MCP Native** โ€” First-class Model Context Protocol integration. Works with Claude Desktop, Claude Code, Cline, Cursor, Windsurf, and any MCP client
43
+ - ๐Ÿ” **Hybrid Search** โ€” Combines vector similarity with full-text search (FTS5) for accurate recall
44
+ - ๐Ÿงน **Smart Deduplication** โ€” Automatically detects and merges similar memories (>0.92 similarity threshold)
45
+ - ๐Ÿ“Š **Feedback Loop** โ€” Rate memory usefulness to improve future recall accuracy
46
+ - ๐Ÿ” **Secret Detection** โ€” Automatically blocks API keys, passwords, and tokens from being stored
47
+ - โฐ **Temporal Queries** โ€” Filter memories by time: "last week", "3 days ago", or exact dates
48
+ - ๐Ÿ“ฆ **Namespace Isolation** โ€” Organize memories by project, client, or any scope you need
49
+ - ๐ŸŒ **REST API** โ€” Full HTTP API with CORS support for custom integrations
50
+ - ๐Ÿ–ฅ๏ธ **Web Dashboard** โ€” React-based UI for browsing, searching, and managing memories
51
+ - ๐Ÿ’พ **Export** โ€” Export memories to Markdown, JSON, or plain text for documentation
68
52
 
69
- # Filter by namespace
70
- node bin/engram.js list --namespace project-alpha
53
+ ---
71
54
 
72
- # Delete a memory
73
- node bin/engram.js forget <memory-id>
55
+ ## Quick Start
74
56
 
75
- # Run consolidation
76
- node bin/engram.js consolidate
57
+ ### 1. Install
77
58
 
78
- # View conflicts
79
- node bin/engram.js conflicts
59
+ ```bash
60
+ npm install -g @hbarefoot/engram
80
61
  ```
81
62
 
82
- ### 2. MCP Server (Claude Desktop/Code)
63
+ ### 2. Start the server
83
64
 
84
- Integrate with Claude Desktop or Claude Code.
85
-
86
- **โœจ Easiest Method: Use the Integration Wizard**
65
+ ```bash
66
+ engram start
67
+ ```
87
68
 
88
- 1. Run `npm run dev` to start the dashboard
89
- 2. Open http://localhost:5173 and go to the **Agents** tab
90
- 3. Click **Quick Setup** โ†’ **Launch Setup Wizard**
91
- 4. Select your platform and copy the auto-generated configuration
69
+ ### 3. Connect to your AI agent
92
70
 
93
- **Alternative: Manual Setup**
71
+ Add Engram to your MCP client config:
94
72
 
95
- **macOS**: Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
73
+ **Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
96
74
 
97
75
  ```json
98
76
  {
99
77
  "mcpServers": {
100
78
  "engram": {
101
- "command": "node",
102
- "args": [
103
- "/path/to/engram/bin/engram.js",
104
- "start",
105
- "--mcp-only"
106
- ]
79
+ "command": "engram",
80
+ "args": ["start", "--mcp-only"]
107
81
  }
108
82
  }
109
83
  }
110
84
  ```
111
85
 
112
- **Available MCP Tools:**
113
- - `engram_remember` - Store a memory
114
- - `engram_recall` - Search for relevant memories
115
- - `engram_forget` - Delete a memory
116
- - `engram_status` - Get system status
117
-
118
- See [docs/mcp-setup.md](docs/mcp-setup.md) for detailed configuration.
119
-
120
- ### 3. REST API
121
-
122
- Full HTTP API for programmatic access:
86
+ **Claude Code:**
123
87
 
124
88
  ```bash
125
- # Create a memory
126
- curl -X POST http://localhost:3838/api/memories \
127
- -H "Content-Type: application/json" \
128
- -d '{
129
- "content": "User prefers Svelte for frontend",
130
- "category": "preference",
131
- "entity": "svelte",
132
- "confidence": 0.9
133
- }'
134
-
135
- # Search memories
136
- curl -X POST http://localhost:3838/api/memories/search \
137
- -H "Content-Type: application/json" \
138
- -d '{
139
- "query": "frontend preferences",
140
- "limit": 5
141
- }'
142
-
143
- # Get system status
144
- curl http://localhost:3838/api/status
145
-
146
- # List memories with filters
147
- curl "http://localhost:3838/api/memories?namespace=default&limit=10"
148
-
149
- # Delete a memory
150
- curl -X DELETE http://localhost:3838/api/memories/<memory-id>
89
+ claude mcp add engram -- engram start --mcp-only
151
90
  ```
152
91
 
153
- See [docs/api.md](docs/api.md) for complete API documentation.
154
-
155
- ### 4. Web Dashboard
156
-
157
- Visual interface for managing memories:
92
+ **Cline / Cursor / Windsurf:** Add the same MCP config to your editor's settings. Engram's built-in Integration Wizard can auto-detect your setup:
158
93
 
159
94
  ```bash
160
- npm start
95
+ engram connect
161
96
  ```
162
97
 
163
- Then open http://localhost:5173 in your browser.
98
+ ### 4. Use it
164
99
 
165
- **Dashboard Features:**
166
- - ๐Ÿ“Š System overview with statistics
167
- - ๐Ÿ“ Browse and filter memories
168
- - ๐Ÿ” Semantic search with score visualization
169
- - โž• Create new memories
170
- - ๐Ÿ—‘๏ธ Delete memories
171
- - ๐Ÿ“ˆ View category and namespace distributions
172
- - โš ๏ธ Detect and resolve conflicts
173
- - ๐Ÿ”„ Run consolidation
100
+ Once connected, your AI agent can store and recall memories naturally:
174
101
 
175
- ### 5. PM2 Process Manager (Production Service)
102
+ > **You:** "Remember that our API uses JWT tokens with 24-hour expiry"
103
+ >
104
+ > **Claude:** *stores the memory via `engram_remember`*
105
+ >
106
+ > **You:** (next day) "What authentication approach are we using?"
107
+ >
108
+ > **Claude:** *recalls via `engram_recall`* โ€” "Your API uses JWT tokens with 24-hour expiry."
176
109
 
177
- Run Engram as a persistent background service using PM2:
110
+ Memories persist across sessions, restarts, and even different AI clients sharing the same Engram instance.
178
111
 
179
- ```bash
180
- # Install PM2 globally (if not already installed)
181
- npm install -g pm2
112
+ ---
182
113
 
183
- # Start Engram as a PM2 service
184
- npm run pm2:start
114
+ ## MCP Tools
185
115
 
186
- # Check status
187
- npm run pm2:status
116
+ Engram exposes 6 tools to AI agents via the Model Context Protocol:
188
117
 
189
- # View logs
190
- npm run pm2:logs
118
+ | Tool | Description |
119
+ |---|---|
120
+ | `engram_remember` | Store a memory with category, entity, confidence, namespace, and tags |
121
+ | `engram_recall` | Retrieve relevant memories by semantic query with optional filters |
122
+ | `engram_forget` | Delete a specific memory by ID |
123
+ | `engram_feedback` | Rate a memory as helpful or unhelpful to improve future recall |
124
+ | `engram_context` | Generate a pre-formatted context block (markdown/xml/json) with token budget |
125
+ | `engram_status` | Health check with memory count, model status, and configuration info |
191
126
 
192
- # Restart service
193
- npm run pm2:restart
127
+ ### Memory Categories
194
128
 
195
- # Stop service
196
- npm run pm2:stop
129
+ Memories are organized by type for better retrieval:
197
130
 
198
- # Remove from PM2
199
- npm run pm2:delete
131
+ - **fact** โ€” Objective truths about setup, architecture, or configuration
132
+ - **preference** โ€” User likes, dislikes, and style choices
133
+ - **pattern** โ€” Recurring workflows and habits
134
+ - **decision** โ€” Choices made and the reasoning behind them
135
+ - **outcome** โ€” Results of actions taken
200
136
 
201
- # Monitor in real-time
202
- npm run pm2:monit
203
- ```
137
+ ---
204
138
 
205
- **Auto-start on boot:**
139
+ ## CLI Reference
206
140
 
207
141
  ```bash
208
- # Generate startup script
209
- pm2 startup
210
-
211
- # Save current PM2 process list
212
- pm2 save
142
+ engram start # Start MCP + REST server
143
+ engram start --mcp-only # MCP server only (for agent integration)
144
+ engram start --port 3838 # Custom port for REST API
145
+
146
+ engram remember "content" # Store a memory from the command line
147
+ engram recall "query" # Search memories
148
+ engram forget <id> # Delete a memory
149
+ engram list # List all memories
150
+ engram status # Health check and stats
151
+
152
+ engram export # Export memories to JSON
153
+ engram import <file> # Import memories from file
154
+ engram consolidate # Run deduplication and cleanup
155
+
156
+ engram agents # List detected AI agents on your system
157
+ engram connect # Interactive setup wizard for MCP clients
213
158
  ```
214
159
 
215
- PM2 configuration is in [ecosystem.config.cjs](ecosystem.config.cjs). Logs are stored in `~/.engram/logs/`.
160
+ ---
216
161
 
217
- ## Architecture
162
+ ## REST API
218
163
 
219
- ### Memory Categories
164
+ The REST API runs on `http://localhost:3838` by default.
220
165
 
221
- Engram organizes memories into five categories:
166
+ | Endpoint | Method | Description |
167
+ |---|---|---|
168
+ | `/health` | GET | Health check |
169
+ | `/api/status` | GET | System status with stats |
170
+ | `/api/memories` | POST | Create a memory |
171
+ | `/api/memories` | GET | List memories (with pagination, category/namespace filters) |
172
+ | `/api/memories/search` | POST | Semantic search |
173
+ | `/api/memories/:id` | GET | Get a single memory |
174
+ | `/api/memories/:id` | DELETE | Delete a memory |
175
+ | `/api/consolidate` | POST | Run deduplication and cleanup |
176
+ | `/api/conflicts` | GET | Get detected memory conflicts |
222
177
 
223
- - **preference** - User likes/dislikes ("prefers Fastify over Express")
224
- - **fact** - Objective truth about their setup ("uses PostgreSQL 15")
225
- - **pattern** - Recurring workflow ("always runs tests before commit")
226
- - **decision** - Choice they made and why ("chose React for its ecosystem")
227
- - **outcome** - Result of an action ("deployment succeeded after fixing port")
178
+ ---
228
179
 
229
- ### Hybrid Recall Algorithm
180
+ ## Web Dashboard
230
181
 
231
- Memories are ranked using a weighted formula:
182
+ Engram includes a built-in web dashboard at `http://localhost:3838` when running the full server:
232
183
 
233
- ```
234
- score = (similarity ร— 0.5) + (recency ร— 0.15) + (confidence ร— 0.2) + (access ร— 0.05) + fts_boost
235
- ```
184
+ - **Dashboard** โ€” Overview of memory stats and recent activity
185
+ - **Memory Browser** โ€” Browse, filter, and manage all stored memories
186
+ - **Search** โ€” Semantic search with similarity scores
187
+ - **Statistics** โ€” Charts and breakdowns by category, namespace, and time
188
+ - **Agents** โ€” Integration hub with a setup wizard for connecting MCP clients
236
189
 
237
- - **Similarity**: Cosine similarity of embeddings (0-1)
238
- - **Recency**: Time-based decay using last access time
239
- - **Confidence**: User-specified or auto-calculated confidence (0-1)
240
- - **Access**: Normalized access count (0-1, capped at 10 accesses)
241
- - **FTS Boost**: +0.1 if found via full-text search
242
-
243
- ### Database Schema
244
-
245
- ```sql
246
- CREATE TABLE memories (
247
- id TEXT PRIMARY KEY,
248
- content TEXT NOT NULL,
249
- entity TEXT,
250
- category TEXT DEFAULT 'fact',
251
- confidence REAL DEFAULT 0.8,
252
- embedding BLOB,
253
- source TEXT,
254
- namespace TEXT DEFAULT 'default',
255
- tags TEXT, -- JSON array
256
- access_count INTEGER DEFAULT 0,
257
- decay_rate REAL DEFAULT 0.01,
258
- created_at INTEGER NOT NULL,
259
- updated_at INTEGER NOT NULL,
260
- last_accessed INTEGER
261
- );
262
-
263
- -- FTS5 virtual table for full-text search
264
- CREATE VIRTUAL TABLE memories_fts USING fts5(
265
- content, entity, category, namespace,
266
- content='memories', content_rowid='rowid'
267
- );
268
- ```
269
-
270
- ## Configuration
271
-
272
- Engram uses a YAML configuration file at `~/.engram/config.yml`:
190
+ ---
273
191
 
274
- ```yaml
275
- dataDir: ~/.engram
276
- port: 3838
192
+ ## How It Works
277
193
 
278
- defaults:
279
- namespace: default
280
- recallLimit: 5
281
- confidenceThreshold: 0.3
194
+ 1. **Store**: When an AI agent calls `engram_remember`, the memory text is embedded locally using [all-MiniLM-L6-v2](https://huggingface.co/Xenova/all-MiniLM-L6-v2) (a 23 MB model that runs on CPU). The embedding and metadata are stored in a local SQLite database at `~/.engram/memory.db`.
282
195
 
283
- security:
284
- secretDetection: true
196
+ 2. **Recall**: When `engram_recall` is called, the query is embedded with the same model and matched against stored memories using cosine similarity. FTS5 keyword matching runs in parallel, and results are merged using a hybrid scoring algorithm.
285
197
 
286
- consolidation:
287
- duplicateThreshold: 0.92
288
- decayEnabled: true
289
- staleCleanupDays: 90
290
- ```
198
+ 3. **Deduplicate**: Before storing, Engram checks existing memories for similarity. Exact duplicates (>0.95) are rejected. Near-duplicates (0.92โ€“0.95) are merged intelligently.
291
199
 
292
- ## Advanced Features
200
+ 4. **Learn**: The `engram_feedback` tool lets agents mark memories as helpful or unhelpful. This adjusts confidence scores and influences future recall ranking.
293
201
 
294
- ### Secret Detection
202
+ 5. **Protect**: Every memory passes through secret detection before storage. API keys, passwords, tokens, and other sensitive data are automatically blocked.
295
203
 
296
- Engram automatically detects and redacts common secrets:
297
-
298
- - OpenAI API keys (`sk-...`)
299
- - Stripe keys (`pk_...`, `sk_live_...`)
300
- - AWS keys (`AKIA...`)
301
- - GitHub tokens (`ghp_...`, `gho_...`)
302
- - Slack tokens (`xoxb-...`, `xoxp-...`)
303
- - Google API keys (`AIza...`)
304
- - Private keys (`BEGIN PRIVATE KEY`)
305
- - Database connection strings
306
- - JWT tokens
204
+ ---
307
205
 
308
- ### Consolidation
206
+ ## Configuration
309
207
 
310
- Run periodic consolidation to maintain memory quality:
208
+ Engram stores its data and config in `~/.engram/`:
311
209
 
312
- ```bash
313
- node bin/engram.js consolidate
314
210
  ```
315
-
316
- **What it does:**
317
- - Removes duplicate memories (>0.92 similarity)
318
- - Detects contradictions between memories
319
- - Applies confidence decay to old, unused memories
320
- - Marks stale memories for review
321
-
322
- ### Namespaces
323
-
324
- Organize memories by project or context:
325
-
326
- ```bash
327
- # Create memories in different namespaces
328
- engram remember "Uses Docker" --namespace project-alpha
329
- engram remember "Prefers Kubernetes" --namespace project-beta
330
-
331
- # Filter by namespace
332
- engram list --namespace project-alpha
333
- engram recall "container tech" --namespace project-alpha
211
+ ~/.engram/
212
+ โ”œโ”€โ”€ memory.db # SQLite database (memories + embeddings)
213
+ โ”œโ”€โ”€ config.json # Server configuration
214
+ โ””โ”€โ”€ models/ # Cached embedding model (~23 MB)
334
215
  ```
335
216
 
336
- ## Development
337
-
338
- ### Project Structure
217
+ Default settings work out of the box. To customize:
339
218
 
340
- ```
341
- engram/
342
- โ”œโ”€โ”€ bin/
343
- โ”‚ โ””โ”€โ”€ engram.js # CLI entry point
344
- โ”œโ”€โ”€ src/
345
- โ”‚ โ”œโ”€โ”€ config/
346
- โ”‚ โ”‚ โ””โ”€โ”€ index.js # Configuration management
347
- โ”‚ โ”œโ”€โ”€ memory/
348
- โ”‚ โ”‚ โ”œโ”€โ”€ store.js # SQLite operations
349
- โ”‚ โ”‚ โ”œโ”€โ”€ recall.js # Hybrid search
350
- โ”‚ โ”‚ โ””โ”€โ”€ consolidate.js # Memory consolidation
351
- โ”‚ โ”œโ”€โ”€ embed/
352
- โ”‚ โ”‚ โ””โ”€โ”€ index.js # Embedding generation
353
- โ”‚ โ”œโ”€โ”€ extract/
354
- โ”‚ โ”‚ โ”œโ”€โ”€ rules.js # Category/entity extraction
355
- โ”‚ โ”‚ โ””โ”€โ”€ secrets.js # Secret detection
356
- โ”‚ โ”œโ”€โ”€ server/
357
- โ”‚ โ”‚ โ”œโ”€โ”€ mcp.js # MCP server
358
- โ”‚ โ”‚ โ””โ”€โ”€ rest.js # REST API server
359
- โ”‚ โ””โ”€โ”€ utils/
360
- โ”‚ โ”œโ”€โ”€ id.js # UUID generation
361
- โ”‚ โ””โ”€โ”€ logger.js # Structured logging
362
- โ”œโ”€โ”€ dashboard/ # React web UI
363
- โ”œโ”€โ”€ test/ # Test suites
364
- โ”œโ”€โ”€ docs/ # Documentation
365
- โ””โ”€โ”€ examples/ # Usage examples
219
+ ```json
220
+ // ~/.engram/config.json
221
+ {
222
+ "port": 3838,
223
+ "defaultNamespace": "default",
224
+ "recallLimit": 5,
225
+ "confidenceThreshold": 0.3,
226
+ "secretDetection": true
227
+ }
366
228
  ```
367
229
 
368
- ### Running Tests
230
+ ---
369
231
 
370
- ```bash
371
- # Run all tests
372
- npm test
232
+ ## Advanced Usage
373
233
 
374
- # Run tests once (no watch)
375
- npm run test:run
234
+ ### Namespace Isolation
376
235
 
377
- # Run specific test file
378
- npx vitest test/memory/store.test.js
379
- ```
380
-
381
- ### Building
236
+ Organize memories by project or client:
382
237
 
383
238
  ```bash
384
- # No build step required - uses ESM modules directly
385
- node bin/engram.js start
386
- ```
239
+ # Store memories in different namespaces
240
+ engram remember "Uses Next.js 14 with app router" --namespace my-saas
241
+ engram remember "WordPress multisite with Redis cache" --namespace client-site
387
242
 
388
- ## API Reference
389
-
390
- See [docs/api.md](docs/api.md) for complete REST API documentation.
391
-
392
- ### Key Endpoints
393
-
394
- - `POST /api/memories` - Create memory
395
- - `GET /api/memories` - List memories
396
- - `POST /api/memories/search` - Search memories
397
- - `GET /api/memories/:id` - Get single memory
398
- - `DELETE /api/memories/:id` - Delete memory
399
- - `POST /api/consolidate` - Run consolidation
400
- - `GET /api/conflicts` - Get detected conflicts
401
- - `GET /api/status` - System status
402
- - `GET /health` - Health check
403
-
404
- ## Examples
405
-
406
- ### Example 1: Project Context Memory
407
-
408
- ```javascript
409
- // Store project decisions
410
- await api.createMemory({
411
- content: "Chose Fastify over Express because of better TypeScript support and performance",
412
- category: "decision",
413
- entity: "fastify",
414
- confidence: 1.0,
415
- namespace: "project-api",
416
- tags: ["backend", "framework"]
417
- });
418
-
419
- // Later, recall why you chose it
420
- const results = await api.searchMemories("why did we choose Fastify?", {
421
- namespace: "project-api",
422
- limit: 3
423
- });
243
+ # Recall searches within a namespace
244
+ engram recall "what framework?" --namespace my-saas
424
245
  ```
425
246
 
426
- ### Example 2: User Preferences
427
-
428
- ```javascript
429
- // Store user preferences
430
- await api.createMemory({
431
- content: "User prefers compact code without unnecessary comments",
432
- category: "preference",
433
- entity: "coding-style",
434
- confidence: 0.9
435
- });
436
-
437
- // Recall preferences before generating code
438
- const prefs = await api.searchMemories("coding style preferences", {
439
- category: "preference",
440
- limit: 5
441
- });
442
- ```
443
-
444
- ### Example 3: Infrastructure Facts
445
-
446
- ```javascript
447
- // Document infrastructure
448
- await api.createMemory({
449
- content: "Production database is PostgreSQL 15 on AWS RDS (db.t3.medium)",
450
- category: "fact",
451
- entity: "postgresql",
452
- namespace: "production"
453
- });
454
-
455
- // Quick lookup
456
- const infra = await api.searchMemories("production database", {
457
- namespace: "production"
458
- });
459
- ```
247
+ AI agents can use namespaces automatically โ€” just include the namespace parameter in `engram_remember` and `engram_recall` calls.
460
248
 
461
- See [examples/](examples/) directory for more detailed examples.
249
+ ### Temporal Queries
462
250
 
463
- ## Performance
464
-
465
- - **Memory Storage**: ~1ms per memory (with embedding)
466
- - **Recall Search**: ~10-50ms for 5 results (depends on database size)
467
- - **Database Size**: ~2KB per memory (including embedding)
468
- - **Embedding Model**: 23MB (downloaded on first use)
469
- - **Memory Usage**: ~50MB base + loaded model
470
-
471
- ## Troubleshooting
472
-
473
- ### Embedding model not downloading
251
+ Filter memories by time:
474
252
 
475
253
  ```bash
476
- # Check internet connection and disk space
477
- # Model downloads to ~/.engram/models/
478
- ls -lh ~/.engram/models/
479
-
480
- # Manual download if needed
481
- mkdir -p ~/.engram/models
482
- # The model will auto-download on first use
254
+ engram recall "deployment changes" --after "last week"
255
+ engram recall "API decisions" --after "2025-01-01" --before "2025-06-01"
483
256
  ```
484
257
 
485
- ### Port already in use
258
+ ### Export for Documentation
259
+
260
+ Export your project's memory as documentation:
486
261
 
487
262
  ```bash
488
- # Change the port
489
- node bin/engram.js start --port 8080
263
+ engram export --format markdown --namespace my-project > PROJECT_CONTEXT.md
264
+ engram export --format json > memories-backup.json
490
265
  ```
491
266
 
492
- ### Database locked
267
+ ---
493
268
 
494
- ```bash
495
- # SQLite WAL mode should prevent this, but if it happens:
496
- # Close all connections and restart
497
- pkill -f "node bin/engram.js"
498
- node bin/engram.js start
499
- ```
269
+ ## Contributing
500
270
 
501
- ### Tests failing
271
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
502
272
 
503
273
  ```bash
504
- # Clean test databases
505
- rm -rf /tmp/engram-*
506
-
507
- # Run tests
508
- npm test
274
+ git clone https://github.com/HBarefoot/engram.git
275
+ cd engram
276
+ npm install
277
+ npm run dev
509
278
  ```
510
279
 
511
- ## Contributing
512
-
513
- Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
280
+ ---
514
281
 
515
282
  ## License
516
283
 
517
- MIT License - see [LICENSE](LICENSE) file for details.
518
-
519
- ## Acknowledgments
520
-
521
- - Built with [better-sqlite3](https://github.com/WiseLibs/better-sqlite3) for fast SQLite access
522
- - Embeddings powered by [@xenova/transformers](https://github.com/xenova/transformers.js)
523
- - REST API built with [Fastify](https://www.fastify.io/)
524
- - Dashboard built with [React](https://react.dev/) and [Tailwind CSS](https://tailwindcss.com/)
525
- - MCP integration via [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/sdk)
526
-
527
- ## Support
528
-
529
- - ๐Ÿ“– [Documentation](docs/)
530
- - ๐Ÿ› [Issue Tracker](https://github.com/your-username/engram/issues)
531
- - ๐Ÿ’ฌ [Discussions](https://github.com/your-username/engram/discussions)
532
-
533
- ---
534
-
535
- **Made with โค๏ธ for the AI agent community**
284
+ MIT ยฉ 2026 [HBarefoot](https://github.com/HBarefoot)