Add Agent Skills support and restructure Copilot settings#1519
Conversation
Implements Claude Code-style Agent Skills (agentskills.io) end-to-end: - Discovery: scan project + user skill dirs (.agents/skills, .claude/skills, ~/.wso2-mi/skills), parse SKILL.md frontmatter, dedupe by precedence, gate project scope on workspace trust. - Catalog: drift-aware "# Available Skills" reminder (mirrors AGENTS.md block). - Activation: dedicated `skill` tool (name + optional args, $ARGUMENTS subst, resource listing, dedup) plus deterministic `/skill-name` user invocation with a `/` autocomplete in the chat input (reuses the @mention machinery). - Management UI: Settings > Skills section to list/enable/disable/delete skills, grouped by scope, with modal-confirmed deletion. - Enable/disable persistence per skill home scope; global skills are OFF by default (project skills ON), via a default-aware override store. New RPCs: listSkills, listManagedSkills, setSkillEnabled, deleteSkill.
Skills management is content (a growing, per-item list), not a preference, and was crowding the flat settings scroll. Convert SettingsPanel into a drill-down: a root category list (Models & Thinking, Skills, Web Search, Account) that pushes full-width sub-pages, with the header back arrow walking the stack (sub-page -> root -> chat). - Skills gets its own page with room to grow; root shows a count pill. - Reset-to-defaults moves onto the Models & Thinking page (its only scope). - Web Search row is rendered only for AWS Bedrock.
… narrow When the AI panel is docked as a wide editor tab, the drill-down's full-width sub-pages waste the horizontal space. Add a width-aware layout: - Wide (>= 560px): persistent left nav rail + content pane (Claude-desktop style), with the active category highlighted. - Narrow (sidebar dock): keep the drill-down list -> sub-page, where a rail would be too cramped. A ResizeObserver (set up in useLayoutEffect so the first paint picks the right layout) flips between them live as the panel is resized. Each category body is extracted into a render function dispatched by categoryContent(), so both layouts share the same JSX with no duplication; CategoryRow gains active / showChevron to serve as both a list row and a rail item. Reset-to-defaults moves inline to the bottom of the Models content so it renders identically in either layout.
Add a "Signed in with" card to the Account page that tells the user how they are authenticated — WSO2 (MI Copilot, free with quota), their own Anthropic API key, or AWS Bedrock. Derived from the existing isByok / isAwsBedrock props (the same signal the header AuthProviderChip uses), so no new RPC is needed.
|
Warning Review limit reached
Next review available in: 43 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughChangesThis PR adds agent skills across shared RPC contracts, filesystem discovery and state persistence, prompt and tool execution, RPC management, chat autocomplete, and settings UI. Skills can be discovered by scope, enabled or disabled, activated through slash syntax or the agent tool, and deleted through settings. Session prompts track skill catalog changes and activated skill content. Anthropic Sonnet 5 is selected for relevant agent paths with updated generation settings. Sequence Diagram(s)sequenceDiagram
participant User
participant AIChatFooter
participant RpcClient
participant RpcManager
participant SkillDiscovery
User->>AIChatFooter: types "/" trigger
AIChatFooter->>RpcClient: listSkills()
RpcClient->>RpcManager: listSkills request
RpcManager->>SkillDiscovery: discoverSkills(projectPath)
SkillDiscovery-->>RpcManager: SkillCatalogEntry[]
RpcManager-->>RpcClient: ListSkillsResponse
RpcClient-->>AIChatFooter: skills list
AIChatFooter-->>User: render suggestions dropdown
sequenceDiagram
participant Agent
participant Prompt
participant SkillDiscovery
participant Model
participant SkillTool
Agent->>Prompt: buildSessionContextSnapshot(projectPath)
Prompt->>SkillDiscovery: discoverSkills(includeProjectScope)
SkillDiscovery-->>Prompt: skills catalog
Prompt-->>Agent: rendered skills context
Agent->>Model: send prompt
Model->>SkillTool: invoke skill(name, args)
SkillTool-->>Model: formatted skill content
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
e175875 to
b3faf75
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds end-to-end Agent Skills support to MI Copilot agent mode (discovery → catalog injection → activation via a new skill tool and /skill-name user invocations), and restructures the Copilot Settings UI into a responsive master/detail (wide nav-rail vs narrow drill-down) layout with a new Skills management page backed by new RPCs.
Changes:
- Implements skill discovery, enable/disable persistence, deletion, and prompt/catalog injection; adds a new
skilltool plus deterministic/skill-nameactivation. - Adds new agent-panel RPCs (
listSkills,listManagedSkills,setSkillEnabled,deleteSkill) acrossmi-core,mi-rpc-client, andmi-extension. - Refactors the AI panel settings UI to support category navigation and a Skills management view; adds slash-command autocomplete for skills in the chat footer.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/mi-visualizer/src/views/AIPanel/component/SettingsPanel.tsx | Restructures Settings UI and adds Skills management (list/toggle/delete). |
| packages/mi-visualizer/src/views/AIPanel/component/AIChatFooter.tsx | Adds /skill-name autocomplete dropdown and keyboard handling. |
| packages/mi-rpc-client/src/rpc-clients/agent-mode/rpc-client.ts | Adds RPC client types + methods for skills listing/management. |
| packages/mi-extension/src/rpc-managers/agent-mode/rpc-manager.ts | Implements skill RPC handlers (list/managed list/toggle/delete) and deletion confirmation. |
| packages/mi-extension/src/rpc-managers/agent-mode/rpc-handler.ts | Registers new skills RPC endpoints. |
| packages/mi-extension/src/ai-features/agent-mode/tools/types.ts | Adds skill tool name and execute type. |
| packages/mi-extension/src/ai-features/agent-mode/tools/skill_tools.ts | Implements skill activation + SKILL.md formatting/resource listing. |
| packages/mi-extension/src/ai-features/agent-mode/tools/skill_discovery.ts | Implements skill discovery + per-scope enable/disable state persistence. |
| packages/mi-extension/src/ai-features/agent-mode/tools/index.ts | Re-exports skill discovery/activation utilities and SKILL_TOOL_NAME. |
| packages/mi-extension/src/ai-features/agent-mode/tool-action-mapper.ts | Adds UI tool-action strings for the skill tool. |
| packages/mi-extension/src/ai-features/agent-mode/storage-paths.ts | Exports getWso2MiHomeDir and adds skills-state path helpers. |
| packages/mi-extension/src/ai-features/agent-mode/chat-history-manager.ts | Tracks skills catalog hash for drift-aware block reinjection. |
| packages/mi-extension/src/ai-features/agent-mode/agents/main/tools.ts | Registers skill tool when model-invocable skills exist. |
| packages/mi-extension/src/ai-features/agent-mode/agents/main/system.ts | Documents Skills behavior in the system prompt. |
| packages/mi-extension/src/ai-features/agent-mode/agents/main/prompt.ts | Injects # Available Skills + user-activated skill blocks into prompts. |
| packages/mi-extension/src/ai-features/agent-mode/agents/main/agent.ts | Resolves /skill-name invocations server-side and dedups activations per run. |
| packages/mi-core/src/rpc-types/agent-mode/types.ts | Adds RPC types for skills listing/management and block hash state. |
| packages/mi-core/src/rpc-types/agent-mode/rpc-type.ts | Adds new skills RequestType definitions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/mi-extension/src/ai-features/agent-mode/agents/main/agent.ts`:
- Around line 686-693: The /skill-name activation path in agent.ts only logs
failures in the slashSkill try/catch, so the user gets no visible feedback when
the requested skill cannot be loaded. Update the failure handling in the
slashSkill block to surface a user-visible error or warning (for example by
returning an explicit error response or injecting a clear message into the
conversation state) instead of only calling logError, while keeping the
successful path that sets userActivatedSkillContent and activatedSkills
unchanged.
In `@packages/mi-extension/src/ai-features/agent-mode/tools/skill_discovery.ts`:
- Around line 317-337: The `mutateSkillStates` read-modify-write flow is
unsynchronized, so overlapping updates can overwrite each other. Update the
`mutateSkillStates` path to serialize writes per `skills-state.json` file,
either by routing all updates through a per-file queue or by using an atomic
update helper, while keeping the existing `parseSkillStates`,
`getSkillsStatePath`, and `fsp.writeFile` flow intact.
- Around line 226-236: The skill discovery flow in skill_discovery.ts currently
accepts any frontmatter name, but the slash invocation path in agent.ts only
supports slash-safe identifiers, so some discovered skills cannot actually be
launched. Update the discovery logic around the name handling to either reject
non-matching names up front or generate a slash-safe alias, and then use that
same value consistently in discovery, autocomplete, and invocation code paths so
/skill-name always maps to an invokable skill.
In `@packages/mi-extension/src/rpc-managers/agent-mode/rpc-manager.ts`:
- Around line 1729-1736: The setSkillEnabled RPC currently coerces any
non-project scope to user and still permits project-scope mutations in untrusted
workspaces, bypassing the trust gate used elsewhere in the skill API. Update
setSkillEnabled in rpc-manager.ts to validate request.scope explicitly, return
an error for invalid scope values instead of defaulting to user, and block
project-scope changes when vscode.workspace.isTrusted is false before calling
setSkillEnabledState. Apply the same scope validation and trust check to the
related mutation path mentioned in the diff so both paths follow the same
policy.
In `@packages/mi-visualizer/src/views/AIPanel/component/AIChatFooter.tsx`:
- Around line 1903-1962: `AIChatFooter` caches `/skill` suggestions in
`allSkillsRef` and never invalidates them, so the autocomplete can become stale
after runtime skill enable/disable/delete changes. Update the `useEffect` that
computes suggestions to refresh or clear `allSkillsRef.current` when
`slashContext` opens, or subscribe to a shared “skills changed” signal and
re-run the `listSkills` fetch before calling `computeSuggestions`.
In `@packages/mi-visualizer/src/views/AIPanel/component/SettingsPanel.tsx`:
- Around line 520-524: The empty-state copy in SettingsPanel’s InfoNote points
to outdated skill locations, so update the text to match the actual discovery
paths used by the backend: project skills from .agents/skills and
.claude/skills, and user skills from ~/.wso2-mi/skills. Make the same copy
change in AIChatFooter so both empty states stay consistent and no longer direct
users to the wrong location.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4b8ddef9-b4a3-448e-be48-742227167b32
📒 Files selected for processing (18)
packages/mi-core/src/rpc-types/agent-mode/rpc-type.tspackages/mi-core/src/rpc-types/agent-mode/types.tspackages/mi-extension/src/ai-features/agent-mode/agents/main/agent.tspackages/mi-extension/src/ai-features/agent-mode/agents/main/prompt.tspackages/mi-extension/src/ai-features/agent-mode/agents/main/system.tspackages/mi-extension/src/ai-features/agent-mode/agents/main/tools.tspackages/mi-extension/src/ai-features/agent-mode/chat-history-manager.tspackages/mi-extension/src/ai-features/agent-mode/storage-paths.tspackages/mi-extension/src/ai-features/agent-mode/tool-action-mapper.tspackages/mi-extension/src/ai-features/agent-mode/tools/index.tspackages/mi-extension/src/ai-features/agent-mode/tools/skill_discovery.tspackages/mi-extension/src/ai-features/agent-mode/tools/skill_tools.tspackages/mi-extension/src/ai-features/agent-mode/tools/types.tspackages/mi-extension/src/rpc-managers/agent-mode/rpc-handler.tspackages/mi-extension/src/rpc-managers/agent-mode/rpc-manager.tspackages/mi-rpc-client/src/rpc-clients/agent-mode/rpc-client.tspackages/mi-visualizer/src/views/AIPanel/component/AIChatFooter.tsxpackages/mi-visualizer/src/views/AIPanel/component/SettingsPanel.tsx
Alongside the existing attach hint, show '@ to mention files' and '/ to invoke a skill' so the input affordances are discoverable on the empty state. Tighten the hint list spacing to keep the three lines compact.
- Validate skill names against the /skill-name identifier pattern at discovery; fall back to the directory name or skip, so every discovered skill is invocable and safe to embed in the <skill_content name="…"> wrapper. - Serialize per-file skills-state.json read-modify-writes so concurrent enable/disable toggles can't clobber each other. - Enforce scope validation + workspace-trust on setSkillEnabled/deleteSkill (reject unknown scopes; block project-scope mutations in untrusted workspaces). - Surface /skill-name activation failures to the user instead of only logging. - Slash autocomplete: guard on rpcClient and refetch the skill list each time the menu (re)opens so it reflects enable/disable/delete done in Settings. - Fix the skills empty-state copy to list the actual discovery paths.
The failure notice was reusing the activated-skill block, so it inherited the '# Activated Skill / follow the instructions below' success framing — wrong for a failure and inconsistent with how dynamic agent instructions are delivered. Add a userActivatedSkillFailed flag so the builder emits the failure text as-is; the prompt template already wraps it in <system-reminder>.
Group the user-scope skills directory with the Copilot's other on-disk state under ~/.wso2-mi/copilot/ (where its skills-state.json already lives), instead of the bare MI home shared with the runtime/CLI. Add a getGlobalSkillsDir() helper mirroring getGlobalSkillsStatePath(), and update the empty-state copy in both settings and the chat footer. Pre-release, so no migration needed.
- skill tool param is now a plain string (was a z.enum of discovered names) so its schema is constant; toggling skills no longer invalidates the cached tools prefix. Valid names live only in the drift-aware "# Available Skills" reminder and are validated at execute time. - Always register the skill tool (drop the >=1-skill guard) and mark it deferred (DEFERRED_TOOLS + DEFERRED_TOOL_DESCRIPTIONS) so its schema loads on demand via load_tools and stays out of the cached prefix. - Rewrite the tool description to mirror Claude Code's Skill tool. - User-activated disable-model-invocation skills: add a notice to the "# Activated Skill" reminder that they are user-invocable only. - skill executor now receives the full discovered set: a user-only skill returns a directed SKILL_USER_ONLY error (ask the user to run /skill-name) instead of a misleading "Unknown skill"; the already-active check runs first so re-invocation reports "already active". - system prompt: note the skill tool is deferred (load first) and that user-only skills cannot be model-activated. - compaction prompt: don't re-summarize re-injected <system-reminder> context blocks, except "# Activated Skill" (which isn't re-injected).
- Add ANTHROPIC_SONNET_5 (Anthropic id claude-sonnet-5, Bedrock
anthropic.claude-sonnet-5). The default main preset and the `sonnet`
sub-preset now resolve to it (connection.ts, subagent_tool.ts reverse-map,
explore/synapse-context subagents).
- Handle Sonnet 5 breaking changes: stop sending a non-default `temperature`
(Sonnet 5 / Opus 4.8 reject it with a 400), and send
thinking:{type:'disabled'} when thinking is toggled off (Sonnet 5 runs
adaptive thinking by default when the field is omitted). The sonnet
subagents also omit temperature and disable thinking so adaptive thinking
doesn't eat their small (4-8K) output budget; the Haiku path is unchanged.
- MI_INTEL Opus main-preset downgrade target -> Sonnet 5.
- UI: Settings "Models & Thinking" labels now read "Claude Sonnet 5" for the
main "Normal" and sub-agent "High" options.
The /-menu lists enabled-only skills (listSkills -> discoverSkills), so a present-but-disabled SKILL.md — which every global skill is by default — showed "No skills available", implying that adding the file was enough. The hint now also directs users to enable the skill in Settings > Skills and notes that global skills are disabled by default.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/mi-extension/src/ai-features/agent-mode/tools/skill_discovery.ts`:
- Around line 197-210: Update readSkill to enforce a defined product size limit
using stat.size before the synchronous fs.readFileSync call; return undefined
for oversized SKILL.md files while preserving the existing handling for valid
files and stat/read errors.
- Around line 363-368: Update the state-file write flow around readSkillStates
to persist the JSON payload to a temporary sibling file first, then atomically
replace the destination after the write completes. Ensure the temporary file
uses the destination’s directory and is cleaned up appropriately, while
preserving the existing states and updatedAt payload.
- Around line 458-472: Update discoverSkills to resolve name duplicates in
scanAllSkills order before checking enabled status: retain the first skill per
case-insensitive name as the precedence winner, log later duplicates as
shadowed, then filter disabled winners from the resulting catalog. Preserve the
existing sorting and shadowing behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 110416ea-2d3c-4973-982a-618651b0f03d
📒 Files selected for processing (25)
packages/mi-core/src/rpc-types/agent-mode/rpc-type.tspackages/mi-core/src/rpc-types/agent-mode/types.tspackages/mi-extension/src/ai-features/agent-mode/agents/compact/prompt.tspackages/mi-extension/src/ai-features/agent-mode/agents/main/agent.tspackages/mi-extension/src/ai-features/agent-mode/agents/main/prompt.tspackages/mi-extension/src/ai-features/agent-mode/agents/main/system.tspackages/mi-extension/src/ai-features/agent-mode/agents/main/tools.tspackages/mi-extension/src/ai-features/agent-mode/agents/subagents/explore/agent.tspackages/mi-extension/src/ai-features/agent-mode/agents/subagents/synapse-context/agent.tspackages/mi-extension/src/ai-features/agent-mode/chat-history-manager.tspackages/mi-extension/src/ai-features/agent-mode/storage-paths.tspackages/mi-extension/src/ai-features/agent-mode/tool-action-mapper.tspackages/mi-extension/src/ai-features/agent-mode/tools/index.tspackages/mi-extension/src/ai-features/agent-mode/tools/skill_discovery.tspackages/mi-extension/src/ai-features/agent-mode/tools/skill_tools.tspackages/mi-extension/src/ai-features/agent-mode/tools/subagent_tool.tspackages/mi-extension/src/ai-features/agent-mode/tools/tool_load.tspackages/mi-extension/src/ai-features/agent-mode/tools/types.tspackages/mi-extension/src/ai-features/connection.tspackages/mi-extension/src/rpc-managers/agent-mode/rpc-handler.tspackages/mi-extension/src/rpc-managers/agent-mode/rpc-manager.tspackages/mi-rpc-client/src/rpc-clients/agent-mode/rpc-client.tspackages/mi-visualizer/src/views/AIPanel/component/AIChatFooter.tsxpackages/mi-visualizer/src/views/AIPanel/component/SettingsPanel.tsxpackages/mi-visualizer/src/views/AIPanel/component/WelcomeMessage.tsx
🚧 Files skipped from review as they are similar to previous changes (13)
- packages/mi-core/src/rpc-types/agent-mode/rpc-type.ts
- packages/mi-extension/src/ai-features/agent-mode/agents/main/system.ts
- packages/mi-extension/src/rpc-managers/agent-mode/rpc-handler.ts
- packages/mi-extension/src/ai-features/agent-mode/tools/types.ts
- packages/mi-extension/src/ai-features/agent-mode/tool-action-mapper.ts
- packages/mi-extension/src/ai-features/agent-mode/chat-history-manager.ts
- packages/mi-extension/src/ai-features/agent-mode/tools/index.ts
- packages/mi-core/src/rpc-types/agent-mode/types.ts
- packages/mi-rpc-client/src/rpc-clients/agent-mode/rpc-client.ts
- packages/mi-extension/src/rpc-managers/agent-mode/rpc-manager.ts
- packages/mi-extension/src/ai-features/agent-mode/agents/main/prompt.ts
- packages/mi-visualizer/src/views/AIPanel/component/SettingsPanel.tsx
- packages/mi-visualizer/src/views/AIPanel/component/AIChatFooter.tsx
- Bound the SKILL.md read during discovery: read only a 64 KB frontmatter prefix (via fd) for oversized files so a pathological SKILL.md can't block the extension host or exhaust memory. The skill is still discovered. - Write the per-scope skills-state.json atomically (temp sibling + rename) so a concurrent reader (discovery's readSkillStates, not part of the write chain) never observes a half-written file and reverts skills to defaults. - Resolve name precedence before filtering disabled skills in discoverSkills: a disabled higher-precedence skill now shadows an enabled lower-precedence duplicate of the same name instead of letting it win.
Summary
Adds Claude Code-style Agent Skills (agentskills.io) to MI Copilot agent mode, end-to-end, and restructures the Copilot Settings panel to host skill management alongside the existing model / web / account settings.
Related issue: https://github.com/wso2-enterprise/integration-engineering/issues/1828
Agent Skills
.agents/skills,.claude/skills,~/.wso2-mi/skills), parsesSKILL.mdfrontmatter, dedupes by precedence, and gates project scope on workspace trust.# Available Skillsreminder (mirrors the AGENTS.md block).skilltool (name + optional args,$ARGUMENTSsubstitution, resource listing) plus deterministic/skill-nameuser invocation with/autocomplete in the chat input (reuses the @mention machinery).listSkills,listManagedSkills,setSkillEnabled,deleteSkill.Settings panel restructure
ResizeObserverflips between them live; both layouts share one set of render functions.isByok/isAwsBedrockprops (no new RPC).Notes
mi-extension(agent tooling + RPC handlers),mi-visualizer(AI panel UI), and themi-core/mi-rpc-clientRPC type & client definitions.main; test-merges cleanly.