Core Concepts
Recall memory
Ask a memory space a question with Lynk and get back the most relevant, current memories.
lynk.recall takes a question in plain words and returns the memories that answer it, best first. You don't need to match the stored text or know which memories exist.
Recall memories
This example asks one question and prints what comes back:
from docklee import Lynk
lynk = Lynk()
records = lynk.recall_sync("How does Maya like to be contacted?", top_k=5)
for record in records:
print(record.confidence, record.content)The API returns a list, best match first:
[
{
"id": "9b1e7c42-5d3a-4f08-b6e2-1a7c0d93e5f4",
"content": "Maya now prefers phone calls.",
"memory_type": "entity",
"confidence_score": 0.91
},
{
"id": "e47a03d9-2c18-4b6f-8e5a-7f1d9c2b0a36",
"content": "Maya moved from Austin to Denver last month.",
"memory_type": "entity",
"confidence_score": 0.64
}
]The older email preference isn't in the list. It was replaced by the newer one, so recall returns only the current value.
recall options
| Option | Python | TypeScript | Default | Description |
|---|---|---|---|---|
| Query | query | first argument | none | The question, in plain words. |
| Memory space | memory_space_id | memorySpaceId | DOCKLEE_MEMORY_SPACE_ID | The space to read for this call. |
| Result count | top_k | topK | 5 | How many memories to return, from 1 to 50. |
| End user | end_user | endUser | DOCKLEE_END_USER | Returns only that person's memories. Required in a multi-user space. |
The memory record
| Python | TypeScript | Description |
|---|---|---|
memory_id | memoryId | The memory's ID. |
content | content | The remembered text. |
memory_type | memoryType | The storage class of the memory. See Memory types. |
confidence | confidence | How strongly this memory answers the query, from 0 to 1. |
Sync and async
In Python, recall is async and recall_sync blocks. Use the one that matches your code:
records = await lynk.recall("What plan is the customer on?")
records = lynk.recall_sync("What plan is the customer on?")Use memories in a prompt
Join the recalled memories into a short block above the user's message:
records = lynk.recall_sync(user_message, end_user=user_id)
known = "\n".join(f"- {record.content}" for record in records)
prompt = f"What you know about this user:\n{known}\n\nUser: {user_message}"Recall before your model replies, and capture after. Each turn then starts with what your app already knows and adds what it just learned.
Next steps
You can read memories back. Learn how Docklee picks which ones to return.