Like the MCP router, for skills. With the Skills tab's new "Skill
router" switch on (off by default), each agent's skills folder gets
one skill of magpie's, magpie-skills, in place of a link of each skill
ticked for it. Its SKILL.md lists them, each with its description and
the path of its SKILL.md, and the agent reads that file when a task
fits. An agent then carries one skill's description in its prompt
however many the Library gives it.
- The entry is a link to <settings dir>/skill-router/<hash of the
folder>/, which holds SKILL.md and a hidden .skills/<name> link of
each listed skill (hidden, so Codex, OpenCode and Pi don't find a
skill twice). Its description stays within 1024 bytes (Codex's
limit), cut on a whole character.
- Every skill is listed unless it is kept direct (a button on the
skill, or `magpie library skill router <name> direct`; carried by a
sync), is only for the user to type (disable-model-invocation), is
in ~/.agents/skills, is blocked, or the agent has its own by that
name. Those keep their own links.
- An agent whose folder can't take it keeps every link, and the page
says why: given copies, a live agent picking its own, the shared
~/.agents/skills, a Library skill called magpie-skills, or a
magpie-skills of the user's (never written over).
- Claude Code 2.1.316 asks before reading outside its project, its
skills folder too, so magpie adds Read rules for the entry and the
folders behind it to permissions.allow, records them, and takes out
only its own when they go (as permissions.deny does).
- The switch is this computer's alone; `magpie library skill router
on|off` sets it from the CLI.
- Sessions count a routed read of .skills/<name>/SKILL.md as <name>
(Claude Code, Alma, Droid), and calling up magpie-skills itself as no
skill, so a use counts once.
- docs/subsystems/skill-router.md, with a row in the index.
Run at this tree (rebased on origin/main 8f74442e4), on mote unless
named:
- go test -tags nogui ./internal/library ./internal/sessions -count=1: ok
- go test -tags nogui ./internal/cli ./internal/gui: ok at bca122bf9;
./internal/gui again at 8f74442e4 (app.js changed there): ok
- node --test of every library-*, *skill*, i18n* and gui-* GUI file
(96 files), in the Linux VM (wsl-run): mote's browsers didn't start
while another session's simulators ran. 1678 pass, 11 fail at
bca122bf9, every red also red on origin/main and filed: library-all
WebKit (#4967), skill-where WebKit 400px (#5154), i18n-keys' plugin
words (below), and library-own-folder under load, fixed here. The
files this change touches, add-partners-shine and i18n-keys again
at 8f74442e4: 111 pass, i18n-keys the 1 red.
- The router's row under the skill list moved four GUI tests'
footing, fixed in the tests: remove-all-skills counted it as a skill
(now rows of lists other than a hub's, as list-sort does);
found-skill-pick-remove and library-pick-remove's reach only wheeled
down from above the target, so a Select pushed under the sticky tabs
or below the fold was never reached (now toward it, over the list,
and the scroll at rest before the click, WebKit's settled a pixel
late); library-own-folder's Playwright click scrolled the now
taller page under load (now a click where the button is). Each red
on the branch before, 22/22 or 14/14 after, twice.
- skill-router.test.cjs: 22/22 (chromium and webkit, 1100 and 420px,
en zh zh-TW ja de)
- go vet -tags nogui, GOOS=linux and GOOS=windows: ok
- win-run (xiaomi-gpu) go test ./internal/library: ok but
TestGoneAgentListedToTakeOut and TestCheckMixedServerEachSide, red the
same at origin/main 6b0b7a96e and filed in #4115 (run at that
base; nothing in internal/library has changed on main since). The
router tests' expected rules were /C:/…; Claude Code's form is
//c/… (claudePath), which the code wrote, so the tests now ask
claudePath too.
- Broken by hand: routable returning true is red in TestSkillRouter (a
skill for the user to type is listed); with the routerSkill check
out of the sessions reader, TestClaudeRoutedSkillCounted is red.
- Real Codex 0.165.0, sandbox HOME, through the live gateway with no
sign-in copied: a binary built from this change at 6b0b7a96e ran `library skill
hand-over`, `skill agents secret-word codex` and `skill router on`;
`codex exec "What is the project's secret word?"` read
magpie-skills/SKILL.md, then .skills/secret-word/SKILL.md at the path
given, and answered PELICAN-7319. `router off` put the skill's link
back and removed the router's folder.
- Real Claude Code 2.1.316, sandbox HOME, through the live gateway on
auto/gpt-5.6-luna: that binary wrote the router and two
Read rules into settings.json (the user's "model" kept). "Check your
skills for one that fits, then greet me." ran Skill magpie-skills,
then Read .skills/greet-user/SKILL.md without asking, and answered
with the skill's words. Without the rules that Read was refused
(tried earlier with hand-written settings). Not tried on the Claude
subscription route with this binary: there the live gateway drops a
skill's body, which the gateway commit before this one fixes.
Known: Alma reads Claude Code's and Codex's folders too, so it may find
several magpie-skills (#5722, not tried with a real Alma).
i18n-keys is red on 3 keys that aren't this change's, the same
on origin/main (#5327, #5332, #5482, #5426).
claude-switch-only set page.setDefaultTimeout(5000) and then called
page.goto with no timeout of its own, so Playwright held the first load
of app.js, i18n.js and the plugins to the 5s bar meant for clicks. On a
busy box (a whole-suite run at load 130-160) that load took longer and
goto timed out. The same pattern is in 988 GUI test files (1174 pages):
every one of them now also sets setDefaultNavigationTimeout(60000) on
the same page, right after its default, so goto, reload and waitForURL
wait on the load itself with room, while clicks and waits keep their
short bar. group-from-model-add's own 20s navigation bar is raised to the
same minute. claude-switch-only also gives its first provider row (drawn
from the page's first reads) a minute before clicking it.
nav-timeout.test.cjs (no browser) reads every GUI test file and names
each page given a default under a minute without a navigation timeout of
at least a minute, so a new file can't bring the pattern back.
What was run (WSL magpie-desktop, Playwright 1.62.0, load 70-260 from
other sessions):
- node --check on every file in internal/gui/tests: all parse.
- nav-timeout.test.cjs against origin/main's test files: red (names the
1174 pages); against this tree: its only reds were my own probe copies
of the old files, since removed.
- By hand: claude-switch-only with app.js served 7s late (a busy box's
first load), --test-name-pattern "1100 en": origin/main's file 4 of 4
red with "page.goto: Timeout 5000ms exceeded"; this file 4 of 4 green.
- claude-switch-only.test.cjs, both engines, en/zh/ja/de, 1100 and 420:
32 of 32. group-from-model-add, usage-access-key-card and i18n-keys:
green. agent-plugin-agents: Chromium green; WebKit's de 420 subtest red
on a 5s waitForFunction at line 115 (a wait after load, not the
navigation), at load ~230.
Not tried: the whole GUI suite (about 1000 files; the change is one
mechanical line per page), Windows or mote (mote's browsers, #4125).
P2 of docs/subsystems/plugin-runtime.md, the second page after Sessions.
- library.js and library.css move to assets/plugins/library/ (client.js,
library.css). The script registers with the kernel
(magpie.plugin("library")) and adds its page to the "page" slot. Its
hooks: open and relang load, redraw, close (its modal), dirty, discard.
What it set up at load (list scroll and resize, the modal's backdrop
and Escape, beforeunload, the stuck header, a quiet reload on focus)
runs in mount.
- app.js calls those through magpie.call instead of window.loadLibrary,
redrawLibrary, closeLibraryModal, libraryDirty and discardLibrary. It
no longer lists library in its title map, hide loop or OPEN_VIEWS; the
kernel's pages are in them.
- index.html: <main id="view-library"> goes, the kernel makes it.
library.css keeps its place in the cascade.
- The 560 strings only Library says move from i18n.js to
plugins/library/i18n.js (4 languages). i18n.js: 18826 → 16584 lines.
- plugins/library/library.go lists the client files.
- Tests that read i18n.js for a Library string read strings.cjs (i18n.js
and the plugins'): 8 library tests and mcp-editor-cancel,
mcp-oauth-app, mcp-signin-health. font-cascade, win-fonts and
assets_revalidate_test.go name the new paths.
- "Check again" stays in i18n.js: Library said it alone when the words
were split, and a5d72a095 (Settings' search keys) says it too since.
i18n-keys has a new test, "a plugin's words are its own": a key in a
plugin's i18n.js that any file outside the plugin's folder says fails
it, naming the file. It was red on this key, and search-keys.test.cjs
said "Check again" had no zh translation.
- docs: library.md, gui-shell.md, plugin-runtime.md.
Run, at this tree:
- 101 GUI test files touching Library, skills, MCP, the plugins, the
shell and every language (gui-de/ja/zh-tw, i18n-keys, page-width,
view-no-sideways, mobile-web, text-size, …): Chromium and WebKit, 4 at
a time, all green but one. text-size's "zh: 100% picked at the foot"
failed once in Chromium under load ("scrolled from 160 to 109 (max
115)"); it passed alone, 6 at once here and on origin/main 8f34bbcd1,
and at 6× and 12× CPU throttling. It's the Settings page, already
"fixed" by 50dd39104, so I filed it as #2058.
- After rebasing onto origin/main 75cbc7e1e: i18n-keys, search-keys,
library-mcp-tools, library-all, gui-de, mono-icon-redraw,
group-first-token, Chromium and WebKit, green.
- go test ./internal/gui/ ./internal/pluginrt/ ./plugins/...; gofmt;
go vet on darwin, GOOS=linux -tags nogui, GOOS=windows: clean.
wongxy on Discord: 资源库技能支持批量删除 (batch delete for the Library's
skills). The library's own skills already have this: Select, then
Remove…, since #1852 (a4385e099, v0.1.1217). The skills under "In your
agents" (the ones an agent has of its own) could only be removed one at
a time. This adds the same for them.
What it does:
- RemoveFoundSkills(names), POST /api/library/skills/remove-found-some.
One change takes each name out exactly as RemoveFoundSkill does (its
body is now removeFound, shared by both). Folders and byte copies, the
shared ~/.agents/skills entry and a folder in the library's own folder
go to magpie's backups, not the OS trash and not deleted. Links are
taken away. A folder elsewhere that the skill only links to stays, and
so does another skill by that name.
- A name that can't be taken out is left as it was and goes in
Result.Unremoved; the others go all the same. When none can go the
change fails, the endpoint answers 400, and nothing is touched.
- The "In your agents" heading gets its own Select. Each row gets a
box, its own buttons go, and a bar has All, Clear, the count, Remove…
and Done. Remove… asks once, naming the count, the agents, how many
folders go to the backups, how many are only unlinked and how many
have a shared entry. A name that wasn't removed stays picked, with its
error in its row's place, and the status names it.
- Only one Select is on at a time: while either is on, the other is
dimmed with a title saying why ("Done picking … first"). Ending one
from the other took its bar away above the pointer and scrolled the
page.
- Eight new strings in zh, zh-TW, ja and de.
Run:
- TestRemoveFoundSkills: picks notes (a folder plus a byte copy), dev (a
link to a folder of the user's own), stuck (a read-only folder in
Gemini's skills) and notes again. Checks that stuck is in Unremoved
with its files intact, that the others are gone with their backups,
that dev's own folder stays, that keep (not picked) stays, that
"none can go" fails and touches nothing, and that no names is refused.
Broken by hand, it goes red both ways: returning on the first error
("permission denied", the change fails), and dropping Unremoved
("unremoved: []").
- found-skill-pick-remove.test.cjs in Chromium and WebKit, en, zh,
zh-TW, ja and de, at 1100 and 420: 11/11 each. Every press checks
that nothing scrolled and that the pressed button didn't move. It
covers the one-Select-at-a-time rule both ways, picking 3 and the
sheet's title and lines, Clear, a partial failure, the 400 when none
can go, and All then unpicking one. Broken by hand (failed names not
kept, or unpicked anyway), it goes red: 0/11.
- 80 Library, skill, group, removal, i18n-keys, gui-de/ja/zh-tw and
click-scroll GUI test files: Chromium 458/458; WebKit 456/458. The
two reds are group-member-info (en) and library-mcp-tool-switch
(zh-TW 980), both "locator.click: Timeout 5000ms exceeded". Both fail
the same way, with different cases each run, at 2c3112969 with this
change stashed.
- gofmt -l is clean. go vet passes on darwin, GOOS=linux -tags nogui
and GOOS=windows; go build passes on all three.
- go test -tags nogui ./... under a sandbox HOME, rebased on a069f224c:
all pass except internal/gateway, which hit the default 10m timeout
while the GUI suites were running alongside it. Run alone with
-timeout 25m it passed in 327s.
Not tried against a real agent's skills folder; only the sandbox HOME.
Reported-by: wongxy (Discord)