---
title: "Self-learning"
url: "https://docs.mekodata.ai/concepts/how-meko-learns/self-learning/"
---

# Self-learning

Whether agent searches found enough context in the datapack, and whether adding the missing fact helped

Open a datapack and choose the **Self-learning** tab. It shows whether the searches agents ran found enough context in this datapack. The tab is off unless the deployment turns it on, and it is available only for the datapack owner and a maintainer.

The agent can still reply when a search falls short. On a partial match it uses what the datapack returned and says what is missing. That missing part was never in the datapack. The agent may already know it, or it may look it up with another tool, such as a web search. The score counts only what came back from the datapack. **High** means that result was enough to answer from. Below that, the reply can still look complete.

Store a fact once. Questions that need that fact can find it without a separate sentence for every wording. The Self-learning tab shows which searches come back short again and again. Add the missing fact, then check that the same search does better.

[Watch your agent learn](/quick-start/watch-your-agent-learn/) is a fact an agent stores and a later session reads back. [Learnings](/concepts/how-meko-learns/learnings/) moves a private memory into the knowledge the team shares. Self-learning reads searches that have already run and shows whether what came back from the datapack was enough. It opens on **Summary**. Observe, Analyze, and Improve stay empty until an agent has called `context_search` on this datapack.

## Observe

Observe answers what was searched, and how it went.

Each row is one `context_search`: the query, when it ran, and a quality band from the best result.

| Band | Best score               | What it means                                                  |
|------|--------------------------|----------------------------------------------------------------|
| High | 0.75 or more             | Sufficient. The agent can answer from the context and cite it. |
| Mid  | 0.50 up to 0.75          | Partial. Use the context, and say what is missing.             |
| Low  | Below 0.50, or no result | Insufficient. Do not rely on it.                               |

The list defaults to the last 14 days. The search log is kept for 30 days. A row appears once an agent calls `context_search` on this datapack. A search run to check a fix, from Improve, is not listed here.

## Analyze

Analyze answers why searches fell short. High searches have no reason. For the rest, the first matching reason wins, in this order.

| Reason                  | What Meko saw                                                            |
|-------------------------|--------------------------------------------------------------------------|
| A source failed         | A source reported an error. That is a system fault, not missing content. |
| Vague prompt            | Fewer than 4 words, or a short follow-up that points at an earlier turn. |
| Out-of-date source      | The best result is 90 or more days old.                                  |
| Source not searched     | No results, and the search was restricted to one source.                 |
| Nothing matched         | Every source that ran returned nothing.                                  |
| Below the quality floor | Results existed, and the quality floor removed all of them.              |
| Weak match              | The best score is below 0.50.                                            |
| Partial match           | The best score is from 0.50 up to 0.75.                                  |

Two more reasons describe the datapack as it is now, not the search as it ran: **Datapack is empty** (no memories or documents yet) and **Indexing in progress** (content was added and is not searchable yet).

## Improve

Improve answers what to add, and whether it helped.

Improve does not add a memory or a file. Add the missing fact from **Memories**, or the missing document with **Add Knowledge**, then come back here.

Pick a search that fell short and click **Run the prompt again**. The first run saves that search as a test prompt. A datapack holds up to 50 saved prompts. The run repeats the search and charts the best score against the earlier run. Each run counts as one search. If the new content is still indexing, the page says so: run the prompt again shortly.

Summary also lists what would raise the share of high matches: add the first memory or document, connect an agent so searches exist, fill a coverage gap, clarify a vague prompt, refresh an out-of-date source, or check a source that failed.

## Check a fix from an agent

An agent uses four tools, which a deployment registers only when self-learning is on. The datapack's owner or a maintainer can call them. `selflearning_verify` needs a key that can write. The other three need a key that can read.

1. `selflearning_status` reads the quality and the open to-dos. Start here. `selflearning_status` and `selflearning_shortfalls` default to 14 days and `selflearning_query_log` to 7, so pass the same `last` to all three.
2. `selflearning_shortfalls` lists the searches behind one to-do. `selflearning_query_log` reads the search log, newest first.
3. Fix the shortfall with `memory_add`, `memory_update`, or `knowledgebase_upload_document`, using a source you can name.
4. `selflearning_verify` replays that search and reports the match before and after. Run it after something has changed. Passing `log_id` saves the search as a test prompt. The result includes `outcome` (`improved`, `no_change`, `worse`, or `no_baseline`), `indexing`, and `nothing_added_since_last_run`. When `nothing_added_since_last_run` is true, the replay is not new. When `indexing` is true, run it again once that is false. You can replay about 10 times a minute on a datapack. Each person has their own allowance.

See [Self-learning tools](/reference/mcp-server/#self-learning-tools).

| You see              | What it means                                                                                                                                                          |
|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `INSUFFICIENT_SCOPE` | The key needs read scope, or write scope for `selflearning_verify`.                                                                                                    |
| `FORBIDDEN`          | Only an owner or a maintainer can use Self-learning.                                                                                                                   |
| `NOT_FOUND`          | The datapack or id is wrong, or this deployment does not serve Self-learning.                                                                                          |
| `LIMIT_REACHED`      | The datapack already has 50 saved test prompts. Replay one you saved, with `test_prompt_id`.                                                                           |
| `not_found`          | No saved test prompt has that id. Pass `log_id` to save the search first.                                                                                              |
| `FREE_TIER_LIMIT`    | The replay would go over your search limit.                                                                                                                            |
| `RATE_LIMITED`       | Wait, then try again.                                                                                                                                                  |
| `replay_timed_out`   | The replay took longer than the tool waits and may already have run. Don't retry yet. Read `latest_run` for this search, and verify again only if there is no new run. |

Limitation

Self-learning counts searches made through `context_search`. A search made only with `memory_search` or `knowledgebase_search` is not in this log.
