DEV Community

J Now
J Now

Posted on

Why my Claude Code skill-tree plugin has two state paths

Built skill-tree to answer a specific question: am I actually developing new collaboration behaviors with Claude, or just running the same handful faster? Anthropic published a study in February (9,830 conversations, 11 observable behaviors) and I wanted my own sessions classified against that baseline.

The plugin classifies those same 11 behaviors from the Dakan & Feller 4D AI Fluency Framework, assigns one of seven archetype cards (rendered as tarot cards with museum art), and picks a behavior you haven't tried as a growth quest for your next session. The quest persists across sessions via a SessionStart hook.

That persistence is where the interesting constraint showed up.

Claude Code has a stable home directory, so state goes to ~/.skill-tree/ and that's that. Cowork's $HOME is ephemeral — anything written there is gone when the session ends. Which means a growth quest written to $HOME/.skill-tree/quest.json after session one doesn't exist when session two starts. The plugin never fails loudly; it just silently loses your state and picks a new quest as if you're a first-time user.

The fix is one conditional and one env var:

if os.environ.get("CLAUDE_PLUGIN_ROOT"):
    state_dir = Path(os.environ["CLAUDE_PLUGIN_ROOT"]) / ".user-state"
else:
    state_dir = Path.home() / ".skill-tree"
Enter fullscreen mode Exit fullscreen mode

$CLAUDE_PLUGIN_ROOT is durable in Cowork even when $HOME isn't, so quest state survives there. Claude Code doesn't set that variable, so it falls back to the home directory path.

Small thing, but it's the kind of environmental difference that only bites you after you've watched a user lose their progress and gone looking for why.

Install in Claude Code: claude plugin marketplace add robertnowell/ai-fluency-skill-cards && claude plugin install skill-tree-ai@ai-fluency-skill-cards

Example archetype card: skill-tree-ai.fly.dev/fixture/illuminator

github.com/robertnowell/skill-tree

Top comments (0)