You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
init: CLAUDE_CONFIG_DIR is used as given when relative or holding a literal ~ #4247
resolve_claude_dir_from (src/hooks/init/mod.rs) returns CLAUDE_CONFIG_DIR as-is whenever it is non-empty. A relative value, or one holding a ~ the shell never expanded (quoted in an env file, set in a GUI launcher), resolves against the current directory.
On develop (c50ff30d), run from a project directory with a fresh HOME:
CLAUDE_CONFIG_DIR
result
~/.claude (literal)
exit 1, Failed to create temp file in ~/.claude
.claude, missing
exit 1, same error
.claude, exists in the project
exit 0, writes ./.claude/{RTK.md,CLAUDE.md,settings.json} and reports a global install
Once #2521 lands, the first two also exit 0 and create ./~/.claude/ or ./.claude/ in the project.
Options: reject non-absolute values with an error naming the variable, or expand a leading ~ and then reject anything still relative. resolve_codex_dir_from uses the same non-empty filter on CODEX_HOME; the Hermes, Droid, Copilot and Pi resolvers are worth checking at the same time.
Closing as not planned, and I apologise: this issue was wrong.
Claude Code reads CLAUDE_CONFIG_DIR exactly as set (process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), ".claude")). That holds in every release from 0.2.9 to 2.1.304, on Linux and Windows, including 2.1.283, the current release when I opened this. A literal ~ or a relative value resolves against the directory Claude Code was launched from: started in proj/ with CLAUDE_CONFIG_DIR='~/.claude', it loads proj/~/.claude/settings.json. So the three rows in the table above are rtk agreeing with Claude Code. Expanding or rejecting the value, as #4261 did at my suggestion, makes rtk init install where Claude Code never looks and makes the hook miss the user's deny rules.
One real problem came out of checking this: rtk's hook resolves a relative value against its own working directory, which moves when the agent cds, while Claude Code keeps the launch directory. That is now #4676.
Activity
rtk-wshm-sync-bot commentedon Sep 25, 2026
🔍 Automated Triage
bughighSummary
resolve_claude_dir_from (and likely codex/hermes/droid/copilot/pi resolvers) accepts relative paths and unexpanded literal
~for CONFIG_DIR env vars, causing wrong-directory writes or misleading global-install reports; should reject or properly expand/validate.📁 Relevant files
src/hooks/init/mod.rsSuggested Actions
~Triaged automatically by wshm · This is an automated analysis, not a human review.
KuSh commentedon Oct 20, 2026
Closing as not planned, and I apologise: this issue was wrong.
Claude Code reads
CLAUDE_CONFIG_DIRexactly as set (process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), ".claude")). That holds in every release from 0.2.9 to 2.1.304, on Linux and Windows, including 2.1.283, the current release when I opened this. A literal~or a relative value resolves against the directory Claude Code was launched from: started inproj/withCLAUDE_CONFIG_DIR='~/.claude', it loadsproj/~/.claude/settings.json. So the three rows in the table above are rtk agreeing with Claude Code. Expanding or rejecting the value, as #4261 did at my suggestion, makesrtk initinstall where Claude Code never looks and makes the hook miss the user's deny rules.One real problem came out of checking this: rtk's hook resolves a relative value against its own working directory, which moves when the agent
cds, while Claude Code keeps the launch directory. That is now #4676.