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)
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:
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: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
prisma.memory.findMany()call with orderingsearch()(types, tags, cooldowns)