miantiao_me on X asked for custom slash commands (prompt templates) kept
once in the Library and given to agents as skills are. Library → Slash
commands keeps a name, a description and a prompt where $ARGUMENTS is
every word typed after /name and $1, $2… the first, second… word. Each
ticked agent gets its own command file, in its own folder and shape
(internal/library/commands.go, from each agent's docs and source):
- Claude Code: <claude dir>/commands/<name>.md; $n becomes $ARGUMENTS[n-1]
(Claude counts from 0), a literal $0 is escaped.
- OpenCode: <config>/commands/<name>.md, as written.
- Pi: <agent dir>/prompts/<name>.md, as written.
- Gemini CLI: ~/.gemini/commands/<name>.toml, $ARGUMENTS is {{args}}.
- Qwen Code: <qwen home>/commands/<name>.md, {{args}}.
- Factory Droid: ~/.factory/commands/<name>.md, $ARGUMENTS.
- Gemini, Qwen and Droid have no $1…: a command using them is not written
for those agents, and the row and editor say so.
- Codex is listed greyed: it reads ~/.codex/prompts no more, its skills
took their place. WSL agents get none yet.
What magpie wrote is recorded per file with its hash (Applied.Commands),
through syncOwnFiles, now shared with subagents: a file the user changed,
or one by that name magpie didn't write, is never overwritten or removed;
one equal to magpie's bytes is adopted. Commands travel with backups and
WebDAV sync (Bundle.Commands; an older bundle keeps this computer's).
docs/subsystems/library.md has the row.
Run (mote was over its load, so mica, then mote at the end):
- At 4119054bb on origin/main 90efddaba: gofmt -l clean; GOOS=linux and
GOOS=windows go vet -tags nogui ./... ok; go test -timeout 45m ./...
every package ok but internal/cli's TestEveryRouteHasACommandOrIsNamed
(POST /api/providers/delete, from 90efddaba, #6677).
- GUI at 5783bf8cb (on 49f49c41c): the 276 files this can reach (every
library, i18n and sidebar-icon file, new library-commands included),
both engines, 420 and 1100, en/zh/zh-TW/ja/de: 5218 of 5340 pass. The 15
red files were run again at 49f49c41c itself and are red the same
there, test for test.
- At this head (rebased on 217e933dd, which touches only core i18n.js of
these files): internal/library, gui, davsync ok, cli red as above;
the 81 library, i18n and nav-sub-icons GUI files pass but library-env
(#6675).
- Final head (rebased on cd030691a): go test ./internal/library ok; GUI
library-commands, -plugins, -hooks, -subagents, -groups and i18n-keys,
both engines: 68 of 68 pass.
- Broken by hand: Claude's $n mapping left as written turns
TestCommandsWordsByPlace red; the sidebar section missing turned
library-groups red (my bug, fixed here).
- Real, sandbox HOME: Claude Code 2.1.316 `claude -p "/magpietry alpha
beta"` expanded first=[alpha] second=[beta]; OpenCode 2.0.25 listed it
(GET /api/command) and its session command expanded the same. Gemini
got the $n problem and no file.
Red on origin/main too, not this change: found-skill-pick-remove (#5013),
library-env (#6675), skill-group-shared (#6687), old-webkit (#6030,
#5919), the /api/update/using posts (#6133, #6667, #6668), library-new-skill
(#6539), mobile-web (#5013), phone-no-sideways (#5869), view-no-sideways
(#6669), and skill-where, text-size, usage-ledger and
usage-speed-all-models, each with an open issue. Left alone: a Claude plugin's
commands becoming library commands (#6672).
Not tried: pi, Qwen Code and Droid binaries (their files checked by tests
only), Codex (greyed), a real run on Windows or Linux.