thread-recall
Part of the Governed Agent Stack: free, on-prem building blocks for an AI agent you can point at a real database and audit.
Governed, on-prem conversation memory for AI agents. It stores what an agent should remember across turns — per-thread history and optional semantic recall — and makes that memory governable: PII can be masked before it is ever written, and every write can be mirrored into a tamper-evident audit log.
The default backend is SQLite with embeddings as JSON and cosine in Python: zero dependencies, works immediately, nothing leaves the building. A Postgres + pgvector backend (for scale) is the next step; the scoring logic is backend-agnostic so it drops in cleanly.
This is the write-side companion to sql-steward. sql-steward is the read-only query gateway and stays read-only; thread-recall is where agent state lives, kept separate on purpose.
Quickstart
pip install thread-recall
thread-recall demo
from thread_recall import Memory
mem = Memory("agent.db") # or ":memory:"; mask=True / audit=True optional
mem.remember("thread-42", "user", "How much MRR did the pro plan make?", embedding=embed(q))
mem.remember("thread-42", "assistant", "Pro plan MRR was 297.")
mem.recent("thread-42", k=10) # last 10 turns, chronological
mem.search("thread-42", embed("revenue"), k=5) # nearest turns by embedding
Why it's "governed"
- PII masked on write.
Memory(..., mask=True)runs content through pii-veil before it is stored, so raw personal data never lands in the memory store. No-op if pii-veil isn't installed. - Tamper-evident audit.
Memory(..., audit=True)mirrors every write into an agent-blackbox hash-chained ledger, so "what did the agent choose to remember" has a checkable answer. No-op if agent-blackbox isn't installed. - On-prem by default. SQLite file on your disk; embeddings generated by whatever local model you choose. Nothing is sent out.
API
| Method | Purpose |
|---|---|
remember(thread_id, role, content, embedding=None, metadata=None) |
Store a turn (PII-masked first if enabled). Returns its id. |
recent(thread_id, k=10) |
Last k turns, chronological. |
search(thread_id, query_embedding, k=5) |
Semantic recall: nearest turns by cosine over stored embeddings. |
forget(thread_id) |
Delete a thread's memory. |
count(thread_id=None) |
Turn count for a thread, or overall. |
Embeddings are supplied by the caller (generate them with any local model). thread-recall stores and scores them; it does not call out to any embedding service itself.
Roadmap
- Postgres + pgvector backend for scale and native nearest-neighbour (the SQLite backend computes cosine in Python, fine for thread-scoped recall, not for millions of rows).
- A thin LangGraph adapter, to use thread-recall alongside a LangGraph checkpointer.
Develop
git clone https://github.com/Pawansingh3889/thread-recall
cd thread-recall
pip install -e ".[dev]"
pytest -q
License
MIT
Metadata
Release files for thread-recall 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| thread_recall-0.1.1.tar.gz | 10.8 kB | With provenance | Details for thread_recall-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| thread_recall-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for thread_recall-0.1.1-py3-none-any.whl |
Total release size: 21.6 kB
Release files / thread_recall-0.1.1.tar.gz
| Download URL | thread_recall-0.1.1.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1bd12697600ae4db35612e9ec89e9db4c55321808efc4dead5d758f2d3777b29
|
|
BLAKE2b-256 checksum How to use checksums |
734c88239646bc1f69e7cecc0e5e8d3c115a22a44631d05d725c69bbecd82cf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.
Transparency logRelease files / thread_recall-0.1.1-py3-none-any.whl
| Download URL | thread_recall-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2fc5d7e6863f20c20d2aa7d69586064a5394c134caf27e02de0af6274adfbb1
|
|
BLAKE2b-256 checksum How to use checksums |
e8101eab368462d0532c6b960e9d959e7f870683fa33ee6e91b9b65f3be397ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.
Transparency logSecurity for thread-recall 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for thread_recall-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.