@199-bio/engram 0.1.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 ADDED
@@ -0,0 +1,304 @@
1
+ # Engram
2
+
3
+ **Give your AI a perfect memory.**
4
+
5
+ Engram remembers everything you tell it—names, relationships, preferences, conversations—and recalls exactly what's relevant when you need it. No cloud. No API keys. Just memory that works.
6
+
7
+ Works with any LLM that supports MCP (Model Context Protocol)—Claude, GPT, Gemini, local models, and more.
8
+
9
+ > *An engram is a unit of cognitive information imprinted in a physical substance—the biological basis of memory.*
10
+
11
+ ---
12
+
13
+ ## What It Does
14
+
15
+ Tell your AI about your world:
16
+
17
+ > "My colleague Sarah is allergic to shellfish and prefers window seats. She's leading the Q1 product launch."
18
+
19
+ Later, ask:
20
+
21
+ > "I'm booking a team lunch and flights for the offsite—what should I know?"
22
+
23
+ Engram connects the dots—*avoid seafood restaurants, book Sarah a window seat, and she's probably busy with the launch*—and gives your AI the context to truly help.
24
+
25
+ **It's not just search. It's understanding.**
26
+
27
+ ---
28
+
29
+ ## Quick Start
30
+
31
+ ### Install
32
+
33
+ ```bash
34
+ npm install -g engram-mcp
35
+ ```
36
+
37
+ ### Add to Your MCP Client
38
+
39
+ **Claude Desktop** — add to `~/.claude/claude_desktop_config.json`:
40
+
41
+ ```json
42
+ {
43
+ "mcpServers": {
44
+ "engram": {
45
+ "command": "engram"
46
+ }
47
+ }
48
+ }
49
+ ```
50
+
51
+ **Claude Code:**
52
+
53
+ ```bash
54
+ claude mcp add engram -- engram
55
+ ```
56
+
57
+ **Other MCP clients** — point to the `engram` command. It speaks standard MCP over stdio.
58
+
59
+ That's it. Your AI now has memory.
60
+
61
+ ---
62
+
63
+ ## How to Use
64
+
65
+ Just talk naturally. Your AI will remember what matters.
66
+
67
+ ### Storing Memories
68
+
69
+ Say things like:
70
+ - "Remember that Sarah is allergic to shellfish"
71
+ - "My anniversary is March 15th"
72
+ - "I prefer morning meetings, never schedule anything before 9am"
73
+
74
+ ### Recalling
75
+
76
+ Just ask:
77
+ - "What do you know about Sarah?"
78
+ - "When is my anniversary?"
79
+ - "What are my meeting preferences?"
80
+
81
+ Your AI automatically searches its memory and uses what's relevant.
82
+
83
+ ### The Knowledge Graph
84
+
85
+ Engram doesn't just store text—it understands relationships:
86
+
87
+ - **People**: Sarah, John, Dr. Martinez
88
+ - **Places**: Office, Conference Room A, Seattle HQ
89
+ - **Organizations**: Acme Corp, Stanford, FDA
90
+ - **Connections**: Sarah → works at → Acme Corp
91
+ - **Observations**: Sarah is allergic to shellfish
92
+
93
+ This means when you ask about Sarah's work, Engram knows to also surface relevant information about Acme Corp.
94
+
95
+ ---
96
+
97
+ ## What Makes It Special
98
+
99
+ | Feature | Why It Matters |
100
+ |---------|----------------|
101
+ | **Hybrid Search** | Finds memories by keywords AND meaning |
102
+ | **Knowledge Graph** | Understands relationships between people, places, things |
103
+ | **100% Local** | Your memories never leave your computer |
104
+ | **No API Keys** | Works offline, no subscriptions |
105
+ | **Fast** | ~50ms to recall, feels instant |
106
+
107
+ ---
108
+
109
+ ## The Nine Tools
110
+
111
+ Your AI gets these capabilities:
112
+
113
+ | Tool | What It Does |
114
+ |------|--------------|
115
+ | `remember` | Store something new |
116
+ | `recall` | Find relevant memories |
117
+ | `forget` | Remove a memory |
118
+ | `create_entity` | Add a person, place, or concept |
119
+ | `observe` | Note something about an entity |
120
+ | `relate` | Connect two entities |
121
+ | `query_entity` | Get everything about someone/something |
122
+ | `list_entities` | See all people, places, etc. |
123
+ | `stats` | Check memory statistics |
124
+
125
+ ---
126
+
127
+ ## Examples
128
+
129
+ ### Personal Assistant
130
+
131
+ ```
132
+ You: "Remember that my anniversary is March 15th and my partner loves Italian food"
133
+ AI: ✓ Stored. I've noted this as an important date with preferences.
134
+
135
+ You: "I need to plan something special next month"
136
+ AI: Your anniversary is coming up on March 15th! Given your partner's love for
137
+ Italian food, perhaps a nice Italian restaurant reservation?
138
+ ```
139
+
140
+ ### Relationship Context
141
+
142
+ ```
143
+ You: "My friend David lives in Austin and always recommends great coffee shops."
144
+ AI: ✓ Stored. Created entity: David (person), with observation about Austin and coffee expertise.
145
+
146
+ You: "I'm visiting Austin next week"
147
+ AI: David is in Austin—he'd probably have great coffee shop recommendations!
148
+ Want me to remind you to ask him?
149
+ ```
150
+
151
+ ### Professional Memory
152
+
153
+ ```
154
+ You: "John Chen is our VP of Engineering. He prefers async communication and hates meetings before 11am."
155
+ Claude: ✓ Stored. Created entity: John Chen (person, VP of Engineering).
156
+
157
+ You: "I need to schedule a sync with John"
158
+ Claude: Given John's preferences, I'd suggest a late morning slot, maybe 11:30am,
159
+ or an async Loom video if it doesn't require real-time discussion.
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Privacy
165
+
166
+ **Your memories stay on your machine.**
167
+
168
+ - All data stored locally in `~/.engram/`
169
+ - No cloud services, no external APIs
170
+ - No telemetry, no tracking
171
+ - You own your data completely
172
+
173
+ ---
174
+
175
+ ## Technical Details
176
+
177
+ <details>
178
+ <summary>How It Works</summary>
179
+
180
+ Engram uses a three-layer retrieval system:
181
+
182
+ 1. **BM25 (Keyword Search)**: SQLite FTS5 finds exact matches—names, dates, specific phrases
183
+ 2. **ColBERT (Semantic Search)**: Neural embeddings find conceptually related memories
184
+ 3. **Knowledge Graph**: Entity relationships expand context
185
+
186
+ These are fused using Reciprocal Rank Fusion (RRF) to get the best of all approaches.
187
+
188
+ ```
189
+ Query: "What should I know about Sarah?"
190
+
191
+ ├── BM25 → finds "Sarah" in memories
192
+ ├── ColBERT → finds semantically related content
193
+ └── Graph → Sarah → works at → Acme Corp → Q1 launch
194
+
195
+ └── RRF Fusion → Best combined results
196
+ ```
197
+
198
+ </details>
199
+
200
+ <details>
201
+ <summary>Architecture</summary>
202
+
203
+ ```
204
+ engram/
205
+ ├── src/
206
+ │ ├── index.ts # MCP server
207
+ │ ├── storage/
208
+ │ │ └── database.ts # SQLite + FTS5
209
+ │ ├── graph/
210
+ │ │ ├── extractor.ts # Entity extraction
211
+ │ │ └── knowledge-graph.ts
212
+ │ └── retrieval/
213
+ │ ├── colbert.ts # ColBERT wrapper
214
+ │ ├── colbert-bridge.py # Python RAGatouille
215
+ │ └── hybrid.ts # RRF fusion
216
+ ```
217
+
218
+ </details>
219
+
220
+ <details>
221
+ <summary>Building from Source</summary>
222
+
223
+ ```bash
224
+ git clone https://github.com/199-biotechnologies/engram.git
225
+ cd engram
226
+ npm install
227
+ npm run build
228
+
229
+ # Install globally from local build
230
+ npm install -g .
231
+ ```
232
+
233
+ **Python Dependencies** (for ColBERT):
234
+ ```bash
235
+ pip install ragatouille torch
236
+ ```
237
+
238
+ If Python/ColBERT isn't available, Engram falls back to a simpler retriever automatically.
239
+
240
+ </details>
241
+
242
+ <details>
243
+ <summary>Configuration</summary>
244
+
245
+ Environment variables:
246
+ - `ENGRAM_DB_PATH`: Database location (default: `~/.engram/engram.db`)
247
+
248
+ Claude Desktop full config:
249
+ ```json
250
+ {
251
+ "mcpServers": {
252
+ "engram": {
253
+ "command": "engram",
254
+ "env": {
255
+ "ENGRAM_DB_PATH": "/custom/path/engram.db"
256
+ }
257
+ }
258
+ }
259
+ }
260
+ ```
261
+
262
+ </details>
263
+
264
+ <details>
265
+ <summary>Performance</summary>
266
+
267
+ On M1 MacBook Air:
268
+ - **remember**: ~100ms
269
+ - **recall**: ~50ms
270
+ - **graph queries**: ~5ms
271
+
272
+ Database size: ~1KB per memory (text + embeddings + graph data)
273
+
274
+ </details>
275
+
276
+ ---
277
+
278
+ ## Roadmap
279
+
280
+ - [x] Core MCP server
281
+ - [x] Hybrid search (BM25 + ColBERT)
282
+ - [x] Knowledge graph
283
+ - [x] Entity extraction
284
+ - [ ] Temporal memory decay
285
+ - [ ] Memory consolidation
286
+ - [ ] Export/import
287
+ - [ ] Web dashboard
288
+
289
+ ---
290
+
291
+ ## Author
292
+
293
+ **Boris Djordjevic**
294
+ Founder, [199 Biotechnologies](https://199bio.com)
295
+
296
+ ## License
297
+
298
+ MIT — use it however you want.
299
+
300
+ ---
301
+
302
+ <p align="center">
303
+ <i>Built with care by <a href="https://github.com/199-biotechnologies">199 Biotechnologies</a></i>
304
+ </p>
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../src/graph/extractor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,cAAc,CAAC;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACtC;AAwFD,qBAAa,eAAe;IAC1B;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE;IA8D3C;;OAEG;IACH,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE;IAuFrD;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE;IAe/C;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAyC/B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAuC9B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAiC5B;;OAEG;IACH,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;QACxC,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CA4BH;AAGD,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B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