Skip to content

PAI does not work correctly when installed to a non-default CLAUDE_CONFIG_DIR #830

@raychaser

Description

@raychaser

I use multiple CLAUDE_CONFIG_DIR locations to isolate different workflows. This has been working well, but PAI was effectively hardcoded to ~/.claude — around 30 files used inline process.env.PAI_DIR || join(homedir(), '.claude') patterns that didn't resolve correctly when running from a non-default config directory.

I worked on fixing this and got it working. The fix centralizes all path resolution into a single getPaiDir() helper in hooks/lib/paths.ts that handles $HOME, ${HOME}, and ~ expansion, with homedir() as the fallback. The rest of the changes are mechanical: swap the inline pattern for the helper, remove unused imports.

Here's the diff: main...raychaser:Personal_AI_Infrastructure:main

~48 files touched, though the changes are almost entirely mechanical (import swap + pattern replacement). Tested with a non-default CLAUDE_CONFIG_DIR — hooks fire correctly, statusline works, sessions track to the right directory.

I'd love to see this upstreamed but wanted to check if there's interest before opening a PR, given the size of the change.

Naturally, I found out only after doing all of this about #694, #778, and #784. Should have done research first. Maybe a triumvirate can get it done? @Spirotot @neilinger My change is based on Release 4.0.1 but now has the 4.0.2 changes as well.

PR now live: #873

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