Skip to content

Use the configured Claude profile for skills, fork and usage - #6495

Closed
ymichael wants to merge 1 commit into
mainfrom
bb/claude-config-dir-fixes-thr_s3wyu7n866
Closed

ymichael wants to merge 1 commit into
mainfrom
bb/claude-config-dir-fixes-thr_s3wyu7n866

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The Claude Code plugin worked out the Claude config folder in three places, and none of them matched Claude Code when CLAUDE_CONFIG_DIR is set:

What changed

All changes are inside plugins/provider-claude-code: no daemon protocol change and no SDK change.

  • native-roots.ts: removed the declared user root .claude/skills. The resolver already returns the active profile's skills folder, ~/.claude/skills by default.
  • New bridge/config-directory.ts: one rule for the Claude folder. CLAUDE_CONFIG_DIR is resolved against the session's cwd and NFC-normalized; when it's unset, the folder is ~/.claude. The same file gives the profile's account file and Keychain service: Claude Code-credentials, plus -<first 8 hex of sha256(CLAUDE_CONFIG_DIR)> when the variable is set.
  • bridge.ts: fork passes the session cwd.
  • provider-maintenance.ts: health and usage read the active profile's credentials file, account file and Keychain item.
  • Native-roots golden: the config-dir fixture now expects the default folder's skills to be absent.

Known trade-off: if the Claude resolver fails, for example because the plugin worker crashed, ~/.claude/skills drops out of bb's skill list until it recovers. bb retries after its 10-second cache window. Before this change, the declared root kept that folder listed.

Out of scope: project env overrides in listings (#3925), and the bb CLI skill install folder.

How you verified

  • New credentials test: with CLAUDE_CONFIG_DIR set, usage reads only that profile's Keychain item and files. It fails on main and passes here.
  • Native-roots golden claude-code (config-dir): fails on main because it lists home-claude-skill and linked-home-skill, and passes here. The default golden is unchanged.
  • New config-directory.test.ts: relative paths resolve against the session's cwd, and the default profile is unchanged.
  • pnpm exec turbo run typecheck test --filter=bb-plugin-provider-claude-code passes. All 22 native-roots goldens pass, as do 12 server test files that cover Claude skills and provider roots (180 tests). oxlint is clean.
  • The Keychain suffix rule follows Claude Code's naming. I couldn't confirm it from the compiled CLI, and I haven't checked it against a real moved profile's Keychain item.

Fixes #3926
Fixes #3607

🤖 Generated with Claude Code

AGENT GENERATED

Claude Code declared ~/.claude/skills as a fixed user root while its
resolver also returned $CLAUDE_CONFIG_DIR/skills, so a moved profile listed
both. The resolver already returns the active folder, so the fixed root is
gone.

Fork resolved a relative CLAUDE_CONFIG_DIR against the bridge process
instead of the session's cwd, where Claude Code reads it.

Health and usage read credentials, the account file and the macOS Keychain
item of the default profile; they now read the profile CLAUDE_CONFIG_DIR
selects.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael ymichael closed this Oct 28, 2026
ymichael added a commit that referenced this pull request Nov 6, 2026
## Human comments

## What was wrong

`provider-claude-code` declared a static user skill root
(`.claude/skills` under home) and also set
`experimental_resolvesNativeRoots`, resolving its roots from
`CLAUDE_CONFIG_DIR`. bb scans declared roots in addition to resolved
ones, so with `CLAUDE_CONFIG_DIR` set the skill list included
`~/.claude/skills` as well as `$CLAUDE_CONFIG_DIR/skills`. Claude Code
reads only the configured directory, so the listing offered skills the
agent never loads (#3926).

## What changed

- `plugins/provider-claude-code/src/native-roots.ts`: removed the
declared `user` skill root. `resolveClaudeNativeRoots` already returns
`<claudeDir>/skills`, which is `~/.claude/skills` by default and
`$CLAUDE_CONFIG_DIR/skills` when set. The declared project roots are
unchanged.
- `tests/integration/native-roots-golden`: the fixture now treats the
home skills (`home-claude-skill`, `linked-home-skill`) as present in the
default variant and absent in the `config-dir` variant, and the
`claude-code.config-dir.json` golden drops them.

This is the skills half of closed #6495. The health/usage, fork and
`config-directory.ts` changes are out of scope; #3607 covers them. The
change stays inside the plugin: no protocol bump, no SDK change.

## How you verified

- `pnpm exec turbo run test --filter=bb-plugin-provider-claude-code`: 29
files, 430 tests pass.
- `vitest run native-roots-golden` in `tests/integration`: 22 tests
pass, including the default and config-dir Claude Code variants. Without
the native-roots change, the updated fixture fails because the home
skills are reported under `CLAUDE_CONFIG_DIR`.
- CI runs the full suites.

Fixes #3926

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant