fix(server): Claude picks up project slash commands #13077
ClosedJoeEverest(GitHub profile, opens in a new tab)wants to merge 4 commits into
main fromrefs/pull/13077/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/server/src/provider/Drivers/ClaudeDriver.ts line 263OutdatedResolvedby JoeEverest(GitHub profile, opens in a new tab)@@ -239,8 +243,21 @@239243 ),240244 );245+ // Claude Code resolves slash commands from the cwd — `.claude/commands`246+ // and project-scoped plugins — so the machine-wide probe, which runs in247+ // the server's own directory, cannot see them. One CLI spawn per248+ // workspace, cached on the same TTL as the machine probe.249+ const workspaceSlashCommandsCache = yield* Cache.make({250+ capacity: WORKSPACE_PROBE_CACHE_CAPACITY,251+ timeToLive: CAPABILITIES_PROBE_TTL,252+ lookup: (workspaceCwd: string) =>253+ probeClaudeSlashCommandsForCwd(effectiveConfig, workspaceCwd, processEnv).pipe(254+ Effect.provideService(Path.Path, path),255+ ),256+ });241257 const snapshotForCwd = (cwd: string) =>242258 !effectiveConfig.enabled243259 ? snapshot.getSnapshot244260 : Effect.all([245261 snapshot.getSnapshot,246262 discoverClaudeSkills(effectiveConfig, cwd, processEnv),263+ Cache.get(workspaceSlashCommandsCache, cwd),
- apps/server/src/provider/Drivers/ClaudeDriver.ts line 263OutdatedResolvedby JoeEverest(GitHub profile, opens in a new tab)@@ -239,8 +243,21 @@239243 ),240244 );245+ // Claude Code resolves slash commands from the cwd — `.claude/commands`246+ // and project-scoped plugins — so the machine-wide probe, which runs in247+ // the server's own directory, cannot see them. One CLI spawn per248+ // workspace, cached on the same TTL as the machine probe.249+ const workspaceSlashCommandsCache = yield* Cache.make({250+ capacity: WORKSPACE_PROBE_CACHE_CAPACITY,251+ timeToLive: CAPABILITIES_PROBE_TTL,252+ lookup: (workspaceCwd: string) =>253+ probeClaudeSlashCommandsForCwd(effectiveConfig, workspaceCwd, processEnv).pipe(254+ Effect.provideService(Path.Path, path),255+ ),256+ });241257 const snapshotForCwd = (cwd: string) =>242258 !effectiveConfig.enabled243259 ? snapshot.getSnapshot244260 : Effect.all([245261 snapshot.getSnapshot,246262 discoverClaudeSkills(effectiveConfig, cwd, processEnv),263+ Cache.get(workspaceSlashCommandsCache, cwd),
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- packages/client-runtime/src/providerSkills.ts lines 129 to 129Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -111,3 +112,15 @@111112 return provider.workspaceSnapshots?.find((snapshot) => snapshot.cwd === cwd);112113 }113114115+/**116+ * Whether the provider's snapshot for `cwd` is recent enough to leave alone.117+ * Only refresh decisions use this. A stale snapshot still reads better than118+ * the machine-wide lists, so the resolvers below keep serving it until a119+ * newer one replaces it rather than dropping the workspace's own entries.120+ */121+export function hasFreshProviderWorkspaceSnapshot(122+ provider: ServerProvider | null | undefined,123+ cwd: string | null | undefined,124+): boolean {125+ const snapshot = provider && resolveProviderWorkspaceSnapshot(provider, cwd);126+ // @effect-diagnostics-next-line globalDate:off
juliusmarminge closed this
Sign in to join this conversation.

macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed