Temporal Event Tracking

Category: Retrieval

Problem

Users ask time-based questions: "What did we discuss last week?", "When did the user switch to the new framework?", "What's changed since my last visit?" Pure vector search has no concept of time — it returns results by semantic similarity regardless of when events occurred.

Architecture

Dakera's hybrid retrieval includes temporal awareness. Memories are stored with timestamps and the retrieval system understands temporal expressions in queries. The BM25 component matches date strings while the temporal inference engine resolves relative time expressions.

Flow

Implementation

from dakera import Dakera
from datetime import datetime

client = Dakera(base_url="http://localhost:3300", api_key="dk-...")

# Store events with temporal context in the content
client.memory.store(
    content="2026-05-01: Migrated database from PostgreSQL 14 to PostgreSQL 16",
    namespace="project-log",
    metadata={"type": "event", "date": "2026-05-01", "category": "infrastructure"}
)

client.memory.store(
    content="2026-05-08: Deployed v2.3.0 with new caching layer. Response time dropped 40%.",
    namespace="project-log",
    metadata={"type": "event", "date": "2026-05-08", "category": "deployment"}
)

client.memory.store(
    content="2026-05-12: User reported they switched from React to Svelte for the frontend",
    namespace="project-log",
    metadata={"type": "event", "date": "2026-05-12", "category": "tech-choice"}
)

# Temporal queries work naturally
results = client.memory.recall(
    query="What infrastructure changes happened this month?",
    namespace="project-log",
    top_k=10
)
# Returns the PostgreSQL migration and deployment events

# Query about specific timing
results = client.memory.recall(
    query="When did the user switch frontend frameworks?",
    namespace="project-log",
    top_k=5
)
# Returns: "2026-05-12: User reported they switched from React to Svelte"

# Search for recent changes
results = client.memory.search(
    query="What changed in the last 7 days?",
    namespace="project-log",
    top_k=10
)

TypeScript Example

import { Dakera } from 'dakera';

const client = new Dakera({
  baseUrl: 'http://localhost:3300',
  apiKey: 'dk-...'
});

// Store time-stamped events
await client.memory.store({
  content: `${new Date().toISOString().split('T')[0]}: Sprint planning completed. ` +
    `Prioritized auth refactor and API rate limiting.`,
  namespace: 'project-log',
  metadata: { type: 'event', category: 'planning' }
});

// Recall temporal events
const results = await client.memory.recall({
  query: 'What was planned in the last sprint?',
  namespace: 'project-log',
  topK: 5
});

When to Use This Pattern

Key Considerations