add-knowledge
Skill82 starsChanged 37 days agoMITView on GitHub
Add a knowledge source (public website, SharePoint, OneDrive, or a locally uploaded file) to a locally-cloned Copilot Studio agentic-loop agent by writing the modern capabilities/knowledge YAML. Use when the user asks to add, attach, or ground a knowledge source (a public website, SharePoint or OneDrive link, or an uploaded file) on a locally-cloned Copilot Studio agent.
We split this skill into the rules it gives an agent
9 rules. 0 are common, 4 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
If plugin-paths.json cannot be read, fall back to locating reference/knowledge-schema.md under the installed plugin directory.
- Very specific: line 41
If none is found, tell the user this skill needs a locally-cloned agentic-loop agent (clone one with pac copilot clone, or use /migrate).
- Distinctive: line 43
If several are found, ask the user which agent to add the knowledge to.
- Very specific: line 44
Read the agent's schemaName from settings.mcs.yml (e.g.
- Very specific: line 85
Protect existing uploaded files: Before copying, inspect the destination payload and all sidecars whose mcs.metadata.componentName names …
- Distinctive: line 87
If neither exists, copy the payload and create one sidecar.
- Distinctive: line 88
If the payload or a matching sidecar exists, do not overwrite anything.
- Distinctive: line 111
Always pair the result with a reminder to ensure end users have access in SharePoint/OneDrive.
- Very specific: line 121
Add --dry-run to resolve the plan (encoded share id, Graph endpoint, scopes, needsClientId)
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add a Knowledge Source
You are a workflow that adds a knowledge source to a locally-cloned Copilot Studio
agentic-loop agent by writing modern capabilities/knowledge YAML. You discover the agent,
classify the requested source, normalize its URL, and write a *.mcs.yml component. You never invent
behavior the files do not support.
Initial request: $ARGUMENTS
Supports four source kinds: Public Website, SharePoint, OneDrive, and Uploaded file.
Authoritative schema — read this first
The exact YAML for every source kind, the capabilities/knowledge file layout, filename
conventions, SharePoint/OneDrive URL normalization, best practices, and limitations live in a single
shared reference — reference/knowledge-schema.md. It is the source of truth; the
copilot-studio-architect agent uses the same file, so the two never drift. Read it before writing
any YAML and follow it exactly.
Resolve its path via the plugin root: read
path.join(os.homedir(), '.copilot-studio-cli', 'plugin-paths.json') to get pluginRoot for the
current mcs-assistant plugin, then read path.join(pluginRoot, 'reference', 'knowledge-schema.md').
If plugin-paths.json cannot be read, fall back to locating reference/knowledge-schema.md under the
installed plugin directory.
Core Process
1. Locate the target agent (blocking)
- Auto-discover the cloned agent with
Glob: **/settings.mcs.yml. A cloned agentic-loop workspace containssettings.mcs.ymlat its root. Never hardcode an agent name. - If none is found, tell the user this skill needs a locally-cloned agentic-loop agent (clone
one with
pac copilot clone, or use/migrate). Stop. - If several are found, ask the user which agent to add the knowledge to.
- Read the agent's
schemaNamefromsettings.mcs.yml(e.g.crbab_guitarcoach_dcF_b3) — it is the filename prefix for source-backed knowledge components. - The knowledge folder is
<agent>/capabilities/knowledge/(create it if missing). Uploaded files additionally use<agent>/capabilities/knowledge/files/.
2. Parse the arguments
Extract from $ARGUMENTS:
- The URL or local file path of the source.
- An optional name and/or description.
3. Classify, build, and save (per reference/knowledge-schema.md)
- Classify the input into one of the four source kinds:
- Require every URL source to be absolute HTTPS with no embedded username or password.
- a
-my.sharepoint.*host with/personal/…→ OneDrive (SharePointKnowledgeSource,targetKind: File) *.sharepoint.com,*.sharepoint.us,*.sharepoint.cn, or*.sharepoint-mil.us→ SharePoint (targetKind: Filefor a file,Folderfor a folder/library)- other absolute
https://URL → Public Website (WebsiteKnowledgeSource), after applying the reference's public-site validation. Reject paths deeper than two nonempty segments and ask for a broader HTTPS base URL instead. - an existing, supported regular local file → Uploaded file (copy into
files/+ metadata-only sidecar). Do not treat directories or unsupported file types as uploads.
- Normalize SharePoint/OneDrive URLs (direct path,
AllItems.aspx?id=decode, sharing-link refusal,%20encoding) exactly as the reference specifies. - (Optional) Verify access — for SharePoint/OneDrive sources only, you may pre-check that the link is valid and the signed-in user can read it, before writing YAML (see "Optional access pre-check" below). This is opt-in and best-effort: skip it silently if it isn't configured.
- Generate the YAML for the matching source kind using the reference's shapes and metadata
rules (
componentName, plus a genuinely descriptivedescription). Encode every value derived from user input, a URL, a path, or an existing file as a YAML-safe double-quoted scalar usingJSON.stringify(value)semantics; never interpolate an external value as raw YAML structure. - Save using the reference's filename convention:
- source-backed →
capabilities/knowledge/<schemaName>.<slug>_<id>.mcs.yml - uploaded file → copy the file into
capabilities/knowledge/files/, then write the metadata-only sidecarcapabilities/knowledge/files/<slug>_<id>.mcs.ymlApply the reference's exact 100-character schema-name budget before writing. Check that the resulting component path does not already exist; regenerate the id on a component-name collision.
- source-backed →
- Protect existing uploaded files. Before copying, inspect the destination payload and all
sidecars whose
mcs.metadata.componentNamenames that payload:- If neither exists, copy the payload and create one sidecar.
- If the payload or a matching sidecar exists, do not overwrite anything. Ask whether to replace the existing source or copy under a different payload name.
- On explicit replacement, reuse the existing sidecar filename/suffix and update that sidecar; do not create a second sidecar. If zero or multiple matching sidecars make replacement ambiguous, stop and report the conflict.
4. Confirm
Tell the user what was created: the source kind, the resolved siteUrl (or copied file), and the
path of the written *.mcs.yml. Remind them the agent must be re-packed/pushed and (re)published for
the new knowledge to take effect. For source types not supported here (Dataverse, AI Search, SQL
Server, Graph connectors), point them to the Limitations section of the reference.
Optional access pre-check (SharePoint / OneDrive)
For SharePoint/OneDrive links you can verify up front that the link resolves and the signed-in
(author) user can read it — without downloading the file — via a single Microsoft Graph call
(GET /shares/{id}/driveItem). This is opt-in (offer it, or run it when the user asks); never
block adding the source on it.
⚠️ Delegated-permissions caveat — always state this. SharePoint/OneDrive knowledge is retrieved at runtime using each end user's permissions. This check runs as the author, so a ✅ result confirms your access only — it does not guarantee end users of the agent can access the item. Always pair the result with a reminder to ensure end users have access in SharePoint/OneDrive.
How to run it. Resolve pluginRoot from
path.join(os.homedir(), '.copilot-studio-cli', 'plugin-paths.json') (as in step "Authoritative
schema" above), then:
node "<pluginRoot>/scripts/verify-knowledge-access.bundle.js" --agent-dir "<agentDir>" "<url>"- Add
--dry-runto resolve the plan (encoded share id, Graph endpoint, scopes,needsClientId) without authenticating — useful to check setup first. - It reuses the same per-agent Entra public-client app id the
/chatskill saves. That app registration must also have the delegated Microsoft Graph permissionFiles.ReadWriteconsented, and must be an app the user owns in the tenant. Microsoft documentsFiles.ReadWriteas the least-privileged delegated permission forGET /shares; although this script only issues aGET, the consent grants the app read/write access to files the signed-in user can access. Make that permission impact clear before asking the user to opt in. IfneedsClientIdis true or auth/permission errors come back, explain the missing setup and continue adding the source anyway. - Tokens are persisted only when OS-backed encrypted storage is available. Otherwise the check uses an in-memory cache for that run and never writes Graph credentials to plaintext storage.
- US Government, DoD, and China SharePoint hosts select their matching Graph and Microsoft Entra
endpoints automatically.
--cloud <name>can override inference when necessary. AADSTS65002in anerrormeans the--client-idis a Microsoft first-party/sample app, which cannot obtain Graph tokens. Tell the user to supply their own Entra app registration (single-tenant, public client flows enabled, delegated GraphFiles.ReadWriteconsented). An app id that works for/chat(preauthorized for the Power Platform API) is not automatically valid for Graph. This is a setup issue, not a failure of the source — continue.
Interpreting the JSON status:
status | Meaning | What to tell the user |
ok | Dry-run plan resolved; no request was sent | inspect needsClientId, authority, and scopes before opting in |
accessible | Link valid; author can read it | ✅ proceed — plus the end-user caveat above |
forbidden | Access denied — no access or the link doesn't resolve (Graph /shares returns 403 for both) | ⚠️ re-copy the URL from the browser, confirm you (and end users) have access, then retry — you can still add it, but it returns nothing without access |
notfound | Link didn't resolve (uncommon — /shares usually returns forbidden for bad links) | ❌ likely a wrong/renamed URL — re-copy it from the browser address bar |
skipped | Not a SharePoint/OneDrive URL | no check needed |
error | Setup/auth/network problem | note it's optional; continue adding the source |
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- microsoft/skills-for-copilot-studio★ 486same name
- tikhomirovv/agents-knowledge★ 2same name
- thunderphone/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- add-skillSkill
- clone-agentSkill
- create-agentSkill
- delete-agentSkill
- publish-agentSkill
- pull-agentSkill
- push-agentSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

