Skip to content

Add Modern Agent support with skill filtering - #165

Open
adilei wants to merge 19 commits into
mainfrom
feature/modern-agent-skills
Open

Add Modern Agent support with skill filtering#165
adilei wants to merge 19 commits into
mainfrom
feature/modern-agent-skills

Conversation

@adilei

@adilei adilei commented May 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Introduces dual agent type support (Generative Orchestration vs Modern Agents) with deterministic skill filtering, 6 new modern agent authoring skills, and infrastructure fixes.

How skill filtering works

PreToolUse (fires on every Skill tool call)
    │
    ▼
filter-skills.js
    │
    ├─ reads the invoked skill's SKILL.md frontmatter (agent-types tag)
    ├─ if "both" → allow
    ├─ reads settings.mcs.yml to detect workspace agent type
    └─ if mismatch → block with helpful message

Single source of truth: the agent-types tag in each SKILL.md frontmatter. No generated files, no build step, no state files.

CI workflow

.github/workflows/validate-skill-types.yml — fails if any skill is missing agent-types frontmatter or has an invalid value.

New skills (Modern Agents)

Skill Purpose
new-skill Create an InlineAgentSkill in topics/ dir
list-skills List all skills and tools in a modern agent
edit-agent-modern Edit instructions, output format, model, conversation starters
add-tool Guide for adding ConnectorTool/McpTool/WorkflowTool (UI connection + YAML edit)
add-knowledge-modern Add WebsiteKnowledgeSource via YAML; guide for SharePoint/files/Dataverse
edit-skill Edit InlineAgentSkill markdown content and description

Clone fix

manage-agent clone now accepts --cluster-category N for non-prod environments (was hardcoded to 5/prod, causing 403 on test environments).

Evals

5 eval scenarios covering modern agent authoring: create skill, edit skill, edit instructions, add knowledge, add conversation starters.


Known Issues: Push/Pull Tooling

Both the LSP (VS Code extension) and PAC CLI have issues with Modern Agents. These are platform bugs, not plugin bugs.

LSP (manage-agent.bundle.js) — current approach

Issue Impact Workaround
Push demotes existing DialogComponents to TranslationsComponents Tools/skills added via the UI may disappear from the UI after a CLI push. The YAML file is preserved but Dataverse re-registers it as content-only (TranslationsComponent) instead of invocable (DialogComponent). Only push when you've made changes. If a tool disappears, re-add it via the CPS UI. New components created by the push are registered correctly.
Stale row versions after rapid push cycles PreconditionFailed / ConcurrencyVersionMismatch errors on push. Always pull before push. If push still fails, re-clone the agent.
Clone hardcodes prod cluster 403 Forbidden when cloning from non-prod environments. Use --cluster-category 1 for test environments (fixed in this PR).
Clone nests directories Agent cloned into workspace/agent-name/agent-name/. Scripts should detect and flatten the nesting after clone.

PAC CLI (pac copilot) — future approach

Issue Impact Workaround
pac copilot push crashes on $kind format ArgumentOutOfRangeException in KindFromType when reading Modern Agent YAML. Cannot push Modern Agents at all. Use LSP for push. PAC clone works fine.
Feature flag required pac copilot clone/pull/push commands are hidden behind verbCopilotSync: "on" in featureflags.json. Set flag in ~/.dotnet/tools/.store/microsoft.powerapps.cli.tool/<version>/.../featureflags.json.
Requires .NET 10 PAC CLI v2.7.4 needs .NET 10 runtime. Install via Homebrew: brew install dotnet@10.

Recommendation

Use the LSP for all push/pull/clone/publish operations. Be aware of the DialogComponent demotion bug — avoid pushing if you haven't changed tool files. Switch to PAC CLI once the $kind crash is fixed.


Test plan

  • Skill filtering: modern skill blocked on classic workspace with helpful message
  • Skill filtering: classic skill works on classic workspace
  • Clone: --cluster-category 1 enables clone on test environments
  • Push: instructions, skills, knowledge sources round-trip via pull → edit → push
  • Push: new skill in topics/ creates DialogComponent (visible in UI)
  • Push: new knowledge source appears in UI
  • CI: validates all skills have agent-types tag
  • Evals: 22/25 content checks pass (3 skill tracing failures are eval harness limitation)
  • Modern skills on modern workspace (manual testing — hook blocking confirmed working)

🤖 Generated with Claude Code

adilei and others added 5 commits May 11, 2026 22:49
Introduces the foundation for supporting modern Copilot Studio agents
alongside classic ones. Modern agents use instructions + skills + tools
instead of topics + action nodes.

Key changes:
- SessionStart hook detects agent type (classic vs modern) from
  settings.mcs.yml and writes blocked skill list to state file
- PreToolUse hook blocks incompatible skills with a helpful message
  (e.g., "new-skill is for modern agents only")
- 3 new modern-only skills: new-skill, list-skills, edit-agent-modern
- 9 classic-only skills tagged with agent-types: classic frontmatter
- Author agent updated with dual dispatch table (classic vs modern)
- InlineAgentSkill template for modern agent skills

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Runs on PRs that touch skills or the detection hook. Parses
agent-types frontmatter from SKILL.md files and compares against
the hardcoded lists in detect-agent-type.js.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The hook can list future skills (add-tool, edit-tool, etc.) that
don't have SKILL.md files yet. CI now only checks that every skill
WITH agent-types frontmatter is in the hook — not the reverse.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CI now fails if any skill is missing agent-types frontmatter,
forcing contributors to think about agent type compatibility.

All existing skills tagged:
- classic: 12 skills (topics, nodes, actions, cards, triggers, variables)
- modern: 3 skills (new-skill, list-skills, edit-agent-modern)
- both: 16 skills (manage, clone, validate, chat, eval, etc.)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
add-knowledge, add-other-agents, and edit-agent are classic-only
(their modern equivalents are add-knowledge-modern, etc.)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@adilei adilei changed the title Add modern (CLI/Dracarys) agent support with skill filtering Add Modern Agent support with skill filtering May 11, 2026
adilei and others added 14 commits May 11, 2026 23:23
- filter-skills.js now detects agent type AND blocks in one step
  (reads settings.mcs.yml on each Skill invocation — single file read)
- Remove detect-agent-type.js and the state file (~/.copilot-studio-cli/agent-type.json)
- Remove SessionStart detection hook from hooks.json
- Add build-skill-filter.js: generates filter-skills.js from SKILL.md frontmatter
- CI validates: all skills have agent-types tag + committed hook matches build output

Contributor workflow:
1. Add agent-types: classic|modern|both to SKILL.md
2. Run: node scripts/build-skill-filter.js
3. Commit both files — CI enforces they match

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- build-skill-filter.js now generates skill-types.json (data only)
- filter-skills.js is a static script that reads the JSON
- CI validates: all skills have agent-types + JSON matches frontmatter
- Cleaner separation: data (JSON) vs logic (JS)

Contributor workflow:
1. Add agent-types: classic|modern|both to SKILL.md
2. Run: node scripts/build-skill-filter.js
3. Commit SKILL.md + hooks/skill-types.json

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Instead of a generated JSON file + build script + CI sync check,
the hook now reads the invoked skill's own SKILL.md frontmatter
directly. Single source of truth, no build step.

- filter-skills.js reads SKILL.md agent-types tag on each invocation
- CI just validates every skill has the tag (one simple check)
- Removed: skill-types.json, build-skill-filter.js

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use only public-facing names: "Generative Orchestration" and
"Modern Agents" throughout skill descriptions, author agent,
and system prompt.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8 evals covering:
- 3 modern skills blocked on classic agent (new-skill, list-skills, edit-agent-modern)
- 3 classic skills blocked on modern agent (new-topic, add-adaptive-card, add-node)
- 1 classic skill allowed on classic agent (new-topic)
- 1 modern skill allowed on modern agent (new-skill)

Also adds modern-agent fixture with CLICopilotRecognizer and cliagent-1.0.0 template.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8 eval scenarios testing skill routing by agent type.
Note: hook-based blocking works in real sessions but not in
eval sub-agent forks (hooks don't propagate into forked contexts).
Evals test Author agent routing behavior instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keep only positive cases: classic skill on classic agent, modern
skill on modern agent. Hook blocking is validated by manual testing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The LSP clone hardcoded clusterCategory=5 (prod), causing 403
on test/preprod environments. Now accepts --cluster-category N
and writes it to conn.json so push/pull use the correct token.

Usage: manage-agent clone --cluster-category 1 ...

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- add-tool: guide pattern (like classic add-action) — walks user through
  UI for connector/MCP/workflow connection, then edits YAML after pull
- add-knowledge-modern: creates WebsiteKnowledgeSource YAML directly,
  guides to UI for SharePoint/files/Dataverse
- edit-skill: edit InlineAgentSkill markdown content and description
- Updated author agent dispatch table with all modern skills

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8 eval scenarios covering all modern skills:
- new-skill: create ReturnPolicy skill
- edit-skill: update OrderLookup description
- edit-agent-modern: change instructions, add conversation starters
- add-knowledge-modern: add website knowledge source
- list-skills: list skills and tools
- add-tool: guide for adding Outlook connector
- Classic topic creation (baseline regression)

Modern agent fixture now includes:
- Instructions with conversation starters
- Existing OrderLookup skill in topics/
- MSN Weather ConnectorTool in translations/
- Website knowledge source in knowledge/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 evals: create skill, edit skill, edit instructions,
add knowledge, add conversation starters.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Skill tracing hooks don't propagate into forked sub-agents in the
eval harness. Keep skill_invoked (works for some) and content checks
(always work). 22/25 remaining checks pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant