A forgetting layer for RAG systems — heat-based decay, tiered storage, graceful eviction.
Project description
forget-rag
A forgetting layer for RAG systems — heat-based decay, tiered storage, and graceful eviction so your knowledge base doesn't get dumber over time.
Status: v0.1 (alpha). BM25 + heat ranking, L1/L2/L3 tiers, soft delete with restore-ready schema. Vector layer lands in v0.2.
Install
pip install forget-rag
# with the LangChain adapter
pip install "forget-rag[langchain]"
Quickstart
from forget_rag import ForgettingMemory
memory = ForgettingMemory(
backend="sqlite",
decay_halflife_days=30,
tiers={"L1": 1000, "L2": 10000, "L3": "unlimited"},
)
memory.add("Some knowledge chunk", tags=["meeting", "2026-Q1"])
results = memory.search("query", limit=5) # auto-promotes hot chunks
report = memory.health_check() # what should be forgotten?
What's in the box
- Heat score — every chunk has a decay function based on access frequency + recency.
- L1 / L2 / L3 tiers — modeled after CPU cache; hot stays in vector
- FTS, warm in FTS only, cold is archived but searchable.
- Soft delete —
forget()flags rather than drops; v0.2 will exposerestore()on top of the existingforgotten_atcolumn. - LangChain adapter —
ForgettingRetrieverextendsBaseRetrieverfor drop-in chain use.
Companion CLI
The mem-broom
companion package wraps this library with a typer-based CLI for ad-hoc
memory hygiene. v0.1 ships it as a git install (the PyPI publish is
deferred — see the project README for the install command).
Links
- Repo: https://github.com/zx22413/forget-rag
- Benchmark write-up: https://github.com/zx22413/forget-rag/blob/main/docs/benchmark.md
- Architecture: https://github.com/zx22413/forget-rag/blob/main/docs/architecture.md
- Issues: https://github.com/zx22413/forget-rag/issues
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file forget_rag-0.1.0.tar.gz.
File metadata
- Download URL: forget_rag-0.1.0.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7467fcd19daafa74f94e38ac58fddb0b69d30ef62b8c7c84c9bcc2eb7841fb4
|
|
| MD5 |
0deb8a1278194a4d56b282daf99c1102
|
|
| BLAKE2b-256 |
9a7f994f417755ea7765450f97e167380a7e6f5c5dfdbdc5bf60430c121e7b24
|
Provenance
The following attestation bundles were made for forget_rag-0.1.0.tar.gz:
Publisher:
publish.yml on zx22413/forget-rag
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
forget_rag-0.1.0.tar.gz -
Subject digest:
e7467fcd19daafa74f94e38ac58fddb0b69d30ef62b8c7c84c9bcc2eb7841fb4 - Sigstore transparency entry: 1440264966
- Sigstore integration time:
-
Permalink:
zx22413/forget-rag@ea93b28615908a7230b88cc2824fe7e9e9cf22ca -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/zx22413
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ea93b28615908a7230b88cc2824fe7e9e9cf22ca -
Trigger Event:
release
-
Statement type:
File details
Details for the file forget_rag-0.1.0-py3-none-any.whl.
File metadata
- Download URL: forget_rag-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ff5a3e1da60b9ca408fed159e842cee07f1d4a801d28f41b681abe2e858c8ca
|
|
| MD5 |
5a26cd4047ae8af3fcca4fcaa18d6c6c
|
|
| BLAKE2b-256 |
89a917a43f1072ddad5e75d6326e53b4e368555e8b218693955a6cbb6d322d03
|
Provenance
The following attestation bundles were made for forget_rag-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on zx22413/forget-rag
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
forget_rag-0.1.0-py3-none-any.whl -
Subject digest:
4ff5a3e1da60b9ca408fed159e842cee07f1d4a801d28f41b681abe2e858c8ca - Sigstore transparency entry: 1440264975
- Sigstore integration time:
-
Permalink:
zx22413/forget-rag@ea93b28615908a7230b88cc2824fe7e9e9cf22ca -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/zx22413
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ea93b28615908a7230b88cc2824fe7e9e9cf22ca -
Trigger Event:
release
-
Statement type: