[BUG] Inline plugin skill content not delivered after /clear — "Successfully loaded skill" but no instructions
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When running Claude Code with --plugin-dir pointing to a local plugin, skills load and work correctly on the initial session. After running /clear, the same skill invocation prints "Successfully loaded skill" but delivers no SKILL.md content to the agent. The agent receives the skill name resolution but not the instructions, so it falls back to searching the filesystem for the SKILL.md manually.
The same symptom occurs in cron-spawned sessions (via CronCreate) — the cron job runs /my-skill:sub-skill but the spawned process doesn't inherit --plugin-dir, so the skill name resolves against a stub but content is empty.
Related symptom — CLAUDE_PLUGIN_ROOT is also unpopulated in these sessions. In both the post-/clear and cron-spawned cases, CLAUDE_PLUGIN_ROOT is an empty string, even though CLAUDE_CODE_EXECPATH and CLAUDECODE are set. This means any skill that shells out via ${CLAUDE_PLUGIN_ROOT}/... (a documented pattern for plugin-scoped scripts) will silently expand to paths like /hooks/scripts/... and fail. So --plugin-dir and cron-spawn sessions appear to be "half-loaded": command/skill name resolution works, but SKILL.md content injection and plugin env var population do not. Likely the same root cause (plugin context not fully propagated into the new session), but worth calling out so a fix covers both.
What Should Happen?
After /clear, skills from --plugin-dir should continue to deliver their SKILL.md content to the agent, since the process was launched with that flag and it's still running. Cron-spawned sessions should inherit the parent session's plugin configuration. In both cases, CLAUDE_PLUGIN_ROOT should be populated for the loaded plugin so plugin-scoped scripts can resolve their paths.
Error Messages/Logs
No error messages. The failure is silent — "Successfully loaded skill" appears, then the agent proceeds with no instructions. Observable only by watching the agent's subsequent behavior (searching for files, not following skill steps).
❯ /my-plugin:my-skill
● Skill(my-plugin:my-skill)
⎿ Successfully loaded skill
● Search(pattern: "/home/user/.claude/**/my-plugin/**/my-skill*")
⎿ Found 0 files
● Bash(find /home/user/.claude -type d -name "my-plugin*" 2>/dev/null)
⎿ /home/user/.claude/plugins/data/my-plugin-inline
The agent immediately starts searching for the skill file on disk — it wouldn't do this if the SKILL.md content had been delivered.
Env var check in the same session:
● Bash(echo "CLAUDE_PLUGIN_ROOT=$CLAUDE_PLUGIN_ROOT; CLAUDECODE=$CLAUDECODE; CLAUDE_CODE_EXECPATH=$CLAUDE_CODE_EXECPATH")
⎿ CLAUDE_PLUGIN_ROOT=; CLAUDECODE=1; CLAUDE_CODE_EXECPATH=/usr/local/bin/claude
CLAUDE_PLUGIN_ROOT is empty while the other Claude Code env vars are set.
Steps to Reproduce
- Create a plugin with a skill (a directory with
.claude-plugin/plugin.jsonandskills/<name>/SKILL.md). Have the skill reference${CLAUDE_PLUGIN_ROOT}/...somewhere so the env var gap is observable. - Launch:
claude --plugin-dir /path/to/plugin - Invoke the skill:
/my-plugin:my-skill— confirm it works (agent follows SKILL.md instructions) - Run
/clear - Invoke the same skill again:
/my-plugin:my-skill - Observe: "Successfully loaded skill" prints, but agent has no instructions and starts searching for the file
- In the same session, run
echo "$CLAUDE_PLUGIN_ROOT"via the Bash tool — confirm it is empty
For the cron variant:
- In the working session (before
/clear), use CronCreate with prompt/my-plugin:my-skill - When the cron fires, the spawned session shows the same symptoms (empty skill body + empty
CLAUDE_PLUGIN_ROOT)
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.107
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
IntelliJ IDEA terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗