Knowledge Source Router logo

Knowledge Source Router

Organization
microsoft
knowledge-source-router

Required whenever a knowledge request names or implies a country, asks what applies "here," or compares countries. Treat Country as document metadata, not as a content-search term. Before any content search, general-knowledge answer, or clarification, use sharepoint_metadata_filter to discover and filter the Country column. Then pass every matching document URL to knowledge_search_sharepoint through scopeUrls.

Overview

Publishermicrosoft
Repositorycat-agent-skills
Skill nameknowledge-source-router
Stars
95
Forks
115
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by microsoft on GitHub. Read the source before you install it.

Installation

Install the Knowledge Source Router AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/microsoft/cat-agent-skills/tree/main/submissions/knowledge-source-router
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/microsoft/cat-agent-skills.git /tmp/cat-agent-skills
mkdir -p .claude/skills
cp -r /tmp/cat-agent-skills/submissions/knowledge-source-router .claude/skills/knowledge-source-router
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Knowledge Source Router in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Knowledge Source Router on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Knowledge Source Router is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Knowledge Source Router

Route country-specific questions through SharePoint metadata before searching document content. A country identifies which documents apply; it is not a keyword to search for inside those documents.

Follow this workflow in order. The content search depends on URLs returned by the metadata filter, so it cannot run in parallel with metadata discovery.

1. Discover the Country metadata

Start with a broad metadata call:

text
sharepoint_metadata_filter(includeColumns: ["*"])

Read availableColumns as the authoritative list of library metadata.

  • If Country exists, use that exact column name and its recorded values.
  • If Country is absent, state that the library does not track Country and stop.
  • If the request does not identify a specific country, inspect the available Country values before asking the user to choose one.

Do not infer a file's country from its title, folder, contents, or general knowledge.

2. Establish the complete country set

First inspect the whole library:

text
sharepoint_metadata_filter(groupByColumn: "Country")

Use the returned groups, totalMatched, and blankCount directly. The expected relationship is:

text
sum(groups) + blankCount == totalMatched

Do not pre-filter this call with keyword. A keyword would reveal only files about that term, not every file assigned to the country.

Then enumerate all files for the requested country:

text
sharepoint_metadata_filter(
  columnFilter: { column: "Country", operator: "eq", value: "<recorded value>" },
  includeColumns: ["*"]
)

For a comparison, retrieve the countries together:

text
sharepoint_metadata_filter(
  columnFilter: {
    column: "Country",
    operator: "in",
    values: ["<recorded value 1>", "<recorded value 2>"]
  },
  includeColumns: ["*"]
)

Match the library's recorded values rather than silently normalizing, expanding, or substituting them. Include every returned file, including underscore-prefixed files and index files.

The grouping and enumeration calls may run in parallel after Country has been discovered because neither depends on the other's output.

3. Search only the matching documents

Collect the url from every file returned by the country filter, then call:

text
knowledge_search_sharepoint(
  search_query: "<the user's question in natural language>",
  scopeUrls: ["<url 1>", "<url 2>", "..."]
)

Never omit scopeUrls for a country-specific request. Do not start this call until the country filter has returned the complete URL set; otherwise the search can mix content from other countries or unassigned files into the answer.

If no files match the requested country, report that result instead of running an unscoped search.

4. Read the complete scoped set

A country may map to several documents, and the obvious filename may not hold the complete answer. For every scoped URL:

  1. Open the file.
  2. Use the appropriate file-type skill to preprocess it.
  3. Read it in full.

Answer from the union of the relevant content, and state which documents were read. Do not stop after the first apparently complete file.

5. Report boundaries without filling gaps

Include the scope boundaries that help the user interpret the answer:

  • Report groups, totalMatched, and blankCount from the metadata response when describing library coverage.
  • Note relevant-looking documents excluded because they carry a different Country value.
  • Describe an empty Country value as blank or unassigned. Never backfill it from the file's title, folder, contents, or the active filter.

6. Cite the documents used

Cite the ReferenceId for every document that contributes to the answer, such as [doc:turn1doc1]. Cite only documents actually used. Never expose a SAS token or signed query string from a document URL.

Guardrails

AvoidWhy
Searching document content for a country nameProse mentions do not establish applicability, and tagged files may never name the country.
Running metadata discovery and content search togetherThe scoped URL set does not exist until metadata filtering completes.
Using keyword to establish country membershipIt silently omits matching documents that do not contain the keyword.
Reading only the name-matching fileOther files assigned to the same country may contain required terms or exceptions.
Counting displayed rowstotalMatched, groups, and blankCount are the authoritative counts.
Assigning blank metadata from contextAn inference is not a recorded Country value.

Example

For "What employee benefits apply in the United States?":

  1. Discover Country with sharepoint_metadata_filter(includeColumns: ["*"]).
  2. Group by Country and filter using the library's exact value for the United States.
  3. Collect every returned URL.
  4. Search with the original question and all URLs in scopeUrls.
  5. Read every scoped document and answer from their combined content.
  6. Report excluded Country values and unassigned files, then cite each source used.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Knowledge Source Router AI skill do?

Required whenever a knowledge request names or implies a country, asks what applies "here," or compares countries. Treat Country as document metadata, not as a content-search term. Before any content search, general-knowledge answer, or clarification, use sharepoint_metadata_filter to discover and filter the Country column. Then pass every matching document URL to knowledge_search_sharepoint through scopeUrls.

Why use Knowledge Source Router on TypingMind?

Because you install it once and use it with any model. Knowledge Source Router is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Knowledge Source Router in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/microsoft/cat-agent-skills/tree/main/submissions/knowledge-source-router. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Knowledge Source Router?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Knowledge Source Router?

As many as you like. As long as a model supports skills, you can use Knowledge Source Router with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Knowledge Source Router AI skill free?

Yes. It is published on GitHub by microsoft under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇