Skip to content

Add list() method for non-semantic memory retrieval #1

@TickTockBent

Description

@TickTockBent

Problem

Currently, to get memories without a semantic query (e.g., for conversation openers where there's no user message yet), consumers must use a workaround:

// Current hack in Jeorge's getRecentMemories()
const results = await johnny.search(namespace, 'recent events and context about user', {
  maxDistance: 0.9, // Very permissive to get more results
})

This is semantically meaningless and relies on the permissive threshold to return something.

Proposed Solution

Add a list() method that retrieves memories by recency without requiring semantic matching:

const memories = await johnny.list(namespace, {
  limit: 10,
  orderBy: 'createdAt',  // or 'updatedAt', 'lastMentionedAt'
  order: 'desc',
  types: ['fact', 'event'],  // optional filter
  excludeMentionedWithin: 18,  // optional cooldown
})

Use Case

Jeorge (conversational journaling app) needs to inject recent memories into the system prompt at conversation start, before the user has sent any message. There's no query to search against, so a simple "get recent memories" is more appropriate.

Implementation Notes

  • This would be a simple prisma.memory.findMany() call with ordering
  • No embedding generation or vector search needed
  • Should support the same filtering options as search() (types, tags, cooldowns)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions