README.md

January 3, 2026 ยท View on GitHub

๐Ÿ’ซ LiCoMemory: Lightweight and Cognitive Agentic Memory for Efficient Long-Term Reasoning

If you like our project, please give us a star โญ on GitHub for the latest update.

LiCoMemory is a novel end-to-end agentic memory framework that supports real-time updating and retrieval, enabling efficient and scalable retrieval over multi-session dialogues. LiCoMemory introduces Cognigraph, a lightweight hierarchical graph that utilizes entities and relations as semantic indexing layers, and employs temporal and hierarchy-aware search with integrated reranking for adaptive and coherent knowledge retrieval.

๐Ÿ’ซ Key Features

  • Multi-Session Memory: Efficiently stores and retrieves information across multiple dialogue sessions, enabling long-term conversation memory.
  • Dynamic Graph Construction: Supports real-time graph update and retrieval augmentation during human-agent interaction.
  • Hierarchical Cognigraph: Maintains a multi-layered yet lightweight graph structure for efficient update and accurate retrieval.
  • Time-Aware Retrieval: Leverages a unified rerank to achieve balance between entity-level, session-level and temporal-level similarity.

๐Ÿš€ Get Started

Requirements.txt is included to help get you started. To run LiCoMemory, use the following command:

python main.py -opt config/Memory.yaml -dataset_name <dataset_name> -root <root_name> -query 1

Parameters

  • -opt: Path to the configuration YAML file (e.g., config/Memory.yaml)
  • -dataset_name: Name of the dataset (e.g., locomo_0, longmem_ku/lm_1)
  • -external_graph: (Optional) Path to external graph file to load from
  • -root: (Optional) Root directory name for storing results
  • -query: (Optional) Whether to run query and evaluation (1 to enable, 0 to disable). If not specified, will prompt user

Configuration

Update config/Memory.yaml to configure:

  1. Dataset Path: Set data_root to your dataset directory
  2. API Keys: Configure your LLM and embedding API keys
  3. Key Parameters:
    • force: Set True for compulsary graph reconstruction; Set False for loading existing graph structure from given path
    • enable_visual: Set True for a visual feedback of the retrieved content
    • enable_CogniRank: Set True to enable the unified rerank
    • enable_llm_eval: Set True to utilize LLM judging for the answer; Set False to enable the exact match evaluation
    • enable_summary: Set True to activate session summary generation

๐Ÿงฐ Experimental Settings

We have incorporated several baseline methods:

BaselinePaperCode
LoCoMoEvaluating Very Long-Term Conversational Memory of LLM AgentsLoCoMo
A-MemA-MEM: Agentic Memory for LLM AgentsA-Mem
Mem0Mem0: Building Production-Ready AI Agents with Scalable Long-Term MemoryMem0
ZepZep: A Temporal Knowledge Graph Architecture for Agent MemoryZep
MemOSMemOS: A Memory OS for AI SystemMemOS
MemoryBankMemoryBank: Enhancing Large Language Models with Long-Term MemoryMemoryBank

The following datasets are utilized for testing:

  • LOCOMO focuses on extremely long multi-session dialogues, containing 1,986 questions in five distinct categories: single-hop, multi-hop, temporal, open-domain and adversial reasoning.
  • LongmemEval is a comprehensive benchmark for evaluating long-term memory in conversational agents, consists of 500 questions across six types: single-session user (S.S.U.), single-session assistant (S.S.A.), single-session preference (S.S.P.), multi-session, temporal reasoning, and knowledge update.

Use the scirpts in the folder 'dataset' to modify the original dataset into the intended format for LiCoMemory.

โš™๏ธ Experimental Results

LiCoMemory achieves state-of-the-art QA accuracy and recall with lower latency, retrieval volume and token consumption than competing memory frameworks on two long-term dialogue benchmarks across different backbone models, verifying the advantages of its CogniGraph structure and precise retrieval design.

Subset breakdowns also confirm LiCoMemory's consistent superiority across all task types, with the largest improvements in temporal-reasoning and multi-session related queries.

Acknowledgements

We acknowledge these excellent works for providing open-source code and inspiration: Zep, Mem0, A-Mem, LoCoMo, LongMemEval, MemOS, MemoryBank.