Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug] Project-scope skill discovery uses stale global cwd, never the active worktree — .claude/skills/<name> never surfaces in the composer picker #7871

ClosedManuelG2711(GitHub profile, opens in a new tab) opened this issue 1 comment

Summary

Project-scope Claude skills (.claude/skills/<name>/SKILL.md committed in a repo) never appear in the composer's / or $ picker for sessions running in a git worktree, even when the file is present on disk, the app has been fully restarted, and the worktree branch includes the commit that added it. User-scope skills (~/.claude/skills/<name>) work fine in the same sessions.

Root cause

ClaudeDriver.create resolves the cwd used for skill/capability discovery from the app-global ServerConfig service, not from the workspace/worktree of the thread actually being served:

// apps/server/src/provider/Drivers/ClaudeDriver.ts:124
const { cwd } = yield* ServerConfig;
...
// :156-163
const capabilitiesProbeCache = yield* Cache.make({
  capacity: 1,
  timeToLive: CAPABILITIES_PROBE_TTL,
  lookup: () =>
    probeClaudeCapabilities(effectiveConfig, processEnv, cwd)...
});
...
// :166-171
const checkProvider = checkClaudeProviderStatus(
  effectiveConfig, ..., processEnv, cwd,
)

ServerConfig.cwd (apps/server/src/config.ts:71) is set once at server bootstrap and used only for autoBootstrapProjectFromCwd — it has no relationship to worktrees, which live under a separate worktreesDir. Since the capabilities cache is capacity-1 and keyed off this fixed cwd, discoverClaudeSkills's project-scope scan (apps/server/src/provider/Drivers/ClaudeSkills.ts:95-155, which correctly checks <cwd>/.claude/skills) is effectively always run against the wrong directory for any worktree.

On the client, ChatComposer.tsx (~862-888, 1082-1156) sources the picker's skillItems/providerSlashCommandItems from this same per-provider-instance snapshot (one snapshot per configured account, per its own code comment — not per open thread/worktree), so the stale result is what every worktree's composer sees. User-scope discovery (ClaudeSkills.ts:104-105) is intentionally cwd-independent, which is why ~/.claude/skills/* skills are unaffected and always show up.

Note: discoverClaudeSkills already merges user- and project-scope skills by design (project wins on name collision) — this bug is purely that project-scope discovery runs against the wrong cwd, not a missing merge capability.

Repro

  1. Add .claude/skills/foo/SKILL.md to a repo and merge it to main.
  2. Create a fresh worktree/session from post-merge main.
  3. Restart t3code entirely.
  4. Type /foo in that session's composer.

Expected: /foo matches the skill and fires it (same as a user-scope skill would). Actual: nothing happens — the picker has no entry for it, and Enter just submits the literal text as a chat message.

Suggested fix direction

Thread the requesting thread's actual worktree path into skill/capability discovery instead of the global ServerConfig.cwd — e.g. key probeClaudeCapabilities/checkClaudeProviderStatus calls (and their cache) by the active project/worktree path when a thread context is available, falling back to ServerConfig.cwd only for the account-level health check in Settings, which doesn't need project skills at all. Correspondingly, ChatComposer.tsx would need to source skills/slashCommands per active thread's workspace rather than solely from selectedProviderEntry.snapshot.

  1. Note

    🤖 GPT-5.6 Sol in Codex responding on behalf of Theo

    Closing as a duplicate of #6449. Claude skill discovery uses the server startup directory instead of the active project.

    Track the remaining work in #6449.

Sign in to join this conversation.