Skip to content

MemoryGC/memgc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

memgc

Agentic memory with calibrated decay — your AI agents remember what matters and forget what doesn't.

Self-hostable. Runs on your own machine. Python and Node.js bindings ship from the same core.

# Python
uv add memgc

# Node.js (wraps the Python core via a JSON-RPC bridge)
npm install memgc-js

What it does

memgc is a memory layer for AI agents. It does five things, each behind one method:

Method What it does
MemGC.open(path) Open or create a memgc database.
mc.extract(messages) Pull atomic facts from a transcript and store them.
mc.consolidate(messages) Compress a conversation into a dense YAML state snapshot.
mc.dreaming() Calibrated decay GC — score every memory, archive cold ones.
mc.answer(question) Agentic search-and-answer via the PRISM loop. Returns text + supporting evidence.

The differentiator vs. every other agent-memory library: dreaming(). Memories decay on a calibrated half-life weighted by recall frequency, recency, consolidation, and conceptual centrality. Stale facts archive themselves so your agent stays sharp instead of drowning in cruft.

Quickstart — Python

from memgc import MemGC

mc = MemGC.open("./mydb")

mc.extract([
    {"speaker": "Alice", "content": "I moved to Lisbon in March 2024.", "date": "2024-03-15"},
])

ans = mc.answer("Where does Alice live now?")
print(ans.text)              # synthesized answer
print(len(ans.memories))     # supporting evidence count

mc.close()

Quickstart — Node.js

const { MemGC } = require('memgc-js');

(async () => {
  const mc = await MemGC.open('./mydb');

  await mc.extract([
    { speaker: 'Alice', content: 'I moved to Lisbon in March 2024.', date: '2024-03-15' },
  ]);

  const ans = await mc.answer('Where does Alice live now?');
  console.log(ans.text);
  console.log(ans.memories.length);

  await mc.close();
})();

The Node bindings spawn a Python subprocess and talk to it over JSON-RPC. You still need Python ≥ 3.12 and pip install memgc on the same machine. Set MEMGC_PYTHON=/path/to/python if python3 isn't on your PATH.

How answer() works (the PRISM loop)

Every question runs through:

  1. Analyzer — decomposes the question into sub-questions.
  2. Entity-filtered recall — narrows candidate memories by entity match before vector + BM25 fusion.
  3. Selector ⇔ Adder × 3 — three rounds of pruning and expansion to shape the evidence pool.
  4. Generator × 7 — seven parallel synthesis samples, self-consistency vote.
  5. Verifier — final check; regenerates if evidence binding is weak.

You get back an Answer with the synthesized text, the supporting memories, wall-clock elapsed time, and token usage.

Packages

Ecosystem Page Install
PyPI https://pypi.org/project/memgc/ uv add memgc
npm https://www.npmjs.com/package/memgc-js npm install memgc-js

License

MIT

About

Agentic memory with calibrated decay — your AI agents remember what matters, forget what doesn't.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors