context: fork frontmatter in plugin commands not honored by plugin system
Description
When a plugin command file contains context: fork in its YAML frontmatter, the directive is not honored by the Claude Code plugin system's command loading mechanism.
Expected Behavior
When a plugin command file has:
---
context: fork
agent: general-purpose
model: sonnet
---
The plugin system should either:
- Automatically spawn a subagent before injecting the command instructions, or
- Instruct Claude to spawn a subagent via the Task tool
Actual Behavior
The Claude Code plugin system loads the command content and injects it into the conversation with <command-name> tags. Claude then follows this instruction from the Skill tool documentation:
"If you see a <command-name> tag in the current conversation turn, the skill has ALREADY been loaded and its instructions follow in the next message. Do NOT call this tool - just follow the skill instructions directly."
This causes Claude to execute the command instructions directly in the main conversation context. The context: fork, agent, and model frontmatter fields are effectively ignored.
Root Cause
The Claude Code plugin system architecture has a gap:
- Plugin system parses the command frontmatter and injects command content into conversation
- Frontmatter metadata (
context: fork,agent,model) is not acted upon by the plugin system - Claude receives only the instruction to "follow the skill instructions directly" without being told to respect the fork context
The plugin system strips or ignores the context: fork directive during command loading, and there's no mechanism to communicate this metadata to Claude as actionable instructions.
Suggested Fix
The plugin system should:
- Detect
context: forkin command frontmatter during loading - Either spawn the subagent directly, or inject instructions for Claude to use the Task tool with the specified
agentandmodelparameters
Reproduction
- Create a plugin command file with
context: forkin frontmatter - Invoke the command via
/plugin:command-name - Observe that Claude executes directly in main context instead of spawning a subagent
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗