The best way to control Claude Code, Codex and more from any computer or phone
fix(server): list skills from plugins synced from claude.ai (#28633)
Julius Marminge committed
Nov 11, 2026 at 15:46 UTC
2cd799642bd6e5d0e1cfe094e5c0dee428b59eb0
4 files changed
+421
-59
apps/server/src/provider/Drivers/ClaudeSkills.test.ts
+224
@@ -354,6 +354,230 @@ it.layer(NodeServices.layer)("discoverClaudeSkills", (it) => {
354
}),
355
);
356
357
+ it.effect("discovers skills from the current account's claude.ai synced plugins", () =>
358
+ Effect.gen(function* () {
359
+ const fs = yield* FileSystem.FileSystem;
360
+ const path = yield* Path.Path;
361
+ const configDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
362
+ const synced = path.join(configDir, "plugins", "synced");
363
+ const organization = "11111111-2222-4333-8444-555555555555";
364
+ const writeBucket = Effect.fn(function* (account: string, skillSuffix = "") {
365
+ const bucket = path.join(synced, `${organization}_${account}`);
366
+ const plugins = [
367
+ {
368
+ pluginId: "plugin_01pstack",
369
+ name: "pstack",
370
+ directory: "pstack",
371
+ skill: "poteto-mode",
372
+ },
373
+ {
374
+ pluginId: "plugin_01design",
375
+ name: "0f6a7c9e-1111-4222-8333-444444444444",
376
+ generation: 2,
377
+ directory: "0f6a7c9e-1111-4222-8333-444444444444~g2",
378
+ prefix: "design",
379
+ skill: "design-critique",
380
+ },
381
+ ];
382
+ for (const plugin of plugins) {
383
+ const pluginDir = path.join(bucket, plugin.directory);
384
+ yield* writeSkill(path.join(pluginDir, "skills"), plugin.skill + skillSuffix, "# Synced");
385
+ yield* fs.makeDirectory(path.join(pluginDir, ".claude-plugin"));
386
+ yield* fs.writeFileString(
387
+ path.join(pluginDir, ".claude-plugin", "plugin.json"),
388
+ JSON.stringify({ name: plugin.prefix ?? plugin.name }),
389
+ );
390
+ }
391
+ yield* fs.writeFileString(
392
+ path.join(bucket, "manifest.json"),
393
+ JSON.stringify({
394
+ lastUpdated: 1761990000000,
395
+ plugins: plugins.map(({ pluginId, name, generation }) => ({
396
+ pluginId,
397
+ name,
398
+ ...(generation ? { generation } : {}),
399
+ })),
400
+ }),
401
+ );
402
+ yield* fs.writeFileString(path.join(synced, `.bucket-${organization}_${account}`), "");
403
+ return bucket;
404
+ });
405
+ const bucket = yield* writeBucket("66666666-7777-4888-9999-aaaaaaaaaaaa");
406
+ yield* writeBucket("77777777-8888-4999-aaaa-bbbbbbbbbbbb", "-other-account");
407
+ yield* fs.writeFileString(
408
+ path.join(configDir, ".claude.json"),
409
+ JSON.stringify({
410
+ oauthAccount: {
411
+ organizationUuid: organization,
412
+ accountUuid: "66666666-7777-4888-9999-aaaaaaaaaaaa",
413
+ },
414
+ }),
415
+ );
416
+
417
+ assert.deepEqual(
418
+ (yield* discoverClaudeSkills({ homePath: configDir }, undefined, {})).map((skill) => [
419
+ skill.name,
420
+ skill.path,
421
+ ]),
422
+ [
423
+ [
424
+ "design:design-critique",
425
+ path.join(
426
+ bucket,
427
+ "0f6a7c9e-1111-4222-8333-444444444444~g2",
428
+ "skills",
429
+ "design-critique",
430
+ "SKILL.md",
431
+ ),
432
+ ],
433
+ ["pstack:poteto-mode", path.join(bucket, "pstack", "skills", "poteto-mode", "SKILL.md")],
434
+ ],
435
+ );
436
+ assert.deepEqual(
437
+ (yield* discoverClaudeSkills({ homePath: configDir }, undefined, {
438
+ CLAUDE_CODE_PLUGIN_CACHE_DIR: path.join(configDir, "relocated-cache"),
439
+ })).map((skill) => skill.name),
440
+ ["design:design-critique", "pstack:poteto-mode"],
441
+ );
442
+ assert.deepEqual(
443
+ (yield* discoverClaudeSkills({ homePath: configDir }, undefined, {
444
+ CLAUDE_CODE_OAUTH_TOKEN: "token",
445
+ CLAUDE_CODE_ACCOUNT_UUID: "77777777-8888-4999-aaaa-bbbbbbbbbbbb",
446
+ })).map((skill) => skill.name),
447
+ ["design:design-critique-other-account", "pstack:poteto-mode-other-account"],
448
+ );
449
+ yield* fs.writeFileString(
450
+ path.join(configDir, "settings.json"),
451
+ '{"enabledPlugins":{"pstack@synced":false}}',
452
+ );
453
+ assert.deepEqual(
454
+ (yield* discoverClaudeSkills({ homePath: configDir }, undefined, {})).map(
455
+ (skill) => skill.name,
456
+ ),
457
+ ["design:design-critique"],
458
+ );
459
+ yield* fs.writeFileString(
460
+ path.join(configDir, "settings.json"),
461
+ '{"syncClaudeAiPlugins":false}',
462
+ );
463
+ assert.deepEqual(yield* discoverClaudeSkills({ homePath: configDir }, undefined, {}), []);
464
+ }),
465
+ );
466
+
467
+ it.effect("gives a synced namespace to an installed plugin, then the first synced row", () =>
468
+ Effect.gen(function* () {
469
+ const fs = yield* FileSystem.FileSystem;
470
+ const path = yield* Path.Path;
471
+ const configDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
472
+ const bucketName = "11111111-2222-4333-8444-555555555555_unbound";
473
+ const synced = path.join(configDir, "plugins", "synced");
474
+ const bucket = path.join(synced, bucketName);
475
+ for (const [directory, prefix, skill] of [
476
+ ["pstack", "pstack", "poteto-mode"],
477
+ ["pstack-copy", "pstack", "copied"],
478
+ ["tools", "tools", "synced-tool"],
479
+ ["a_b", undefined, "renamed"],
480
+ ["PSTACK", "PSTACK", "shouted"],
481
+ ] as const) {
482
+ yield* writeSkill(path.join(bucket, directory, "skills"), skill, "# Synced");
483
+ if (prefix === undefined) continue;
484
+ yield* fs.makeDirectory(path.join(bucket, directory, ".claude-plugin"));
485
+ yield* fs.writeFileString(
486
+ path.join(bucket, directory, ".claude-plugin", "plugin.json"),
487
+ JSON.stringify({ name: prefix }),
488
+ );
489
+ }
490
+ yield* fs.writeFileString(
491
+ path.join(bucket, "manifest.json"),
492
+ JSON.stringify({
493
+ plugins: ["pstack", "pstack-copy", "tools", "a:b. ", "PSTACK", "no-id"].map(
494
+ (name, index) => (name === "no-id" ? { name } : { pluginId: `plugin_0${index}`, name }),
495
+ ),
496
+ }),
497
+ );
498
+ yield* fs.writeFileString(path.join(synced, `.bucket-${bucketName}`), "");
499
+ const installed = path.join(configDir, "plugins", "cache", "shop", "tools");
500
+ yield* writeSkill(path.join(installed, "skills"), "installed-tool", "# Installed");
501
+ yield* fs.writeFileString(
502
+ path.join(configDir, "plugins", "installed_plugins.json"),
503
+ JSON.stringify({
504
+ plugins: {
505
+ "tools@shop": [{ scope: "user", installPath: installed }],
506
+ "pstack@shop": [{ scope: "user", installPath: path.join(configDir, "missing") }],
507
+ },
508
+ }),
509
+ );
510
+ const names = (enabled: boolean) =>
511
+ Effect.gen(function* () {
512
+ yield* fs.writeFileString(
513
+ path.join(configDir, "settings.json"),
514
+ JSON.stringify({ enabledPlugins: { "tools@shop": enabled, "pstack@shop": true } }),
515
+ );
516
+ const skills = yield* discoverClaudeSkills({ homePath: configDir }, undefined, {
517
+ CLAUDE_CODE_ORGANIZATION_UUID: "11111111-2222-4333-8444-555555555555",
518
+ CLAUDE_CODE_ACCOUNT_UUID: "not-a-uuid",
519
+ });
520
+ return skills.map((skill) => skill.name);
521
+ });
522
+
523
+ assert.deepEqual(yield* names(true), [
524
+ "a_b:renamed",
525
+ "pstack:poteto-mode",
526
+ "tools:installed-tool",
527
+ ]);
528
+ assert.deepEqual(yield* names(false), [
529
+ "a_b:renamed",
530
+ "pstack:poteto-mode",
531
+ "tools:synced-tool",
532
+ ]);
533
+ yield* writeSkill(path.join(bucket, "no-id", "skills"), "unlisted", "# Synced");
534
+ assert.notInclude(
535
+ (yield* discoverClaudeSkills({ homePath: configDir }, undefined, {
536
+ CLAUDE_CODE_ORGANIZATION_UUID: "11111111-2222-4333-8444-555555555555",
537
+ })).map((skill) => skill.name),
538
+ "no-id:unlisted",
539
+ );
540
+ }),
541
+ );
542
+
543
+ it.effect("hides synced plugins from local settings but not shared project settings", () =>
544
+ Effect.gen(function* () {
545
+ const fs = yield* FileSystem.FileSystem;
546
+ const path = yield* Path.Path;
547
+ const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
548
+ const configDir = path.join(tempDir, "claude-home");
549
+ const workspace = path.join(tempDir, "workspace");
550
+ const bucketName =
551
+ "11111111-2222-4333-8444-555555555555_66666666-7777-4888-9999-aaaaaaaaaaaa";
552
+ const synced = path.join(configDir, "plugins", "synced");
553
+ yield* writeSkill(path.join(synced, bucketName, "pstack", "skills"), "poteto-mode", "# S");
554
+ yield* fs.writeFileString(
555
+ path.join(synced, bucketName, "manifest.json"),
556
+ '{"plugins":[{"pluginId":"plugin_01pstack","name":"pstack"}]}',
557
+ );
558
+ yield* fs.writeFileString(path.join(synced, `.bucket-${bucketName}`), "");
559
+ yield* fs.makeDirectory(path.join(workspace, ".claude"), { recursive: true });
560
+ yield* fs.writeFileString(
561
+ path.join(workspace, ".claude", "settings.json"),
562
+ '{"syncClaudeAiPlugins":false}',
563
+ );
564
+ const environment = {
565
+ CLAUDE_CODE_ORGANIZATION_UUID: "11111111-2222-4333-8444-555555555555",
566
+ CLAUDE_CODE_ACCOUNT_UUID: "66666666-7777-4888-9999-AAAAAAAAAAAA",
567
+ };
568
+ const names = Effect.map(
569
+ discoverClaudeSkills({ homePath: configDir }, workspace, environment),
570
+ (skills) => skills.map((skill) => skill.name),
571
+ );
572
+ assert.deepEqual(yield* names, ["pstack:poteto-mode"]);
573
+ yield* fs.writeFileString(
574
+ path.join(workspace, ".claude", "settings.local.json"),
575
+ '{"syncClaudeAiPlugins":false}',
576
+ );
577
+ assert.deepEqual(yield* names, []);
578
+ }),
579
+ );
580
+
581
it.effect("discovers user and project skills with frontmatter metadata", () =>
582
Effect.gen(function* () {
583
const fs = yield* FileSystem.FileSystem;
apps/server/src/provider/Drivers/ClaudeSkills.ts
+180
-51
@@ -12,6 +12,8 @@ import { parse as parseYamlDocument } from "yaml";
12
13
import { expandHomePath } from "@t3tools/provider-core/server/pathExpansion";
14
15
+import { claudeAccountConfigPath, readClaudeOauthAccount } from "../claudeResetCredits.ts";
16
+
17
type ClaudeSkillScope = "user" | "project";
18
19
type ClaudeSkillRoot = {
@@ -216,6 +218,7 @@ const SkillSettings = fromLenientJson(
218
Schema.Struct({
219
skillOverrides: Schema.optional(Schema.Record(Schema.String, SkillOverrideValue)),
220
enabledPlugins: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
221
+ syncClaudeAiPlugins: Schema.optional(Schema.Unknown),
222
}),
223
);
224
const decodeSkillSettings = Schema.decodeUnknownEffect(SkillSettings);
@@ -247,7 +250,10 @@ const readSkillSettings = Effect.fn("readSkillSettings")(function* (
250
const platform = yield* HostProcess.Platform;
251
const overridesByName = new Map<string, SkillOverride>();
252
const enabledPlugins = new Map<string, boolean>();
253
+ let syncedPluginsHidden = false;
254
const repositoryRoot = cwd === undefined ? undefined : yield* findRepositoryRoot(cwd);
255
+ const projectSettingsPath =
256
+ cwd === undefined ? undefined : path.join(cwd, ".claude", "settings.json");
257
258
for (const settingsPath of claudeSettingsPaths(
259
path,
@@ -284,9 +290,13 @@ const readSkillSettings = Effect.fn("readSkillSettings")(function* (
290
enabledPlugins.delete(key);
291
}
292
}
293
+ // Claude ignores this switch in shared project settings, and honors only false.
294
+ if (parsed?.syncClaudeAiPlugins === false && settingsPath !== projectSettingsPath) {
295
+ syncedPluginsHidden = true;
296
+ }
297
}
298
289
- return { skillOverrides: overridesByName, enabledPlugins };
299
+ return { skillOverrides: overridesByName, enabledPlugins, syncedPluginsHidden };
300
});
301
302
const InstalledPlugins = Schema.fromJsonString(
@@ -306,15 +316,128 @@ const PluginManifest = Schema.fromJsonString(
316
}),
317
);
318
319
+const SyncedPlugins = Schema.fromJsonString(
320
+ Schema.Struct({ plugins: Schema.Array(Schema.Unknown) }),
321
+);
322
+const decodeSyncedPlugin = Schema.decodeUnknownOption(
323
+ Schema.Struct({
324
+ pluginId: Schema.String,
325
+ name: Schema.String,
326
+ generation: Schema.optional(Schema.Number),
327
+ }),
328
+);
329
+const ACCOUNT_UUID_PATTERN = /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i;
330
+
331
+/** Claude compares plugin names case-insensitively. */
332
+function pluginNameKey(name: string): string {
333
+ return name.normalize("NFC").toLowerCase();
334
+}
335
+
336
+/** Claude's folder for a synced row: reserved characters become `_`, trailing dots and spaces go. */
337
+function syncedPluginDirectoryName(name: string): string {
338
+ const replaced = name.replace(/[<>:"|?*\\/]/g, "_");
339
+ let end = replaced.length;
340
+ while (end > 0 && (replaced[end - 1] === "." || replaced[end - 1] === " ")) end--;
341
+ return replaced.slice(0, end);
342
+}
343
+
344
function isInsideDirectory(path: Path.Path, directory: string, candidate: string): boolean {
345
const relative = path.relative(directory, candidate);
346
return relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
347
}
348
349
+const readPluginManifest = Effect.fn("readPluginManifest")(function* (pluginPath: string) {
350
+ const fileSystem = yield* FileSystem.FileSystem;
351
+ const path = yield* Path.Path;
352
+ return yield* fileSystem
353
+ .readFileString(path.join(pluginPath, ".claude-plugin", "plugin.json"))
354
+ .pipe(
355
+ Effect.flatMap(Schema.decodeUnknownEffect(PluginManifest)),
356
+ Effect.orElseSucceed(() => undefined),
357
+ );
358
+});
359
+
360
+const pluginSkillRoots = Effect.fn("pluginSkillRoots")(function* (
361
+ installPath: string,
362
+ scope: ClaudeSkillScope,
363
+ prefix: string,
364
+ manifest: typeof PluginManifest.Type | undefined,
365
+) {
366
+ const fileSystem = yield* FileSystem.FileSystem;
367
+ const path = yield* Path.Path;
368
+ const roots: Array<ClaudeSkillRoot> = [];
369
+ const defaultDirectory = path.join(installPath, "skills");
370
+ const hasDefaultDirectory = yield* fileSystem
371
+ .exists(defaultDirectory)
372
+ .pipe(Effect.orElseSucceed(() => false));
373
+ if (hasDefaultDirectory) roots.push({ directory: defaultDirectory, scope, prefix });
374
+ const declared = manifest?.skills;
375
+ if (declared === undefined && !hasDefaultDirectory) {
376
+ const hasRootSkill = yield* fileSystem
377
+ .exists(path.join(installPath, "SKILL.md"))
378
+ .pipe(Effect.orElseSucceed(() => false));
379
+ if (hasRootSkill) roots.push({ directory: installPath, scope, prefix });
380
+ }
381
+
382
+ const canonicalInstallPath = yield* fileSystem
383
+ .realPath(installPath)
384
+ .pipe(Effect.orElseSucceed(() => undefined));
385
+ for (const relative of typeof declared === "string" ? [declared] : (declared ?? [])) {
386
+ const directory = path.resolve(installPath, relative);
387
+ if (!isInsideDirectory(path, installPath, directory) || canonicalInstallPath === undefined) {
388
+ continue;
389
+ }
390
+ const canonicalDirectory = yield* fileSystem
391
+ .realPath(directory)
392
+ .pipe(Effect.orElseSucceed(() => undefined));
393
+ // The native loader rejects manifest roots that escape through a symlink, too.
394
+ if (
395
+ canonicalDirectory !== undefined &&
396
+ isInsideDirectory(path, canonicalInstallPath, canonicalDirectory)
397
+ ) {
398
+ roots.push({ directory, scope, prefix });
399
+ }
400
+ }
401
+ return roots;
402
+});
403
+
404
+/** The `<org>_<account>` folder Claude syncs the signed-in account's claude.ai plugins into. */
405
+const resolveSyncedPluginBucket = Effect.fn("resolveSyncedPluginBucket")(function* (
406
+ config: Pick<ClaudeSettings, "homePath">,
407
+ configDirPath: string,
408
+ environment: NodeJS.ProcessEnv,
409
+) {
410
+ const accountConfigPath = yield* claudeAccountConfigPath(
411
+ config.homePath.trim() || environment.CLAUDE_CONFIG_DIR?.trim() ? configDirPath : undefined,
412
+ );
413
+ const account = yield* readClaudeOauthAccount(accountConfigPath);
414
+ const organizationId = environment.CLAUDE_CODE_ORGANIZATION_UUID ?? account?.organizationUuid;
415
+ // A stored claude.ai login names its own account; an injected token uses the env account.
416
+ const environmentAccountId = environment.CLAUDE_CODE_ACCOUNT_UUID;
417
+ const accountId =
418
+ account !== undefined && !environment.CLAUDE_CODE_OAUTH_TOKEN
419
+ ? typeof account.accountUuid === "string"
420
+ ? account.accountUuid
421
+ : undefined
422
+ : environmentAccountId && ACCOUNT_UUID_PATTERN.test(environmentAccountId)
423
+ ? environmentAccountId
424
+ : "unbound";
425
+ if (
426
+ !organizationId ||
427
+ !accountId ||
428
+ !ACCOUNT_UUID_PATTERN.test(organizationId) ||
429
+ (accountId !== "unbound" && !ACCOUNT_UUID_PATTERN.test(accountId))
430
+ ) {
431
+ return undefined;
432
+ }
433
+ return `${organizationId.toLowerCase()}_${accountId.toLowerCase()}`;
434
+});
435
+
436
const discoverPluginSkillRoots = Effect.fn("discoverPluginSkillRoots")(function* (
437
configDirPath: string,
438
cwd: string | undefined,
439
enabledPlugins: ReadonlyMap<string, boolean>,
440
+ syncedBucket: string | undefined,
441
environment: NodeJS.ProcessEnv,
442
) {
443
const fileSystem = yield* FileSystem.FileSystem;
@@ -330,8 +453,8 @@ const discoverPluginSkillRoots = Effect.fn("discoverPluginSkillRoots")(function*
453
Effect.flatMap(Schema.decodeUnknownEffect(InstalledPlugins)),
454
Effect.orElseSucceed(() => undefined),
455
);
333
- if (installed === undefined) return [];
456
const roots: Array<ClaudeSkillRoot> = [];
457
+ const claimedPluginNames = new Set<string>();
458
// The CLI's process.cwd() resolves symlinks; registry projectPath values remain lexical.
459
const workspace =
460
cwd === undefined
@@ -342,7 +465,7 @@ const discoverPluginSkillRoots = Effect.fn("discoverPluginSkillRoots")(function*
465
const repositoryRoot =
466
workspace === undefined ? undefined : yield* findPluginRepositoryRoot(workspace);
467
345
- for (const [key, entries] of Object.entries(installed.plugins).sort()) {
468
+ for (const [key, entries] of Object.entries(installed?.plugins ?? {}).sort()) {
469
if (enabledPlugins.get(key) !== true) continue;
470
const applicable = yield* Effect.filter(
471
entries.flatMap((entry) => Option.toArray(decodeInstalledPlugin(entry))),
@@ -369,47 +492,48 @@ const discoverPluginSkillRoots = Effect.fn("discoverPluginSkillRoots")(function*
492
if (!install) continue;
493
const scope = install.scope === "user" || install.scope === "managed" ? "user" : "project";
494
const installPath = path.resolve(cwd ?? ".", install.installPath);
372
- const manifest = yield* fileSystem
373
- .readFileString(path.join(installPath, ".claude-plugin", "plugin.json"))
374
- .pipe(
375
- Effect.flatMap(Schema.decodeUnknownEffect(PluginManifest)),
376
- Effect.orElseSucceed(() => undefined),
377
- );
495
+ const manifest = yield* readPluginManifest(installPath);
496
const prefix = manifest?.name ?? key.split("@")[0];
497
if (!prefix) continue;
380
-
381
- const defaultDirectory = path.join(installPath, "skills");
382
- const hasDefaultDirectory = yield* fileSystem
383
- .exists(defaultDirectory)
384
- .pipe(Effect.orElseSucceed(() => false));
385
- if (hasDefaultDirectory) roots.push({ directory: defaultDirectory, scope, prefix });
386
- const declared = manifest?.skills;
387
- if (declared === undefined && !hasDefaultDirectory) {
388
- const hasRootSkill = yield* fileSystem
389
- .exists(path.join(installPath, "SKILL.md"))
390
- .pipe(Effect.orElseSucceed(() => false));
391
- if (hasRootSkill) roots.push({ directory: installPath, scope, prefix });
392
- }
393
-
394
- const canonicalInstallPath = yield* fileSystem
395
- .realPath(installPath)
396
- .pipe(Effect.orElseSucceed(() => undefined));
397
- for (const relative of typeof declared === "string" ? [declared] : (declared ?? [])) {
398
- const directory = path.resolve(installPath, relative);
399
- if (!isInsideDirectory(path, installPath, directory) || canonicalInstallPath === undefined) {
400
- continue;
401
- }
402
- const canonicalDirectory = yield* fileSystem
403
- .realPath(directory)
404
- .pipe(Effect.orElseSucceed(() => undefined));
405
- // The native loader rejects manifest roots that escape through a symlink, too.
406
- if (
407
- canonicalDirectory !== undefined &&
408
- isInsideDirectory(path, canonicalInstallPath, canonicalDirectory)
409
- ) {
410
- roots.push({ directory, scope, prefix });
411
- }
412
- }
498
+ // A registry record whose install is gone loads nothing and claims no namespace.
499
+ if (Option.isSome(existing)) claimedPluginNames.add(pluginNameKey(prefix));
500
+ roots.push(...(yield* pluginSkillRoots(installPath, scope, prefix, manifest)));
501
+ }
502
+ if (syncedBucket === undefined) return roots;
503
+
504
+ const syncedPath = path.join(configDirPath, "plugins", "synced");
505
+ const bucketPath = path.join(syncedPath, syncedBucket);
506
+ const disabledSyncedPlugins = new Set(
507
+ [...enabledPlugins].flatMap(([pluginKey, enabled]) =>
508
+ !enabled && pluginKey.endsWith("@synced") ? [pluginNameKey(pluginKey.slice(0, -7))] : [],
509
+ ),
510
+ );
511
+ const hasBucketMarker = yield* fileSystem
512
+ .exists(path.join(syncedPath, `.bucket-${syncedBucket}`))
513
+ .pipe(Effect.orElseSucceed(() => false));
514
+ if (!hasBucketMarker) return roots;
515
+ const synced = yield* fileSystem.readFileString(path.join(bucketPath, "manifest.json")).pipe(
516
+ Effect.flatMap(Schema.decodeUnknownEffect(SyncedPlugins)),
517
+ Effect.orElseSucceed(() => undefined),
518
+ );
519
+ for (const row of synced?.plugins ?? []) {
520
+ const plugin = Option.getOrUndefined(decodeSyncedPlugin(row));
521
+ const directoryName = plugin === undefined ? "" : syncedPluginDirectoryName(plugin.name);
522
+ if (!plugin || !directoryName || directoryName.startsWith(".")) continue;
523
+ const generation = plugin.generation;
524
+ const pluginPath = path.join(
525
+ bucketPath,
526
+ generation !== undefined && Number.isInteger(generation) && generation >= 2
527
+ ? `${directoryName}~g${generation}`
528
+ : directoryName,
529
+ );
530
+ const manifest = yield* readPluginManifest(pluginPath);
531
+ const prefix = manifest?.name ?? directoryName;
532
+ // An installed plugin of the same name, then the first synced row, holds the namespace.
533
+ const key = pluginNameKey(prefix);
534
+ if (claimedPluginNames.has(key) || disabledSyncedPlugins.has(key)) continue;
535
+ claimedPluginNames.add(key);
536
+ roots.push(...(yield* pluginSkillRoots(pluginPath, "user", prefix, manifest)));
537
}
538
return roots;
539
});
@@ -511,12 +635,22 @@ export const discoverClaudeSkills = Effect.fn("discoverClaudeSkills")(function*
635
): Effect.fn.Return<ReadonlyArray<ServerProviderSkill>, never, FileSystem.FileSystem | Path.Path> {
636
const fileSystem = yield* FileSystem.FileSystem;
637
const path = yield* Path.Path;
514
- const configDirPath = yield* resolveClaudeConfigDirPath(config, environment ?? process.env, cwd);
515
- const { skillOverrides, enabledPlugins } = yield* readSkillSettings(
638
+ const env = environment ?? process.env;
639
+ const configDirPath = yield* resolveClaudeConfigDirPath(config, env, cwd);
640
+ const { skillOverrides, enabledPlugins, syncedPluginsHidden } = yield* readSkillSettings(
641
configDirPath,
642
cwd,
518
- environment ?? process.env,
643
+ env,
644
);
645
+ // Most installs have no synced folder; skip reading `.claude.json` for them.
646
+ const hasSyncedPlugins =
647
+ !syncedPluginsHidden &&
648
+ (yield* fileSystem
649
+ .exists(path.join(configDirPath, "plugins", "synced"))
650
+ .pipe(Effect.orElseSucceed(() => false)));
651
+ const syncedBucket = hasSyncedPlugins
652
+ ? yield* resolveSyncedPluginBucket(config, configDirPath, env)
653
+ : undefined;
654
655
const roots: ReadonlyArray<ClaudeSkillRoot> = [
656
{ directory: path.join(configDirPath, "skills"), scope: "user" },
@@ -527,12 +661,7 @@ export const discoverClaudeSkills = Effect.fn("discoverClaudeSkills")(function*
661
directory: path.join(path.resolve(cwd ?? ".", directory), ".claude", "skills"),
662
scope: "project" as const,
663
})),
530
- ...(yield* discoverPluginSkillRoots(
531
- configDirPath,
532
- cwd,
533
- enabledPlugins,
534
- environment ?? process.env,
535
- )),
664
+ ...(yield* discoverPluginSkillRoots(configDirPath, cwd, enabledPlugins, syncedBucket, env)),
665
];
666
667
const skillsByName = new Map<string, ServerProviderSkill>();
apps/server/src/provider/claudeResetCredits.ts
+11
-3
@@ -23,7 +23,10 @@ const Credentials = Schema.Struct({
23
});
24
const Config = Schema.Struct({
25
oauthAccount: Schema.optional(
26
- Schema.Struct({ organizationUuid: Schema.optional(Schema.String) }),
26
+ Schema.Struct({
27
+ organizationUuid: Schema.optional(Schema.String),
28
+ accountUuid: Schema.optional(Schema.Unknown),
29
+ }),
30
),
31
});
32
const Grant = Schema.Struct({
@@ -226,12 +229,17 @@ export const readClaudeResetCredits = Effect.fn("readClaudeResetCredits")(
229
Effect.orElseSucceed(() => undefined),
230
);
231
229
-export const readClaudeOrganizationId = (accountConfigPath: string) =>
232
+export const readClaudeOauthAccount = (accountConfigPath: string) =>
233
readJson(Config, accountConfigPath).pipe(
231
- Effect.map((config) => config.oauthAccount?.organizationUuid?.trim() || undefined),
234
+ Effect.map((config) => config.oauthAccount),
235
Effect.orElseSucceed(() => undefined),
236
);
237
238
+export const readClaudeOrganizationId = (accountConfigPath: string) =>
239
+ readClaudeOauthAccount(accountConfigPath).pipe(
240
+ Effect.map((account) => account?.organizationUuid?.trim() || undefined),
241
+ );
242
+
243
export const claudeAccountConfigPath = Effect.fn("claudeAccountConfigPath")(function* (
244
configDir: string | undefined,
245
) {
docs/user/providers-claude.md
+6
-5
@@ -95,11 +95,12 @@ Claude skills come from the config directory's `skills` folder and the project's
95
`.claude/skills` folder. If both define the same name, the config-directory copy
96
wins. Skills disabled in Claude's settings do not appear in the composer.
97
98
-Use `$` in the composer to select a skill. Enabled installed Claude plugins also
99
-contribute skills under names such as `plugin:review`. Skills marked `disable-model-invocation`
100
-can still be started by you. Invoke those one per message: Claude directly runs
101
-only the last named skill and may try to start earlier ones through its Skill
102
-tool, which refuses skills reserved for manual invocation.
98
+Use `$` in the composer to select a skill. Enabled installed Claude plugins,
99
+and plugins synced from your claude.ai account, also contribute skills under
100
+names such as `plugin:review`. Skills marked `disable-model-invocation` can
101
+still be started by you. Invoke those one per message: Claude directly runs only
102
+the last named skill and may try to start earlier ones through its Skill tool,
103
+which refuses skills reserved for manual invocation.
104
105
## Task lists
106