memwatch
Memory staleness detection and auto-expiry for LLM agents
memwatch is a Python library that tracks how stale each fact in an AI agent's memory has become, using decay curves and contradiction detection to flag or discard outdated information like old job titles or previous addresses before the agent repeats them.
memwatch is a Python library that helps AI agents forget things at the right time. Most agent memory systems store facts indefinitely, which means an agent might keep saying "you work at Google" months after someone changed jobs. memwatch addresses this by tracking how fresh each stored fact is and flagging or discarding it once it becomes unreliable.
The library uses three complementary approaches. The first is temporal decay: each fact gets a freshness score that falls over time using a formula inspired by the Ebbinghaus forgetting curve. Different categories of facts decay at different rates, so employment data (which changes often) goes stale faster than objective facts (which rarely change). The second approach is contradiction detection, which scans new user input for signals that an old fact no longer holds, such as a sentence like "I just moved to a new city." The third is category-aware time-to-live settings, with nine predefined categories (employment, location, contact, preference, relationship, skill, belief, fact, general) that each have their own configurable half-life.
Developers interact with memwatch through a simple Python API or a command-line tool. The core workflow is to add facts with a category label, call check() whenever new user input arrives, and then review any suggested updates. You can also run a report to see all stored memories along with their current freshness scores and estimated days remaining. An optional dependency on sentence-transformer embeddings improves contradiction detection; leaving it out gives a pure standard-library build.
The library includes adapters for mem0, LangChain, and existing SQLite databases. These adapters let teams add staleness detection to an agent memory system without rewriting their storage layer. The SQLite adapter in particular overlays memwatch on an existing database and does not require any schema changes.
memwatch is at an early stage: benchmarks are listed as coming soon and the repository was created in June 2026. It is available on PyPI, published under the MIT license, and written entirely in Python. The README does not document a server component or hosted service, so all processing runs locally.
Where it fits
- Add staleness tracking to a mem0 or LangChain agent so it stops repeating outdated facts after the user mentions a change like switching jobs.
- Use the SQLite adapter to overlay memwatch onto an existing agent memory database and add decay scores without changing the schema.
- Run a freshness report on all stored agent memories to see which facts are close to expiry and review them before the agent uses them again.
- Configure per-category half-lives so employment facts expire within weeks while objective facts stay valid for months.