claude-code - 💡(How to fix) Fix CLAUDE_PLUGIN_DATA is unnamespaced — plugins persisting it via CLAUDE_ENV_FILE pollute other plugins and skills

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

CLAUDE_PLUGIN_DATA is a shared, unnamespaced environment variable. When Claude Code runs a plugin hook, it sets CLAUDE_PLUGIN_DATA to that plugin's data directory. Plugins can then persist this into the session via CLAUDE_ENV_FILE. Because the variable name is not scoped to the plugin that set it, any other plugin or skill that reads CLAUDE_PLUGIN_DATA later in the same session will get the wrong path.

RAW_BUFFERClick to expand / collapse

Summary

CLAUDE_PLUGIN_DATA is a shared, unnamespaced environment variable. When Claude Code runs a plugin hook, it sets CLAUDE_PLUGIN_DATA to that plugin's data directory. Plugins can then persist this into the session via CLAUDE_ENV_FILE. Because the variable name is not scoped to the plugin that set it, any other plugin or skill that reads CLAUDE_PLUGIN_DATA later in the same session will get the wrong path.

Reproduction

  1. Install the Codex plugin (codex@openai-codex) — its SessionStart hook calls CLAUDE_ENV_FILE to persist CLAUDE_PLUGIN_DATA into the session
  2. Also install any skill or plugin that reads CLAUDE_PLUGIN_DATA to find its own state directory (e.g. gstack)
  3. Start a new session — the later plugin/skill reads CLAUDE_PLUGIN_DATA and gets the Codex plugin's data path

Why this matters

CLAUDE_ENV_FILE is the correct, documented mechanism for plugins to make env vars available to their skill scripts post-hook. The Codex plugin is using it correctly. The platform design issue is that CLAUDE_PLUGIN_DATA is a single shared name with no plugin-scoped namespace — so any plugin persisting it clobbers the value for every other plugin that reads it later.

Suggested fix

Namespace the variable by plugin ID: CLAUDE_PLUGIN_DATA_<PLUGIN_ID> (e.g. CLAUDE_PLUGIN_DATA_CODEX_OPENAI_CODEX). This is a breaking change, so a transition period where both the old and new names are set would ease migration. Alternatively, document that CLAUDE_PLUGIN_DATA is a hook-only variable and must not be persisted via CLAUDE_ENV_FILE — and provide a separate mechanism for plugins that need their data path available in skill scripts post-hook.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix CLAUDE_PLUGIN_DATA is unnamespaced — plugins persisting it via CLAUDE_ENV_FILE pollute other plugins and skills