Why contradictions matter
A customer service agent has a memory: “Customer is on the Basic plan.” Stored 8 months ago, confidence 1.0. The customer upgraded to Premium 3 months ago. The agent still applies Basic plan logic — not because the model is bad, but because contradicting information was never processed. Engram solves this by detecting contradictions when new memories are stored.How detection works
When a new memory is stored, Engram:- Finds semantically similar existing memories using HNSW embedding search (similarity ≥ 0.60)
- Runs tension analysis on each similar pair
- Handles the result based on tension type
Tension types
Hard contradiction
Hard contradiction
Two beliefs that cannot both be true simultaneously.Example: “User lives in New York” → “User moved to Tokyo”Handling: The original memory’s confidence is demoted by
0.20. If it falls below 0.40, it is archived. The new memory is stored at 0.70 confidence.Temporal update
Temporal update
New information supersedes old — the old fact was true at some point but is now outdated.Example: “User’s phone is iPhone 12” → “User recently upgraded to iPhone 15”Handling: The original memory is archived. The new memory is stored at full confidence.Detected via temporal markers: now, recently, as of, switched to, moved to, upgraded, no longer, formerly…
Contextual coexistence
Contextual coexistence
Both beliefs are valid — they apply in different contexts.Example: “User prefers concise responses for quick questions” + “User prefers detailed responses for research tasks”Handling: Both memories coexist at their original confidence. No demotion.
Soft tension
Soft tension
Related but not directly contradicting — possibly complementary.Handling: New memory is stored without penalising the existing one. Both coexist.
Detection modes
Engram supports two contradiction detection modes:LLM-based (default when LLM_PROVIDER is set)
Uses an LLM to analyse tension between two belief statements. Higher accuracy on subtle contradictions. Adds ~2–5s latency to store operations.Embedding-only (zero API calls)
Uses cosine similarity bands + temporal/negation text heuristics. Zero external API calls. Sub-millisecond analysis. ~45–55% accuracy on the benchmark contradiction suite (vs. ~65% for LLM-based).Embedding-only mode still outperforms Mem0 (~15%) and Zep (~20%) on the same benchmark — because they have no contradiction detection at all. You don’t need LLM-based detection to be best-in-class.