Skip to content

fix(ai-vault): list Claude sessions under a CLAUDE_CONFIG_DIR exported only by the login shell - #33506

Merged
nwparker merged 1 commit into
mainfrom
nwparker/agint-claude-history-custom-config-roots
Oct 25, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/agint-claude-history-custom-config-roots

Conversation

@nwparker

@nwparker nwparker commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2

ELI5

If you tell Claude Code to keep its files somewhere other than ~/.claude by putting export CLAUDE_CONFIG_DIR=... in your shell startup file, Orca opened from the Dock or Finder never sees that line. Agent Session History, the Claude usage scan, and transcript lookups only looked in ~/.claude/projects, so those sessions didn't show up. Orca's Claude account router already reads your login shell to find this folder. History now looks there too.

Root cause

  • Claude Code writes transcripts to $CLAUDE_CONFIG_DIR/projects/<encoded-cwd>/<id>.jsonl. You can see this in the installed CLI (2.1.310): function s(){return process.env.CLAUDE_CONFIG_DIR} and x(process.env.CLAUDE_CONFIG_DIR||Y_(), ...). I also confirmed it with a real run (below).
  • refactor(ai-vault, native-chat): one per-call agent root table #27079 made claudeProjectsHostDirs() respect CLAUDE_CONFIG_DIR, but it only reads process.env. A macOS GUI launch doesn't get variables exported from rc files.
  • ClaudeProfileRouter already resolves the login-shell env ("Dock launches lack CLAUDE_CONFIG_DIR exported by shell startup files"). systemDefaultHome() returned the right folder, but claudeProfileHistoryDirs() only returned managed account homes.

Change

  • claudeProfileHistoryDirs() now puts the router's userConfigDir() ahead of the account homes. userConfigDir() is the user's own CLAUDE_CONFIG_DIR; Orca-injected account pins are already excluded, and it is undefined when not overridden. Every consumer goes through this one function, so all of them pick it up: AI Vault scan roots (passed to scan workers via localAiVaultScanRoots), the subagent transcript allowlist, native-chat session file resolution, Claude usage transcript discovery, and worktree-retirement discovery.
  • Usage discovery and retirement discovery now de-dupe their root lists, so a folder that comes from both process.env and the login shell is walked only once.
  • Added a regression test in claude-profile-router.test.ts. It fails on main.

Verification

  • Real CLI repro: I used an isolated HOME=/tmp/agint-… with CLAUDE_CONFIG_DIR=$HOME/.claude-work and the real claude 2.1.310 talking to a local fake Anthropic endpoint. The transcript landed in .claude-work/projects/-private-tmp-…-proj/<id>.jsonl, and $HOME/.claude was never created.
  • Real code-path repro (not checked in): $HOME/.zshrc exports CLAUDE_CONFIG_DIR, process.env has none, and SHELL=/bin/zsh. A real ClaudeProfileRouter resolved the real login shell, then I ran localAiVaultScanRoots() and scanAiVaultSessions().
    • main: router systemDefaultHome = …/.claude-work, claudeProfileProjectsDirs = [], 0 Claude sessions.
    • this branch: the session is listed.
  • Resume: zsh -ilc 'claude --resume <id> -p again' from the same isolated home picked up CLAUDE_CONFIG_DIR from .zshrc and appended to the same transcript. History's plain claude --resume in an Orca terminal therefore works for this setup.
  • pnpm tc:node, the targeted tests (router, scanner roots, claude-usage, retirement, native-chat), and check:code-quality:changed all pass.

Scope / not covered

This fixes the "one custom config dir exported by the shell" case, plus Windows user-level env vars set after Orca started, because the router's PowerShell probe reads them. It does not cover the multi-profile setup where each terminal or wrapper (for example claude-work) sets its own CLAUDE_CONFIG_DIR and nothing global names those dirs. That needs a product decision: a setting for extra Claude config dirs, or deriving dirs from the configured Claude command. That's why this PR says Refs, not Fixes.

Risk

Low. This adds at most one existing directory (the user's own Claude config) to the history roots. Hosts without an override are unchanged, because userConfigDir() is undefined there.

Refs #23505

…d only by the login shell

A Dock-launched Orca never inherits CLAUDE_CONFIG_DIR from ~/.zshrc, so session
history, usage and transcript lookups only scanned ~/.claude/projects. The Claude
account router already resolves the login-shell value; reuse it as a history root.

Refs #23505
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.

1 participant