Why Memories exist
Most applications start every conversation from scratch. Memories let your agent carry useful user-specific context from one session to the next, so responses become more personal over time. A memory is information your application saves for later: a preference, a past conversation, a decision, or a fact about a user. For example, saving “this customer already tried restarting” lets a support agent avoid suggesting it again. Your application must send the information to HydraDB; it is not captured automatically. See Knowledge vs Memories for a side-by-side comparison.The mental model: user context vs. shared context
Choose by the purpose of the content: reference material goes in Knowledge; information to remember between conversations goes in Memories. A private document can still be knowledge. To keep a user’s memories separate, send that user’scollection on writes, status checks, and queries. Your backend selects it from the authenticated session. Content categories do not grant or enforce user access.
Good candidates for Knowledge ingestion include product docs, policy PDFs, internal wikis, Slack exports, and other shared material that should be reusable across users.
What happens when you ingest a memory
When you callPOST /context/ingest with type=memory, HydraDB turns your input into queryable user context.
The pipeline works like this:
- Parse the input: raw text, markdown, or user-assistant pairs.
- Optionally infer meaning: if
infer: true, HydraDB extracts the underlying preference, trait, or fact. - Index it: once indexed,
POST /querycan retrieve it withtype: "memory"ortype: "all".
infer. It decides whether HydraDB should extract a useful fact from text or dialogue, or store exactly what you send.
Ingestion is asynchronous, so memories are not queryable immediately. Poll GET /context/status until the memory reaches at least graph_creation, or wait for indexing_status to become completed if you need full indexing. Alternatively, register a webhook to be notified when indexing finishes instead of polling.
Choose the right input shape
Each memory item takes eithertext or user_assistant_pairs, not both (sending both returns 400). Choose the shape that matches the content you already have.
Text
Usetext for any prose input: plain observations, captured facts, preference statements, meeting notes, memos, or semi-structured records. Set is_markdown: true when the content uses markdown syntax (headings, lists, code blocks) and you want HydraDB to preserve that structure during chunking and embedding. Leave is_markdown unset (or false) for plain prose.
User-assistant pairs
Useuser_assistant_pairs when the useful signal comes from dialogue, especially when the preference is implied rather than explicitly stated.
Memory fields
The full schema lives onPOST /context/ingest. For type=memory, send a JSON-stringified memories array; each item can use the fields below.
Request-level fields
memories item fields
Query memories
Memories live in their own store, separate from Knowledge.POST /query reaches each store through the type parameter:
type: "memory"queries the Memories store (vectorstore_status.memories).type: "knowledge"queries the Knowledge store (vectorstore_status.knowledge).type: "all"runs both in parallel and returns a single merged, re-ranked result set.
One endpoint, two stores. Both stores are read from the same collection. If shared documents live in their own collection, list it next to the user’s in
collections. See Query.Minimal working example
This example stores a user preference scoped to one user.id for each memory and an initial status of queued. The payload is wrapped in the standard envelope, so the fields live under data (response.data.results):
GET /context/status with the returned id, or register a webhook, until the memory is indexed.
Choose whether HydraDB should infer the memory
infer controls how much extraction work your application does before sending content to HydraDB.
Use infer: true when the input is raw signal
With infer: true, you give HydraDB messy or indirect evidence (dialogue, logs, behavior, feedback, or observations), and HydraDB extracts the useful preference, trait, or fact.
For example, instead of writing your own logic to decide whether a user prefers dark mode, send the raw stream of UI events and let HydraDB infer it. The example below shows exactly this.
Use infer: true for:
- Dialogue where the preference is implicit.
- Behavior logs and event streams.
- Feedback like “the last summary was too long.”
- Any input where the useful memory needs to be derived from raw context.
custom_instructions only takes effect when infer: true. Use it to guide extraction, for example: "Focus on UI and notification preferences only".
Use infer: false when the input is already the memory
With infer: false (the default), HydraDB stores and indexes exactly what you send. There is no extraction step.
Use infer: false for:
- Facts you already captured, such as
"User's plan tier is Pro". - Pre-structured notes.
- Content you want to retrieve exactly as written.
infer: false is faster and deterministic. infer: true is better when your input is raw, noisy, or indirect.
Example: infer a preference from behavior
Here is a more realistic example. A user has been toggling dark mode in your app. Instead of extracting the preference yourself, send the raw behavior log and let HydraDB infer the useful memory.POST /query runs with type: "memory" and a query like "what UI settings does the user prefer?", HydraDB can return the inferred preference (for example, "prefers dark mode") rather than the raw event log.
If you sent the same input with infer: false, HydraDB would index the event log verbatim. That is useful only when you want to retrieve the log itself.
Common mistakes
Related
- Knowledge: shared, database-wide document context
- Query: how memories are retrieved at query time
- Multi-tenant support: scoping memories per user or workspace
- Metadata: designing filterable fields
