fix: prefer CLAUDE_CONFIG_DIR for plugin detection to avoid wrong-profile selection#6
Open
fix: prefer CLAUDE_CONFIG_DIR for plugin detection to avoid wrong-profile selection#6
Conversation
…file selection When multiple Claude profiles are installed (e.g., ~/.claude and ~/.claude-jsl), the previous `find "$HOME/.claude" "$HOME/.claude-"*` pattern with `head -1` always resolved to ~/.claude alphabetically, even when running from the JSL profile. Claude Code exposes CLAUDE_CONFIG_DIR pointing to the active profile. The fix checks that env var first and falls back to the broad find pattern only when CLAUDE_CONFIG_DIR is unset or the plugin isn't found under it. This preserves backward compatibility with the default profile and older Claude Code versions. Affects: ce:refresh (Step 1), ce:run (Step 2), ce:user-scenarios (Step 2) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When multiple Claude profiles are installed (e.g.,
~/.claudeand~/.claude-jsl), the plugin detection logic:PLUGIN_DIR=$(find "$HOME/.claude" "$HOME/.claude-"* -path "*/compound-engineering/*/agents/review" -type d 2>/dev/null | head -1 | sed 's|/agents/review$||')always resolves to
~/.claudealphabetically becausefindlists it first andhead -1takes that. Users running from a non-default profile (e.g.,~/.claude-jsl) end up with the wrongPLUGIN_DIR, pointing at the default profile's plugin installation instead of their active one.Fix
Claude Code exposes
CLAUDE_CONFIG_DIRas an environment variable pointing to the active profile directory. The fix checks that variable first:The fallback preserves backward compatibility with:
~/.claudeprofile (whereCLAUDE_CONFIG_DIRmay equal~/.claudeor be unset)CLAUDE_CONFIG_DIRplugins/compound-engineeringrelative path)Files changed
skills/refresh/SKILL.md— Step 1: Locate plugin (searches foragents/review)skills/ce-run/SKILL.md— Step 2: Locate plugin (searches fororchestrators)skills/ce-user-scenarios/SKILL.md— Step 2: Locate plugin (searches foragents/user)Test plan
/ce:refreshfrom the JSL profile resolvesPLUGIN_DIRto~/.claude-jsl/plugins/...instead of~/.claude/plugins/...CLAUDE_CONFIG_DIRset falls back to thefindpattern unchanged🤖 Generated with Claude Code