Skip to content

Preserve plugin namespaces when loading skills - #433

Merged
ilovepixelart merged 14 commits into
ilovepixelart:mainfrom
HuliLulu46:preserve-plugin-skill-names
Nov 14, 2026
Merged

ilovepixelart merged 14 commits into
ilovepixelart:mainfrom
HuliLulu46:preserve-plugin-skill-names

Conversation

@HuliLulu46

Copy link
Copy Markdown
Contributor

Summary

Preserve the Claude plugin namespace in skill commands and model discovery:

- /skill:deploy
+ /kit:deploy

Plugin skills now register their own commands and use a plugin_skill tool for model invocation. Both entry points share argument/file expansion, plugin variables, invocation restrictions, hooks, and fork handling. Personal and project skills keep /skill:name.

Keep Skill grants, denials, scoped calls, and hook names consistent across both tools, including child agents. Preserve subagent skill preloading through qualified plugin names and a bare-name fallback. Resolve duplicate plugin skill definitions consistently; existing plugin commands win name collisions.

Evidence

  • Before: plugin skills lost their namespace when passed to pi's native skill loader, so unrelated plugins could collide on one /skill:name.
    After: regression tests cover namespaced discovery, actual command-handler expansion, live invocation restrictions, current working directories, hooks/forks, session refresh, tool restrictions, and child-agent preloading.
  • npm run check passes: 3,380 tests passed; 5 skipped. Coverage floors pass (98.96% lines, 93.40% branches).
  • Tests cover the change.
  • bash scripts/e2e-smoke.sh passes all 20 assertions against the provider payload from a real pi CLI, including namespaced model discovery, expanded plugin commands through RPC, and the qualified skill input in print mode.

Merge Danger

Door: two-way

Blast Radius: plugins

Existing plugin-skill invocations must change from /skill:name to /plugin:name. The explicit /skill:plugin:name form is also accepted; use it with pi -p on older pi versions whose print mode exits before an extension command's submitted prompt starts. Plugin-root SKILL.md layout remains unsupported. No dependency or release-version changes.

lisilu and others added 14 commits November 14, 2026 21:48
pluginSkills() runs on every session start, input, tool call and
preload, and printed the same collision warning each time. The two
warnings now go through warnOnce, which moves from subagent/agents.ts
to internal/warn-once.ts so both modules share one implementation.
The plugin_skill tool split the name on any whitespace while
parseSkillInvocation split on a space only, so the tool accepted
{"command":"/kit:deploy\nprod"} and then failed with "/kit:deploy was
not run." Both now end the name at the first whitespace character.
Claude Code documents that plugin skills are not affected by
skillOverrides. The setting was applied to them, with a bare-name
fallback, so a key written for a personal "deploy" skill also turned off
every plugin's "deploy". Plugin skills now ignore the setting for the
command, the plugin_skill listing and both invocation paths; personal
and project skills keep their behaviour.
user-invocable: false only kept the command from being registered.
Typed "/kit:deploy prod" or "/skill:kit:deploy prod" then reached the
input handler, which expanded the hidden skill's body. The input path
now checks the flag for plugin skills, shows a notice and expands
nothing. The plugin_skill tool is unaffected.
Claude Code names a plugin skill plugin:<directory> internally and uses
the frontmatter name for display. Only plugin:<frontmatter name>
resolved. The directory spelling now resolves on typed input, the
plugin_skill tool and subagent preloading. It registers no second
command and adds no listing entry, and a skill's own name wins over
another skill's directory alias.
"/skill:deploy prod" for the plugin skill kit:deploy resolved to nothing
and the literal text reached the model. A bare /skill:<name> now
resolves to the plugin skill when exactly one enabled plugin ships that
name and no personal, project or pi skill has it, and emits a notice
once per process and name that points at /<plugin>:<name>. When several
plugins ship the name nothing runs and the notice lists the qualified
names. The bare form is documented as deprecated and due for removal in
the next major version.
With plugins aaa and kit both shipping "deploy", an agent from plugin
kit with "skills: [deploy]" preloaded aaa's skill. Claude Code resolves
a bare name as the exact name, then <agent's own plugin>:<name>, then
the first :name match. The own-plugin step is now applied before the
cross-plugin fallback.
Four behaviours could be removed with the suite still green:
- inlineFork: the fork test ran without a UI, where a fork waits anyway.
  A model-invoked fork is now run with a UI and must return its result
  through the tool.
- the followUp delivery of a typed plugin skill while the agent is busy.
- the hook filter "if: Skill(name)" for a plugin_skill call.
- the explicit /skill:plugin:name input form.
docs/skills.md said a skill with malformed frontmatter degrades to pi's
plain expansion of the raw body. pi's loader skips such a skill, so a
personal or project skill is not registered and typed input naming it
passes through unexpanded. A plugin skill behaves the same way: no
command, no plugin_skill entry, a warning naming the file. The doc line
now states that, and a test pins the plugin side.
docs/skills.md said the plugin_skill listing refreshes through
prepareLoadout while a comment in commands.ts said pi cannot re-describe
a tool. pi runs a tool's prepareLoadout hook whenever it applies the
active tools and takes replacement descriptions from it (added in pi
0.99.0). The comment now says slash_command keeps its first description
because it defines no such hook, and the doc states when the hook runs
and which pi versions lack it.
The sentence "Use that form for pi -p" in docs/skills.md refers to
/skill:plugin:name and had drifted behind the alias and
user-invocable sentences.
The local in expandSkillInvocation held the refusal returned by
bareFormRefusal, not a list of ambiguous skills.
@ilovepixelart
ilovepixelart merged commit baea654 into ilovepixelart:main Nov 14, 2026
12 checks passed
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.

2 participants