Files
magpie/docs/subsystems/library.md
T
yetone e3a497d7a2 library, gui: Hooks are a fifth Library category, kept once and written into each ticked agent's own hooks file (#1790, AllenReder)
What: the Library page has a Hooks tab beside Instructions, MCP, Skills
and RTK. A hook is a command, an event, an optional tool filter, a
timeout and the agents ticked for it. magpie writes it into each agent in
that agent's own file and shape:
  Claude Code  <claude dir>/settings.json   hooks.<Event>[{matcher, hooks[]}]
  Codex        <codex home>/hooks.json       same shape
  Gemini CLI   ~/.gemini/settings.json       same shape, timeout in ms
  Cursor       ~/.cursor/hooks.json          flat entries, version 1
Portable events (turn end, after a tool, before a tool, prompt sent,
session start) map to each agent's own name; "shell"/"edit" map to each
agent's own tool names. An agent's own event (codex:PermissionRequest,
cursor:afterFileEdit, ...) is offered too and given to that agent only.
Rows have agent chips (All first), Select + bar, and Remove all, like
skills and servers. An agent that can't take a hook has its chip greyed
with the reason: every agent but those four ("has no hooks magpie can
write"), an agent in WSL (not yet), and another agent for a native event.
The page also says when an agent has all hooks turned off
(disableAllHooks, hooksConfig.enabled=false, [features] hooks=false).

Why these choices (product call delegated to us): the four agents are
the ones with a documented, file-based command-hook API whose events line
up; others (OpenCode's JS plugins, dsh, ...) have no comparable file, so
they're named as unavailable rather than half-supported. Removal is
exact: Applied.Hooks records each entry as written (canonical JSON), and
only an entry still exactly as written is taken out; one the user edited
is theirs, and their own hooks beside it are never touched. A hooks file
that doesn't parse is a problem, never treated as empty or written over.
Codex keeps trust per hook in config.toml keyed by group position, so
taking a group out re-keys the user's trust for the groups after it
(codexRekey) instead of silently untrusting them. Carried bundles
(backup/WebDAV/S3) don't carry hooks in this first version.

Run:
- go test ./internal/library ./internal/gui (sandbox HOME): pass. New
  hooks_test.go: each agent's shape; the user's edited entry stays and is
  no longer recorded; an unparseable file is left alone and reported;
  Codex trust moves with its groups; native events/unavailable agents;
  hooks-off reported.
- library-hooks.test.cjs: 12/12 in chromium and webkit, at 440px, in en,
  zh, zh-TW, ja, de; against the old library.js it fails (timeouts on the
  missing tab). All 52 new strings translated in the 4 languages.
- library-loading.test.cjs expects the Hooks tab in its tab lists
  (it failed on this change before; 6/6 now).
- Every library-*/skill-* GUI test in chromium and webkit: all pass but
  WebKit timeouts in library-mcp-tool-switch/library-mcp-tools, which fail
  the same on origin/main b0a904bd9 under load (#1609, commented).
- gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean. Full go test ./... at the pre-rebase
  head c1c1a730f: 49 packages ok. After rebasing onto 86b2f4d05:
  library, gui and gateway's Anthropic/Zed tests ok.

Not tried: real Claude Code / Codex / Gemini / Cursor runs firing the
written hooks; the shapes were checked against each agent's source and
docs, not executed.
2026-10-12 22:44:28 +08:00

27 KiB

Library: instructions, MCP servers, skills, hooks and RTK

The library keeps what every agent should know in one place: the instructions each agent reads before a conversation, the MCP servers it can call, the skills it can load, and the hooks it runs at points of its turn. magpie writes these into each agent's own files in that agent's format, and takes back only what it wrote. Everything else in those files stays as it was. Package internal/library also gives agents RTK, a CLI that cuts shell output down before the model reads it.

Responsibilities and sources of truth

Part Responsibility Source
library.json Library holds the instruction sets, the MCP servers, the skills, the projects, skill groups and copy settings. Applied records what magpie last wrote into each agent, so it only ever takes away its own. The instruction texts and skill folders live under Dir (library/ in magpie's config folder). library.go
One change change locks the library, loads it, applies one edit, saves, syncs every agent and saves again. Every exported mutation (SaveServer, InstallSkills, SetSkillHow and the rest) goes through it. One change runs at a time, whether from the page or the CLI. library.go
Targets Targets lists the detected agents (agent.Detected), plus apps like Claude Desktop, with where each keeps its instructions file (and an Override it reads instead), its MCP file and its skills folder. An agent in a running WSL distro has its places under the distro's home (wslTargetOf): Claude Code, Codex, Pi and OmO each by its own rule, and every agent that keeps all of them in its own folder (Hermes Agent, omp, OpenCode, Droid and the rest of ownFolder, #1323) by the same rule as on this machine, its MCP file marked as WSL's so a Windows program isn't given to it. An agent a plugin adds (a.Plugin) has the places its plugin's agent.library names (pluginTarget): an instructions file, an MCP file in one of agentplug.MCPFormats (each the mcpFormat of the agent it is named for, pluginMCP) and a skills folder, ~ and $VAR expanded as its config is; one that names none is no target. Before, a plugin's agent got models and keys only. targets.go
Sync sync writes each target's instructions and MCP servers. It then takes edits made in agents' skill copies into the library (takeEdits) and links or copies the skills. ~/.agents/skills goes first, so an agent that reads it gets no second link. Then it syncs projects' skills. sync.go
Instructions magpie's part of an agent's instructions file sits between two marker lines. The rest of the file is the user's. Several named sets can be switched between (#106). instructions.go
MCP servers A Server is a command or a URL (http, sse). mcpFile encodes it in each agent's own format (one mcpFormat per agent family) and merges it with the user's own fields for that entry. Also files get the same servers; Extra files are only read when importing. CheckServers connects as an agent would and keeps the result in memory only: with each tool's name and the first paragraph of its description (ToolList, at most maxToolList, a description cut at maxToolDesc runes), which the page lists when the server's "N tools" is clicked, following tools/list's nextCursor up to maxToolPages pages (listTools). Each step (initialize, notifications/initialized, tools/list; connect for SSE) has its own budget, 60s for a URL and 30s for a command (remoteStep, stdioStep), and a timeout names its Step and how long it Waited; a timeout isn't kept, so the next look asks again (#1467). The page asks once a session for the servers some agent or project has (inUse in library.js); one no agent has shows "not checked" and is checked only when its status is clicked (#1597, library-mcp-health.test.cjs). A server that needs OAuth is signed in once in magpie, and agents reach it through the gateway's /mcp/<name> (#615). A server whose authorization server refuses magpie's dynamic client registration with 401 or 403 admits only the clients it lists (Figma's, #1619): the sign-in fails with mcpauth.ErrClientRefused, which says so and that each agent signs in itself, and the agents keep the server's own address. magpie never registers under another client's name; one that reaches the gateway from another machine (a WSL distro under NAT) is given it with the LAN sharing key as its Authorization (agent.KeyAt), as its models are, which the gateway takes in place of a sign-in and never passes on; turning sharing on or off, or a new key (access.LANChanged), writes such entries again. ConfigOfServers is the servers picked as an agent's project file (projectMCPFiles) would hold them, written by the same code into a folder of its own and read back, with those the agent can't take there named; the page's Copy config… puts it on the clipboard for a project magpie doesn't keep (#1478). Each listed tool has a switch: the tools turned off are the server's DisabledTools, set by ServerTools, and written into each agent given the server that can leave out a single tool (see the constraint below). mcp.go, mcp_check.go, mcp_signin.go, mcp_copy.go, mcp_tools_off.go
Skills A skill is a folder with a SKILL.md. It comes from GitHub, from a folder on this machine (linked, so editing the folder edits the skill) or from the market. Each agent gets a link or a marked copy (#896, SkillHow). An agent in a WSL distro always gets a copy. A copy's mark keeps the hash of what was copied, so a sync knows a copy unchanged since then is current without reading its files (copyIsFresh, #1031); other copies are hashed. A skill an agent has of its own (foundSkills, the page's "In your agents") is brought in with ImportSkill, or taken out of every agent that has it with RemoveFoundSkill (#1303): its folders and copies of the very same files, its shared ~/.agents/skills entry and a folder of it in the library's own folder go to the backups, its links are taken away, and a folder elsewhere it only links to, or another skill by that name, stays. skills.go, skill_how.go, skill_edits.go, skill_from.go
Skills market MarketSkills lists skills.sh's most installed and what its search finds. magpie's own skills (featuredSkills) go first, marked official: magpie-quota, in magpie-community/plugins, lets an agent read magpie quota --json and wait with magpie quota wait. Until skills.sh lists one it has no count of installs and no skills.sh link (featured). InstallMarketSkill installs any of them from its repository. market.go
Skills a repository added A check for updates (CheckSkills) also asks, for each GitHub repository and ref the library has skills from, GitHub's list of its files (repoTree, one API request, free when the ETag still matches). Only when that list has a skill folder beside the installed ones (under newBase, their deepest common folder) that the library doesn't have and hasn't offered does findNew fetch the repository for the skills' names and descriptions. SeenSkills records per repo@ref the paths the install picker showed and the ones set aside, so they aren't offered again. The finds live in memory (newFound) and reach the page as View.NewSkills; AddNewSkills gives each to the agents that have its repository's other skills, and IgnoreNewSkills sets it aside (/api/library/skills/{add-new,ignore-new}). skillnew.go, skillcheck.go
Skill groups The page groups skills by SkillView.Repo, the repository each came from (tracer.repoOf): its GitHub source, CC Switch's Origin, From, the skills CLI's lock or the git checkout a linked folder is in. From is written when a repository is probed (installing from it again, noteFrom): for a skill with the very same SKILL.md, and for one traced to nowhere by a name the repository has when the library has others from there, since a pack added a while ago is mostly older copies edited there since (White Immortal on Discord: 20 of mattpocock/skills' 38). Group again (RegroupSkills, POST /api/library/skills/regroup) fetches each GitHub repository the skills are traced to and does the same; it fails only when none could be fetched. A skill traced to another repository is never moved. skill_from.go, library.js
Skill updates A skill from GitHub (kind: github, a market install among them) keeps the commit it was fetched at and Hash, the hash of its files as fetched. CheckSkills asks GitHub for each one's last commit and keeps the result in memory; View.CheckDue says none was checked since magpie started, or not for checkEvery (12 hours), and the page then checks by itself as the skills open (#1449). editState says a skill was changed here when the library's folder no longer hashes to Hash (.DS_Store aside), or an agent's copy was edited since its mark and not yet taken in; the view's edited says so. UpdateSkill refuses such a skill with *EditedError unless told to replace it (the page's own Update asks first; the CLI takes --replace-edits), and UpdateSkills/UpdateSomeSkills leave it as it is, in Unupdated. A replaced version that was changed, or that can't be told (no Hash), is moved to the backups (keepReplaced). Skills the skills CLI manages (npx skills, ~/.agents/.skill-lock.json) are only grouped: the CLI updates them (npx skills update). A linked folder, a skill imported from an agent and a From-only skill have no remote to check; one CC Switch installed (Origin) can be updated by hand but isn't checked. skill_changed.go, skillcheck.go, skills.go
Hooks A Hook (#1790) is a command, an event, an optional matcher, a timeout and the agents ticked for it. Its event is portable (HookEvents: turn-end, after-tool, before-tool, prompt, session-start, each under the agent's own name) or an agent's own ("codex:PermissionRequest"), which only that agent is given. A portable tool event can be narrowed to shell or edit tools, each agent's own tool names for them. syncHooks writes each into the agent's own file and shape (hookSpecOf): Claude Code <claude dir>/settings.json, Codex hooks.json beside its config.toml, Gemini CLI ~/.gemini/settings.json (timeout in ms), Cursor ~/.cursor/hooks.json (flat entries, version: 1). Every other agent, and an agent in WSL, is refused with why, and the page greys its chip with that reason. The page also says when an agent has every hook turned off (hooksOff: Claude Code's disableAllHooks, Gemini's hooksConfig.enabled, Codex's [features] hooks). hooks.go
Backups Before a change first writes an agent file, backups copies it to BackupDir, one folder per change. The last keepBackups (30) changes are kept. backup.go
RTK SetRTK runs rtk's own installer (rtk init -g …) for an agent being switched on. For one being switched off, it removes exactly what the installer wrote, using magpie's own code, which works even with rtk gone. ReadRTK reads each agent's files to say which have the hook. rtkSpec.blocked stops the installer where it would break an agent. A detected agent RTK has no hook for at all is still listed, from rtkNoHook, with the reason and a switch that can't be turned on (dsh: its hooks can allow or deny a command but not rewrite it, and rtk init has no --agent dsh). rtk.go

Runtime path

  1. Edit. The Library page or magpie library calls an exported function such as SaveServer, ServerAgents, InstallSkills, SkillAgents or SetSkillHow. The skills and servers pages each have Select, Turn all on, Turn all off and Remove all. Select's bar calls SomeSkillsAgents or SomeServersAgents (/api/library/{skills,servers}/agents-some), Turn all on or off calls EverySkillAgents or EveryServerAgents for the agents shown, and Remove all calls RemoveSkills or RemoveServers. The hooks page has Select and Remove all too (SomeHooksAgents, RemoveHooks). Each of these is one change that takes every item out as a single removal would (#1027). A row's agent chips start with All (allChip in library.js), which gives the item to every agent shown that can take it, or takes it from them all; the pickers that choose the agents before an item is added (installing skills from a repository or the market, adding, bringing in or installing a server) have the same All: most start with every agent lit, and one agent alone took a click on each of the others (#1531).
  2. Change. change edits library.json under the lock and calls sync.
  3. Write. For each target, syncInstructions, syncMCP and syncHooks write magpie's part in the agent's format and record it in Applied. Skills are linked or copied into the agent's skills folder. A copy edited since it was made is taken into the library first.
  4. Result. The Result lists the agents changed, a Problem for each thing that couldn't be given, and the backup folder.

Constraints and failure behavior

  • magpie takes away only what Applied or its mark says it wrote. A folder of the user's with a skill's name is never touched. The user's own fields in an MCP entry are kept.
  • An edit never silently loses. When an agent's copy of a skill and the library both changed, the newest edit wins, and the losing one is kept with the backups.
  • An update from GitHub never silently replaces a skill changed here. It is refused, or skipped in an update of several, until the user says to replace it, and the version replaced goes to the backups.
  • A failure for one agent is a Problem in the result. It doesn't stop the others.
  • A server an agent can't reach is not written there, and mcpFile.supports says why. For example, Claude Desktop takes no remote server, and Codex, Goose, dsh, Grok, Command Code and Zed take no SSE.
  • A server's headers (remote) or environment (command) can name a variable as ${NAME} (#1250). library.json keeps the placeholder, and refsOf gives each MCP format the agent's own syntax, with the agent's source cited beside it: ${NAME} for most, {env:NAME} for OpenCode and MiMo, ${env:NAME} for Cursor, and Codex's own keys (bearer_token_env_var, env_http_headers, env_vars). Goose gets ${NAME} plus env_keys. dsh (DeepSeek Harness) gets a !!js expression it evaluates as it loads the server (#1435): a whole ${NAME} is !!js process.env.NAME, and a value mixing text and variables is the text as JSON string literals joined with (process.env.NAME ?? ""), so the user's text is never run as code and an unset variable inside it is empty. A whole variable that isn't set makes dsh leave the server out as invalid. magpie reads only those forms back as ${NAME}; any other !!js keeps the entry the user's. An agent with no syntax (Claude Desktop, Antigravity, Kimi, Cline, ZCode, Zed, Devin, Alma, Pi with pi-mcp-extension) is never written the value: refsProblem makes supports refuse the server, a magpie entry already there is taken out, and AgentView.NoEnvRefs greys its chip with the reason. Codex and Goose's extra keys are magpie's only while the server names a variable there (refKeys), so the user's own env_vars or env_keys are kept. CheckServers expands the variable from magpie's own environment, and one that isn't set is novar, naming it.
  • A server's tools turned off on the page (nf1qaz2w on Discord) are kept by their names as the server gives them, in Server.DisabledTools, and written only to the agents that read a setting for it (toolsOffOf), each in its own form, checked against its source:
    • Codex: disabled_tools in the server's table in config.toml (codex-rs/config/src/mcp_types.rs, applied by ToolFilter in codex-rs/codex-mcp/src/tools.rs, openai/codex cc7ba336).
    • Gemini CLI: excludeTools in the server's entry (docs/tools/mcp-server.md; mcp-client.ts drops a tool by its own name, google-gemini/gemini-cli 9b6e0265).
    • Crush: disabled_tools in the server's entry (MCPConfig in internal/config/config.go, filterTools, charmbracelet/crush df5b024a).
    • Hermes Agent: tools.exclude in the server's entry, the original names (tools/mcp_tool_registration.py, mcp-config-reference.md, NousResearch/hermes-agent c5733167). tools.include, prompts and resources beside it are the user's.
    • Claude Code: a rule mcp__<server>__<tool> in permissions.deny of its settings.json (Target.Settings, beside .claude.json; for a WSL distro the distro's). A bare tool name in deny takes the tool out of Claude's context (code.claude.com/docs/en/permissions). Both names are spelt as Claude Code 2.1.296 spells them, each character but a letter, a digit, _ and - an _.
    • OpenCode: "<server>_<tool>": false in the top-level tools of opencode.json (opencode.ai/docs/mcp-servers, "Manage"), the names spelt as name() in packages/core/src/tool/mcp.ts does; migrateTools in packages/core/src/config/normalize.ts makes each a deny rule (sst/opencode 0d61729b).
    • Every other agent (Cursor, Copilot and Goose, whose lists are allow-lists only, Zed, Kimi, Pi, Grok, Devin, Antigravity, Alma, dsh, omp, ZCode, Command Code, Cline, WorkBuddy, CodeBuddy, Droid, Claude Desktop, MiMo Code, a plugin's agent) gets the server whole. AgentView.ToolsOff is false for it, and the open list of tools names those given the server as unable to turn off single tools. A project's file and Copy config… carry no tools turned off either. magpie records what it added (Applied.ToolsOff per server for a list in an entry, Applied.ToolRules for Claude Code's rules and OpenCode's keys) and takes back only that (offList): a name, rule or key the user had already is theirs and stays when the tool is turned on again, and an OpenCode key the user set to true is never written over. A list or permissions.deny that isn't a list of names is a problem, never taken as empty, and the file is left as it is. The key, and Claude Code's permissions or OpenCode's tools, goes when magpie's were the last in it. The editor's save sends no tools, so SaveServer keeps those turned off.
  • magpie's own MCP server (magpie-image, and any mcp … run by a program named magpie) runs this computer's magpie (#1439). InstallServer gives it magpie by full path (update.Program: the AppImage, not its mount; Homebrew's opt link, not the Cellar), and that path is right only on this computer. When the library is read, and after every change, heal points such a server whose program isn't on this computer (another system's path, a magpie moved out of Downloads, a bare magpie) at this magpie, so the agents and CheckServers get it; a magpie program that is here (another build) and a server run by any other program stay as they are. A carried library (Collect, for a backup or a WebDAV or S3 sync) names it as plain magpie, so two computers carry the same bundle and a sync doesn't write one's path over the other's; Put then reads it as that computer's magpie. self_here.go
  • A carried library (Collect) has every file of each skill, its templates and other binaries included, up to maxCarried (16 MiB) a file and maxCarriedAll (32 MiB) in all, chosen smallest first across the skills (readSkills), so every skill's text goes before any big file. The total keeps a sealed backup under the 64 MiB a sync reads: the files are base64 twice in it. What is left out is named in Left, and Put keeps this computer's copy of such a file in the skill it puts (keepLeft). carry.go
  • WorkBuddy's servers go in $WORKBUDDY_CONFIG_DIR/mcp.json (default ~/.workbuddy; WorkBuddy AI, the international build, keeps its own in ~/.workbuddy-ai, #1494), and CodeBuddy Code's go in the first of .mcp.json, mcp.json and ~/.codebuddy.json that exists, as resolveMcpFilePath reads them (#1266). WorkBuddy connects a server only after the user has switched it on once in its own MCP settings. It keeps that approval in mcp-approvals.json, keyed by the command, args and env names or the URL's origin, so changing those asks again. magpie never writes the approval, and the servers page says so, by the build's name, when a server is given to WorkBuddy or WorkBuddy AI.
  • Alma's servers go in ~/.config/alma/mcp.json on every system (its home, not its data folder), as its own MCP settings write them: command/args/env, or url/headers with transport: "sse" only for SSE (#1292). Alma reads the file as it starts and when its MCP settings refresh, so a server given to it while it runs reaches it after one of those.
  • Zed's servers go in context_servers of the settings.json magpie sets its model in (agent.zed: ~/.config/zed on macOS, $XDG_CONFIG_HOME/zed on Linux, %APPDATA%\Zed on Windows, or $MAGPIE_ZED_CONFIG_DIR), as command/args/env or url/headers (ContextServerSettingsContent, zed-industries/zed 2c99f547). The file is JSONC: it is edited in place, so the user's comments, other settings and own servers stay, and enabled, remote, timeout and oauth in magpie's entry are the user's. Zed speaks streamable HTTP only (its http.rs only POSTs), so no SSE. An entry Zed's extensions configure (settings and no command or url) is never written over: a server by that name is refused for Zed (mcpFile.foreign), and asks for another name. Zed reloads the file as it changes.
  • An agent with no place for an item is refused by Takes, never recorded as given it. The refusal lists the agents here that take that item (takenBy), and says where it goes instead (noPlace): OpenChamber reads OpenCode's global AGENTS.md, skills folder and opencode.json (its server's shared.js), so it gets them from OpenCode; Claude Desktop's chat keeps its instructions in its own settings, with the Claude account, and its Code tab reads Claude Code's. A plugin's agent is refused an item its agent.library names no place for, and the refusal names the key its plugin would set.
  • Removing RTK never uses rtk init --uninstall. That command deletes Gemini's GEMINI.md whole and removes Claude Code, OpenCode and Cursor together.
  • A hook is recorded entry by entry, as written (Applied.Hooks, compared as canonical JSON). magpie takes out only an entry still exactly as it wrote it; one the user edited is theirs from then on, and the user's own hooks beside it stay. A hooks file that doesn't parse is a problem and is never written. Codex keeps each hook's trust in config.toml as [hooks.state."<path>:<event>:<group>:<handler>"], keyed by position, so when magpie takes a group out codexRekey moves the user's trust for the groups after it to their new place.
  • A carried library (backup, WebDAV, S3, profile bundles) doesn't carry hooks yet.
  • CC Switch's own skills folder is only ever read.
  • Reading the page never waits on reading skills through (#541). Read compares an agent's own skill with the same name in another agent (sameTree) and hashes each library skill given as a copy (hashFiles, for behind). Both are kept against a stamp of the folders (each file's and link's path, type, size and mtime, stamper in treememo.go), taken by the same walk that compares or hashes them, before a file is opened; a later read walks the folder without opening a file, and while the stamps match reuses the answer. Only an answer from a whole read of folders untouched for settleFor (3s) is kept: a folder that couldn't be walked or read, or was written a moment ago, is read again next time, never taken as unchanged. A rewrite that keeps a file's size and mtime isn't seen. Glance (GET /api/library?glance=1) is the page without those two, marked partial; the page draws it first, then the whole read, which runs behind and foundSkills after the library's lock is let go, so a change doesn't wait on them either.
  • Skills installed together (InstallSkills, InstallMarketSkill, AddNewSkills, through installFrom and installChange) install each on its own. One the library lists from the same source, or a folder in the library's own skills folder holding exactly that skill's files (left by an install that stopped before the library was saved), is had already and goes in Result.Had. Its files are never written, so the user's edits stay. Another skill by that name, listed or only in the folder, or a folder that can't be read, is left as it is and goes in Result.Skipped with why. The rest are installed and named in Result.Installed. Only when nothing was installed or had does the change fail, with the first reason.

Verification

go test -tags nogui ./internal/library -run 'TestCheckSkillsFindsNewOnes|TestNewBase|TestUpdateKeeps|TestCheckDue|TestCheckSkillsMarksItDone|TestTargets|TestServer|TestImportServer|TestCheck|TestInstructions|TestInstructionSets|TestSkill|TestRemoveFoundSkill|TestInstallSet|TestInstallLists|TestEverySkillAgents|TestEveryServerAgents|TestSomeServersAgents|TestRemoveServers|TestRTK|TestEnvRefs|TestDshRefRoundTrip|TestDshImportKeepsJS|TestAgentMCPFiles|TestCodeBuddyMCPFile|TestZedMCP|TestOwnServerFromElsewhereRunsThisMagpie|TestUsersOwnServerStaysAsItIs|TestCarriedOwnServerIsEachComputersMagpie|TestCarry|TestPageReadDoesntReadUnchangedSkillsAgain|TestJustWrittenSkillIsReadAgain|TestUnreadableSkillIsntRememberedAsDifferent|TestGlanceLeavesOutTheAgentsSkills|TestPluginAgent|TestPluginMCPFormatsAreWritten|TestToolsOff|TestOffList|TestHooks'
go test -tags nogui ./internal/library
node --test internal/gui/tests/library-items.test.cjs internal/gui/tests/library-rtk-gain.test.cjs internal/gui/tests/library-rtk-nohook.test.cjs internal/gui/tests/library-servers-bulk.test.cjs internal/gui/tests/library-env-refs.test.cjs internal/gui/tests/library-zed-mcp.test.cjs internal/gui/tests/library-workbuddy-trust.test.cjs internal/gui/tests/skill-new-in-repo.test.cjs internal/gui/tests/skill-update-edited.test.cjs internal/gui/tests/remove-found-skill.test.cjs internal/gui/tests/library-loading.test.cjs internal/gui/tests/library-mcp-tools.test.cjs internal/gui/tests/library-mcp-tool-switch.test.cjs internal/gui/tests/library-hooks.test.cjs

The package's TestMain runs in a home of its own (testenv), never the user's real agent files.