JonahFu asked on X (tweet 2123236872940073039) for each subagent's
local path in Library > Subagents, to edit it with an LLM, or to keep a
subagent in a git repository.
Each subagent of the library (not a plugin's) is now kept on this
computer in <library>/subagents/<name>.md as well, in Claude Code's
shape (name, description, model, skills, mcpServers, the prompt), or in
a file of the user's own set under the editor's Advanced (folded unless
one is set), in a repository say:
- FileHash is what the file said when magpie last wrote or took it in.
An edit there (by hand, by an agent, a git pull) is taken in at the
next sync and before a change made on the page, and every ticked
agent gets it. While magpie runs, KeepLinked's loop syncs when a
file's hash differs, once per edit.
- An edit that can't be read as a subagent (no front matter, another
name, no prompt) is left as it is, the agents keep what it said
before, and the editor says why. magpie writes a file only when it is
missing, or still as magpie left it; never the user's edit.
- A file of the user's own that is there already is what the subagent
says (a bad one refuses the save). It must be an absolute .md path,
not a folder, not inside the library, not one another subagent uses,
and not a file magpie writes for an agent.
- Rename and remove take the library's own file only while it is as
magpie wrote it; the user's own file always stays.
- File and FileHash are this computer's: Collect leaves them out, Put
keeps this computer's.
The editor shows the path (click reveals it, Copy copies it), a line
that edits there reach the agents, and the error when one wasn't taken
in. i18n in zh, zh-TW, ja and de.
docs/subsystems/library.md: a row for the subagent's own file and its
tests.
Run at the tree before 2051dfc23 (a Pi market change in
pimarket.go and plugin/market.go only) came onto origin/main:
- mote-run: gofmt -l none; GOOS=linux and GOOS=windows go vet -tags
nogui ./... and go vet ./...: ok. go test -timeout 45m ./...: every
package ok, internal/library 504s, except known reds not touched here:
internal/cli TestHealthcheckFindsTheRunningGatewayWithoutMagpieAddr,
TestUpdateRestartsTheGatewayItFindsWithoutMagpieAddr and
TestUpdateFindsAMagpieThatWroteNoRecord (#6471, #6223: a real gateway
on mote's 127.0.0.1:3425), internal/gateway
TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (#7117).
mote and mica were both over their cores; the suite went to mote.
- mica-run: node --test library-subagents, library-rules,
library-commands, i18n-keys, i18n-en-no-cjk (Chromium and WebKit,
420 and 1100 wide, en zh zh-TW ja de): 44 of 44. Before that, every
library-*, lib-*, nav-* and i18n* file (95 files, 2071 tests): red
only in library-commands (its tab-order assert, fixed in the previous
commit) and library-open-again's 1100px cases, red the same alone at
base 14b6b9555 (#6751).
- Red on the old code: TestSubagentFileFollowed and
TestSubagentFileUnreadable went red with the follow step skipped and
the hash check dropped; library-subagents.test.cjs is red against the
previous commit's client.js.
- Real use: a sandbox HOME magpie on mica (fake claude on PATH) wrote
~/.config/magpie/library/subagents/reviewer.md; an edit there with a
new description and prompt reached ~/.claude/agents/reviewer.md and
library.json on the next `library sync`; an edit with no front matter
was left as written and Claude Code's file kept the old text.
- After rebasing on 2051dfc23, mica-run: go vet ./internal/library
./internal/plugin and go test -timeout 45m ./internal/library: ok.
Not tried: a real Claude Code or other agent editing the file, a real
git pull into a repository file while magpie runs (KeepLinked's loop is
covered by TestSubagentOwnFile only), Windows and Linux.