Skip to content

feat: support plugin-contributed custom agents - #2365

Merged
7Sageer merged 5 commits into
mainfrom
feat/plugin-agent-files
Jul 29, 2026
Merged

feat: support plugin-contributed custom agents#2365
7Sageer merged 5 commits into
mainfrom
feat/plugin-agent-files

Conversation

@7Sageer

@7Sageer 7Sageer commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — the problem is explained below.

Problem

Plugins can ship skills, slash commands, MCP servers, and hooks, but there is no way for a plugin to provide custom agents. A team distributing a workflow as a plugin cannot bundle purpose-built sub-agents with it; users have to copy agent files into their user- or project-level agent directories by hand.

What changed

Plugins can now contribute custom agents on both engines:

  • The plugin manifest gains an agents field: one or more ./ paths that must resolve to directories inside the plugin root (same validation as skills). When the field is omitted, an agents/ directory at the plugin root is picked up automatically, mirroring the root SKILL.md fallback.
  • Enabled plugins' agent directories feed a new agent-file source at a priority above built-in profiles but below every other file source (user / extra / project / --agent-file), so any locally defined agent shadows a plugin-provided one, and replacing a built-in agent still requires override: true in the frontmatter.
    • v1 (agent-core): SessionAgentProfileCatalog accepts pluginRoots, wired through RPC session creation and the Session fallback catalog config; the catalog is rebuilt on new sessions and /reload.
    • v2 (agent-core-v2): new Session-scope PluginAgentProfileSource mirroring PluginSkillSource, merged by the session agent-profile catalog and refreshed on /plugins reload via plugin.onDidReload.
  • The klient wire contract (pluginManifestSchema) exposes the new agents field so the v1↔v2 plugin parity holds.
  • Docs: plugins.md (manifest field table + a "Plugin Agents" section) and agents.md (discovery scope order is now Explicit > Project > Extra > User > Plugin > Built-in), in both English and Chinese.

This approach reuses the existing agent-file discovery and priority-merge machinery instead of adding a parallel registration path, so plugin agents behave exactly like agents from any other directory scope.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e927dcb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 29, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@e927dcb
npx https://pkg.pr.new/@moonshot-ai/kimi-code@e927dcb

commit: e927dcb

7Sageer added 4 commits July 29, 2026 20:08
# Conflicts:
#	docs/en/customization/plugins.md
#	docs/zh/customization/plugins.md
#	packages/agent-core-v2/docs/state-manifest.d.ts
#	packages/agent-core-v2/test/app/plugin/manifest.test.ts
@7Sageer
7Sageer merged commit fa2c5ce into main Jul 29, 2026
14 checks passed
@7Sageer
7Sageer deleted the feat/plugin-agent-files branch July 29, 2026 13:59
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