Skip to content

fix: honor CLAUDE_CONFIG_DIR in ts init global scope and transcript discovery#66

Open
andrebrait wants to merge 2 commits into
Mibayy:mainfrom
andrebrait:fix/claude-config-dir
Open

fix: honor CLAUDE_CONFIG_DIR in ts init global scope and transcript discovery#66
andrebrait wants to merge 2 commits into
Mibayy:mainfrom
andrebrait:fix/claude-config-dir

Conversation

@andrebrait

Copy link
Copy Markdown

Fixes #65.

What

Claude Code supports relocating its configuration directory via the CLAUDE_CONFIG_DIR environment variable. Two spots resolved Claude paths from a hardcoded ~/.claude:

  • settings_path("claude", "global") (cli_init/agent_paths.py) — ts init --agent claude --global wrote hooks into ~/.claude/settings.json, which Claude Code never loads on such setups, so the install silently had no effect.
  • transcript_root() (discover/transcript_scanner.py) — transcript discovery and the stats features scanned ~/.claude/projects instead of the active config dir.

Both now honor CLAUDE_CONFIG_DIR when set and keep the ~/.claude default otherwise. The explicit home override used by tests still wins over the environment variable.

Tests

Four new tests (two per module): env var honored, and default/explicit-home behavior preserved. Written first and confirmed failing on unpatched main, passing unchanged after the fix.

Full suite: 1793 passed, 9 skipped, 1 failed — the failure (tests/test_daemon_client.py::test_successful_call_returns_text) also fails on untouched upstream/main in the same environment, so it is pre-existing and unrelated.

🤖 Generated with Claude Code

andrebrait and others added 2 commits July 16, 2026 18:22
…iscovery

Claude Code supports relocating its config directory via the
CLAUDE_CONFIG_DIR environment variable. settings_path() resolved the
claude global scope from a hardcoded ~/.claude/settings.json, so
'ts init --agent claude --global' wrote hooks into a file Claude Code
never loads; transcript_root() likewise read ~/.claude/projects, so
transcript discovery and the stats features scanned the wrong directory.

Resolve both from CLAUDE_CONFIG_DIR when set; an explicit home override
(used by tests) still wins.

Fixes Mibayy#65

Co-Authored-By: Claude <noreply@anthropic.com>
andrebrait added a commit to andrebrait/token-savior that referenced this pull request Jul 16, 2026
…iscovery

Cherry-pick of upstream PR Mibayy#66 (fixes Mibayy#65).

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ts init and transcript discovery ignore CLAUDE_CONFIG_DIR

1 participant