Standard vector RAG (Retrieval-Augmented Generation) for AI agents suffers from two fatal flaws:
- Temporal Confusion: If a user changed their email address three times over 6 months, vector cosine similarity frequently retrieves the old, invalid email address.
- Context Window Blowout: Stuffing entire conversational transcripts into prompt context burns tens of thousands of tokens and causes catastrophic forgetting.
To solve this, we engineered agent-memory-mesh — a local-first Bi-Temporal Knowledge Graph for autonomous agents.
Bi-Temporal Time Axes Explained
Every memory fact in agent-memory-mesh is indexed along two independent dimensions:
- Valid Time: When the fact was actually true in the real world.
- Transaction Time: When the agent recorded the fact into memory.
This eliminates historical contradictions: the agent knows what was true in March 2026 vs what is true today.
74% Lossless Context Compression
Instead of storing raw text transcripts, conversational turns are distilled into semantic graph triples:
(Subject, Predicate, Object, ValidTimeRange, Confidence, MerkleHash)
This achieves a measured 74% reduction in token storage while preserving 100% factual accuracy.
Quick Usage in Python
Install via pip:
pip install agent-memory-mesh
from agent_memory_mesh import MemoryMesh
mesh = MemoryMesh.create_local("./agent_memory.db")
# Store fact with automatic bi-temporal stamps
mesh.remember(
subject="User104",
predicate="auth_token_format",
object_val="Ed25519",
confidence=1.0
)
# Query current point-in-time truth
fact = mesh.query(subject="User104", predicate="auth_token_format")
print(f"Verified Fact: {fact.value} (Recorded: {fact.transaction_time})")
Sovereign Ecosystem & Open Source
- ⭐ GitHub Repository: https://github.com/BenniAlencar/agent-memory-mesh
- 🌐 Benni OS Portal: https://benni-os.net
- 📖 Full Bilingual Architecture: https://benni-os.net/blog/como-utilizar-agent-memory-mesh-no-ecossistema-benni-os.html
Top comments (0)