library: with the skill router on, the page says when no skill is listed for an agent and when its own skills stay in its prompt (ConatusMoon2222 on X)

ConatusMoon2222 turned the Skill router on and reported it "does not take
effect". Reproduced in a sandbox HOME: the router lists only the library's
skills ticked for an agent. An agent with nothing ticked, or each skill kept
direct, got no magpie-skills, yet its row said "on"; and skills in an
agent's own folder that the library lacks stay in its prompt with no word
on the page.

AgentView.SkillRouter is now "none" for an agent whose folder takes the
router but has nothing listed (Applied.Router false), and the Skills tab
names those agents, and the agents that have skills of their own the
library lacks, under the switch (.lib-hub-why data-why none / found). Four
languages (zh, zh-TW, ja, de). docs/subsystems/skill-router.md updated.

Run on mote: go test -tags nogui ./internal/library (ok, 260s);
skill-router.test.cjs in chromium and webkit, all four languages, narrow
and wide (22 pass, with the new found line asserted); go test ./internal/gui
Asset/Budget/Script ok; gofmt clean; go vet nogui darwin/linux/windows clean.
Broken by hand: sync.go back to the parent, TestSkillRouterLastSkillUnticked
goes red ("nothing listed, the view says on").
GUI i18n-*, library-*, skill-* files: all green except skill-fold-all and
skill-manual, red on origin/main from the window's /api/update/using POST
(#5982, not this change).
Not tried: a real agent on Windows; the reporter gave no agent, OS or
version, so the cause for their machine is inferred, not confirmed.
This commit is contained in:
yetone
2026-11-13 10:53:40 +08:00
parent 5d93f6b3d9
commit cba704d5f0
7 changed files with 50 additions and 4 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ With the Library's switch "Skill router" on, each agent's skills folder is given
| Entry | `placeRouter` writes `routerDir(t.Skills)` (`<settings dir>/skill-router/<sha256 of the folder's real path, 6 bytes>/`): its SKILL.md and, under `.skills/`, a link to each listed skill's folder. The folder's entry `magpie-skills` is a link to it (`routerOurs` knows magpie's by where it leads). `Applied.Router` records it; with nothing listed, the entry and its folder go. | `placeRouter`, `writeRouter`, `routerOurs` |
| SKILL.md | Front matter `name: magpie-skills` and a description of at most 1024 bytes (`routerDescMax`: Codex refuses a longer one), naming the skills with as much of each description as fits, cut on a whole character (`routerDesc`). The body gives each skill's whole description and the path of its SKILL.md through the agent's own folder (`<skills>/magpie-skills/.skills/<name>/SKILL.md`). `.skills` is hidden, so the agents that look for skills in every folder under theirs (Codex, OpenCode, Pi) don't find a listed skill twice. | `writeRouter`, `routerDesc` |
| Claude Code's Read rules | Claude Code asks before it reads outside its project, its own skills folder too, and checks both the path given and where a link leads (2.1.316). For Claude Code (`claude`, any profile; not a plugin agent) magpie adds `permissions.allow` rules to its settings.json: `Read(//<entry's real path>/**)` and `Read(//<library skills folder's real path>/**)`, or one for each listed skill whose folder is elsewhere (`routerRules`; Windows paths as `/c/...`, `claudePath`). `Applied.RouterRules` records magpie's, so it takes out only those and keeps the user's own (`offList`, as for `permissions.deny`). | `routerRules`, `routerAllow` |
| GUI | Under the skill list on the Library's Skills tab: a row "Skill router" with its switch (`.lib-skillrouter`, `.lib-switch`), and with it on, one line for each reason an agent keeps its own links, naming those agents (`.lib-hub-why[data-why]`). Each skill the router may list has a button (`.lib-routedirect`, `aria-pressed`) that keeps it out of the router or lists it again; a skill kept out shows "Not through the router" (`.lib-direct`). | `skillRouterPart` in [`plugins/library/client.js`](../../internal/gui/assets/plugins/library/client.js) |
| GUI | Under the skill list on the Library's Skills tab: a row "Skill router" with its switch (`.lib-skillrouter`, `.lib-switch`), and with it on, one line for each reason an agent keeps its own links, naming those agents (`.lib-hub-why[data-why]`). `none` is an agent whose folder takes the router but has no skill listed (`AgentView.SkillRouter`, `routerNone`: nothing ticked for it, or each kept direct), and `found` names the agents whose own folder holds skills the library lacks, which the router can't list and each stays in the prompt. Each skill the router may list has a button (`.lib-routedirect`, `aria-pressed`) that keeps it out of the router or lists it again; a skill kept out shows "Not through the router" (`.lib-direct`). | `skillRouterPart` in [`plugins/library/client.js`](../../internal/gui/assets/plugins/library/client.js) |
| Sessions | A Read of `…/magpie-skills/.skills/<name>/SKILL.md` counts as the use of `<name>` (Claude Code, Alma, Droid: `routedSkill`; Codex counts any SKILL.md it reads). Calling up `magpie-skills` itself is counted as a Skill tool call and no skill (`routerSkill`), so a routed use is counted once. | `routedSkill`, `state.tool`, `ccTool` in [`internal/sessions`](../../internal/sessions/sessions.go) |
## Runtime path
@@ -2744,6 +2744,15 @@ magpie.plugin("library", (ctx) => {
out.push(p);
}
}
// skills in an agent's own folder that the library doesn't have are not
// listed, so each stays in its prompt
const mine = skillAgents().filter((a) => !a.gone && (a.skillRouter === "on" || a.skillRouter === "none")
&& lib.foundSkills.some((f) => !f.manual && f.agents.includes(a.id))).map((a) => a.name).join(", ");
if (mine) {
const p = el("p", "lib-aside lib-hub-why", t("{agents} has skills of its own that aren't in the library, so the router doesn't list them: bring them in below.", { agents: mine }));
p.dataset.why = "found";
out.push(p);
}
return out;
}
// What the router says of itself to the agents (packinggoodsllc_07668 on
@@ -6563,6 +6572,7 @@ magpie.plugin("library", (ctx) => {
["shared", "{agents} reads ~/.agents/skills, which other agents read too, so it keeps each skill of its own."],
["taken", "A skill in the library is called magpie-skills, so {agents} keeps each skill of its own: give that skill another name for the router to be used."],
["own", "{agents} has a skill called magpie-skills of its own, which magpie leaves as it is, so it keeps each skill of its own."],
["none", "No skill of the library's is listed for {agents}: tick one for it, or list one kept out of the router."],
];
for (const [k, text] of why) {
const n = names(k);
@@ -6572,6 +6582,15 @@ magpie.plugin("library", (ctx) => {
out.push(p);
}
}
// skills in an agent's own folder that the library doesn't have are not
// listed, so each stays in its prompt
const mine = skillAgents().filter((a) => !a.gone && (a.skillRouter === "on" || a.skillRouter === "none")
&& lib.foundSkills.some((f) => !f.manual && f.agents.includes(a.id))).map((a) => a.name).join(", ");
if (mine) {
const p = el("p", "lib-aside lib-hub-why", t("{agents} has skills of its own that aren't in the library, so the router doesn't list them: bring them in below.", { agents: mine }));
p.dataset.why = "found";
out.push(p);
}
return out;
}
@@ -90,6 +90,8 @@ magpie.strings({
"{agents} reads ~/.agents/skills, which other agents read too, so it keeps each skill of its own.": "{agents} 读取 ~/.agents/skills,其他 Agent 也读这个文件夹,所以仍逐个拿到每个 Skill。",
"A skill in the library is called magpie-skills, so {agents} keeps each skill of its own: give that skill another name for the router to be used.": "资源库里有个 Skill 叫 magpie-skills,所以 {agents} 仍逐个拿到每个 Skill:给它换个名字,路由才会生效。",
"{agents} has a skill called magpie-skills of its own, which magpie leaves as it is, so it keeps each skill of its own.": "{agents} 自己有个叫 magpie-skills 的 Skill,magpie 不会动它,所以仍逐个拿到每个 Skill。",
"No skill of the library's is listed for {agents}: tick one for it, or list one kept out of the router.": "{agents} 没有可由 Skill 路由列出的库内 Skill:为它勾选一个,或把不经过路由的 Skill 改为列出。",
"{agents} has skills of its own that aren't in the library, so the router doesn't list them: bring them in below.": "{agents} 自己的文件夹里有库中没有的 Skill,Skill 路由不会列出它们:在下方把它们引入库中。",
"Each agent is given it as its own skill, as with the skill router off.": "每个 Agent 都单独拿到它,和关闭 Skill 路由时一样。",
"{name} is listed in the skill router": "{name} 已在 Skill 路由里列出",
"{name} is given to each agent as its own skill": "每个 Agent 现在单独拿到 {name}",
@@ -1083,6 +1085,8 @@ magpie.strings({
"{agents} reads ~/.agents/skills, which other agents read too, so it keeps each skill of its own.": "{agents} 讀取 ~/.agents/skills,其他 Agent 也讀這個資料夾,所以仍逐一拿到每個 Skill。",
"A skill in the library is called magpie-skills, so {agents} keeps each skill of its own: give that skill another name for the router to be used.": "資源庫裡有個 Skill 叫 magpie-skills,所以 {agents} 仍逐一拿到每個 Skill:給它換個名字,路由才會生效。",
"{agents} has a skill called magpie-skills of its own, which magpie leaves as it is, so it keeps each skill of its own.": "{agents} 自己有個叫 magpie-skills 的 Skill,magpie 不會動它,所以仍逐一拿到每個 Skill。",
"No skill of the library's is listed for {agents}: tick one for it, or list one kept out of the router.": "{agents} 沒有可由 Skill 路由列出的庫內 Skill:為它勾選一個,或把不經過路由的 Skill 改為列出。",
"{agents} has skills of its own that aren't in the library, so the router doesn't list them: bring them in below.": "{agents} 自己的資料夾裡有庫中沒有的 Skill,Skill 路由不會列出它們:在下方把它們引入庫中。",
"Each agent is given it as its own skill, as with the skill router off.": "每個 Agent 都單獨拿到它,和關閉 Skill 路由時一樣。",
"{name} is listed in the skill router": "{name} 已在 Skill 路由裡列出",
"{name} is given to each agent as its own skill": "每個 Agent 現在單獨拿到 {name}",
@@ -2076,6 +2080,8 @@ magpie.strings({
"{agents} reads ~/.agents/skills, which other agents read too, so it keeps each skill of its own.": "{agents} は他のエージェントも読む ~/.agents/skills を読むので、スキルを 1 つずつ持ち続けます。",
"A skill in the library is called magpie-skills, so {agents} keeps each skill of its own: give that skill another name for the router to be used.": "ライブラリに magpie-skills という名前のスキルがあるため、{agents} はスキルを 1 つずつ持ち続けます。ルーターを使うにはそのスキルの名前を変えてください。",
"{agents} has a skill called magpie-skills of its own, which magpie leaves as it is, so it keeps each skill of its own.": "{agents} には独自の magpie-skills というスキルがあり、magpie はそれに手を付けないため、スキルを 1 つずつ持ち続けます。",
"No skill of the library's is listed for {agents}: tick one for it, or list one kept out of the router.": "{agents} には、スキルルーターが一覧できるライブラリのスキルがありません。1 つ選ぶか、ルーターを通さないスキルを一覧に戻してください。",
"{agents} has skills of its own that aren't in the library, so the router doesn't list them: bring them in below.": "{agents} には、ライブラリにない独自のスキルがあり、スキルルーターは一覧しません。下で取り込んでください。",
"Each agent is given it as its own skill, as with the skill router off.": "スキルルーターがオフのときと同じく、各エージェントがこのスキルを個別に受け取ります。",
"{name} is listed in the skill router": "{name} はスキルルーターに一覧されています",
"{name} is given to each agent as its own skill": "{name} は各エージェントに個別のスキルとして渡されます",
@@ -3069,6 +3075,8 @@ magpie.strings({
"{agents} reads ~/.agents/skills, which other agents read too, so it keeps each skill of its own.": "{agents} liest ~/.agents/skills, das auch andere Agenten lesen, und behält daher jede Skill einzeln.",
"A skill in the library is called magpie-skills, so {agents} keeps each skill of its own: give that skill another name for the router to be used.": "Eine Skill der Bibliothek heißt magpie-skills, daher behält {agents} jede Skill einzeln: Gib dieser Skill einen anderen Namen, damit der Router genutzt wird.",
"{agents} has a skill called magpie-skills of its own, which magpie leaves as it is, so it keeps each skill of its own.": "{agents} hat eine eigene Skill namens magpie-skills, die magpie unverändert lässt, und behält daher jede Skill einzeln.",
"No skill of the library's is listed for {agents}: tick one for it, or list one kept out of the router.": "Für {agents} ist kein Skill der Bibliothek im Router gelistet: Hake einen für den Agenten an oder liste einen aus dem Router herausgenommenen wieder.",
"{agents} has skills of its own that aren't in the library, so the router doesn't list them: bring them in below.": "{agents} hat eigene Skills, die nicht in der Bibliothek sind; der Router listet sie nicht: Hole sie unten in die Bibliothek.",
"Each agent is given it as its own skill, as with the skill router off.": "Jeder Agent erhält sie als eigene Skill, wie bei ausgeschaltetem Skill-Router.",
"{name} is listed in the skill router": "{name} ist im Skill-Router aufgelistet",
"{name} is given to each agent as its own skill": "{name} wird jedem Agenten als eigene Skill gegeben",
+6 -2
View File
@@ -24,7 +24,7 @@ const fixture = (st) => ({
{ id: "claude", name: "Claude Code", icon: "claudecode-color", skills: `${HOME}/.claude/skills`, ...(st.on ? { skillRouter: "on" } : {}) },
{ id: "pi", name: "Pi", icon: "", skills: `${HOME}/.agents/skills`, ...(st.on ? { skillRouter: "shared" } : {}) },
],
instructions: { agents: [], sets: [] }, servers: [], foundServers: [], projects: [], foundSkills: [], problems: [],
instructions: { agents: [], sets: [] }, servers: [], foundServers: [], projects: [], foundSkills: [{ name: "mine", description: "Its own", agents: ["claude"] }], problems: [],
skills: [
{ name: "pdf", description: "Read PDFs", kind: "folder", agents: ["claude", "pi"], ...(st.direct ? { router: "direct" } : {}) },
{ name: "deploy", description: "Ship it", kind: "folder", agents: ["claude"], manual: true },
@@ -137,7 +137,11 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// Pi keeps its own skills, and the page says why
const why = v.locator('.lib-hub-why[data-why="shared"]');
assert.equal((await why.textContent()).trim(), w("{agents} reads ~/.agents/skills, which other agents read too, so it keeps each skill of its own.", { agents: "Pi" }));
assert.equal(await v.locator(".lib-hub-why").count(), 1);
// Claude Code has a skill of its own the library lacks: it stays in
// its prompt, the router can't list it, and the page says so
const found = v.locator('.lib-hub-why[data-why="found"]');
assert.equal((await found.textContent()).trim(), w("{agents} has skills of its own that aren't in the library, so the router doesn't list them: bring them in below.", { agents: "Claude Code" }));
assert.equal(await v.locator(".lib-hub-why").count(), 2);
assert.deepEqual(await sideways(page), []);
await shot(page, `${engine}-${lang}-${width}-on`);
+1
View File
@@ -63,6 +63,7 @@ const (
routerShared = "shared" // its folder is ~/.agents/skills, read by many
routerTaken = "taken" // the library has a skill called magpie-skills
routerOwn = "own" // its folder has a magpie-skills of its own
routerNone = "none" // its folder takes it, but no skill is listed there
)
// routerDescMax is the most a SKILL.md's description may be: Codex
+9
View File
@@ -192,6 +192,15 @@ func TestSkillRouterLastSkillUnticked(t *testing.T) {
if a := loaded(t).Applied["claude"]; a != nil && a.Router {
t.Fatalf("applied: %+v", a)
}
// the router is on and lists nothing there: the page must not say "on"
// for an agent whose prompt is as it was (ConatusMoon2222 on X)
if got := agentView(t, routerView(t), "claude").SkillRouter; got != routerNone {
t.Fatalf("nothing listed, the view says %q", got)
}
ok(t)(SkillAgents("pdf", []string{"claude"}))
if got := agentView(t, routerView(t), "claude").SkillRouter; got != "on" {
t.Fatalf("a skill listed, the view says %q", got)
}
}
// A magpie-skills of the user's own in the agent's folder is left as it
+6 -1
View File
@@ -429,7 +429,8 @@ type AgentView struct {
Hub string `json:"hub,omitempty"`
// SkillRouter, with the skill router on, is "on" for an agent whose
// skills folder is given magpie-skills, or why it keeps each skill's
// own link (routerWhy): copies, liveagent, shared, taken or own
// own link (routerWhy): copies, liveagent, shared, taken or own; or
// "none" for an agent whose folder takes it and has no skill to list
SkillRouter string `json:"skillRouter,omitempty"`
// How is the way it is given its skills, link or copy, and HowOwn its
// own over the library's; MustCopy is one that can only take copies
@@ -636,6 +637,10 @@ func readView(problems []Problem, glance bool) (*View, error) {
av.SkillRouter = "on"
if why := l.routerWhy(t, av.How == HowCopy); why != "" {
av.SkillRouter = why
} else if a := l.Applied[t.Agent.ID]; !t.Gone && (a == nil || !a.Router) {
// the folder takes it, yet no skill is listed there:
// none is ticked for the agent, or each is kept direct
av.SkillRouter = routerNone
}
}
}