agentleFS
RagnarPitlaRagnarPitla/microsoft-agent-skills-private-archive/.github/skills/copilot-studio-knowledge-grounding/SKILL.md

copilot-studio-knowledge-grounding

Skill2 starsChanged 2 months agoMITView on GitHub

Diagnose and fix a Copilot Studio agent that hallucinates, cites the wrong source, or answers inconsistently. Use when an agent fabricates details not in its knowledge sources, when citations link to irrelevant or non-existent pages, when the same question gets different answers in different sessions, or when curating knowledge sources before go-live.

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask what "wrong" actually looks like.

    line 19
  2. Distinctive:

    If the agent may answer from the model's general knowledge, it will - and it will sound identical to a grounded answer.

    line 40
  3. Distinctive:

    Ask: should this agent ever answer from outside its sources?

    line 45
  4. Distinctive:

    Test as the *least*-privileged user who will use the agent, not as yourself.

    line 85
  5. Distinctive:

    When behaviour differs by user, check this before anything else.

    line 86
  6. Distinctive:

    If they need a guarantee that the agent never states something false, no configuration provides that.

    line 113
  7. Distinctive:

    If retrieval is returning the wrong content, no instruction repairs it.

    line 121
  8. Distinctive:

    If a link 404s, the page was probably renamed.

    line 142

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- Generated from SKILL.md by scripts/build-harnesses.mjs. Do not edit by hand; run `npm run build`. --><!-- Source: skills/build/copilot-studio-knowledge-grounding/SKILL.md -->

Hallucination is the most common complaint about Copilot Studio agents, and it is usually blamed on the model. That is only partly fair. The model's uncertainty is a product limitation you cannot configure away - but most real-world cases are caused by four things the builder controls, and those are fixable today.

Separate the two honestly. Telling someone their retrieval problem is the model's fault sends them to wait for a fix that will not come.

Diagnose before prescribing

Ask what "wrong" actually looks like. The four symptoms have different causes and conflating them wastes everyone's time:

  • Fabricates facts that appear nowhere in the sources - usually general knowledge fallback, or retrieval finding nothing and the model filling in.
  • Cites a real document but the wrong one - a retrieval and content structure problem, not a model problem.
  • Citations point to irrelevant parent pages or URLs that do not exist - usually source structure, or content that was indexed and then moved.
  • Different answers to the same question in different sessions or for different users - very often permissions, not randomness. This is the one most likely to be misdiagnosed.

That last symptom deserves its own question: does it vary by user, or by session for the same user? By user means permissions. By session for the same user points at retrieval or configuration.

The four builder-controlled causes

1. General knowledge fallback left enabled

If the agent may answer from the model's general knowledge, it will - and it will sound identical to a grounded answer. For an agent that should only speak from curated content, this must be off. Most "it invented a policy" reports are this.

Ask: should this agent ever answer from outside its sources? For an HR policy or compliance agent the answer is almost always no, and people rarely realise it is on.

2. Knowledge sources too broad or stale

Pointing an agent at an entire SharePoint site is the default move and a reliable way to get wrong answers. Retrieval competes across everything you gave it, so superseded documents, drafts and near-duplicates actively degrade results.

The curation questions worth asking:

  • Is there more than one document that could answer the same question? If so, which is authoritative, and is the other one still reachable?
  • Is anything in scope out of date, superseded, or a draft that was never removed?
  • Would a knowledgeable human be able to find the right answer in this corpus quickly? If not, retrieval will not either.

Narrow, curated and current beats comprehensive. Every time.

3. Documents structured for humans, not retrieval

Long unstructured documents retrieve badly. A 60-page handbook with no clear headings gives retrieval nothing to latch onto, and the chunk that comes back is often the wrong part of the right document - which produces exactly the "cites a real document, wrong content" symptom.

What helps: clear headings, one topic per section, questions answered near the words people use to ask them, and tables or key facts stated in text rather than only in images. Content in an image is invisible to retrieval.

4. Permissions differ between builder and users

The one most teams miss. Retrieval respects the caller's access. The builder is usually an administrator, so the agent in test can reach documents that real users cannot. Under a real user it retrieves less, finds nothing, and either falls back or guesses.

Test as the least-privileged user who will use the agent, not as yourself. When behaviour differs by user, check this before anything else.

Validate the fix

A grounding fix you cannot measure is a guess. Build a small test set before changing anything, so you can tell whether you improved it:

  • Take real questions - from users, support tickets or the agent's own conversation transcripts. Invented questions test the agent you imagined.
  • Include questions the agent should refuse, because the answer is not in scope. An agent that never says "I do not know" is not grounded, it is confident.
  • Record the expected answer and the document it should cite. Citation correctness is the thing you are actually testing.
  • Include at least one question where two documents disagree, if that exists in the corpus. That is where retrieval quality shows.
  • Re-run the same set after each change, as the same user. Changing the corpus and the test user at once tells you nothing.

Say plainly what cannot be fixed

  • Model uncertainty is a product limitation. Well-grounded agents still get things wrong occasionally, and the fix is a human review path for high-stakes answers, not more configuration.
  • Knowledge source portability between environments is a known constraint. If they are fighting bindings that break on promotion, that is ALM, not grounding, and it needs a rebinding step rather than a retry.
  • If they need a guarantee that the agent never states something false, no configuration provides that. Change the design so a human approves, or narrow the scope until the risk is acceptable.

Do not

  • Recommend prompt wording as the primary fix. It helps at the margin, and it is the most common piece of advice given because it is the easiest to give. If retrieval is returning the wrong content, no instruction repairs it.
  • Quote chunk sizes, index limits, file size caps or retrieval parameters from memory. These change. Point at the docs.
  • Assume classic topics or generative orchestration. Ask - the grounding behaviour differs.
  • Blame the model before checking fallback, corpus and permissions. In that order.

Sources

Verified as resolving on 2026-08-18.

If a link 404s, the page was probably renamed. Say you could not verify it rather than guessing a replacement URL.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.