The garbage collection engine for AI agent memory.
Vector databases retrieve similar text, but cannot resolve contradiction or time. Sieve scores memories, supersedes outdated facts, and prunes stale context with ~0.2ms local latency—without burning tokens on per-turn LLM calls.
- [DECISION] Our primary database is configured as PostgreSQL 15 on port 5432. - [TASK] TODO: Deploy staging cluster before Friday's investor presentation.
Score → Supersede → Prune Pipeline #
How Sieve manages agent memories in three simple stages. It runs locally in your Python agent loop or as a background service with ~0.2ms latency in local mock benchmarks.
Filter Out Noise
Every memory an agent records is scored in ~0.2ms. Sieve separates key decisions and tasks from casual conversation ("hello", "thanks", small talk), keeping only what truly matters.
Spot Changing Facts
When a user updates instructions (like switching from PostgreSQL to MongoDB), standard vector search gets confused. Sieve compares facts pairwise and immediately identifies that the older record is now outdated.
Keep Prompts Clean
Before calling your LLM, Sieve evicts all outdated facts from the prompt. Your agent only sees the latest single source of truth—preventing hallucinations and slashing token costs by up to 70%.
- [DECISION] Primary database configured as PostgreSQL 15 on port 5432. - [DECISION] AWS ECS Fargate container selected for deployment runtime. - [CHAT] haha yeah sounds good, let's connect later today! - [TASK] TODO: Deploy staging cluster before Friday's investor demo. - [DECISION] Actually, we migrated to MongoDB 7.0 for document schemas.
- [DECISION] Actually, we migrated to MongoDB 7.0 for document schemas. - [TASK] TODO: Deploy staging cluster before Friday's investor presentation.
Honest Performance & Labeled Evaluation #
Evaluated against 1,000 conversational turns and 14 adversarial ground-truth pairs testing hard negatives (clarification questions, orthogonal updates, and revisions). Verified with 60 passing tests across Apple Silicon and Linux x86_64.
| Architecture Approach | Contradiction Strategy | Staleness Precision | Staleness F1 | Scoring Latency | 10k Turn API Cost | Context Window Impact |
|---|---|---|---|---|---|---|
| Vector Stores (Chroma, Pinecone) | Topical Similarity (Blind to Time) | ~0% (Returns Both) | N/A | 15ms | $0.00 | High hallucination risk; returns conflicting facts |
| Generative LLM Triage (Mem0, Letta) | Autoregressive Prompts (GPT-4o) | ~95.0% | ~92–95% | 850ms – 2,200ms | ~$13.50 | Prunes memory, but adds 1–2s per-turn user latency |
| Sieve (Local Heuristic Engine) | Deterministic Overlap + Interrogative Guard | 100.0% (0 false alarms) | 88.9% | ~0.19ms | $0.00 | 20–43% bloat pruned locally via SQLite FTS5 |
| Sieve (Neural Laya Model) | Calibrated ModernBERT Cross-Encoder | 100.0% (0 false alarms) | 75.0% | ~33ms GPU / ~390ms CPU | $0.00 | True probability-calibrated supersession without cloud API |
benchmarks/eval_dataset.py. Clarification questions ("What port is Postgres on?") and orthogonal architecture decisions ("Deploying Redis alongside Postgres") achieve a 0% false positive rate, ensuring critical facts are never accidentally pruned.
LayaScorer: Calibrated non-autoregressive ModernBERT cross-encoder with calibrated probability scores on GPU/CPU.
RLock), sticky user restoration immunity, automatic FTS5 trigger cleanup on purges, and cached pairwise sweeps to eliminate redundant O(N) evaluations.
Watch Supersession Detection in Real-Time #
Watch an autonomous agent session execute below in real time. As new conversation turns arrive and facts change, Sieve's deterministic pairwise engine instantly supersedes stale memories and prunes the prompt.
- [DECISION] We decided to deploy PostgreSQL as our primary database engine. - [TASK] TODO: Provision staging cluster environment before Friday's demo.
Engineered for Your Existing Stack #
Drop Sieve into Python agent loops, LangChain LCEL chains, Chroma vector stores, or run as a standalone FastAPI microservice.
# 1. Initialize persistent memory store (pure Python, SQLite + FTS5) from sieve import SieveMemory memory = SieveMemory("agent_memory.db") # 2. Record conversation turns scoped to a session/tenant memory.remember("Primary database is PostgreSQL.", namespace="user_88") memory.remember("TODO: Email weekly summary to team.", namespace="user_88") # User updates their architecture preference later in the session: memory.remember("Actually, we migrated to MongoDB instead of PostgreSQL.", namespace="user_88") # 3. Sweep prunes outdated PostgreSQL note (superseded_by: MongoDB) memory.sweep(namespace="user_88") # 4. Formatted, clean context string ready for system prompt system_prompt_context = memory.get_context(namespace="user_88")