# Ranking (/docs/memory/intelligence/ranking)
Similar words aren't enough to find the right memory. "What did the customer prefer before the redesign?" needs a memory that's about the customer, from the right time, and still trusted. Docklee ranks every recall on several signals at once.

## Five signals [#five-signals]

| Signal | Asks |
| --- | --- |
| Relevance | How closely does this memory answer the question? |
| Validity | Is this memory still current, or has it been replaced? |
| Confidence | How much does Docklee trust this memory? See [Confidence](/docs/memory/intelligence/confidence). |
| Connections | How many other memories link to this one? |
| Recency | How recently was this memory created or recalled? |

## The question shapes the weights [#the-question-shapes-the-weights]

Before ranking, Docklee reads the question and decides which links to follow and which signals matter most.

| The question | Docklee leans on |
| --- | --- |
| Names a person, company, or product | Every memory about that entity |
| Uses "before", "after", "when", or "timeline" | Memories in time order |
| Uses "why", "because", or "led to" | Cause and effect links |
| Anything else | Meaning |

Meaning is always part of the search, so a recall never returns less than a plain search would.

## Ask better questions [#ask-better-questions]

| Instead of | Ask |
| --- | --- |
| `"maya email"` | `"How does Maya like to be contacted?"` |
| `"renewal"` | `"What happened before Northwind renewed?"` |
| `"cancel"` | `"Why did the customer cancel?"` |

<CodeTabs items={['Python', 'TypeScript']}>
  <Tab value="Python">
    ```python
    records = lynk.recall_sync("What happened before Northwind renewed?", top_k=10)
    ```
  </Tab>
  <Tab value="TypeScript">
    ```ts
    const records = await lynk.recall('What happened before Northwind renewed?', { topK: 10 });
    ```
  </Tab>
</CodeTabs>

<Callout type="idea">
Pass the user's own message as the query. It already carries the names and time words that ranking uses.
</Callout>

## Next steps [#next-steps]

You know how recall decides. Capture memories automatically next.

<Cards>
  <Card title="Instrument your app" href="/docs/memory/automatic-capture/instrument" description="Capture write requests for you." />
  <Card title="Recall memory" href="/docs/memory/recall-memory" description="Every recall option." />
  <Card title="Entities and links" href="/docs/memory/intelligence/entities-and-links" description="The links ranking follows." />
</Cards>
