Skip to main content

Temporal Memory

Query memories from specific points in time using temporal queries.

Temporal Queries

MEMANTO supports three types of time-based queries:

1. As Of (Point in Time)

Query memories as they existed at a specific time:
Query: "What did we know on March 28?"
Result: Memories as they were on March 28,
        ignoring any superseded memories
Use case: Historical audit trail
# Get state as of yesterday
response = httpx.get(
    f"{base}/agents/{agent}/recall/as-of",
    params={
        "query": "customer status",
        "as_of": "2025-03-28T14:00:00Z"
    },
    headers=headers
)

2. Changed Since (Time Range)

Query memories created or modified since a date:
Query: "What changed in the last 7 days?"
Result: All memories created or modified since that date
Use case: Recent updates and changes
# Get all changes from last week
response = httpx.get(
    f"{base}/agents/{agent}/recall/changed-since",
    params={
        "query": "all updates",
        "changed_since": "2025-03-23"
    },
    headers=headers
)

3. Current Only (Non-Superseded)

Query only current, non-superseded memories:
Original: "Project deadline is April 15"
Superseded: "Project deadline is May 1"

Query: "What's the deadline?" --current-only
Result: "Project deadline is May 1" (ignores old deadline)
Use case: Get ground truth without outdated info
# Get only current commitments
response = httpx.get(
    f"{base}/agents/{agent}/recall/current",
    params={"query": "commitments"},
    headers=headers
)

Time Format

MEMANTO uses ISO 8601 format with UTC:
2025-03-30T16:30:00Z
 └─ YYYY-MM-DDTHH:MM:SSZ (always UTC)
Dates can also be:
2025-03-30  (just date, uses midnight UTC)

Use Cases

1. Audit Trail

Verify what was known at a specific time:
# What did we know about Alice on March 1?
response = httpx.get(
    f"{base}/agents/support/recall/as-of",
    params={
        "query": "customer Alice",
        "as_of": "2025-03-01T00:00:00Z"
    },
    headers=headers
)

2. Change Tracking

See what changed during a project:
# What changed during the sprint?
response = httpx.get(
    f"{base}/agents/project/recall/changed-since",
    params={
        "query": "all updates",
        "changed_since": "2025-03-24"
    },
    headers=headers
)

3. Ground Truth

Get current facts without confusion from updates:
# What are we currently committed to?
response = httpx.get(
    f"{base}/agents/project/recall/current",
    params={"query": "commitments"},
    headers=headers
)
# Returns only active commitments, not superseded ones

4. Time Series Analysis

Track how information changed over time:
# How has the deadline changed?
dates = ["2025-03-01", "2025-03-15", "2025-03-30"]

for date in dates:
    response = httpx.get(
        f"{base}/agents/project/recall/as-of",
        params={
            "query": "project deadline",
            "as_of": date
        },
        headers=headers
    )
    result = response.json()["memories"][0]["content"]
    print(f"{date}: {result}")

# Output:
# 2025-03-01: Project deadline is April 15
# 2025-03-15: Project deadline is May 1
# 2025-03-30: Project deadline is May 1 (extended)

5. Regression Detection

Find when something changed:
# When did the customer's preference change?
test_dates = ["2025-03-20", "2025-03-25", "2025-03-30"]

for date in test_dates:
    response = httpx.get(
        f"{base}/agents/support/recall/as-of",
        params={
            "query": "contact preference",
            "as_of": date
        },
        headers=headers
    )
    pref = response.json()["memories"][0]["content"]
    print(f"{date}: {pref}")

# Find when it changed from "phone" to "email"

Memory Versioning

When you supersede a memory:
Original Memory
  └─ Created: 2025-03-20
     Content: "Project deadline: April 15"
     Status: Current

Superseded by New Memory
  └─ Created: 2025-03-25
     Content: "Project deadline: May 1 (extended)"
     Status: Current

"As of" Queries:
  └─ Before March 25: Returns original memory
  └─ After March 25: Returns new memory

Best Practices

DO

  • Use ISO 8601 timestamps
  • Supersede outdated memories
  • Check “current only” for ground truth
  • Track important changes over time
  • Document why memories change

DON’T

  • Delete old memories (supersede instead)
  • Ignore temporal information
  • Mix old and new data without checking dates
  • Assume memories never change
  • Forget to extend sessions for long operations

Next Steps