A reproducible long-term memory QA framework that structures retrieved evidence into a ledger before answer generation to improve multi-session reasoning.

Stars

264

7-day growth

No data

Forks

28

Open issues

1

License

MIT

Last updated

2026-07-15

Why it is worth attention

It introduces a novel evidence-organization step (ledger) between retrieval and generation, and provides a one-command automatic memory wrapper for OpenAI clients, with visual demos and benchmark case replay.

Who it is for

  • Researchers studying long-term memory for LLMs
  • Developers integrating persistent memory into applications
  • AI engineers evaluating structured reasoning pipelines

Use cases

  • Building chatbots with persistent multi-session user memory
  • Conducting reproducible experiments on memory-augmented reasoning
  • Evaluating question answering over the LongMemEval benchmark
  • Adding automatic memory retain/recall to existing OpenAI-compatible applications

Strengths

  • Clear end-to-end pipeline: Retain → Recall → Organize → Answer → Judge
  • One-command automatic memory integration via wrap_openai() for both Responses and Chat Completions APIs
  • Visual demos (memory pipeline and benchmark case replay) that illustrate evidence organization
  • Two pipeline modes (ledger and self-evolution) for comparative study of structured evidence

Considerations

  • Requires PostgreSQL with pgvector extension
  • Depends on an OpenAI-compatible API for both LLM and embeddings
  • Not a standalone memory system; designed as a research framework with setup overhead
  • Peer-reviewed paper is not yet published (arXiv 'coming soon')

README quick start

Structured Memory Intelligence for Reliable Long-Horizon Reasoning

ShadowWeave Team

  

English · 中文


Abstract

The Holographic Memory System (HMS) is a reproducible long-term memory QA framework for studying whether structured answer-time evidence organization can improve a language model's reasoning over retrieved memories.

The project focuses on the LongMemEval setting, where a question may require evidence from multiple sessions, timestamps, extracted memory facts, and raw source snippets.

One-Command Automatic Memory

HMS can wrap an existing OpenAI client so each model call automatically:

user input -> Recall relevant memories -> inject context -> call the LLM
           -> Retain the completed user/assistant exchange

Configure the model Base URL, API key, and model in .env, then run:

bash scripts/run_memory_demo.sh

The script starts PostgreSQL and HMS locally, waits for the memory API, installs the local SDK adapter in an isolated uv environment, and runs a two-turn demo. The first turn stores a preference and project; the second turn recalls both without manually calling retain() or recall().

For this demo, one OPENAI_API_KEY / OPENAI_BASE_URL / OPENAI_MODEL set is enough. The script reuses it for HMS reasoning and retain extraction when the role-specific values remain unset. Set the embedding model separately when your provider does not support text-embedding-3-small.

The application-side integration is one wrapper call:

from openai import OpenAI
from hms_litellm import wrap_openai

client = wrap_openai(
    OpenAI(),
    hms_api_url="http://127.0.0.1:18080",
    api_key="YOUR_HMS_API_KEY",
    bank_id="user-alice",
)

response = client.responses.create(
    model="gpt-4o-mini",
    input="What do you remember about my current project?",
)

wrap_openai() supports both client.responses.create(...) and client.chat.completions.create(...), including streaming. Use a stable, per-user bank_id; optionally set session_id to accumulate one conversation as a tracked HMS document.

Experiment Design

The reproducible evaluation follows one complete pipeline:

Dataset conversations
  -> Retain: extract and store structured memories
  -> Recall: retrieve evidence for each question
  -> Organize: b

Related repositories

Similar projects matched by category, topics, and programming language.

NousResearch
Featured
NousResearch GitHub avatar

hermes-agent

Hermes Agent is an open-source, self-improving AI agent with a built-in learning loop that creates skills from experience, runs across platforms, and supports any LLM provider.

AI & Machine Learning
215,644
littledivy
Featured
littledivy GitHub avatar

mimic

mimic captures traffic from any iOS or web app and automatically generates a Python client library that lets you call the app's API like a regular library.

AI & Machine LearningDeveloper Tools
1,057
joeseesun
Featured
joeseesun GitHub avatar

qiaomu-goal-meta-skill

qiaomu-goal-meta-skill transforms vague requests into a copy-ready Codex /goal command with defaults, verification, boundaries, and pause conditions.

AI & Machine Learning
776