Retrieve memories
retrieve_memoriesRetrieve memories by semantic relevance, by date window, or both. Returns
episodes, facts, working memory, concepts, procedures and perceptions,
each in its own list. For a single call that also aggregates entities and
hypotheses on a topic, use cognitive_query.
With `query`, results are ranked by relevance, blended with usage (for
episodes) and confidence (for facts). Without `query`, episodes come newest
first and facts highest confidence first. `orden` set to 'reciente' or
'antiguo' returns episodes and facts in chronological order instead, by
when each thing happened. Retrieval records usage: each
returned episode's importance score rises slightly (so frequently used
memories rank higher later), and returned facts get their access count
updated. Superseded memories are still returned, with the correction
attached in `superseded_por`.
With `query` and no `memory_types`, the response also carries `rules`:
the user's rules relevant to this query, each with `cuando` (the situation
it covers) and `entonces` (what the user set for that situation). A
relevance judge selects them (0 to 3); `juez.alcance` is 'reglas' when the
judge looked only at rules and the other lists are unfiltered. When the
judge did not answer (`juez.aplicado` false), at most the two closest
rules by distance are returned with `juzgada: false`; measured, about half
of those do not apply to the query.
The response always includes:
- `totals`: matches per type within the relevance threshold, before
limit/offset; use `offset` to page through the rest.
- `tipos_consultados`: the memory types actually queried.
- `ventana`: the date window applied ({inicio, fin, origen, etiqueta}).
`origen: "inferida"` means a Spanish recency phrase in the query (such
as "acabo de" or "hace un rato") narrowed the search to the last 24 hours;
pass time_range="all_time" to disable that.
Args:
query: Natural-language description of what to retrieve. Optional:
without it and with a date window, the result is that window
unranked.
entity_id: Restrict to memories linked to this entity UUID.
memory_types: Types to query; omit for all. Values: 'episodic',
'semantic', 'working', 'conceptual', 'procedural', 'perception'
(the response field names such as 'episodes' and 'facts' are
also accepted). An unknown value returns 422 with the accepted values.
limit: Total budget, split evenly across the queried types
(limit // number of types). Default 50, i.e. about 8 items per
type when all six are queried.
offset: Skip the first N episodes/facts to get the next page.
session_id: Include this session's working memory. Without it,
`working_memory` is empty.
time_range: Window label. Calendar days in the user's time zone:
'today', 'yesterday', 'this_week', 'last_week', 'this_month',
'last_month', 'this_year' (Spanish equivalents such as 'hoy',
'ayer', 'anteayer' are also accepted). Rolling: 'last_1h',
'last_6h', 'last_12h', 'last_24h', 'last_48h', 'last_72h',
'last_7d', 'last_14d', 'last_30d', 'last_90d', 'last_180d',
'last_365d'. Unbounded: 'all_time'. An unknown label returns 422.
since: Inclusive ISO-8601 lower bound, e.g. '2026-08-01' or
'2026-08-01T14:30:00'. A date without time starts at 00:00.
until: Inclusive ISO-8601 upper bound. A date without time ends at
the end of that day. `since` later than `until` returns 422.
orden: 'relevancia' (default, the order described above), 'reciente'
(newest first) or 'antiguo' (oldest first). Without `query`,
pages are chronological. With `query`, each page holds the most
relevant memories (as with 'relevancia') returned in date order;
`offset` moves to the next most relevant ones.
`time_range` and `since`/`until` are mutually exclusive; combining them
returns 422. The window applies to every memory type: episodes by when
they happened, facts by the date of the fact (`valid_from`: when it
happened or since when it is true), perceptions by when they were
measured. Each fact carries `fecha_origen` ('declarada': given by its
writer; 'episodio': taken from the episode it came from, approximate;
'registro': when it was stored, nothing better known) and
`fecha_precision` ('momento', 'dia', 'mes', 'anio').
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "retrieve_memories"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| orden | No | relevancia | |
| query | No | ||
| since | No | ||
| until | No | ||
| offset | No | ||
| entity_id | No | ||
| session_id | No | ||
| time_range | No | ||
| memory_types | No |