ZifaMem: Structured Memory for Persona, Preference, and Emotional Continuity in AI Companions

2026-07-20Artificial Intelligence

Artificial IntelligenceMachine Learning
AI summary

The authors developed ZifaMem, a memory system designed to help AI companions remember users and past conversations better over time. They found that using this structured memory improved the AI's ability to maintain emotional connection by about 11% compared to just giving the AI all previous chat history. Different memory approaches were tested, and ZifaMem performed similarly well to another method called Mem0. The study also showed that considering multiple past conversation turns is better than looking at just the latest one for emotional continuity. Their system and tools are available publicly for others to use.

structured memoryemotional continuityAI companionsepisodic memorypersona groundinglarge language modelsdialogue systemsmulti-turn contextuser modeling
Authors
Jingzhe Fang, Guozhi Xu, Yunfan Cui, Xiaochen Yang, Zhangyu Hua
Abstract
AI companions are judged not only by single-turn fluency but by whether they sustain emotional continuity: remembering who the companion is, what the user prefers, and how the relationship has felt. We present ZifaMem, a structured memory system that organizes dialogue into session summaries, episodic memories, and a consolidated user model. Against a deployment-honest comparator that supplies the full raw dialogue history, and under a fixed LLM-as-a-judge protocol with route audits, structured memory raises pooled four-backbone emotional-intelligence scores by 11.4% (95% CI 6.3% to 17.1%), and persona grounding improves on all four backbones (Claude +42% relative). Multi-turn affect context wins a +39% net preference over a single-turn snapshot (exploratory), whereas an additional emotion state machine yields no measurable gain on any of five endpoints. Under an identical preregistered protocol, three memory systems (ZifaMem, Mem0, and filtered verbatim retrieval) each improve significantly over raw-history deployment, and ZifaMem and Mem0 are statistically equivalent within +/-5 points on the preregistered primary preference endpoint. The ZifaMem SDK, CLI, and portable Agent Skills are open-sourced at https://github.com/zifacorp/zifamem.