@199-bio/engram 0.5.0 → 0.5.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"consolidator.d.ts","sourceRoot":"","sources":["../../src/consolidation/consolidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,cAAc,EAAU,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAoCxE,UAAU,kBAAkB;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,EAAE,CAAiB;gBAEf,EAAE,EAAE,cAAc;IAS9B,YAAY,IAAI,OAAO;IAIvB;;;OAGG;IACG,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC;QAC3D,cAAc,EAAE,MAAM,CAAC;QACvB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;IAwEF;;OAEG;YACW,gBAAgB;IA4D9B;;OAEG;IACG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA8GjE;;OAEG;IACH,SAAS,IAAI;QACX,UAAU,EAAE,OAAO,CAAC;QACpB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,YAAY,EAAE,MAAM,CAAC;QACrB,wBAAwB,EAAE,MAAM,CAAC;KAClC;CAYF"}
1
+ {"version":3,"file":"consolidator.d.ts","sourceRoot":"","sources":["../../src/consolidation/consolidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,cAAc,EAAU,MAAM,EAAE,MAAM,wBAAwB,CAAC;AA8CxE,UAAU,kBAAkB;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,EAAE,CAAiB;gBAEf,EAAE,EAAE,cAAc;IAS9B,YAAY,IAAI,OAAO;IAIvB;;;OAGG;IACG,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC;QAC3D,cAAc,EAAE,MAAM,CAAC;QACvB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;IAwEF;;OAEG;YACW,gBAAgB;IAoE9B;;OAEG;IACG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAuHjE;;OAEG;IACH,SAAS,IAAI;QACX,UAAU,EAAE,OAAO,CAAC;QACpB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,YAAY,EAAE,MAAM,CAAC;QACrB,wBAAwB,EAAE,MAAM,CAAC;KAClC;CAYF"}
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ async function initialize() {
42
42
  // ============ MCP Server ============
43
43
  const server = new Server({
44
44
  name: "engram",
45
- version: "0.5.0",
45
+ version: "0.5.1",
46
46
  }, {
47
47
  capabilities: {
48
48
  tools: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@199-bio/engram",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Give Claude a perfect memory. Local-first MCP server with hybrid search.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -14,30 +14,40 @@
14
14
  import Anthropic from "@anthropic-ai/sdk";
15
15
  import { EngramDatabase, Memory, Digest } from "../storage/database.js";
16
16
 
17
- const CONSOLIDATION_SYSTEM = `You are a memory consolidation system. Your job is to:
17
+ const CONSOLIDATION_SYSTEM = `You are a high-quality memory consolidation system for a personal AI assistant. Your goal is to create comprehensive, nuanced digests that preserve the richness of human experience and relationships.
18
18
 
19
- 1. CONSOLIDATE: Take a batch of related memories and produce a concise summary that preserves all important facts, dates, names, and relationships. Be factual and precise.
19
+ ## Your Tasks
20
20
 
21
- 2. DETECT CONTRADICTIONS: If any memories contain conflicting information (e.g., different ages, dates, locations, or facts about the same topic), identify them clearly.
21
+ 1. **CONSOLIDATE**: Synthesize memories into a detailed digest that:
22
+ - Preserves ALL specific facts: names, dates, numbers, locations, preferences
23
+ - Captures relationships, emotions, context, and nuance
24
+ - Maintains chronological awareness (what happened when)
25
+ - Notes patterns, recurring themes, and changes over time
26
+ - Includes direct quotes when they reveal personality or important details
22
27
 
23
- Output JSON with this structure:
28
+ 2. **DETECT CONTRADICTIONS**: Flag genuinely conflicting information:
29
+ - Different dates/times for the same event
30
+ - Conflicting facts about the same person/thing
31
+ - Changed preferences or circumstances (note if this might be natural evolution vs. error)
32
+
33
+ ## Output Format (JSON)
24
34
  {
25
- "digest": "Your consolidated summary here. Include all key facts, dates, names. Be concise but complete.",
26
- "topic": "A short topic label (2-5 words)",
35
+ "digest": "Comprehensive summary preserving all important details, context, and nuance. Multiple paragraphs are fine for complex topics.",
36
+ "topic": "Short topic label (2-5 words)",
27
37
  "contradictions": [
28
38
  {
29
- "description": "Clear description of the contradiction",
39
+ "description": "Precise description of the conflict",
30
40
  "memory_ids": ["id1", "id2"]
31
41
  }
32
42
  ]
33
43
  }
34
44
 
35
- Rules:
36
- - Preserve specific details: names, numbers, dates, locations
37
- - Use present tense for current facts, past tense for past events
38
- - If memories are about a person, structure the digest around that person
39
- - Only flag true contradictions (not just incomplete information)
40
- - Be concise - consolidate 10 memories into 2-3 sentences typically`;
45
+ ## Quality Standards
46
+ - NEVER sacrifice important details for brevity
47
+ - Include temporal context (when things happened/changed)
48
+ - Preserve personality, preferences, and relationship dynamics
49
+ - If memories span different time periods, note the evolution
50
+ - Only flag true contradictions, not incomplete information or natural life changes`;
41
51
 
42
52
  interface ConsolidationResult {
43
53
  digest: string;
@@ -166,20 +176,28 @@ export class Consolidator {
166
176
  )
167
177
  .join("\n\n");
168
178
 
169
- const userPrompt = `Consolidate these ${memories.length} memories into a single digest. Identify any contradictions.
179
+ const userPrompt = `Synthesize these ${memories.length} memories into a comprehensive digest.
180
+
181
+ Think deeply about:
182
+ - What are the key facts, events, and details?
183
+ - Who are the people involved and how do they relate?
184
+ - What preferences, opinions, or patterns emerge?
185
+ - Is there a chronological narrative or timeline?
186
+ - Are there any contradictions between memories?
170
187
 
171
188
  MEMORIES:
172
189
  ${memoriesText}
173
190
 
174
- Respond with JSON only.`;
191
+ Create a detailed digest that preserves all important information. Respond with JSON only.`;
175
192
 
176
193
  try {
177
194
  const response = await this.client.messages.create({
178
195
  model: "claude-opus-4-5-20251101",
179
196
  max_tokens: 16000,
197
+ temperature: 1, // Required for extended thinking
180
198
  thinking: {
181
199
  type: "enabled",
182
- budget_tokens: 4000,
200
+ budget_tokens: 10000, // High budget for thorough analysis
183
201
  },
184
202
  messages: [
185
203
  {
@@ -246,20 +264,29 @@ Respond with JSON only.`;
246
264
  )
247
265
  .join("\n\n");
248
266
 
249
- const userPrompt = `Create a comprehensive profile for the entity "${entity.name}" (${entity.type}) based on these memories. Include all known facts, relationships, preferences, and history.
267
+ const userPrompt = `Create a comprehensive, detailed profile for "${entity.name}" (${entity.type}).
268
+
269
+ This profile will serve as the authoritative reference for everything known about this ${entity.type}. Include:
270
+ - All biographical/descriptive facts
271
+ - Relationships with other people/entities
272
+ - Preferences, opinions, personality traits
273
+ - Timeline of events and changes over time
274
+ - Notable quotes or characteristic expressions
275
+ - Any context that helps understand this ${entity.type}
250
276
 
251
277
  MEMORIES ABOUT ${entity.name}:
252
278
  ${memoriesText}
253
279
 
254
- Respond with JSON only.`;
280
+ Create a rich, detailed profile. Do not summarize away important nuances. Respond with JSON only.`;
255
281
 
256
282
  try {
257
283
  const response = await this.client.messages.create({
258
284
  model: "claude-opus-4-5-20251101",
259
285
  max_tokens: 16000,
286
+ temperature: 1, // Required for extended thinking
260
287
  thinking: {
261
288
  type: "enabled",
262
- budget_tokens: 6000,
289
+ budget_tokens: 16000, // Maximum thinking for entity profiles
263
290
  },
264
291
  messages: [
265
292
  {
package/src/index.ts CHANGED
@@ -60,7 +60,7 @@ async function initialize(): Promise<void> {
60
60
  const server = new Server(
61
61
  {
62
62
  name: "engram",
63
- version: "0.5.0",
63
+ version: "0.5.1",
64
64
  },
65
65
  {
66
66
  capabilities: {