My AI agent remembers when it believed things — valid-time memory on FalkorDB
Built for Graph Hacks: Context for AI Agents (WeMakeDevs × FalkorDB), Track 2 — Agent Memory and Coordination.
🎬 Demo video (2:13) · 💻 GitHub
The problem: agents can't answer "what did you believe last Tuesday?"
AI agents forget. Worse — when they change their mind, the old belief is gone.
Ask any agent what it believed last Tuesday and you get a shrug. Vector memory stores what's similar. It can't store what was true when. Embeddings have no time axis, so "what did I believe on October 8th?" is a question no similarity search can answer.
This isn't a cosmetic gap. When an agent takes an action based on a belief it later revised, you need to audit the belief it held at that time — not the one it holds now. Incident response, customer-facing decisions, anything with a paper trail: "why did you do that?" only makes sense as "what did you believe then?"
The idea: put a validity interval on every belief
TimeMachine stores agent memory as a graph in FalkorDB where every belief edge carries a validity interval:
(:Agent)-[:BELIEVES {valid_from, valid_to}]->(:Claim)-[:ABOUT]->(:Topic)
(:Claim)-[:SUPPORTED_BY {valid_from, valid_to}]->(:Evidence)
When the agent changes its mind, the old BELIEVES edge is closed (valid_to gets set) — never deleted. An as-of query filters edges to those valid at time T:
MATCH (t:Topic {name: $topic})<-[:ABOUT]-(c:Claim)<-[b:BELIEVES]-(a:Agent)
WHERE b.valid_from <= $as_of AND (b.valid_to IS NULL OR b.valid_to > $as_of)
RETURN c.text AS belief, b.valid_from AS since
That one query reconstructs the exact belief state the agent held at any moment in its past. The graph is a complete audit trail: every belief, every piece of evidence behind it, every change of mind — queryable at any timestamp.
This is the valid-time temporal pattern from temporal-memory research (Zep/Graphiti-style work), implemented natively in Cypher rather than bolted onto a vector store.
The demo: one outage, three truths
I seeded a fictional 2-week incident — a checkout outage — as the demo dataset:
Date
Evidence lands
Agent's belief
Oct 4
Cache hit rate 95% → 40%
Cache misconfiguration
Oct 7
DB pool exhausted, 500 waiters
Connection pool exhaustion
Oct 10
Deploy v2.4 halved pool 100 → 50
Bad deploy v2.4
Oct 14
Traffic spiked 3× during sale
Traffic spike overwhelmed the pool
Same question, three different true answers — depending on when you ask:
agent.ask("What caused the checkout outage?") # → traffic spike (today)
agent.ask("What caused the checkout outage?", as_of="2026-10-08") # → connection pool exhaustion
agent.ask("What caused the checkout outage?", as_of="2026-10-05") # → cache misconfiguration
agent.why_changed("checkout-outage", "2026-10-10") # → deploy v2.4 halved the pool — PR #2214
agent.timeline("checkout-outage") # full belief history
The twist: counterfactual time travel
Here's the part I'm proudest of. Agents get asked "what if?" questions all the time, and they usually hallucinate the answer. TimeMachine answers them honestly — by forking reality.
what_if() uses FalkorDB's multi-graph support to fork the belief graph, remove one piece of evidence, and recompute what the agent would believe in that alternate timeline:
agent.ask("What if the traffic report never existed?")
In reality I believe: "traffic spike overwhelmed the pool" (since Oct 14).
Without the evidence "traffic spiked 3× during sale" (cloudwatch: traffic report),
I would instead believe: "bad deploy v2.4" (since Oct 10).
Same agent, same graph — a different past, a different truth. The fork happens in its own graph (timemachine_whatif), so the real belief history is untouched.
Why FalkorDB — the decoration test
One rule shaped this project: if the product still works once FalkorDB is taken out, the graph is decoration. So I made sure everything would stop working without it:
A vector DB fundamentally cannot answer as-of questions — embeddings have no time axis. Valid-time filtering needs real graph traversal.
As-of reconstruction has to run at in-memory speed inside the agent loop, not as an offline batch job.
Counterfactual forks need native multi-graph support — clone the belief state, delete one evidence, recompute.
Remove FalkorDB and this product dies. That's the point.
Honest limitations
This is a hackathon prototype, and the honest version is:
The dataset is fictional. A real deployment needs ingestion from actual incident tooling, not a seeded timeline.
The what-if is a replay, not a causal model. It re-runs the timeline minus one evidence; it doesn't model why beliefs changed, only when.
Valid-time only, not bitemporal. I track when a belief was true, not when the agent learned it. Real systems will want both axes.
The natural-language front end uses templates with optional LLM polish — it's a thin layer over the Cypher queries, which are the actual product.
What's next
Bitemporal memory (valid time × transaction time), belief confidence decay, and multi-agent shared memory where forks let teams explore "what if we had seen that evidence?" collaboratively.
TimeMachine: memory with a past tense. Track 2 — Agent Memory and Coordination, Graph Hacks 2026.
Top comments (0)