Repository navigation
fix(paths): follow CLAUDE_CONFIG_DIR to the session tree (#166) - #167
Merged
Merged
Conversation
added 2 commits
July 26, 2026 11:22
Claude Code relocates its whole config tree, projects/ included, when CLAUDE_CONFIG_DIR is set — a separate account per project. The plugin hardcoded ~/.claude, listed a directory with no current transcripts, and the save pipeline no-oped in silence: five days, ~2000 PostToolUse invocations, zero saves, nothing in the logs. Not finding anything is the mild version. A stale transcript sitting in the default tree with more lines than delta_lines_trigger would have been summarized into memory as though it were the live session. Resolved through one claude_projects_dir helper rather than four copies of the path, because four copies of a path is how the slug ended up with five implementations that drifted. The test suite leaked the same variable. Sandboxes point HOME at a temp dir and never cleared CLAUDE_CONFIG_DIR, so a developer who exports it had the real value follow the code out of the fixture. It was invisible while the plugin ignored the variable and appeared the moment it stopped — cleared in conftest for every test, and verified by running the whole suite with it exported: 684 pass with the guard, the reporter's exact five fail without it. Co-Authored-By: Max <noreply>
Review caught the sweep missing scripts/run-tests.sh:146, which still hardcoded $HOME/.claude. So the harness wrote its fixture transcript to one tree while pipeline.shell — now correctly following CLAUDE_CONFIG_DIR — read another, and `shell extract` failed for exactly the developers this fix is for. Pointedly ironic: the commit that introduced the helper says four copies of a path is how the slug ended up with five implementations that drifted. This was a fifth copy of this one, missed by the sweep that argued against copies. detect-tools.sh is not sourced by run-tests.sh, so it expands the variable the same way claude_projects_dir does rather than growing a sixth definition. Verified: with CLAUDE_CONFIG_DIR exported, `shell extract` now passes. The one remaining ✗ (save-session.sh --dry) fails identically with the variable unset — environmental, no session transcript for this checkout, untouched by this branch. Co-Authored-By: Max <noreply>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #166.
Claude Code relocates its whole config tree —
projects/included — whenCLAUDE_CONFIG_DIRis set, which people use to run a separate account per project. The plugin hardcoded~/.claude, so it listed a directory holding no current transcripts and the save pipeline no-oped in silence.The reporter's numbers: five days, ~2000
PostToolUseinvocations, zero saves. Emptylogs/autonomous/, emptytmp/, nonow.md, and nothing anywhere suggesting a problem — the hook wrote its env line and exited 0 every time.Not finding anything is the mild version. A stale transcript left in the default tree with more lines than
delta_lines_triggerwould have been summarized into memory as though it were the live session.The fix
All four sites resolve through one
claude_projects_dir()helper instead of four copies of the path. Four copies is how the session slug ended up with five implementations that drifted apart, and three consecutive review rounds each found a copy that had missed an update.The half that was hiding it
The test suite leaked the same variable. Sandboxes point
HOMEat a temp directory and never clearedCLAUDE_CONFIG_DIR, so a developer who exports it had the real value follow the code straight out of the fixture and into their actual store.That stayed invisible precisely because of the bug: while the plugin ignored the variable, the leak and the defect cancelled out. Honouring it exposed both at once.
Cleared in
conftest.pyfor every test rather than in the five fixtures that happened to break, so the next sandbox is hermetic without anyone needing to know why. Verified the only way that means anything — running the whole suite with the variable exported:Credit
@samoilovartem reported this with a verified patch, the four exact call sites, the worse-variant analysis, and a correct prediction of which five tests would break and why. The test-fixture insight is the part that turns a one-line patch into a fix that stays fixed.
684 passing.