Skip to content

No Claude sessions detected when $CLAUDE_CONFIG_DIR is set (~/.claude is hardcoded) #269

Description

@halindrome

Summary

CodeIsland never detects Claude Code sessions when the user has a custom $CLAUDE_CONFIG_DIR. Claude Code reads that variable to locate projects/ and settings.json, falling back to ~/.claude only when it is unset. CodeIsland hardcodes ~/.claude everywhere and has no reference to CLAUDE_CONFIG_DIR in the source tree, so it scans a directory that is empty for these users.

Impact

The symptom is worse than "no sessions in the list". With hideWhenNoSession enabled (the default in my setup), the app hides itself entirely — so it looks like CodeIsland crashed or failed to launch. It took a ps to confirm the process was alive and healthy the whole time.

Reproduction

  1. Set export CLAUDE_CONFIG_DIR="$HOME/.config/claude-code" and use Claude Code normally, so transcripts accumulate there.
  2. Launch CodeIsland with several Claude sessions running.
  3. No sessions appear. With hideWhenNoSession = 1, the app is invisible.

On my machine:

$ ls ~/.claude/projects | wc -l                 # 0 (directory does not exist)
$ ls ~/.config/claude-code/projects | wc -l     # 12
$ echo $CLAUDE_CONFIG_DIR
/Users/…/.config/claude-code

Affected paths

~/.claude is hardcoded at these session-discovery and config sites:

  • Sources/CodeIsland/AppState.swiftreadModelFromTranscript, discoveryWatchRoots, findActiveClaudeSessions
  • Sources/CodeIsland/SessionTitleStore.swift — transcript lookup
  • Sources/CodeIslandCore/ClaudeUsageScanner.swiftclaudeHome default
  • Sources/CodeIsland/ConfigInstaller.swift — hook settings.json target
  • Sources/CodeIsland/DiagnosticsExporter.swift — settings capture

(The /.claude/worktrees/agent- checks are substring matches on a session's cwd, not config lookups, and are correctly left alone.)

A note on the fix

Reading the environment variable alone is not sufficient. CodeIsland is normally launched from Finder or as a login item, and such a process inherits no shell environment — $CLAUDE_CONFIG_DIR is simply absent. A fix needs a user-visible setting (or a filesystem probe) in addition to the env var. I verified this: with the env var honored but no other fallback, a Finder launch still finds nothing.

I have a PR ready that adds a small resolver with a preference → env var → ~/.config/claude-code probe → ~/.claude chain, keeping current behavior byte-for-byte for users without a custom config dir. Happy to adjust the approach if you would prefer something different.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions