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-jsmemgc 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.
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()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.
Every question runs through:
- Analyzer — decomposes the question into sub-questions.
- Entity-filtered recall — narrows candidate memories by entity match before vector + BM25 fusion.
- Selector ⇔ Adder × 3 — three rounds of pruning and expansion to shape the evidence pool.
- Generator × 7 — seven parallel synthesis samples, self-consistency vote.
- 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.
| Ecosystem | Page | Install |
|---|---|---|
| PyPI | https://pypi.org/project/memgc/ | uv add memgc |
| npm | https://www.npmjs.com/package/memgc-js | npm install memgc-js |
MIT