Repository navigation
Support $CLAUDE_CONFIG_DIR for custom config paths #349
Description
Problem
Claude Code supports $CLAUDE_CONFIG_DIR to override the default ~/.claude directory. However, gstack hardcodes ~/.claude/skills/gstack throughout the codebase (480 occurrences across 50 files). When a user runs Claude Code with a custom $CLAUDE_CONFIG_DIR, gstack silently references the default ~/.claude directory instead — reading the wrong memories, settings, and project config, and writing state to the wrong location.
Scope of affected files
Source-of-truth files (7 — must change)
| File | Role |
|---|---|
scripts/gen-skill-docs.ts |
Defines skillRoot, binDir, browseDir on lines 42-45; embeds paths into all generated preamble/postamble templates |
setup |
Install script — creates symlinks in ~/.claude/skills/, rewrites paths for kiro/codex |
scripts/skill-check.ts |
Validates generated output contains correct host paths |
browse/src/find-browse.ts |
Binary discovery — searches ~/.claude/skills/gstack/browse/dist/browse |
bin/gstack-global-discover.ts |
Session discovery across ~/.claude/projects |
bin/dev-setup |
Creates .claude/skills/gstack dev symlink |
bin/dev-teardown |
Cleans up dev symlinks |
Template files with their own hardcoded paths (~17 .tmpl files)
Several templates (notably gstack-upgrade/SKILL.md.tmpl with 19 refs, codex/SKILL.md.tmpl with 5, autoplan/SKILL.md.tmpl with 7) contain literal ~/.claude/skills/gstack in bash blocks beyond what the generator injects. These need fixing too.
Auto-fixed (no direct changes needed)
28 generated SKILL.md files — regenerated from templates when sources are fixed.
Also need updates
- 6 test files (verify path correctness in generated output)
- 8 documentation files (CLAUDE.md, ARCHITECTURE.md, etc.)
Proposed fix
Replace hardcoded ~/.claude with ${CLAUDE_CONFIG_DIR:-$HOME/.claude} at each layer:
gen-skill-docs.ts— changeskillRoot,localSkillRoot,binDir,browseDirto use the dynamic patternsetup— resolve install target via${CLAUDE_CONFIG_DIR:-$HOME/.claude}find-browse.ts— check$CLAUDE_CONFIG_DIRwhen searching for the browse binarybin/dev-setup,bin/dev-teardown— same pattern.tmplfiles — replace literal~/.claude/skills/gstackwith the dynamic pattern in bash blocks- Regenerate all SKILL.md files
Relation to #289
Issue #289 (host integration contract RFC) proposes a broader abstraction for multi-host support. $CLAUDE_CONFIG_DIR support is a concrete, narrower fix that can land independently — it fixes a real bug for Claude Code users today without waiting for the full host adapter architecture. The fix naturally aligns with #289's direction since it makes path resolution dynamic rather than hardcoded.
Impact
Users running Claude Code with a custom $CLAUDE_CONFIG_DIR will have gstack silently reference the default ~/.claude directory. This means gstack reads the wrong memories, settings, and project config — and writes state (sessions, analytics, skill data) to the wrong location. No error or warning is shown.
Activity
fix: support \$CLAUDE_CONFIG_DIR for custom config paths (garrytan#349)
loocor commentedon Mar 23, 2026
Thanks for writing this up so concretely. I now have PR #364 open as the phase-1 install/runtime tranche of RFC #289:
#364
That PR does not add
$CLAUDE_CONFIG_DIRsupport yet, but it does pull host layouts, discovery roots, and runtime roots into a single contract (scripts/host-registry.ts) instead of leaving them scattered across setup/templates/checks.So to me this issue now looks like a strong, narrow follow-up on top of that contract: config-root resolution should become part of the host path model rather than another repo-wide literal-path cleanup.
zehua commentedon Mar 23, 2026
@loocor let's figure out if the proposed fix in #351 could be merged first or be done on top of #364
loocor commentedon Mar 24, 2026
The changes are huge, and I guess Garry won't merge it.
mkyed commentedon Apr 28, 2026
Until this lands, here's a workaround that auto-applies on every
/gstack-upgrade. Sharing in case it helps anyone running withCLAUDE_CONFIG_DIRset:A
git post-mergehook in each gstack repo runs an idempotent substitution overSKILL.mdandSKILL.md.tmpl, replacing~/.claude/skills/gstack/with the active context's path. Because the hook lives in.git/hooks/, it survivesgit pulland fires automatically after/gstack-upgrade.Script — drop this somewhere on your PATH (e.g.
~/bin/gstack-fix-paths):Hook — drop this in each gstack repo's
.git/hooks/post-merge, mode755:Verified end-to-end on v1.15.0.0: rolled back to v1.14.0.0, artificially regressed
pair-agent/SKILL.md(45 hardcoded refs), rangit pull --ff-only origin main, hook fired automatically and patched 62 SKILL.md files. Idempotent — re-run patches 0.Tested with two parallel contexts (
~/Work/.claudeand~/Personal/.claude). Usesperl -piso it works on both BSD/macOS and GNU/Linux without thesed -isyntax difference.elifarley commentedon Jun 10, 2026
Confirming this still bites on v1.57.9.0, with the most common user-visible failure mode in case it helps prioritize:
Under a custom
CLAUDE_CONFIG_DIR,/autoplanand/codexprint[codex-unavailable: auth missing]on every run even with Codex authenticated. The hardcodedsource ~/.claude/skills/gstack/bin/gstack-codex-probecan't resolve, so_gstack_codex_auth_probeis never defined and! <undefined-cmd>(exit 127) reads as an auth failure. The same mechanism silently degrades thegstack-config/ telemetry / learnings calls.Two small notes for whoever picks this up:
gen:skill-docsoutput and the gate passes.Happy to help test whichever approach lands.
time-attack commentedon Jul 15, 2026
@zehua CLAUDE_CONFIG_DIR remains unsupported by the runtime path contract, and the current pull requests do not implement it safely.
v1.64.0.0 fix wave: full tracker audit — 90 fixes, 52 issues closed, …
capy-ai commentedon Oct 11, 2026
Thanks @zehua and everyone who confirmed this. Installs under a custom CLAUDE_CONFIG_DIR now get their own rendered skills that point at the right root (v1.91.16.0, #1882), so the
/autoplanand/codexcodex-probe failures from hardcoded ~/.claude paths are gone. One small leftover (setup run from outside a skills dir) is tracked in TODOS.md; please upgrade and reopen if you still see wrong-path behavior.