Skip to content

Add memory expiry / TTL support #4

Description

@hd719

Problem

Memories accumulate forever. Over time, outdated facts and stale preferences pollute recall results with irrelevant context, degrading the quality of auto-injected memories.

Proposal

Add optional TTL (time-to-live) support:

  • New ttlDays field on MemoryEntry (nullable — null means permanent)
  • New config option defaultTtlDays (default: null/unlimited for backward compat)
  • Optional ttlDays param on memory_store tool
  • Background cleanup: on plugin start or periodically, delete entries where createdAt + ttlDays < now
  • CLI command: openclaw ltm prune for manual cleanup

Use cases

  • Auto-captured messages should probably expire after 30-90 days
  • Explicitly stored memories can be permanent by default
  • Temporal facts ('meeting tomorrow at 3pm') should auto-expire

Implementation notes

  • Add expiresAt column to the LanceDB schema (nullable number/timestamp)
  • Filter expired entries in search() results
  • Add cleanup in registerService.start()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions