ENGINEERING
Temporal Intelligence: Why Your AI Agent's Memory Should Decay Like a Human's
Your brain doesn't store every memory with equal weight. A conversation from five minutes ago feels vivid and accessible. A conversation from five years ago? It's fuzzy at best — unless something kept reinforcing it.
Most AI memory systems ignore this entirely. They treat a fact stored five months ago with the same importance as one stored five seconds ago. The result? Agents that surface outdated preferences, reference stale context, and burn tokens on memories that stopped being relevant long ago.
At 0Latency, we built temporal intelligence directly into the memory layer. Every memory has a half-life. Every access reinforces it. The result is an agent that naturally prioritizes what matters right now — just like you do.
The Problem With Flat Memory
Consider a simple example. Your AI agent assists a user named Sarah. Six months ago, Sarah mentioned she was planning a trip to Tokyo. Last week, she mentioned she just got back from Tokyo and is now focused on a project deadline.
In a flat memory system — the kind used by most memory providers — both facts have equal retrieval weight. When Sarah asks "What should I focus on today?", the agent might surface the Tokyo travel planning memory alongside the project deadline. It wastes context tokens and confuses the response.
This isn't a theoretical problem. In production systems with thousands of memories per user, flat retrieval means your agent is constantly wading through a swamp of irrelevant context. The cost in tokens alone is staggering — but the cost in response quality is worse.
How Human Memory Actually Works
Cognitive scientists have studied memory decay for over a century, starting with Hermann Ebbinghaus's forgetting curve in 1885. The core insight is simple: memories decay exponentially over time, but each time you recall a memory, it gets reinforced and decays more slowly going forward.
This creates a natural prioritization system:
- Frequently accessed memories stay strong — they're clearly important
- Recently created memories start with high relevance
- Old, untouched memories fade — they're probably not needed
- Old but regularly accessed memories remain strong — they're core knowledge
This is exactly the model 0Latency implements. We call it temporal scoring.
The Half-Life Decay Model
Every memory in 0Latency has a temporal score between 0 and 1. The score is calculated using an exponential decay function with access reinforcement:
# Temporal score formula
score = base_strength * (0.5 ^ (time_elapsed / half_life))
# Where:
# base_strength increases with each access (reinforcement)
# time_elapsed = hours since last access
# half_life = configurable decay rate (default: 168 hours / 7 days)
The default half-life of 7 days means that an unreinforced memory loses half its temporal score every week. After a month, it's at ~6% of its original strength. After two months, it's effectively zero.
But here's where it gets interesting: every time your agent retrieves a memory, the base strength increases and the clock resets. A memory accessed daily will maintain a high temporal score indefinitely. This is access reinforcement — the same mechanism your brain uses.
Temporal Scoring in Practice
Here's how you use temporal scoring with the 0Latency API:
Python
import requests
API_KEY = "your-api-key"
BASE_URL = "https://api.0latency.ai"
# Store a memory — temporal scoring is automatic
response = requests.post(f"{BASE_URL}/memories/extract", headers={
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}, json={
"agent_id": "support-agent",
"content": "Sarah is focused on the Q2 project deadline",
"metadata": {
"user_id": "sarah-123",
"category": "priorities"
}
})
# Retrieve memories — temporal scoring is applied automatically
# Recent and frequently-accessed memories rank higher
results = requests.post(f"{BASE_URL}/memories/search", headers={
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}, json={
"agent_id": "support-agent",
"query": "What is Sarah working on?",
"user_id": "sarah-123",
"limit": 5
# temporal_weight is applied by default (0.3)
})
for memory in results.json()["memories"]:
print(f"Score: {memory['score']:.3f} | "
f"Temporal: {memory['temporal_score']:.3f} | "
f"{memory['content']}")
JavaScript
const API_KEY = "your-api-key";
const BASE_URL = "https://api.0latency.ai";
// Store a memory
await fetch(`${BASE_URL}/memories/extract`, {
method: "POST",
headers: {
"X-API-Key": API_KEY,
"Content-Type": "application/json"
},
body: JSON.stringify({
agent_id: "support-agent",
content: "Sarah is focused on the Q2 project deadline",
metadata: { user_id: "sarah-123", category: "priorities" }
})
});
// Search with temporal scoring (applied by default)
const results = await fetch(`${BASE_URL}/memories/search`, {
method: "POST",
headers: {
"X-API-Key": API_KEY,
"Content-Type": "application/json"
},
body: JSON.stringify({
agent_id: "support-agent",
query: "What is Sarah working on?",
user_id: "sarah-123",
limit: 5
})
});
const { memories } = await results.json();
memories.forEach(m =>
console.log(`Score: ${m.score.toFixed(3)} | Temporal: ${m.temporal_score.toFixed(3)} | ${m.content}`)
);
How scoring works: The final retrieval score is a weighted blend of semantic similarity (how relevant the memory is to the query) and temporal score (how fresh/reinforced it is). By default, temporal weight is 0.3 — meaning 30% of the score comes from recency/reinforcement. You can tune this per query.
Configuring Decay Behavior
Different use cases need different decay rates. A customer support agent might need memories to stay fresh for weeks, while a trading bot needs aggressive decay measured in hours.
# Configure half-life per agent
requests.patch(f"{BASE_URL}/agents/support-agent", headers={
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}, json={
"memory_config": {
"half_life_hours": 336, # 2 weeks — support context stays longer
"temporal_weight": 0.4, # Weight recency more heavily
"reinforce_on_read": True # Each retrieval reinforces the memory
}
})
How This Compares to Competitors
Let's be direct about what other memory providers offer in terms of temporal intelligence:
| Feature | 0Latency | Mem0 | Zep |
|---|---|---|---|
| Temporal decay model | ✅ Half-life with reinforcement | ❌ No decay | ⚠️ Basic recency bias |
| Access reinforcement | ✅ Automatic on every read | ❌ Not available | ❌ Not available |
| Configurable half-life | ✅ Per-agent configuration | ❌ N/A | ❌ N/A |
| Temporal + semantic blend | ✅ Weighted scoring | ❌ Semantic only | ⚠️ Limited |
| Memory importance preservation | ✅ P0-P2 priority tiers | ❌ Flat | ⚠️ Manual tags |
Mem0 stores memories with semantic search but treats all memories as equally current. Zep has some recency awareness, but it's a simple timestamp sort — not a decay model, and definitely not reinforcement learning. Neither system understands that a memory accessed 50 times should persist longer than one accessed once.
Priority Tiers: When Memories Shouldn't Decay
Not every memory should fade. A user's name, their core preferences, critical business rules — these need to persist indefinitely. That's why 0Latency supports priority tiers alongside temporal scoring:
- P0 (Critical): Never decays. User identity, core preferences, compliance rules.
- P1 (Important): Slow decay (4x half-life). Key project context, ongoing relationships.
- P2 (Standard): Normal decay. Conversational context, temporary preferences.
This maps directly to our L0/L1/L2 context budget system, ensuring that critical memories are always loaded first, while transient context competes on relevance and freshness.
Real-World Impact: Dogfooding with Thomas
In our own testing with Thomas (our AI Chief of Staff running on 0Latency), enabling temporal scoring immediately improved recall quality. The agent stopped surfacing outdated pricing ($15/student from two weeks ago instead of current $20/student) and stale project context. Frequently-accessed memories like active task lists stayed ranked high, while one-off conversations from weeks ago naturally faded.
Read the full story in our Thomas case study.
Implementation Details
Under the hood, temporal scoring happens at query time — not as a background job. When you search memories, 0Latency:
- Performs semantic search using vector similarity (pgvector)
- Calculates temporal scores for each candidate memory
- Blends the scores using configurable weights
- Updates access timestamps for reinforcement (if enabled)
- Returns results ranked by the blended score
The entire process completes synchronously in the request path. There's no cron job decaying your memories in the background — the decay is mathematical, computed on the fly. This means zero maintenance and perfectly deterministic behavior.
Getting Started
Temporal scoring is enabled by default on all 0Latency plans, including the free tier. You don't need to configure anything — just store and search memories, and temporal intelligence handles the rest.
For advanced use cases, you can:
- Adjust
half_life_hoursper agent - Change
temporal_weightper query - Disable reinforcement for read-only scenarios
- Set priority tiers to protect critical memories from decay
Check out the full documentation for configuration details and API reference.
Ready to give your agent a memory that thinks?
Start with 10,000 free memories. Temporal scoring included on every plan.
Get Your Free API Key →Frequently Asked Questions
Does temporal decay delete my memories?
No. Temporal decay only affects retrieval ranking. All memories are stored permanently. A memory with a low temporal score simply ranks lower in search results — it's never deleted unless you explicitly remove it.
Can I disable temporal scoring?
Yes. Set temporal_weight: 0 in your query to use pure semantic search. You can also disable it at the agent level. However, we recommend keeping it enabled — most developers see immediate improvements in retrieval quality.
What's the default half-life?
168 hours (7 days). This works well for most conversational AI use cases. Customer support agents often benefit from longer half-lives (14-30 days), while real-time applications might use shorter ones (24-48 hours).
How does reinforcement work exactly?
Every time a memory is returned in a search result, its base_strength increases by a small increment and its last_accessed timestamp resets. This means frequently relevant memories stay strong indefinitely, while rarely-accessed memories naturally fade. You can disable this with reinforce_on_read: false.
Is temporal scoring available on the free plan?
Yes. Temporal scoring is a core feature available on all plans, including the free tier with 10,000 memories and 3 agents. There's no feature gating on memory intelligence — we believe every agent deserves smart retrieval.