Skip to content

Does not detect claude instances if claude's directory is a custom path #12

@hmenzagh

Description

@hmenzagh

Context

I use two separate Claude Code configurations:

  • ~/.claude for my personal plan
  • ~/.claude-pro for my enterprise plan

I switch between them using aliases like:

alias claude-pro='CLAUDE_CONFIG_DIR=~/.claude-pro claude'

Problem

abtop seams to hardcode the sessions and projects directories to ~/.claude/sessions and ~/.claude/projects.

When I launch Claude from my enterprise configuration (CLAUDE_CONFIG_DIR=~/.claude-pro), abtop does not detect the running sessions because it keeps looking in ~/.claude/ instead of ~/.claude-pro/.

Expected behavior

abtop should respect the CLAUDE_CONFIG_DIR environment variable — which is the official Claude Code mechanism for overriding the config directory — and use it to resolve the sessions and projects paths at startup.

For example, if CLAUDE_CONFIG_DIR=~/.claude-pro is set, abtop should look in ~/.claude-pro/sessions and ~/.claude-pro/projects.

Suggested fix

In src/collector/claude.rs, the ClaudeCollector::new() function currently does:

let home = dirs::home_dir().unwrap_or_default();
Self {
    sessions_dir: home.join(".claude").join("sessions"),
    projects_dir: home.join(".claude").join("projects"),
    ...
}

It could be updated to check for CLAUDE_CONFIG_DIR first:

let base = std::env::var("CLAUDE_CONFIG_DIR")
    .map(PathBuf::from)
    .unwrap_or_else(|_| dirs::home_dir().unwrap_or_default().join(".claude"));
Self {
    sessions_dir: base.join("sessions"),
    projects_dir: base.join("projects"),
    ...
}

This would make abtop consistent with how Claude Code itself handles multi-account setups.

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