MCPcopy Create free account
hub / github.com/cosmicstack-labs/mercury-agent / insertReflection

Method insertReflection

src/memory/user-memory.ts:375–401  ·  view source on GitHub ↗
(candidate: UserMemoryCandidate)

Source from the content-addressed store, hash-verified

373 }
374
375 private insertReflection(candidate: UserMemoryCandidate): void {
376 const now = Date.now();
377 const id = generateId('mem');
378
379 this.db.insert({
380 id,
381 user_key: this.userKey,
382 type: 'reflection',
383 summary: candidate.summary,
384 detail: candidate.detail ?? null,
385 scope: 'durable',
386 evidence_kind: 'system',
387 source: 'system',
388 confidence: candidate.confidence,
389 importance: candidate.importance,
390 durability: candidate.durability,
391 evidence_count: 1,
392 provenance: null,
393 dismissed: 0,
394 superseded_by: null,
395 created_at: now,
396 updated_at: now,
397 last_seen_at: now,
398 last_used_at: null,
399 last_used_query: null,
400 });
401 }
402
403 private mergeRecord(existing: MemoryRow, candidate: UserMemoryCandidate): UserMemoryRecord | null {
404 const updatedAt = Date.now();

Callers 1

consolidateMethod · 0.95

Calls 2

insertMethod · 0.80
generateIdFunction · 0.70

Tested by

no test coverage detected