Predictive memory
Shipped in v3-alpha (Beta). One of the four zero-LLM features — pure pattern mining over data we already have. Interfaces may still change before 3.0 stable.
The philosophy
The brain doesn’t just recall the past — it anticipates the future. This costs $0 in LLM tokens because it’s pattern mining on existing data: event history, recall logs, session co-occurrence.
ANTICIPATION ENGINE
Pure SQL/code. Zero LLM calls. Mines temporal patterns.
Input: Episode graph + Event stream + Session history
Output: Pre-fetched context injected BEFORE the agent needs it
Saves: 1–3 recall round-trips per session (~200ms + tokens each)Four pattern types
interface TemporalPattern {
type: "sequential" | "periodic" | "conditional" | "co-occurrence";
confidence: number; // 0–1, based on observation count
observations: number;
lastSeen: Date;
}1. Sequential — “after A, B usually follows”
SQL: event pairs within 24h window, count co-occurrences
e.g.: "After deploy.success → billing.spike (85% conf, 23 obs)"2. Periodic — “every Monday 9am, agent asks about X”
SQL: group recalls by DOW + hour, find peaks
e.g.: "Mon 9–11am: 80% of recalls are about 'weekly metrics'"3. Conditional — “when entity X mentioned, facts about Y are needed”
SQL: co-recall analysis
e.g.: "When 'production' mentioned → 90% chance 'deploy runbook' is recalled"4. Co-occurrence — “facts A, B, C always recalled together”
Already tracked via Hebbian co_recall_countImplementation (zero-cost)
-- Cron: mnemo.anticipate.mine (daily 06:30 UTC)
-- Mines last 30 days of recall telemetry
CREATE MATERIALIZED VIEW mv_sequential_patterns AS
SELECT
e1.name AS trigger_event,
e2.name AS following_event,
COUNT(*) AS observations,
COUNT(*)::float / total.cnt AS confidence,
AVG(EXTRACT(EPOCH FROM e2.occurred_at - e1.occurred_at)) AS avg_delay
FROM mnemo_event e1
JOIN mnemo_event e2 ON e2.workspace_id = e1.workspace_id
AND e2.occurred_at > e1.occurred_at
AND e2.occurred_at < e1.occurred_at + INTERVAL '24 hours'
CROSS JOIN LATERAL (
SELECT COUNT(*) AS cnt FROM mnemo_event
WHERE name = e1.name AND workspace_id = e1.workspace_id
) total
GROUP BY e1.name, e2.name, total.cnt
HAVING COUNT(*) >= 3 AND COUNT(*)::float / total.cnt > 0.5;ROI
Without anticipation:
Agent calls recall 2–3× per session
Cost: 2–3 × (embedding + retrieval) tokens
With anticipation:
Pattern engine pre-injects top-3 likely facts
Agent skips those recall calls
Savings: ~300–600 tokens/session
~200–600ms latencyMCP integration
Anticipation is invisible to the agent — pre-loaded context. But agents
can query it explicitly via memory_introspect.
See also
- Meta-cognition — uses the same materialized-view machinery
- Zero-LLM features — the family this belongs to