Skip to content

Commit 6080301

Browse files
fix(provider-fx): list the skill fx loads for a shared name
Two skills with the same name were both hidden from the `$` menu on the assumption that fx refuses an ambiguous `$name`. Live, fx 0.0.13 hands the model every copy in scan order and the model loads the first one, so the menu now lists that first copy instead of hiding the name. A fleet install with separate copies in ~/.agents/skills and ~/.claude/skills hid 9 skills; all of them are listed again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 75a2402 commit 6080301

3 files changed

Lines changed: 24 additions & 27 deletions

File tree

‎docs/user/providers-fx.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fx also has an **Effort** control. A new thread starts at Medium.
2525

2626
T3 Code does not show fx's backend selector. To use Codex, Grok, or Vercel AI Gateway, run `fx provider` on the environment's machine.
2727

28-
Type `$` in the composer to list the skills fx finds in its skill folders, in the order fx's own skill menu shows them. When two skills share a name, fx can't tell which one you mean, so neither can be picked until you rename one.
28+
Type `$` in the composer to list the skills fx finds in its skill folders, in the order fx's own skill menu shows them. When two different skills share a name, the menu lists the one fx loads for that name: the first copy in fx's folder order, starting with the workspace.
2929

3030
## Permission modes
3131

‎packages/provider-fx/src/server/skills.test.ts‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ describe("discoverFxSkills", () => {
5656
}).pipe(Effect.provide(NodeServices.layer), Effect.scoped),
5757
);
5858

59-
// fx keeps both skills that share a name, ignoring case, and refuses
60-
// `$review` as ambiguous. It skips a SKILL.md whose frontmatter has no name or never
61-
// closes, and a symlinked folder in its managed ~/.fx/skills.
62-
it.effect("offers only skills fx can load and invoke by name", () =>
59+
// For `$review` with two skills of that name (ignoring case), fx's model
60+
// picks the first in scan order, so only that one is offered. fx skips a
61+
// SKILL.md whose frontmatter has no name or never closes, and a symlinked
62+
// folder in its managed ~/.fx/skills.
63+
it.effect("offers the skill fx loads for each name", () =>
6364
Effect.gen(function* () {
6465
const fileSystem = yield* FileSystem.FileSystem;
6566
const path = yield* Path.Path;
@@ -147,16 +148,17 @@ describe("discoverFxSkills", () => {
147148

148149
const skills = yield* discoverFxSkills({ cwd: workspace, environment: { HOME: home } });
149150

151+
// fx scans the workspace before HOME, so the workspace `review` wins
152+
// over ~/.claude's `Review`.
150153
assert.deepEqual(
151-
skills.map((skill) => [skill.name, skill.userInvocable !== false]),
154+
skills.map((skill) => [skill.name, skill.path]),
152155
[
153-
["été", true],
154-
["Été", true],
155-
["bom-folder", true],
156-
["plain", true],
157-
["replacement", true],
158-
["review", false],
159-
["Review", false],
156+
["été", path.join(home, ".fx/skills/accent-lower/SKILL.md")],
157+
["Été", path.join(home, ".fx/skills/accent-upper/SKILL.md")],
158+
["bom-folder", path.join(home, ".fx/skills/bom-folder/SKILL.md")],
159+
["plain", path.join(home, ".fx/skills/plain/SKILL.md")],
160+
["replacement", path.join(home, ".fx/skills/replacement/SKILL.md")],
161+
["review", path.join(workspace, ".fx/skills/review/SKILL.md")],
160162
],
161163
);
162164
}).pipe(Effect.provide(NodeServices.layer), Effect.scoped),

‎packages/provider-fx/src/server/skills.ts‎

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,9 @@ const discoverSkillsInRoot = Effect.fn("discoverFxSkillsInRoot")(function* (inpu
342342

343343
/**
344344
* Skills in fx's menu order. Like fx, a folder reached twice (a symlinked
345-
* root) counts once. A name two different skills share stays listed but
346-
* can't be picked: fx refuses an ambiguous `$name`.
345+
* root) counts once. When two different skills share a name, `$name` lets
346+
* the model choose from fx's catalog, which lists them in scan order; it
347+
* takes the first copy, so that is the one listed here.
347348
*/
348349
export const discoverFxSkills = Effect.fn("discoverFxSkills")(function* (input: {
349350
readonly cwd: string;
@@ -360,24 +361,18 @@ export const discoverFxSkills = Effect.fn("discoverFxSkills")(function* (input:
360361
const cwd = yield* realPath(input.cwd);
361362
const path = yield* Path.Path;
362363
const seenFolders = new Set<string>();
364+
// fx matches `$name` ignoring ASCII case only.
365+
const seenNames = new Set<string>();
363366
const found: Array<{ readonly skill: ServerProviderSkill; readonly rank: number }> = [];
364367
for (const root of skillRoots(path, cwd, home)) {
365368
for (const { skill, folder } of yield* discoverSkillsInRoot(root)) {
366369
if (seenFolders.has(folder)) continue;
367370
seenFolders.add(folder);
371+
const nameKey = skill.name.replace(/[A-Z]/g, (letter) => letter.toLowerCase());
372+
if (seenNames.has(nameKey)) continue;
373+
seenNames.add(nameKey);
368374
found.push({ skill, rank: root.rank });
369375
}
370376
}
371-
// fx matches `$name` ignoring ASCII case only.
372-
const nameKey = (skill: ServerProviderSkill) =>
373-
skill.name.replace(/[A-Z]/g, (letter) => letter.toLowerCase());
374-
const nameCounts = new Map<string, number>();
375-
for (const { skill } of found) {
376-
nameCounts.set(nameKey(skill), (nameCounts.get(nameKey(skill)) ?? 0) + 1);
377-
}
378-
return found
379-
.sort((left, right) => left.rank - right.rank)
380-
.map(({ skill }) =>
381-
(nameCounts.get(nameKey(skill)) ?? 0) > 1 ? { ...skill, userInvocable: false } : skill,
382-
);
377+
return found.sort((left, right) => left.rank - right.rank).map(({ skill }) => skill);
383378
});

0 commit comments

Comments
 (0)