Skip to main content
Call this endpoint at the beginning of every conversation — before your agent generates its first response. Remem returns the most important and recent memories for the user so your agent already knows who they are and what they care about. If you supply current_message, the retrieval switches to semantic mode and returns memories most relevant to what the user just said, rather than a general importance-and-recency sort.
Endpoint: GET https://api.remem.online/memories/context

Request Headers

Query Parameters

string
required
Load memories belonging to this user.
string
required
Load memories belonging to this agent.
integer
default:"10"
Maximum number of memories to return. Minimum 1, maximum 50.
string
The first message sent by the user in this session. When provided, Remem uses semantic retrieval to return memories most relevant to this message. When omitted, memories are sorted by importance and recency.

Code Examples

Response

200 — Success

The response uses the same Memory object shape as the Search Memories endpoint. Refer to the Memory Object Fields table there for a full field-by-field description. Key fields at a glance:

Error Responses

Notes

Use context() at session start, before you have a specific query. It surfaces the memories that are most important and recent for this user overall, giving your agent a baseline understanding before the conversation begins.Use recall() (the Search Memories endpoint) during a session, when the user says something specific and you want memories relevant to that particular message.You can combine both: call context() once at the start to pre-populate your system prompt, then call recall() on each user turn to retrieve memories relevant to what they just said.
If the user has no stored memories yet, context() returns an empty memories array. Make sure your agent handles this gracefully rather than treating it as an error:
A total of 0 in the response is the reliable signal that no memories exist yet for this user + agent pair.