Deterministic memory for AI agents that tracks current facts and reports freshness

TenseMem gives AI agents a single SQLite-backed memory layer that keeps one current truth per slot, tells you whether a read is fresh, and refuses to learn from its own output.

LinkLoot access
Free
Provider costs
Unknown
The useful part2 min read

What you get from it

What it does

TenseMem provides embedded, deterministic state memory for AI agents. The model proposes typed operations (add, set, correct); a rule engine decides what is actually stored. One SQLite file inside your process holds the data—no server required.

Each fact lives in a named slot. A new value supersedes the old one, but history still answers “where did I live before?” Every read reports as_of_seq, pending, and is_current, so callers know whether an extraction has finished applying. Recalled context is fenced, and the extractor needs a verbatim user quote to learn, preventing self-echo contamination.

Who it helps

Developers building agent systems where stale or contradictory memory causes real errors. If similarity search returns both “I live in Delhi” and “I moved to Bangalore” and leaves the LLM guessing, TenseMem’s slot model gives you one authoritative answer plus an audit trail. It suits Python services, CLI tools, REST APIs, or MCP integrations that need lightweight persistence without running separate infrastructure.

Getting started

Install via pip with optional provider extras: tensemem[openai], tensemem[anthropic], tensemem[ollama], tensemem[litellm], or Gemini (GEMINI_API_KEY in environment). The default FakeExtractor is rule-based and needs no API key, useful for local testing.

from tensemem import FakeExtractor, Memory

mem = Memory(FakeExtractor())
added = mem.add("u1", "I live in Delhi")
ctx = mem.context(user_id="u1", min_seq=added.seq, wait=1.5)
print(ctx.text)           # fenced block the model can read
print(ctx.freshness.is_current)  # True once extract finished

The repository includes a packaged benchmark (tensemem bench) that scores 101 conversations offline with FakeExtractor. Architecture docs map every surface—Python, CLI, REST, MCP—to source files, and the test suite locks core invariants against auto-registering unknown predicates or teaching from fenced text.

Limits and costs

Apache-2.0 licensed open source; hosting costs depend on your deployment. Provider keys go in process environment only. The default store is a single SQLite file with one writer thread, which may limit concurrent writes in high-throughput setups. Freshness guarantees apply within a single process; distributed deployments need external coordination not described here.

Community

Discussion

Share practical experience, questions, or warnings with the community.

0

Sign in to join the discussion and vote on comments.

No comments yet. Start the discussion.
Keep exploring

More from this topic

More in Tools & Apps