Search and ground agent answers
Bergur DavidsenUpdated 2026-07-14
A reliable Usable agent does not answer from search snippets alone. It discovers candidate fragments, retrieves the complete relevant sources, checks their scope and freshness, and cites what it used.
The recommended sequence is:
list-workspaces → agentic-search-fragments → get-memory-fragment-content → verify → answerFind the correct workspace
Start with list-workspaces unless the application already has a trusted workspace ID. Match by stable ID and expected name, then confirm the returned role or access context.
Do not let a user-supplied workspace ID bypass your own tenant or project boundary. An application should constrain the workspaces its agent can select.
Search intelligently
Use agentic-search-fragments as the primary discovery tool. Provide:
- a specific natural-language query;
- the known workspace or workspace set;
- useful tags such as
repo:<name>,docs, or a release tag; - a search intent that explains what evidence the task needs;
- a bounded result and iteration limit.
Describe the underlying question, not only keywords. For example:
Find the released public authentication workflow for remote MCP clients, including OAuth and PAT fallback. Exclude draft plans.If results are insufficient, refine the missing dimension: audience, product, repository, date, release, or failure mode. Do not repeat the identical broad query indefinitely.
Choose the right fallback
Use list-memory-fragments for exact filtering, pagination, known tags, known collection membership, or inventory work.
Use search-memory-fragments as a semantic fallback when agentic search is unavailable or a simpler ranked search is sufficient.
A search score is a retrieval signal, not proof that a fragment is authoritative.
Fetch complete sources
For each fragment that influences the answer, call get-memory-fragment-content. Review:
- title, full content, and frontmatter;
- workspace and fragment type;
- tags and summary;
- author and updated date;
- active, partial, or stale indicators where returned;
- release, status, or source evidence in the content.
Search previews can omit caveats, status fields, or the later section that changes the meaning. Never cite a fragment the agent did not fetch.
Resolve conflicts
When sources disagree:
- Prefer released, current, and explicitly authoritative material.
- Separate public product behavior from internal plans or customer-specific notes.
- Check whether the sources describe different versions or environments.
- State the conflict and residual uncertainty.
- Ask for a decision rather than silently merging incompatible instructions.
Do not treat a recently updated draft as stronger than a tagged release solely because its timestamp is newer.
Ground the final answer
A source-backed answer should make it possible to audit the result. Include source titles and, when useful, fragment IDs or links. Distinguish:
- facts directly supported by sources;
- conclusions derived from several sources;
- recommendations from the agent;
- unresolved uncertainty.
For high-impact decisions, quote or summarize the relevant passage and require human review.
Context and cost control
Full fragments can be long. Use progressive disclosure:
- Search metadata and previews.
- Select a small relevant set.
- Fetch complete content for those candidates.
- Narrow again before adding sources to the model context.
If a source is too large, retrieve it completely for verification, then pass only the relevant excerpt plus metadata to the model. Preserve a link or ID to the full source.
Bound search iterations, concurrent calls, and total retrieved content. Report when a limit prevented complete research.
A reusable agent policy
Search the approved Usable workspaces before answering knowledge questions. Fetch each fragment you rely on in full. Prefer released and authoritative sources, cite their titles, label conflicts and uncertainty, and do not mutate knowledge during a retrieval-only task.Troubleshooting
Search returns nothing
Verify the workspace ID and access, broaden the query, remove overly strict tags, and check exact listings.
Results are plausible but wrong
Add product, repository, audience, and release constraints. Fetch the source and inspect its status.
The answer cites snippets only
Require a full get-memory-fragment-content call before synthesis.
Too much context is retrieved
Lower the result limit, split the question, select fewer sources, and summarize only after full-source verification.