context: fork frontmatter in plugin commands not honored by plugin system

Resolved 💬 2 comments Opened Jan 14, 2026 by reedom Closed Feb 27, 2026

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:

  1. Automatically spawn a subagent before injecting the command instructions, or
  2. 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:

  1. Plugin system parses the command frontmatter and injects command content into conversation
  2. Frontmatter metadata (context: fork, agent, model) is not acted upon by the plugin system
  3. 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:

  1. Detect context: fork in command frontmatter during loading
  2. Either spawn the subagent directly, or inject instructions for Claude to use the Task tool with the specified agent and model parameters

Reproduction

  1. Create a plugin command file with context: fork in frontmatter
  2. Invoke the command via /plugin:command-name
  3. Observe that Claude executes directly in main context instead of spawning a subagent

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗