library

package
v0.1.4464 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 74 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package library keeps what every agent should know, once: the instructions each reads before a conversation, the MCP servers it can call and the skills it can load. magpie writes them into each agent's own files in that agent's own format, and takes back only what it wrote — whatever else is in those files stays as it was.

Index

Constants

View Source
const (
	HowLink = "link"
	HowCopy = "copy"
)

The ways an agent can be given its skills.

View Source
const (
	SkillsInAgents = "agents" // each agent's own folder, as ticked
	SkillsInShared = "shared" // ~/.agents/skills too, every skill
)

The places SetSkillsWhere takes.

View Source
const BiliGrowthDefault = 50000

BiliGrowthDefault is bili's nudge step when none is set.

View Source
const BiliURL = "https://github.com/ranxianglei/billion-context"

BiliURL is billion-context's page.

View Source
const HubDirect = "direct"

HubDirect is Server.Hub for a server the hub leaves out: each agent given it keeps its own entry, as with the hub off (#4382).

View Source
const HubEntry = "magpie"

HubEntry is the name of the one entry the hub is given to an agent by.

View Source
const RTKURL = "https://www.rtk-ai.app"

RTKURL is where rtk is installed from.

View Source
const RouterSkill = "magpie-skills"

RouterSkill is the name of the one skill the router gives an agent.

View Source
const RunPath = "/mcp/run/"

RunPath is where the gateway serves a server magpie runs for Codex.

View Source
const SkillDirect = "direct"

SkillDirect is Skill.Router for a skill the router leaves out: each agent given it keeps its own link, as with the router off.

Variables

View Source
var CommandAgents = []string{"claude", "codex", "opencode", "pi", "gemini", "qwen", "droid"}

CommandAgents are the agents a slash command can be given, in the order the page lists them.

View Source
var GitHubTokenEnv = ghtoken.Env

GitHubTokenEnv names the environment variables a token is taken from when Settings has none, in the order they are looked at.

View Source
var HookEvents = []string{"turn-end", "after-tool", "before-tool", "prompt", "session-start"}

HookEvents are the portable events, in the order the page offers them.

View Source
var HookStarts = []string{"startup", "resume", "clear", "compact", "fork"}

HookStarts are the starts a portable session-start hook can be narrowed to (#5604, NEKO-CwC), in Claude Code's words for them (its SessionStart source): a new session, one resumed, one after /clear, one after its context was compacted, and a forked one.

View Source
var HookTools = []string{"shell", "edit"}

HookTools are the kinds of tools a portable tool event can be narrowed to.

View Source
var SubagentAgents = []string{"claude", "codex", "opencode", "gemini", "qwen", "droid", "grok", "cursor", "copilot"}

SubagentAgents are the agents a subagent can be given, in the order the page lists them.

Functions

func AsleepIn added in v0.1.2043

func AsleepIn(id string) string

AsleepIn is the WSL distro, not running now, of the agent with id; "" for any other. A change the library makes for it is written there the next time it runs.

func BackupDir

func BackupDir() string

BackupDir is where a file is copied before magpie first changes it in a change: one folder a change, named by when, a folder an agent in it.

func BiliConfigFile

func BiliConfigFile() string

BiliConfigFile is billion-context.json where bili itself looks for it (src/paths.ts): BILI_CONFIG_FILE, else billion-context/ under XDG_CONFIG_HOME, else under ~/.config — on Windows too, where bili's homedir() is %USERPROFILE%.

func BorrowNote

func BorrowNote(id string) string

BorrowNote is what the last read of the Remote magpie id's Library said went wrong, and the names it left as the user's.

func BorrowedOn

func BorrowedOn() map[string]bool

BorrowedOn are the Remote magpies (provider ids) whose Library is used here. Nil when the library can't be read.

func Changed added in v0.1.182

func Changed() time.Time

Changed is when the library was last changed: library.json, or a file of its own (links not followed), or billion-context.json or Claude Code's plugin records, which a sync carries with it.

func CheckChannel added in v0.1.1224

func CheckChannel(v *RTKView)

CheckChannel asks the package manager upgrade runs what rtk it has, and keeps the answer for six hours (see rtkChannelLatest), so that the next read of the tab draws with it without waiting. It is asked in the background, after the tab has gone out: it is a question for the package manager, which takes seconds, and it answers nothing anyone needs unless a release newer than the one installed is out (#1025).

func CheckServers added in v0.1.794

func CheckServers(ctx context.Context, names []string, fresh bool) (map[string]ServerHealth, error)

CheckServers checks the library's servers called names (every one when there are none). One checked already this session, as it is now, isn't started again unless fresh.

func Dir

func Dir() string

Dir is where the library's own files are: the instructions and the skills.

func GitHubToken added in v0.1.662

func GitHubToken() (token, from string)

GitHubToken is the token requests to GitHub's API carry, and where it came from: "settings", the environment variable's name, or "" for none.

func Holds added in v0.1.1209

func Holds(s *Setup) bool

Holds reports whether the library is as s has it: Restore would put back nothing that differs. A server or skill s names that the library no longer has isn't compared, as Restore can't give it either, nor one added since s was taken, which Restore leaves as it is.

func HubLink(app string) (string, error)

HubLink is the link that adds the hub to app, at this computer's gateway (HubMCPAll, which needs no key here), through the install link its vendor documents: Cursor's cursor://anysphere.cursor-deeplink/mcp/install (docs.cursor.com, "MCP install links") and VS Code's vscode:mcp/install (code.visualstudio.com, "Add an MCP server": URL handler). Each app asks its user before it adds the server.

func Icon

func Icon(u string) ([]byte, string, error)

Icon is a market icon, fetched once and kept on disk: only an icon the market gave out is fetched, so the page can't have magpie fetch anything else.

func IgnoreNewSkills added in v0.1.1091

func IgnoreNewSkills(ids []string) error

IgnoreNewSkills sets aside the new skills a check found, by their IDs: a later check doesn't offer them again.

func InUse added in v0.1.1225

func InUse() (int, error)

InUse counts what the library gives agents: each server, skill, hook and project folder it keeps, and the shared instructions while an agent gets them. The library built-in plugin stays on while it is more than 0. A library.json that can't be read is an error, never 0.

It reads without mu: a sync holds mu for as long as it takes (13s and more with many agents and skills), and boot.js, which the window waits on before it paints, asks this through the built-in plugins (#2774: a white window at start on macOS). library.json is only ever replaced whole (save's edit.WriteAtomic), so a read beside a sync sees the file before or after one of its writes, never half of it.

func KeepLinked added in v0.1.1227

func KeepLinked(ctx context.Context, interval time.Duration)

KeepLinked runs SyncLinked, Woken and a due PublishMemory every interval, until ctx ends: the app's backend, which ends once it has handed the gateway to the new version (gui/handover.go). Before, it ran for as long as the process did, and the copy an update left finishing its requests went on writing the agents' files beside the new one (#4938).

func KeepSkillsCurrent

func KeepSkillsCurrent(ctx context.Context)

KeepSkillsCurrent runs AutoUpdateTick while the gateway serves.

func KeyMCPServers added in v0.1.3195

func KeyMCPServers() []gateway.HubServer

KeyMCPServers are every MCP server in the library, by name, with its tools but those turned off as it last listed them (none when it never has), for the picker of the servers and tools a gateway key may use (wakaka on Discord): the hub, /mcp/<name> and /mcp/run/<name> reach each, whether or not the hub gives it.

func MemoryInInstructions

func MemoryInInstructions() (bool, []string, error)

MemoryInInstructions is whether the agents ticked for instructions are given memory's digest, and those agents.

func PluginServers added in v0.1.3245

func PluginServers() map[string]PluginServer

PluginServers are the plugins' servers by plugin (plugin.Name); none when the library can't be read.

func ProjectAt

func ProjectAt(dir string) (string, error)

ProjectAt is the listed folder of the project dir is (ProjectPath's way, or the same folder through a link): "" for a folder that isn't one.

func ProjectInstrFile

func ProjectInstrFile(agentID string) string

ProjectInstrFile is the file, in a project, an agent reads the project's instructions from when there is none yet: "" for one magpie can't give a project's instructions to.

func ProjectMCPFile added in v0.1.629

func ProjectMCPFile(agent string) string

ProjectMCPFile is the file, in a project, an agent reads the project's MCP servers from: "" for one magpie can't give a project's servers to.

func ProjectNoSSE added in v0.1.635

func ProjectNoSSE(agent string) bool

ProjectNoSSE says whether an agent's project file can't take a server over SSE (Codex's, Pi's), whatever its user-wide one can.

func ProjectOffAgents

func ProjectOffAgents() []string

ProjectOffAgents are the agents a project can turn a global server off for, and ProjectSkillOffAgents a global skill.

func ProjectPath

func ProjectPath(dir string) (string, error)

ProjectPath is a folder as typed on a command line (~, or relative to where magpie runs) made a full path, as AddProject takes it.

func ProjectSkillOffAgents

func ProjectSkillOffAgents() []string

func ProjectSkillsDir added in v0.1.243

func ProjectSkillsDir(agent string) string

ProjectSkillsDir is the folder, in a project, an agent reads its skills from: "" for one magpie can't give a project's skills to.

func ProjectSubagentsDir

func ProjectSubagentsDir(agentID string) string

ProjectSubagentsDir is the folder, in a project, an agent reads its subagents from: "" for one magpie can't give a project's subagents to.

func PublicServers

func PublicServers() []string

PublicServers is the library's servers that the market lists from what ships with magpie (the featured ones and the registry's popular ones), each by its market id, given to at least one agent: what the day's report names of the user's MCP servers, for the market's counts of who uses each (internal/stats). A server of the user's own, one found only by a search of the registry, and one no agent is given are never in it, nor is anything of a server but its id: no name, URL, command or key.

func RTKLatest added in v0.1.328

func RTKLatest() string

RTKLatest is rtk's latest release, from GitHub unless it was read lately; "" when GitHub can't be reached and never could.

func RTKNewer added in v0.1.328

func RTKNewer(a, b string) bool

RTKNewer says whether version a is after b, by their numbers.

func RTKTakes added in v0.1.124

func RTKTakes(q string) (string, error)

RTKTakes is the id of the agent q names when rtk can be given to it.

func RegroupSkills added in v0.1.1213

func RegroupSkills() (int, error)

RegroupSkills traces the library's skills again (the Library page's Group again): each GitHub repository a skill is traced to is fetched, and the skills it has that aren't grouped with it yet are noted as from there, as installing from it again would. It gives how many were grouped; an error only when no repository could be fetched.

func RemoteMCPOn added in v0.1.3135

func RemoteMCPOn() map[string]bool

RemoteMCPOn are the Remote magpies (provider ids) whose editor's switch is on: switched on, or with a server of their router in the library (one added before the switch was there too). Nil when the library can't be read.

func RemoveSignIn

func RemoveSignIn(name, id string) error

RemoveSignIn forgets one of magpie's sign-ins to the server.

func ServeRun added in v0.1.1949

func ServeRun(w http.ResponseWriter, r *http.Request, name string)

ServeRun is the gateway's RunPath<name>: the server called name, run by magpie, over streamable HTTP. The gateway lets only this machine's agents here.

func SharedSkills added in v0.1.2016

func SharedSkills() ([]string, error)

SharedSkills are the names of the library's skills kept in ~/.agents/skills, which HandOverSkills can move into the library.

func SignInServer added in v0.1.694

func SignInServer(ctx context.Context, name string) (mcpauth.State, error)

SignInServer starts signing magpie in to the library's server called name: the State's URL is the page to open in a browser.

func SignInServerAccount

func SignInServerAccount(ctx context.Context, name, label string) (mcpauth.State, error)

SignInServerAccount is SignInServer as another account of the server, put in use once signed in.

func SignOutServer added in v0.1.694

func SignOutServer(name string) error

SignOutServer forgets magpie's sign-in to the server called name, and gives the agents the server's own address again.

func SkillPath

func SkillPath(name string) string

SkillPath is where a library skill's folder is.

func SkillsAbout

func SkillsAbout(ids []string) map[string]string

SkillsAbout is what each skill says of itself, by id (owner/repo/skill), from its SKILL.md; kept on disk once known.

func Takes added in v0.1.113

func Takes(q, kind string) (string, error)

Takes is the id of the agent q names (its id, an alias, its name) when the library can give it kind — "instructions", "mcp" or "skills" — or why not: an agent it has no place for isn't recorded as getting it and then given nothing.

func UseRemoteLibraries

func UseRemoteLibraries(ctx context.Context)

UseRemoteLibraries reads the Library of every Remote magpie switched on.

func UseSignIn

func UseSignIn(name, id string) error

UseSignIn puts one of magpie's sign-ins to the server in use.

Types

type Account

type Account struct {
	ID      string            `json:"id"`
	Name    string            `json:"name"`
	Headers map[string]string `json:"headers,omitempty"`
}

Account is one set of headers a server is asked with.

type AgentInstructions

type AgentInstructions struct {
	Agent    string `json:"agent"`
	Name     string `json:"name"`
	Icon     string `json:"icon"`
	Path     string `json:"path"`
	On       bool   `json:"on"`
	Extra    string `json:"extra"`              // what this agent gets besides
	Own      int    `json:"own"`                // lines of the user's own in the file
	Edited   bool   `json:"edited,omitempty"`   // magpie's part was changed in the file
	Override string `json:"override,omitempty"` // a file the agent reads instead
	Profile  bool   `json:"profile,omitempty"`  // the file is the user's profile to the agent (Target.Profile)
	// Asleep is the WSL distro, not running now, the agent is in: its row
	// is what magpie last knew of it (asleepInstructions), its file isn't
	// read, and a change is written there when the distro next runs.
	// Unseen: magpie never saw where it keeps its instructions
	Asleep string `json:"asleep,omitempty"`
	Unseen bool   `json:"unseen,omitempty"`
}

AgentInstructions is one agent's instructions file as the page shows it.

type AgentView

type AgentView struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Icon         string `json:"icon"`
	Instructions string `json:"instructions,omitempty"`
	MCP          string `json:"mcp,omitempty"`
	Skills       string `json:"skills,omitempty"`
	// ProjectSkills is the folder in a project it reads skills from
	ProjectSkills string `json:"projectSkills,omitempty"`
	// ProjectMCP is the file, in a project, it reads MCP servers from
	ProjectMCP string `json:"projectMCP,omitempty"`
	// ProjectSubagents is the folder in a project it reads subagents from
	ProjectSubagents string `json:"projectSubagents,omitempty"`
	// ProjectInstructions is the file in a project it reads the
	// project's instructions from, when there is none yet
	ProjectInstructions string `json:"projectInstructions,omitempty"`
	// ProjectNoSSE: its project file can't take a server over SSE
	ProjectNoSSE bool `json:"projectNoSSE,omitempty"`
	// ProjectOff and ProjectSkillOff: a server, or a skill, it has from
	// the Library can be turned off for it in one project (project_scope.go)
	ProjectOff      bool     `json:"projectOff,omitempty"`
	ProjectSkillOff bool     `json:"projectSkillOff,omitempty"`
	SkillsAlso      []string `json:"skillsAlso,omitempty"`
	Note            string   `json:"note,omitempty"`
	NoSSE           bool     `json:"noSSE,omitempty"`
	NoRemote        bool     `json:"noRemote,omitempty"`
	// NoEnvRefs: it reads no ${NAME} from its MCP config, so a server
	// whose headers or environment have one isn't given to it (envref.go)
	NoEnvRefs bool `json:"noEnvRefs,omitempty"`
	// ToolsOff: it can be told to leave out single tools of a server
	// (mcp_tools_off.go); the page names those that can't
	ToolsOff bool `json:"toolsOff,omitempty"`
	// Startup: it is given a server's startup timeout (Codex's
	// startup_timeout_sec)
	Startup bool   `json:"startup,omitempty"`
	MCPVia  string `json:"mcpVia,omitempty"`
	// Hub, with the MCP hub on, is "on" for an agent given magpie's one
	// entry in place of its servers, or why it keeps theirs: no-remote
	// (it reaches no server over HTTP), taken (a library server is called
	// magpie) or own (it has an entry called magpie of its own); "" for one
	// given none of the hub's servers
	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; 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
	// (in WSL)
	How      string `json:"how,omitempty"`
	HowOwn   bool   `json:"howOwn,omitempty"`
	MustCopy bool   `json:"mustCopy,omitempty"`
	// Gone: not installed here any more, and listed only for what magpie
	// gave it to be taken out (held); it is given nothing new
	Gone bool `json:"gone,omitempty"`
	// Asleep is the WSL distro, not running now, the agent is in: it is
	// listed by what magpie last knew of it (wsl_asleep.go), and a change
	// for it is written there when the distro next runs. Unseen: magpie
	// never saw where it keeps its MCP servers or skills, so its ticks
	// can't be shown or changed until the distro runs
	Asleep string `json:"asleep,omitempty"`
	Unseen bool   `json:"unseen,omitempty"`
}

AgentView is an agent as the page lists it, with where it keeps each.

type Applied

type Applied struct {
	Instructions bool     `json:"instructions,omitempty"`
	InstrHash    string   `json:"instrHash,omitempty"` // of the part last written
	MCP          []string `json:"mcp,omitempty"`
	Skills       []string `json:"skills,omitempty"`
	// ToolsOff are, for each server, the tools magpie put in the list its
	// entry has of those the agent leaves out; ToolRules the rules beside
	// the servers magpie added to leave tools out (Claude Code's deny
	// rules, OpenCode's tools keys). Neither holds one the user had.
	ToolsOff  map[string][]string `json:"toolsOff,omitempty"`
	ToolRules []string            `json:"toolRules,omitempty"`
	// Hooks are the entries magpie wrote into the agent's hooks, each
	// exactly as written: one changed since is the user's (hooks.go)
	Hooks []HookEntry `json:"hooks,omitempty"`
	// Env are the variables magpie wrote into the agent's settings, with
	// their values: one there with another value since is the user's
	Env []EnvEntry `json:"env,omitempty"`
	// Subagents are the files magpie wrote for the subagents, each with
	// the hash of what it wrote: one changed since is the user's
	Subagents []SubagentFile `json:"subagents,omitempty"`
	// Commands are the files magpie wrote for the slash commands, kept as
	// Subagents are
	Commands []SubagentFile `json:"commands,omitempty"`
	// Startup is, for each server, the startup timeout magpie wrote in its
	// entry (Codex's startup_timeout_sec): one there other than this is
	// the user's
	Startup map[string]float64 `json:"startup,omitempty"`
	// Picked are the skills magpie picked in the agent's own list of
	// those it uses (LiveAgent's skills-settings.json, liveagent.go): one
	// the user unpicked since stays unpicked
	Picked []string `json:"picked,omitempty"`
	// Router: magpie put the skill router's entry, magpie-skills, in the
	// agent's skills folder
	Router bool `json:"router,omitempty"`
	// RouterRules are the rules magpie put in Claude Code's
	// permissions.allow so it reads a listed skill without asking.
	RouterRules []string `json:"routerRules,omitempty"`
	// RouterCommands are the slash commands magpie wrote for the skills
	// the router lists (routerCommands), kept as Commands are
	RouterCommands []SubagentFile `json:"routerCommands,omitempty"`
}

Applied is what magpie last wrote into one agent.

type BiliAgent

type BiliAgent struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Icon string `json:"icon"`
	On   bool   `json:"on"`
	// Status is what bili plugin list says of it when that isn't simply
	// installed or not: partly installed, broken, an error
	Status string `json:"status,omitempty"`
}

BiliAgent is one agent bili's plugin can be given to.

type BiliChange

type BiliChange struct {
	// Growth 0 takes the setting out, back to bili's default
	Growth *int  `json:"growth"`
	Nudge  *bool `json:"nudge"`
	// Summary switches the external summary; switched on, it needs a
	// target, Target or one the file has
	Summary *bool `json:"summary"`
	// Target is the summary model, first of the targets: "recipe/model"
	// from the file's recipes, or Model
	Target *string `json:"target"`
	// Model is a model magpie serves, as the target: magpie's recipe sends
	// it to this computer's gateway
	Model *string `json:"model"`
	// Philosophy "" takes it out; one set turns acknowledgePromptsRisk on,
	// which bili needs to use it
	Philosophy *string `json:"philosophy"`
	// Markers false turns compress.visibilityMarkers off; true takes the
	// setting out, back to bili's default, which shows them
	Markers *bool `json:"markers"`
}

BiliChange is a change to the settings BiliSettings shows; a nil field is left as it is.

type BiliSaved

type BiliSaved struct {
	// Net is bili's net savings: what its folds kept out of every later
	// request, less the rebuilds after a fold and the summaries' cost
	// (netSavedTotal). It can be below zero. Only when HasFolds.
	Net int64 `json:"net"`
	// Gross is the same before those costs (grossSavedTotal), which bili
	// calls a theoretical upper bound.
	Gross    int64 `json:"gross"`
	HasFolds bool  `json:"hasFolds"`
	Folds    int64 `json:"folds"`
	Sessions int64 `json:"sessions"`
	Requests int64 `json:"requests"`
	Input    int64 `json:"input"`
	// USD is bili's net savings in dollars, when it priced the models
	// (hasMoneyData); 0 when it didn't.
	USD float64 `json:"usd,omitempty"`
	// At is when bili said so (RFC 3339).
	At string `json:"at"`
	// Live is whether a running bili said so just now; false is the
	// last answer magpie kept.
	Live    bool   `json:"live"`
	Version string `json:"version,omitempty"`
}

BiliSaved is bili's own count of what it saved.

type BiliSettings

type BiliSettings struct {
	Path string `json:"path"`
	// Bad is why the file can't be read as bili reads it; nothing is
	// changed in it then
	Bad string `json:"bad,omitempty"`
	// Growth is compress.nudgeGrowthTokens, 0 when unset (bili's 50000)
	Growth int `json:"growth"`
	// Nudge is compress.requireNudge
	Nudge bool `json:"nudge"`
	// Summary is compress.externalSummary.enabled, Targets its targets
	// ("recipe/model")
	Summary bool     `json:"summary"`
	Targets []string `json:"targets"`
	// Recipes are the "recipe/model" a target can be from the file's own
	// recipes, magpie's left out
	Recipes []string `json:"recipes"`
	// Philosophy is compress.prompts.compressPhilosophy, used by bili
	// only with compress.acknowledgePromptsRisk (Risk)
	Philosophy string `json:"philosophy"`
	Risk       bool   `json:"risk"`
	// Markers is compress.visibilityMarkers: the 📦/❌ lines bili adds
	// after a compress, decompress or search_context call runs, on unless
	// the file turns them off
	Markers bool `json:"markers"`
	// Reloaded of Running are the bilis that read a change again, of the
	// ones running here
	Reloaded int `json:"reloaded,omitempty"`
	Running  int `json:"running,omitempty"`
}

BiliSettings are the settings of billion-context.json the Library's tab shows: compress's nudge step and whether a fold needs a nudge, its external summary (the fast model summaries are written with) and its compression philosophy.

func ReadBiliSettings

func ReadBiliSettings() (*BiliSettings, error)

ReadBiliSettings is billion-context.json's settings the tab shows.

func SetBiliSettings

func SetBiliSettings(c BiliChange) (*BiliSettings, error)

SetBiliSettings changes billion-context.json and has the bilis running here read it again.

type BiliView

type BiliView struct {
	Path    string      `json:"path,omitempty"` // "" when bili isn't installed
	Version string      `json:"version,omitempty"`
	Agents  []BiliAgent `json:"agents"`
	URL     string      `json:"url"`
	// Install is the command Install runs, "" when there is no npm
	Install string `json:"install,omitempty"`
	// ListErr is why bili plugin list said nothing magpie could read
	ListErr string   `json:"listErr,omitempty"`
	Restart []string `json:"restart,omitempty"`
	Backup  string   `json:"backup,omitempty"`
	// Saved is what bili says it saved (bili_saved.go), nil when no bili
	// has answered here yet
	Saved *BiliSaved `json:"saved,omitempty"`
}

BiliView is the billion-context part of the Library page.

func InstallBili

func InstallBili() (*BiliView, error)

InstallBili installs billion-context the way its README says.

func ReadBili

func ReadBili() *BiliView

func SetBili

func SetBili(id string, on bool) (*BiliView, error)

SetBili gives bili's plugin to an agent with bili's own installer, or takes it away with bili's own remover and puts back what the install changed in the agent's files.

type BorrowResult

type BorrowResult struct {
	Added   []string // skills and sets taken in
	Updated []string
	Removed []string
	Kept    []string // the user's own by the same name, left as they are
}

BorrowResult says what a read of a Remote magpie's Library did.

func Borrow

func Borrow(id, name string, b *Bundle) (*BorrowResult, error)

Borrow keeps the Library b of the Remote magpie id (called name) here, as the notes above say.

func UseRemoteLibrary

func UseRemoteLibrary(ctx context.Context, id string) (*BorrowResult, error)

UseRemoteLibrary reads the Library of the Remote magpie id and keeps it here (Borrow).

type Borrowed

type Borrowed struct {
	Name   string            `json:"name,omitempty"`
	Skills map[string]string `json:"skills,omitempty"`
	Sets   map[string]string `json:"sets,omitempty"`
}

Borrowed is what this computer took from one Remote magpie's Library: by name the hash of each skill as taken, and by id that of each set.

type Bundle added in v0.1.182

type Bundle struct {
	Instructions Instructions      `json:"instructions"`
	Texts        map[string]string `json:"texts,omitempty"` // set → its text
	Extra        map[string]string `json:"extra,omitempty"` // agent → what it gets besides
	MCP          []*Server         `json:"mcp"`
	Skills       []*CarriedSkill   `json:"skills"`
	Icons        map[string]string `json:"icons,omitempty"`
	// Subagents are nil in a bundle from a magpie before they were
	// carried, which knew nothing of this computer's: Put keeps them. Collect
	// always sets it, empty too, so taking the last one out is carried.
	Subagents *[]*Subagent `json:"subagents,omitempty"`
	// Commands are nil in a bundle from a magpie before slash commands,
	// as Subagents are: Put keeps this computer's.
	Commands *[]*Command `json:"commands,omitempty"`
	// Hooks are nil in a bundle from a magpie before they were carried,
	// as Subagents are: Put keeps this computer's. Applied.Hooks, the
	// entries magpie wrote into each agent here, stays out.
	Hooks *[]*Hook `json:"hooks,omitempty"`
	// Env is nil in a bundle from a magpie before variables were carried:
	// Put keeps this computer's. Applied.Env stays out. A backup made
	// without keys carries the names with empty values (WithoutSecrets).
	Env *[]*EnvVar `json:"env,omitempty"`
	// Bili is billion-context's own billion-context.json, with magpie's
	// recipe at the default gateway address (carriedBili). It is nil when
	// this computer has none or it can't be read, and in a bundle from a
	// magpie before it was carried: Put keeps this computer's then.
	Bili *string `json:"bili,omitempty"`
	// ClaudePlugins are the marketplaces and plugins installed in Claude
	// Code itself (claude_plugins.go). nil when there are none, or they
	// can't be read, and in a bundle from a magpie before them: Put adds
	// nothing then. Put only adds, so one computer's never takes away
	// another's.
	ClaudePlugins *ClaudePlugins `json:"claudePlugins,omitempty"`
	// Plugins are the library's own Claude plugins (plugin.go), each as a
	// whole: its parts aren't among the skills, servers, hooks and
	// subagents above, and each computer makes them again from it
	// (plugin_carry.go). nil in a bundle from a magpie before they were
	// carried: Put keeps this computer's then.
	Plugins *[]*CarriedPlugin `json:"plugins,omitempty"`
}

Bundle is the library as a backup carries it to another computer: the instruction sets and the one on, what each agent gets besides, the MCP servers, the skills with their files and the subagents. What magpie wrote into each agent (Applied, the subagents' files among it) is this computer's own and stays out. It is made the same way every time — no times, everything in order — so two computers with the same library carry the same bundle.

func Collect added in v0.1.182

func Collect() (*Bundle, error)

Collect is the library as it is now; nil when there is none yet.

func Shared

func Shared() (*Bundle, error)

Shared is the Library as another magpie is told it: the instruction sets with their texts and the skills with their files. The servers, the hooks and what each agent gets besides are this computer's; a skill linked to a folder here comes as its files.

func (*Bundle) WithSecrets added in v0.1.182

func (b *Bundle) WithSecrets(have *Bundle, secret func(string) bool) *Bundle

WithSecrets is b with the values WithoutSecrets emptied filled from the servers of the same name in have, so a bundle made without keys doesn't take away the ones kept here.

func (*Bundle) WithoutSecrets added in v0.1.182

func (b *Bundle) WithoutSecrets(secret func(string) bool)

WithoutSecrets empties the values of the servers' environment variables and headers that secret says hold one; their names stay, to be filled in.

type Candidate

type Candidate struct {
	Path        string `json:"path"` // in the repository or the folder; "" for its root
	Name        string `json:"name"`
	Description string `json:"description"`
	Have        bool   `json:"have"` // the library has this skill (from here, or the very same files)
	// As is the name the library has it by, or would add it by, when
	// that isn't Name: another skill from elsewhere has that name
	As string `json:"as,omitempty"`
	// Links is that the library's skill by its name came from a folder
	// or an agent, not from anywhere it can be updated from: installing
	// this one puts its files and source in that one's place, so it
	// updates from here (skill_link.go)
	Links bool `json:"links,omitempty"`
}

Candidate is a skill found where the user pointed: in a repository, or in a folder.

type CarriedPlugin

type CarriedPlugin struct {
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Version     string   `json:"version,omitempty"`
	Source      string   `json:"source,omitempty"`
	Pick        string   `json:"pick,omitempty"`
	Agents      []string `json:"agents"`
	Off         bool     `json:"off,omitempty"`
	// Taken are the parts the user took out one by one (PluginView's
	// Missing), taken out on the other computer too
	Taken []string `json:"taken,omitempty"`
	// Files are a plugin's from a folder, as a skill's are; nil for one
	// fetched from its source
	Files map[string][]byte `json:"files"`
	Exec  []string          `json:"exec,omitempty"`
	Left  []string          `json:"left,omitempty"`
}

CarriedPlugin is a library plugin as a sync carries it.

type CarriedSkill added in v0.1.182

type CarriedSkill struct {
	Name   string            `json:"name"`
	Source *Source           `json:"source,omitempty"`
	Agents []string          `json:"agents"`
	Files  map[string][]byte `json:"files"`          // by path in the folder, with /
	Exec   []string          `json:"exec,omitempty"` // the files that run
	Left   []string          `json:"left,omitempty"` // files too big to carry
	// Called is the name its SKILL.md gives, when that isn't Name
	Called string `json:"called,omitempty"`
	// Note is the user's note on it (Skill.Note)
	Note string `json:"note,omitempty"`
	// Router is Skill.Router: direct, kept out of the skill router
	Router string `json:"router,omitempty"`
	// From is the repository the skill was traced to on the computer that
	// made the bundle (Skill.From, skill_from.go), when it isn't a source
	// the skill carries itself: the lock, a checkout, CC Switch's record or
	// an install-again there. What traced it is that computer's own files,
	// so without this the other computer groups the skill under "this
	// computer". Bundles from before this have none.
	From string `json:"from,omitempty"`
	// Fetch is a skill carried as its source (skill_carry.go): the other
	// computer fetches it from there, at the version Hash names (Commit
	// too, for a git repository's), and Files are only what fit, standing
	// in until then. A magpie from before this leaves it out and writes
	// the files, as it did.
	Fetch  bool   `json:"fetch,omitempty"`
	Hash   string `json:"hash,omitempty"`
	Commit string `json:"commit,omitempty"`
}

CarriedSkill is a skill with its folder's files.

type ClaudePlugins

type ClaudePlugins struct {
	// Marketplaces are by name, each as extraKnownMarketplaces holds one:
	// {"source": {…}} and its autoUpdate when set.
	Marketplaces map[string]json.RawMessage `json:"marketplaces,omitempty"`
	// Enabled are the plugins turned on for the user, as plugin@marketplace.
	Enabled []string `json:"enabled,omitempty"`
}

Claude Code's own plugins, the ones installed in Claude Code through its /plugin marketplaces (AXmake110 on X), go with the library: the marketplaces it knows and the plugins turned on for the user, so a computer that syncs ends up with the same plugins. They are not the library's plugin bundles (plugin.go), which magpie keeps and gives to every agent itself.

Claude Code keeps them in its folder (claudeDir, CLAUDE_CONFIG_DIR too):

plugins/known_marketplaces.json  {name: {source: {source: "github", repo}, installLocation, lastUpdated}}
plugins/installed_plugins.json   {version: 2, plugins: {"p@m": [{scope, installPath, version, …}]}}
settings.json                    enabledPlugins: {"p@m": true}, extraKnownMarketplaces: {name: {source}}

What is carried is each marketplace's source and the user's enabled plugin ids. installLocation, installPath and the downloaded code in plugins/marketplaces and plugins/cache are this computer's, and Claude Code fetches them again from the sources. On the other computer they are written where Claude Code reads a declared setup from: settings.json's extraKnownMarketplaces and enabledPlugins. At its next interactive start Claude Code clones the marketplaces and installs the plugins into its own files (tried with Claude Code 2.1.319 in a sandbox CLAUDE_CONFIG_DIR: commit-commands@claude-code-plugins installed from those two settings alone; `claude -p` does not install them).

Only adding: a marketplace or plugin the other computer has under that name, enabled or turned off there, stays as it is there, and a plugin removed on one computer is not removed on the others.

type Command

type Command struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Prompt      string   `json:"prompt"`
	Agents      []string `json:"agents"`
	// Taken are, by agent, the agent's own files it was imported from
	// (command_import.go): this computer's, never carried or shown
	Taken map[string]*TakenFile `json:"taken,omitempty"`
}

Command is a slash command the agents ticked for it are given.

type CommandAgentView

type CommandAgentView struct {
	ID string `json:"id"`
	// Dir is where its commands are; No is why magpie can't give it any
	Dir string `json:"dir,omitempty"`
	No  string `json:"no,omitempty"`
	WSL bool   `json:"wsl,omitempty"`
	// Args: it takes $1, $2…; one without takes only $ARGUMENTS
	Args bool `json:"args,omitempty"`
}

CommandAgentView is an agent the Slash commands tab lists.

type CommandCandidate

type CommandCandidate struct {
	// Path is its first file's, which names it to the import
	Path        string `json:"path"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Prompt      string `json:"prompt"`
	// Agents are those it was found in, each with its file
	Agents []string          `json:"agents"`
	Files  map[string]string `json:"files"`
	// State is, against the library: "" a new one, "same" the library
	// has it saying the same (the import gives it to these agents too),
	// "taken" the library has another command by the name (not pickable)
	State string `json:"state,omitempty"`
	// Clash: another one found by this name says something else
	Clash bool `json:"clash,omitempty"`
	// contains filtered or unexported fields
}

CommandCandidate is one command found, in one agent or several.

type CommandProbe

type CommandProbe struct {
	Candidates []CommandCandidate `json:"candidates"`
	// Left are the files that can't be a command of the library's, with why
	Left []SubagentLeft `json:"left,omitempty"`
}

CommandProbe is the slash commands found in the agents.

func ProbeCommands

func ProbeCommands() (*CommandProbe, error)

ProbeCommands is the slash commands the agents here have of their own; nothing is written.

type CommandView

type CommandView struct {
	*Command
	// Files are, for each agent it was written to, the file
	Files map[string]string `json:"files,omitempty"`
	// Problems are the agents it couldn't be given to, and why
	Problems map[string]string `json:"problems,omitempty"`
}

CommandView is a library slash command, and where each agent has it.

type CommandsImported

type CommandsImported struct {
	Added []string `json:"added,omitempty"`
	// Joined are the library's own commands the agents were added to
	Joined []string `json:"joined,omitempty"`
}

CommandsImported is what an import did, by name.

type Custom added in v0.1.800

type Custom struct {
	Name      string   `json:"name"`
	Transport string   `json:"transport"`
	URL       string   `json:"url,omitempty"`
	Command   string   `json:"command,omitempty"`
	Args      []string `json:"args,omitempty"`
}

Custom is a server to add by hand at an address nothing the market lists is at: a remote one at an endpoint, or one named for its repository whose command is filled in.

func CustomAt added in v0.1.800

func CustomAt(q string, found []MarketServer) *Custom

CustomAt is the server to add by hand for a search, when it's an address and none of what was found is at it.

type EditedError added in v0.1.1151

type EditedError struct{ Name, From string }

EditedError is an update refused because the skill was changed here since it was fetched from GitHub, or From, the git repository it came from.

func (*EditedError) Error added in v0.1.1151

func (e *EditedError) Error() string

type EnvAgentView

type EnvAgentView struct {
	ID   string `json:"id"`
	File string `json:"file,omitempty"`
	No   string `json:"no,omitempty"`
	WSL  bool   `json:"wsl,omitempty"`
}

EnvAgentView is an agent the Variables tab lists: File is where its variables are, No why magpie can't give it any.

type EnvEntry

type EnvEntry struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

EnvEntry is a variable magpie wrote into an agent, with its value.

type EnvVar

type EnvVar struct {
	Name   string   `json:"name"`
	Value  string   `json:"value"`
	Agents []string `json:"agents"`
}

EnvVar is a variable the agents ticked for it are given.

type EnvView

type EnvView struct {
	*EnvVar
	Problems map[string]string `json:"problems,omitempty"`
}

EnvView is a library variable, and why an agent couldn't be given it.

type Found

type Found struct {
	Server *Server  `json:"server"`
	Others []string `json:"others,omitempty"`
	Icon   string   `json:"icon,omitempty"`
	// Own: the agent's app puts it there itself, each time it starts
	// (Codex's node_repl and cua_repl): it isn't one to bring in, and
	// taking it out doesn't last.
	Own bool `json:"own,omitempty"`
}

Found is a server an agent has that the library doesn't: the agents that have it as it is, and those that have another by that name.

type FoundSkill

type FoundSkill struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Agents      []string `json:"agents"`           // the agents that have this very folder
	Others      []string `json:"others,omitempty"` // agents with another by that name
	// Copies are the agents with another folder by that name holding the
	// very same files (CC Switch copies a skill into each agent): brought
	// in, they get the library's in its place
	Copies []string `json:"copies,omitempty"`
	Link   string   `json:"link,omitempty"` // where it really is, when it's a link
	// Manual: its SKILL.md sets disable-model-invocation (meta.Manual)
	Manual bool `json:"manual,omitempty"`
	// Shared is its entry in the user-wide ~/.agents/skills, when it is
	// there; the agents that have it are those whose entry is a link (or a
	// junction) to the very same folder
	Shared string `json:"shared,omitempty"`
	// Library is its folder in the library's own skills folder, put there
	// by hand (or left by a library.json that lost it): brought in, it is
	// listed where it is (#595)
	Library string `json:"library,omitempty"`
	// contains filtered or unexported fields
}

FoundSkill is a skill an agent has that the library doesn't.

type GoneError added in v0.1.1326

type GoneError struct {
	Name   string
	Source string // the repository
}

GoneError is a skill its source was read without: it was removed there.

func (*GoneError) Error added in v0.1.1326

func (e *GoneError) Error() string

type HomeEntry

type HomeEntry struct {
	Agent string `json:"agent"`
	Path  string `json:"path"`
	Link  string `json:"link,omitempty"` // a link, and what it pointed at
	Copy  bool   `json:"copy,omitempty"` // a copy of the very same files
}

HomeEntry is one agent's entry for a skill before it was brought in.

type Hook added in v0.1.1214

type Hook struct {
	Name   string `json:"name"`
	Bundle string `json:"bundle,omitempty"` // the plugin it came with (plugin.go)
	// Description says what the hook is for, in any language (#2011):
	// the name is letters, digits, - and _, which says little to someone
	// who reads Chinese. Only the library keeps it; no agent is given it.
	Description string `json:"description,omitempty"`
	// Event is a portable event (HookEvents), or an agent's own,
	// "<agent>:<Event>" as that agent names it
	Event string `json:"event"`
	// Matcher narrows a tool event to some tools: for a portable event
	// "shell" or "edit" (each agent's own tool names for them), for an
	// agent's own event the agent's own matcher; "" is every tool. A
	// session-start hook is narrowed to the starts it runs at instead
	// (#5604): one or more of HookStarts joined by "|", "compact"
	Matcher string   `json:"matcher,omitempty"`
	Command string   `json:"command"`
	Timeout int      `json:"timeout,omitempty"` // seconds; 0 is the agent's own
	Agents  []string `json:"agents"`
}

Hook is a command the agents ticked for it run at Event.

type HookAgentView added in v0.1.1214

type HookAgentView struct {
	ID string `json:"id"`
	// File is where its hooks are; No is why magpie can't give it any
	File string `json:"file,omitempty"`
	No   string `json:"no,omitempty"`
	// WSL: No is that it runs in WSL, which magpie gives no hooks yet
	WSL bool `json:"wsl,omitempty"`
	// Off: it has every hook turned off in its settings
	Off bool `json:"off,omitempty"`
	// Events are its own events, for a hook of its alone
	Events []string `json:"events,omitempty"`
	// Starts are the session-start matchers it can be given (#5604);
	// StartSources the starts it has, to say why it can't be given another
	Starts       []string `json:"starts,omitempty"`
	StartSources []string `json:"startSources,omitempty"`
}

HookAgentView is an agent the Hooks tab lists.

type HookEntry added in v0.1.1214

type HookEntry struct {
	Name  string          `json:"name"`
	Event string          `json:"event"`
	Entry json.RawMessage `json:"entry"`
}

HookEntry is one entry magpie wrote into an agent's hooks: the hook it is of, the agent's event it is under, and the entry exactly as written.

type HookView added in v0.1.1214

type HookView struct {
	*Hook
	// Native is what each agent it can go to calls its event
	Native map[string]string `json:"native,omitempty"`
	// Problems are the agents it couldn't be given to, and why
	Problems map[string]string `json:"problems,omitempty"`
}

HookView is a library hook, and what each agent makes of it.

type Input

type Input struct {
	Key         string `json:"key"`
	Where       string `json:"where"` // env, header or arg
	Label       string `json:"label"`
	Description string `json:"description,omitempty"`
	Placeholder string `json:"placeholder,omitempty"`
	Secret      bool   `json:"secret,omitempty"`
	Required    bool   `json:"required,omitempty"`
	// contains filtered or unexported fields
}

Input is something a server needs from the user before it can start: a key in its environment, a header it sends, or an argument.

type InstrFile

type InstrFile struct {
	Path string `json:"path"`
	Hash string `json:"hash"`
	Made bool   `json:"made,omitempty"`
}

InstrFile is a project file magpie wrote the project's instructions into: the hash of the part as written, and whether magpie made the file.

type InstrSet added in v0.1.181

type InstrSet struct {
	ID   string `json:"id"`
	Name string `json:"name"` // "" for the first, which the page calls Default
	// File is a file of the user's own the set's text is kept in instead,
	// read each time and written when the set is saved: one shared file
	// such as ~/.agents/AGENTS.md, kept by hand or by another tool.
	File string `json:"file,omitempty"`
}

InstrSet is one set of shared instructions: its text is in its own file.

type Instructions

type Instructions struct {
	Agents []string `json:"agents"` // the agents the shared text is written to
	// Sets are the named texts to pick the shared one from; with none kept
	// there is the one magpie always had, "default"
	Sets   []InstrSet `json:"sets,omitempty"`
	Active string     `json:"active,omitempty"` // the set agents get; "" is "default"
	// NoMemory leaves memory's digest (memory.Digest) out of what the
	// agents are written; by default it follows the shared text
	NoMemory bool `json:"noMemory,omitempty"`
}

Instructions are one shared text, and for each agent whether it gets it and what it gets besides (kept in files beside library.json). The shared text is one of several sets kept to switch between (#106), the one on.

type InstructionsChange

type InstructionsChange struct {
	Shared *string            `json:"shared,omitempty"`
	Agents []string           `json:"agents,omitempty"`
	Extra  map[string]*string `json:"extra,omitempty"`
	// Rewrite writes magpie's part again into these agents' files, over
	// edits made there.
	Rewrite []string `json:"rewrite,omitempty"`
	// The sets: texts by set, a set to switch the agents to, one to add
	// (id and name), one to rename and one to remove. Shared is the text
	// of the set on, as it is after Activate.
	Texts    map[string]*string `json:"texts,omitempty"`
	Activate string             `json:"activate,omitempty"`
	Create   *InstrSet          `json:"create,omitempty"`
	Rename   *InstrSet          `json:"rename,omitempty"`
	Remove   string             `json:"remove,omitempty"`
}

InstructionsChange is what the page saves: the shared text, which agents get it, and what each gets besides. A nil field is left as it is.

type InstructionsView

type InstructionsView struct {
	Shared string              `json:"shared"` // the set on's text
	Sets   []SetView           `json:"sets"`
	Agents []AgentInstructions `json:"agents"`
}

InstructionsView is the Instructions page.

func ReadInstructions

func ReadInstructions() (*InstructionsView, error)

ReadInstructions is the shared text and each agent's file.

type LeftOut added in v0.1.1231

type LeftOut struct {
	Path string `json:"path"`
	Size int64  `json:"size"`
}

LeftOut is a skill of a repository too big to install on its own (fetchSkillFiles): where it is, and what its files come to.

type Library

type Library struct {
	Instructions Instructions `json:"instructions"`
	MCP          []*Server    `json:"mcp"`
	Skills       []*Skill     `json:"skills"`
	// Projects are folders whose agents get some of the skills there
	Projects []*Project `json:"projects,omitempty"`
	// Hooks are commands the agents ticked for each run at a point of
	// their turn (hooks.go, #1790)
	Hooks []*Hook `json:"hooks,omitempty"`
	// Env are the environment variables the agents ticked for each are
	// given in their own settings (env.go)
	Env []*EnvVar `json:"env,omitempty"`
	// Subagents are agents of their own the agents ticked for each can
	// hand a task to (subagents.go, #2283)
	Subagents []*Subagent `json:"subagents,omitempty"`
	// Commands are slash commands the agents ticked for each are given
	// (commands.go)
	Commands []*Command `json:"commands,omitempty"`
	// Plugins are the Claude Code plugins kept as one item each: its
	// skills, servers, hooks and subagents are the items above marked
	// with its name (plugin.go)
	Plugins []*Plugin `json:"plugins,omitempty"`
	// Applied is what magpie wrote into each agent, so that what it takes
	// away is only ever its own.
	Applied map[string]*Applied `json:"applied,omitempty"`
	// Away are other computers' servers by the name of one kept to this
	// computer here (Server.Local), as a sync last brought them: never
	// given to an agent here, and carried on as they came, so a sync from
	// here takes them from nobody (carry.go)
	Away []*Server `json:"away,omitempty"`
	// Icons are the icons of the servers added from the market, by what
	// each runs, for the page to show them by
	Icons map[string]string `json:"icons,omitempty"`
	// SkillGroups are the groups the user made of some skills on the
	// page, each shown as a group of its own (#791)
	SkillGroups []*SkillGroup `json:"skillGroups,omitempty"`
	// CopySkills gives the agents copies of their skills rather than links
	// to the library's, and SkillHow is an agent's own way over it, link or
	// copy (#896, skill_how.go)
	CopySkills bool              `json:"copySkills,omitempty"`
	SkillHow   map[string]string `json:"skillHow,omitempty"`
	// SharedSkills puts every skill on here in ~/.agents/skills too, as
	// magpie's link to the library's folder, for every agent and tool
	// that reads it (usrname1833, skills_shared.go). This computer's
	// own: Collect doesn't carry it
	SharedSkills bool `json:"sharedSkills,omitempty"`
	// AutoUpdateSkills fetches again by itself each skill its GitHub or
	// git repository has changed (0xYaCo on X, skill_autoupdate.go). This
	// computer's own: Collect doesn't carry it
	AutoUpdateSkills bool `json:"autoUpdateSkills,omitempty"`
	// MCPHub gives each agent that can reach it magpie's one MCP server,
	// which hands each call on to the library's servers ticked for it, in
	// place of their own entries (#2679, mcp_hub.go)
	MCPHub bool `json:"mcpHub,omitempty"`
	// SkillRouter gives each agent that can take it magpie's one skill,
	// magpie-skills, listing the library's skills ticked for it, in place
	// of a link of each (skill_router.go). This computer's own: Collect
	// doesn't carry it
	SkillRouter bool `json:"skillRouter,omitempty"`
	// PluginsOffered are the plugins (plugin.Name) given a server of their
	// tools, for one the user removed not to come back (plugin_tools.go)
	PluginsOffered []string `json:"pluginsOffered,omitempty"`
	// BridgesOffered are the Remote magpies (provider ids) whose MCP
	// router was given a server, for one the user removed not to come
	// back (bridge_mcp.go)
	BridgesOffered []string `json:"bridgesOffered,omitempty"`
	// BridgesOn are the Remote magpies (provider ids) the user asked to
	// give their router a server, in the editor's switch (bridge_mcp.go)
	BridgesOn []string `json:"bridgesOn,omitempty"`
	// BorrowOn are the Remote magpies (provider ids) whose Library's
	// skills and prompts this computer uses, and Borrowed what it took
	// from each (borrow.go). This computer's own: Collect doesn't carry
	// either.
	BorrowOn []string             `json:"borrowOn,omitempty"`
	Borrowed map[string]*Borrowed `json:"borrowed,omitempty"`
	// SeenSkills are, by repository and ref ("owner/repo@ref", or a git
	// address and ref), or by a folder the user added ("folder:<path>"),
	// the folders of skills there the page has offered: picked or not at
	// install, or set aside after a check. A check offers only the others
	// as new (skillnew.go).
	SeenSkills map[string][]string `json:"seenSkills,omitempty"`
	// contains filtered or unexported fields
}

Library is library.json: what magpie keeps, and which agents get it.

type Limited added in v0.1.662

type Limited struct {
	Until string `json:"until,omitempty"`
	Token bool   `json:"token,omitempty"`
}

Limited is GitHub's rate limit used up: until when (RFC 3339, "" when GitHub didn't say), and whether the requests carried a GitHub token.

type MarketServer

type MarketServer struct {
	ID          string `json:"id"`
	Name        string `json:"name"` // what the library calls it
	Title       string `json:"title"`
	Description string `json:"description"`
	Publisher   string `json:"publisher,omitempty"`
	Icon        string `json:"icon,omitempty"`
	Homepage    string `json:"homepage,omitempty"`
	Transport   string `json:"transport"`
	// Runs is what starts a local one: npx, uvx or docker
	Runs string `json:"runs,omitempty"`
	// SignIn is a remote one that has the agent sign in, in the browser,
	// the first time it's used
	SignIn   bool `json:"signIn,omitempty"`
	Featured bool `json:"featured,omitempty"`
	// OptIn is one no agent is given unless it is picked for it
	OptIn bool `json:"optIn,omitempty"`
	// Unready is why one of magpie's own can't answer yet (nothing it
	// needs is set up, or Settings turned it off), from the GUI, which
	// knows: its tools still answer, with the same words
	Unready string  `json:"unready,omitempty"`
	Inputs  []Input `json:"inputs"`
	// Have is the library's server that is this one
	Have string `json:"have,omitempty"`
	// Match is one found at the address searched for: its repository, page,
	// endpoint or package is it
	Match bool `json:"match,omitempty"`
	// contains filtered or unexported fields
}

MarketServer is a server the market offers.

func MarketServers

func MarketServers(q string) ([]MarketServer, error)

MarketServers is what the market shows for a search: the featured servers that match it, then the registry's, then the popular ones that do; with no search, the featured and every popular one. A search that is an address — a repository, a page, an endpoint, a package — finds the ones at it.

type MarketSkill

type MarketSkill struct {
	ID       string `json:"id"`     // owner/repo/skill
	Source   string `json:"source"` // owner/repo
	SkillID  string `json:"skillId"`
	Name     string `json:"name"`
	Installs int    `json:"installs"`
	Official bool   `json:"official,omitempty"`
	// Featured is magpie's own, not one skills.sh lists
	Featured bool   `json:"featured,omitempty"`
	Icon     string `json:"icon"`
	// Description is known once it has been fetched
	Description string `json:"description,omitempty"`
	Have        string `json:"have,omitempty"`
}

MarketSkill is a skill the market offers, from a GitHub repository.

func MarketSkills

func MarketSkills(q string) ([]MarketSkill, error)

MarketSkills is what the market shows for a search: magpie's own skills that match it, the most installed skills that do, then what skills.sh finds for it.

type NewSkill added in v0.1.1091

type NewSkill struct {
	// ID is the skill's folder (on GitHub, in the git repository, or on
	// this machine), what the page adds it from and sets it aside by
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	// Kind is where it is: github, git or folder
	Kind string `json:"kind"`
	// Repo is the repository (owner/repo, or the address git fetches),
	// or the folder the user added
	Repo string `json:"repo"`
	Ref  string `json:"ref,omitempty"`
	Path string `json:"path"`
	// From is the repository's folder the check found it in, what Add
	// installs it from
	From string `json:"from"`
	// Agents are those that have the repository's other skills: the ones
	// an Add gives it to
	Agents []string `json:"agents"`
}

NewSkill is a skill a check for updates found where the library has skills from, beside them, that the library doesn't have and that the page hasn't offered before: one a GitHub or git repository, or a folder on this machine, added since its skills were installed (refeccd on Discord). The page offers to add it, or to set it aside.

type OAuthApp added in v0.1.1217

type OAuthApp struct {
	ClientID     string `json:"clientId"`
	ClientSecret string `json:"clientSecret,omitempty"`
	// CallbackPort is the port of the callback URL the app was made with;
	// 0 for one made with http://localhost/callback, which takes any
	CallbackPort int `json:"callbackPort,omitempty"`
}

OAuthApp is an OAuth app made with a server's vendor, by the names Claude Code gives one (--client-id, --client-secret, --callback-port; "oauth": {"clientId", "callbackPort"}).

type PiCopied added in v0.1.3375

type PiCopied struct {
	*PiExtensions
	// Install: the copied extension has dependencies of its own, which
	// `npm install` in its folder on the other side fetches
	Install string `json:"install,omitempty"`
}

PiCopied is what a copy did, for the page to say.

func CopyPi added in v0.1.3375

func CopyPi(from, to, ext, pkg string) (*PiCopied, error)

CopyPi gives one of a Pi's extensions or packages to another Pi. A package is its settings.json entry, written into the other's packages; Pi there installs it when it next starts. An extension is its file or folder, copied into the other's extensions folder, without its node_modules (built for the machine it was on).

type PiExt added in v0.1.3375

type PiExt struct {
	// ID names it in a request: "extensions/<name>" for one in the
	// extensions folder, the settings.json entry for one listed there
	ID   string `json:"id"`
	Name string `json:"name"`
	// Path is where it is, as the Pi's machine names it
	Path string `json:"path"`
	On   bool   `json:"on"`
	// Listed: settings.json names it, rather than the folder holding it
	Listed bool `json:"listed,omitempty"`
	// Folder: a folder, not one file
	Folder bool `json:"folder,omitempty"`
	// contains filtered or unexported fields
}

PiExt is one extension of a Pi's own: in its extensions folder, or listed by path in its settings.json.

type PiExtensions added in v0.1.3375

type PiExtensions struct {
	Pis []PiHere `json:"pis"`
}

PiExtensions is every Pi here, with its extensions and packages.

func ReadPiExtensions added in v0.1.3375

func ReadPiExtensions() *PiExtensions

ReadPiExtensions lists every Pi here, with its extensions and packages.

func SetPiExtension added in v0.1.3375

func SetPiExtension(pi, id string, on bool) (*PiExtensions, error)

SetPiExtension switches one of a Pi's own extensions on or off, as `pi config` does: "-<path>" in settings.json's extensions takes it out, and on takes that out again, adding "+<path>" only when a "!" pattern there would still leave it out.

func SetPiPackage added in v0.1.3375

func SetPiPackage(pi, source string, on bool) (*PiExtensions, error)

SetPiPackage switches a whole package on or off: off is its entry with every filter empty, so Pi keeps it installed and loads none of it; on is its source alone again. One whose entry has other filters is changed in `pi config`, which can pick them one by one.

type PiHere added in v0.1.3375

type PiHere struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Icon string `json:"icon"`
	WSL  string `json:"wsl,omitempty"`
	// Asleep: its distro isn't running, and nothing in it is read, as that
	// would start it (#3896)
	Asleep bool `json:"asleep,omitempty"`
	// Dir is its agent folder, as magpie opens it
	Dir string `json:"dir,omitempty"`
	// Err says why its settings.json can't be read: nothing is listed,
	// and nothing is written to it, rather than taking it for empty
	Err        string      `json:"err,omitempty"`
	Extensions []PiExt     `json:"extensions"`
	Packages   []PiPackage `json:"packages"`
}

PiHere is one Pi: this machine's, or one in a WSL distro.

type PiInstalled

type PiInstalled struct {
	*PiExtensions
	// Pending: only settings.json was changed; Pi installs the package
	// (or no longer loads it) when it next starts
	Pending bool `json:"pending,omitempty"`
}

PiInstalled is what an install or a removal did, for the page to say.

func InstallPiPackage

func InstallPiPackage(pi, source string) (*PiInstalled, error)

InstallPiPackage installs an npm package from the market into a Pi.

func RemovePiPackage

func RemovePiPackage(pi, source string) (*PiInstalled, error)

RemovePiPackage takes a package out of a Pi, as `pi remove` does.

type PiMarketPackage

type PiMarketPackage struct {
	// Source is what Pi installs it by: npm:<name>
	Source      string `json:"source"`
	Name        string `json:"name"`
	Version     string `json:"version,omitempty"`
	Description string `json:"description,omitempty"`
	Publisher   string `json:"publisher,omitempty"`
	// Downloads is npm's count for the last month
	Downloads int    `json:"downloads,omitempty"`
	Icon      string `json:"icon,omitempty"`
	NPM       string `json:"npm"`
	Repo      string `json:"repo,omitempty"`
	Homepage  string `json:"homepage,omitempty"`
	Updated   string `json:"updated,omitempty"`
}

PiMarketPackage is one package the market offers.

func MarketPiPackages

func MarketPiPackages(q string) ([]PiMarketPackage, error)

MarketPiPackages is what the market shows for a search: the popular packages that match it, then what npm finds for it.

type PiPackage added in v0.1.3375

type PiPackage struct {
	Source string `json:"source"`
	Name   string `json:"name"`
	// Kind is npm, git or local
	Kind string `json:"kind"`
	// Pin is the version or ref the source names, if any
	Pin string `json:"pin,omitempty"`
	On  bool   `json:"on"`
	// Filtered: the entry picks some of the package's resources (filters
	// of the user's, or `pi config`'s), which a switch here would lose;
	// it is changed in `pi config`
	Filtered bool `json:"filtered,omitempty"`
	// Installed: Pi has it on disk; one that isn't is installed when Pi
	// next starts
	Installed bool   `json:"installed"`
	Version   string `json:"version,omitempty"`
	// contains filtered or unexported fields
}

PiPackage is one entry of a Pi's settings.json "packages".

type Plugin

type Plugin struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Version     string `json:"version,omitempty"`
	// Source is what the user gave to install it (a folder, a repository,
	// a marketplace.json's folder), and Pick the plugin's name in it when
	// that is a marketplace: an update fetches it again from there
	Source string `json:"source,omitempty"`
	Pick   string `json:"pick,omitempty"`
	// Agents are the agents it is given to when it is on
	Agents []string `json:"agents"`
	// Off is set while it is turned off: none of its parts is given to any
	// agent, and Agents are kept for turning it on again
	Off bool `json:"off,omitempty"`
	// the items it made, by name
	Skills    []string `json:"skills,omitempty"`
	MCP       []string `json:"mcp,omitempty"`
	Hooks     []string `json:"hooks,omitempty"`
	Subagents []string `json:"subagents,omitempty"`
	// Left are the parts of the plugin magpie doesn't carry, and why
	Left []PluginLeft `json:"left,omitempty"`
	// Installed is when it was installed or last updated
	Installed string `json:"installed,omitempty"`
	// Pending is set while a plugin another computer has, by a source
	// this one fetches it from, hasn't been fetched here yet: it was
	// synced in and the fetch failed (plugin_carry.go). Update tries again
	Pending bool `json:"pending,omitempty"`
}

Plugin is a plugin the library keeps.

type PluginCandidate

type PluginCandidate struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Version     string `json:"version,omitempty"`
	Skills      int    `json:"skills"`
	MCP         int    `json:"mcp"`
	Hooks       int    `json:"hooks"`
	Subagents   int    `json:"subagents"`
	// Remote: it is fetched from another repository when installed, so
	// its parts aren't counted
	Remote bool `json:"remote,omitempty"`
	// Have: the library has it already
	Have bool         `json:"have,omitempty"`
	Left []PluginLeft `json:"left,omitempty"`
	// contains filtered or unexported fields
}

PluginCandidate is a plugin found at what the user gave.

type PluginLeft

type PluginLeft struct {
	What string `json:"what"`
	Why  string `json:"why"`
}

PluginLeft is a part of a plugin that wasn't carried.

type PluginProbe

type PluginProbe struct {
	Source      string            `json:"source"`
	Marketplace string            `json:"marketplace,omitempty"` // its name, when there are several
	Candidates  []PluginCandidate `json:"candidates"`
	// contains filtered or unexported fields
}

PluginProbe is what was found at an address.

func ProbePlugins

func ProbePlugins(input string) (*PluginProbe, error)

ProbePlugins looks for plugins at what the user typed: a plugin's folder, a marketplace's (its .claude-plugin/marketplace.json), or a repository with either.

type PluginServer added in v0.1.3245

type PluginServer struct {
	Name   string `json:"name"`
	Plugin string `json:"plugin"` // plugin.Name, which PluginServerOn takes
	// On is the Library's switch for it (!Hidden), so the Plugins page's
	// Give to agents and Hide from agents say what the Library's row does:
	// on with no agent ticked, an app at the MCP router's address has it
	On bool `json:"on"`
}

PluginServer is the server of a plugin's tools, as the plugin's row on the Plugins page shows it.

type PluginView

type PluginView struct {
	*Plugin
	// Missing are parts the user took out one by one since
	Missing []string `json:"missing,omitempty"`
	Dir     string   `json:"dir"`
}

PluginView is a plugin as the page shows it.

type Probe

type Probe struct {
	Source     string      `json:"source"`
	Kind       string      `json:"kind"`
	Candidates []Candidate `json:"candidates"`
	// Left is the skills there too big to install on their own, left out
	// of the candidates (#2062)
	Left []LeftOut `json:"left,omitempty"`
	// contains filtered or unexported fields
}

Probe is what was found at a source.

func ProbeSkills

func ProbeSkills(input string) (*Probe, error)

ProbeSkills looks for skills at what the user typed: a GitHub repository (or a folder in one), any other git repository (GitLab, one on a company's own server; fetched with the user's git), a folder on this machine, or a skills CLI command for one of them.

type Problem

type Problem struct {
	Agent string `json:"agent"`
	What  string `json:"what"` // instructions, mcp:<name>, skill:<name>
	Error string `json:"error"`
	// Own is a skill the agent has a folder of its own for, not the
	// library's: the page offers to use the library's or keep the agent's
	Own bool `json:"own,omitempty"`
}

Problem is one thing that couldn't be given to an agent.

func Unsettled

func Unsettled(probs []Problem) []Problem

Unsettled is the problems a sync's Put said that still hold: a skill's while it is still to be fetched (Pending) or changed here, and none else (a plugin's is said on its row). A library that can't be read keeps them all.

type Project added in v0.1.243

type Project struct {
	Dir string `json:"dir"`
	// Copy puts copies of the skills there, not links to the library's
	// (for Windows, or a folder synced or shared where a link won't do);
	// a copy is made again when the library's skill changes
	Copy bool `json:"copy,omitempty"`
	// Skills are the library's skills the project has, and for which agents
	Skills map[string][]string `json:"skills,omitempty"`
	// Placed are the entries magpie put in the folder (.claude/skills/pdf),
	// the only ones it ever takes away
	Placed []string `json:"placed,omitempty"`
	// Made are the folders magpie made to place them in, taken away again
	// once they're empty; Gitignore is whether it made the .gitignore
	Made      []string `json:"made,omitempty"`
	Gitignore bool     `json:"gitignore,omitempty"`
	// Servers are the library's MCP servers the project has, and for which
	// agents (project_mcp.go)
	Servers map[string][]string `json:"servers,omitempty"`
	// Wrote are, by the project's file (.mcp.json), the servers magpie
	// wrote in it, the only entries it ever takes out
	Wrote map[string][]string `json:"wrote,omitempty"`
	// Startup are, by the project's file, the startup timeout magpie
	// wrote in each server's entry there (Codex's startup_timeout_sec):
	// one other than this is the user's
	Startup map[string]map[string]float64 `json:"startup,omitempty"`
	// MadeFiles are the files magpie made to write servers in, listed in
	// the .gitignore and taken away again once nothing's left in them
	MadeFiles []string `json:"madeFiles,omitempty"`
	// ServersOff and SkillsOff are global servers and skills (given to
	// the agents themselves) the project turns off, and for which agents
	// (project_scope.go)
	ServersOff map[string][]string `json:"serversOff,omitempty"`
	SkillsOff  map[string][]string `json:"skillsOff,omitempty"`
	// Claude is what magpie wrote in Claude Code's own record of the
	// project (~/.claude.json): the router's entry, servers turned off
	Claude *claudeLocal `json:"claude,omitempty"`
	// CodexOff are the servers magpie turned off in the project's
	// .codex/config.toml, Overrides the skills it turned off in
	// .claude/settings.local.json
	CodexOff  []string `json:"codexOff,omitempty"`
	Overrides []string `json:"overrides,omitempty"`
	// Trees are the project's folder in each other worktree of its git
	// repository, given the project's set, with what magpie put in each
	Trees []*Project `json:"trees,omitempty"`
	// Subagents are the library's subagents the project has, and for which
	// agents; AgentFiles the files magpie wrote for them, by their hash
	// (project_subagents.go)
	Subagents  map[string][]string `json:"subagents,omitempty"`
	AgentFiles []SubagentFile      `json:"agentFiles,omitempty"`
	// Instr is the project's own instructions, InstrAgents the agents
	// whose project file they're written into, InstrFiles the files
	// magpie wrote them in (project_instructions.go)
	Instr       string      `json:"instr,omitempty"`
	InstrAgents []string    `json:"instrAgents,omitempty"`
	InstrFiles  []InstrFile `json:"instrFiles,omitempty"`
}

Project is a folder of the user's whose agents get some of the library's skills there, as the project's own: each is placed in the folder the agent reads a project's skills from, and kept out of git.

type ProjectInstr

type ProjectInstr struct {
	Text   *string
	Agents *[]string
}

ProjectInstr is a change to a project's instructions: its text, the agents it is written for, or both; nil leaves that as it is.

type ProjectView added in v0.1.243

type ProjectView struct {
	Dir     string              `json:"dir"`
	Name    string              `json:"name"`
	Copy    bool                `json:"copy"`
	Skills  map[string][]string `json:"skills"`
	Placed  []string            `json:"placed"`
	Servers map[string][]string `json:"servers"`
	// Wrote are, by the project's file, the servers magpie wrote there
	Wrote map[string][]string `json:"wrote"`
	// ServersOff and SkillsOff are the Library's servers and skills
	// turned off in this project, each for the agents named
	ServersOff map[string][]string `json:"serversOff"`
	SkillsOff  map[string][]string `json:"skillsOff"`
	// Trees are the project's folder in the repository's other git
	// worktrees, which follow it
	Trees []string `json:"trees,omitempty"`
	// Subagents are the library's subagents the project has, for the
	// agents named
	Subagents map[string][]string `json:"subagents"`
	// AgentFiles are the project's files magpie wrote for them
	AgentFiles []string `json:"agentFiles"`
	// Instr is the project's own instructions, InstrAgents the agents
	// they're for, InstrFiles the project's files magpie wrote them in
	Instr       string   `json:"instr"`
	InstrAgents []string `json:"instrAgents"`
	InstrFiles  []string `json:"instrFiles"`
	Missing     bool     `json:"missing,omitempty"` // the folder is gone
	// Problems are, by skill ("" for the project's own), what couldn't be done
	Problems map[string]string `json:"problems,omitempty"`
}

ProjectView is a project as the page shows it.

type RTKAgent added in v0.1.124

type RTKAgent struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Icon string `json:"icon"`
	On   bool   `json:"on"`
	// Blocked says why rtk can't be switched on for it here (OpenCode 2);
	// one that has it can still be switched off
	Blocked string `json:"blocked,omitempty"`
	// NoHook: rtk has no hook for it at all (rtkNoHook), and Blocked says why
	NoHook bool `json:"noHook,omitempty"`
	// WSL is the distro an agent in WSL lives in: its hook runs the rtk
	// of that distro (RTKView.WSL), not this machine's
	WSL string `json:"wsl,omitempty"`
	// Asleep: its distro isn't running, so its files aren't read (that
	// would start it) and On isn't known
	Asleep bool `json:"asleep,omitempty"`
}

RTKAgent is one agent rtk can be given to, and whether it has it.

type RTKDay added in v0.1.328

type RTKDay struct {
	Date     string  `json:"date"` // 2006-01-02, local
	Commands int     `json:"commands"`
	Input    int64   `json:"input"`
	Saved    int64   `json:"saved"`
	Pct      float64 `json:"pct"`
}

RTKDay is what rtk saved on one day it ran commands.

type RTKDistro added in v0.1.2054

type RTKDistro struct {
	Name string `json:"name"`
	// Path is rtk's inside the distro, "" when it isn't installed there
	Path    string `json:"path,omitempty"`
	Version string `json:"version,omitempty"`
	// OffPath: found where its installer puts it, but not on the PATH of
	// the distro's shells, which its hooks run rtk by
	OffPath bool `json:"offPath,omitempty"`
	// Install is the command Install RTK runs in the distro
	Install string `json:"install,omitempty"`
	// Asleep: the distro isn't running, and isn't looked in
	Asleep bool `json:"asleep,omitempty"`
}

RTKDistro is the rtk of one WSL distro an agent listed lives in.

type RTKGain added in v0.1.124

type RTKGain struct {
	Commands int     `json:"commands"`
	Input    int64   `json:"input"`
	Saved    int64   `json:"saved"`
	Pct      float64 `json:"pct"`
}

RTKGain is what rtk says it saved, over every command it has recorded.

type RTKView added in v0.1.124

type RTKView struct {
	Path    string   `json:"path,omitempty"` // "" when rtk isn't installed
	Version string   `json:"version,omitempty"`
	Gain    *RTKGain `json:"gain,omitempty"`
	// GainErr is why what rtk saved isn't known: rtk gain failed or
	// printed nothing readable
	GainErr string `json:"gainErr,omitempty"`
	// CodexSandbox is the Windows sandbox Codex runs its commands in,
	// when it has rtk: what rtk saves there isn't counted in Gain
	CodexSandbox string `json:"codexSandbox,omitempty"`
	// Days are what it saved each day it ran commands, oldest first
	Days []RTKDay `json:"days,omitempty"`
	// Latest is rtk's latest release, "" when it isn't known (see
	// CheckLatest); Upgrade the command Upgrade RTK runs, "" when magpie
	// doesn't know how this rtk was installed
	Latest  string `json:"latest,omitempty"`
	Upgrade string `json:"upgrade,omitempty"`
	// NoUpgrade is why there is no Upgrade when magpie knows: "cargo", an
	// rtk cargo installed with no cargo to be found to upgrade it, which
	// the page says with Manual, the command to run in a terminal once
	// there is (新v学员: its Upgrade button only did nothing)
	NoUpgrade string `json:"noUpgrade,omitempty"`
	Manual    string `json:"manual,omitempty"`
	// Admin is the folder rtk is in when only an administrator can change
	// it (winget's for every user, under Program Files): Upgrade asks
	// Windows for one first
	Admin string `json:"admin,omitempty"`
	// Waiting is the package manager this rtk was installed with (winget,
	// Homebrew) when Latest is out but it has nothing newer than this rtk
	// yet, WaitingHas what it has: an upgrade through it would change
	// nothing, so the page offers none (#1025)
	Waiting    string `json:"waiting,omitempty"`
	WaitingHas string `json:"waitingHas,omitempty"`
	// Note is what an upgrade left to say: Homebrew's rtk behind rtk's
	// own release
	Note string `json:"note,omitempty"`
	// OffPath: rtk isn't on the PATH an agent started now gets, so its
	// hooks, which run rtk by name, do nothing (Pi's says "rtk binary not
	// found in PATH"). PathDir is where Put RTK on PATH makes it found — a
	// link to it made in that folder (PathLink), or (Windows) that folder,
	// rtk's own, added to the user's PATH; "" when magpie has nowhere
	PathDir  string     `json:"pathDir,omitempty"`
	PathLink bool       `json:"pathLink,omitempty"`
	OffPath  bool       `json:"offPath,omitempty"`
	Agents   []RTKAgent `json:"agents"`
	// WSL is the rtk of each WSL distro an agent listed lives in
	WSL []RTKDistro `json:"wsl,omitempty"`
	URL string      `json:"url"`
	// Install is the command Install RTK runs, shown before it is clicked
	Install string `json:"install,omitempty"`
	// Restart are the agents a change reached, to be restarted to see it
	Restart []string `json:"restart,omitempty"`
	Backup  string   `json:"backup,omitempty"`
}

RTKView is the RTK part of the Library page.

func InstallRTK added in v0.1.131

func InstallRTK() (*RTKView, error)

InstallRTK installs rtk, when the user asks for it.

func InstallRTKIn added in v0.1.2054

func InstallRTKIn(distro string) (*RTKView, error)

InstallRTKIn installs rtk in WSL distro with rtk's own Linux installer, run there, when the user asks for it. A distro that isn't running isn't started for it.

func PathRTK added in v0.1.681

func PathRTK() (*RTKView, error)

PathRTK puts the rtk magpie found on the PATH agents get, when the user asks for it (see rtkOnPath).

func ReadRTK added in v0.1.124

func ReadRTK() *RTKView

ReadRTK says whether rtk is installed, what it saved, and which agents have it.

func SetRTK added in v0.1.124

func SetRTK(id string, on bool) (*RTKView, error)

SetRTK gives rtk to an agent with rtk's own installer, or takes it away by taking out what that put in — which needs no rtk, so an agent left with the hook of an rtk since removed can be put right.

func UpgradeRTK added in v0.1.328

func UpgradeRTK() (*RTKView, error)

UpgradeRTK brings rtk up to its latest release the way it was installed.

func (*RTKView) CheckLatest added in v0.1.328

func (v *RTKView) CheckLatest()

CheckLatest fills in rtk's latest release (see RTKLatest), and, when it is newer than this rtk, what the package manager that installed it has — but only what that said before, and within its own age (Waiting): asking a package manager is slow (`winget show` refreshes its sources — seconds, on a slow or unreachable network far more), and a read that waits for it holds up the whole tab for a grey tag beside the version. CheckChannel asks in the background instead, and the next read draws with its answer.

type Result

type Result struct {
	Changed  []string  `json:"changed"`  // agents whose files were written
	Problems []Problem `json:"problems"` // what couldn't be written, and why
	Backup   string    `json:"backup,omitempty"`
	// Missing are the servers and skills (mcp:<name>, skill:<name>) a
	// profile named that the library no longer has
	Missing []string `json:"missing,omitempty"`
	// Updated and Unupdated are, for an update of every skill, the ones
	// fetched again and the ones that couldn't be (What is skill:<name>)
	Updated   []string  `json:"updated,omitempty"`
	Unupdated []Problem `json:"unupdated,omitempty"`
	// Current is, for an update of one skill, that skill when what was
	// fetched is the files it already had
	Current []string `json:"current,omitempty"`
	// Gone are, for an update of skills, the ones their sources no longer
	// have: removed there, not failed (skill_gone.go)
	Gone []string `json:"gone,omitempty"`
	// Unimported are, for skills brought in together, the ones that
	// couldn't be (What is skill:<name>)
	Unimported []Problem `json:"unimported,omitempty"`
	// Unremoved are, for skills or servers taken out together, the ones
	// that couldn't be (What is skill:<name> or mcp:<name>)
	Unremoved []Problem `json:"unremoved,omitempty"`
	// Unmoved are, for skills handed over from ~/.agents/skills, the ones
	// that couldn't be moved and stay where they were (What is skill:<name>)
	Unmoved []Problem `json:"unmoved,omitempty"`
	// Installed, Had and Skipped are, for skills installed together, the
	// ones added, the ones the library had already from the same source,
	// and the ones left out with why: another skill by that name, the
	// user's, is never written over (What is skill:<name>)
	Installed []string  `json:"installed,omitempty"`
	Had       []string  `json:"had,omitempty"`
	Skipped   []Problem `json:"skipped,omitempty"`
	// Linked are, for skills installed from GitHub, the ones the library
	// had from a folder by that name that now follow GitHub, with its
	// files (skill_link.go); LinkedKept those of them whose own files
	// weren't GitHub's, kept with the backups
	Linked     []string `json:"linked,omitempty"`
	LinkedKept []string `json:"linkedKept,omitempty"`
	// Subagents is, for subagents imported from a repository, what was
	// added, updated, had already, and left as changed here
	Subagents *SubagentsImported `json:"subagents,omitempty"`
	// Commands is, for slash commands imported from the agents, what was
	// added and the library's own given to more agents
	Commands *CommandsImported `json:"commands,omitempty"`
	// contains filtered or unexported fields
}

Result is what a change did to the agents.

func AddNewSkills added in v0.1.1091

func AddNewSkills(ids []string) (*Result, error)

AddNewSkills adds the new skills a check found, by their IDs, each to the agents that have its repository's other skills. The repository is fetched once for those of it.

func AddProject added in v0.1.243

func AddProject(dir string) (*Result, error)

AddProject adds a folder whose agents can be given library skills.

func AddServerAccount

func AddServerAccount(name, label string, headers map[string]string) (*Result, error)

AddServerAccount gives the server another account, a set of headers (a key as Authorization), and puts it in use.

func AutoUpdateTick

func AutoUpdateTick(now time.Time) (*Result, error)

AutoUpdateTick looks for changed skills and updates them, when the switch is on and no look was made for checkEvery. It returns what the update did, nil when nothing was due or nothing had changed.

func CommandAgentsSet

func CommandAgentsSet(name string, agents []string) (*Result, error)

CommandAgentsSet sets which agents get a slash command.

func CreateSkill

func CreateSkill(name, description string, agents []string) (*Result, error)

CreateSkill makes a skill of the user's own in the library's folder: a SKILL.md with a name and description in its front matter, listed with no source and given to the agents like any other. The name can't be one the library has, one an agent has of its own, or a folder in the way.

func EnvAgents

func EnvAgents(name string, agents []string) (*Result, error)

EnvAgents sets which agents get a variable.

func EveryServerAgents added in v0.1.611

func EveryServerAgents(agents []string, on bool) (*Result, error)

EveryServerAgents gives every server in the library to the agents named, or takes every one from them, in one write rather than one for each server (#475). An agent not named keeps what it has, as with a server's All chip; on gives an agent only the servers it can reach (no SSE for Codex, no remote one for Claude Desktop), as its chips can't be lit for the others.

func EverySkillAgents added in v0.1.596

func EverySkillAgents(agents []string, on bool) (*Result, error)

EverySkillAgents gives every skill in the library to the agents named, or takes every one from them, in one write rather than one for each skill (#443). An agent not named keeps what it has, as with a skill's All chip.

func GroupSkills added in v0.1.896

func GroupSkills(old, name string, names []string) (*Result, error)

GroupSkills puts the skills named into the group called name, made when there is none, and takes them out of any other: a skill is in one group at most. old, when given, is a group renamed to name, and its skills are then those named when any are. No names and no old is nothing; a rename to a group there is already is refused.

func HandBackSkill added in v0.1.2016

func HandBackSkill(name string) (*Result, error)

HandBackSkill puts a skill handed over (HandOverSkills) back into ~/.agents/skills: its folder moves there, and the library links to it, as it did before. Which agents it's ticked for stays as it is; those that read ~/.agents/skills have it again whatever is ticked.

func HandOverSkills added in v0.1.2016

func HandOverSkills(names []string) (*Result, error)

HandOverSkills gives skills kept in ~/.agents/skills to the library to manage (tnt1223 on Discord, "统一移入 magpie 的资源库文件夹,交给 magpie 管理"). Several agents read that folder themselves, so a skill there is on for each of them whatever the library ticks, and turning it off for one, or on this computer alone (OffHere), can't work. Handed over:

  • a folder kept in ~/.agents/skills moves into the library's own folder (renamed, or copied, checked the same and only then set aside with the backups), and its entry there is gone;
  • an entry there that only links to a folder elsewhere is taken away, and the library links to that folder past it;
  • the user's own links to it in the agents' folders, which would point at nothing, are taken away too.

Every agent that read it there, or through such a link, is ticked for it, so each goes on having it, now from the library, till it's unticked. A skill not in the library yet (found in ~/.agents/skills) is brought in first. One that can't be handed over stays as it was, in Unmoved, and the others are handed over all the same. It also turns off the setting that keeps every skill in ~/.agents/skills. HandBackSkill undoes it.

func HookAgents added in v0.1.1214

func HookAgents(name string, agents []string) (*Result, error)

HookAgents sets which agents get a hook.

func ImportCommands

func ImportCommands(paths []string) (*Result, error)

ImportCommands takes the commands found at those paths (each one's first file, as ProbeCommands lists it) into the library, for the agents they were found in.

func ImportInstructions

func ImportInstructions(id string) (*Result, error)

ImportInstructions moves the user's own instructions out of an agent's file into the library: they are added to the shared text, taken out of the file (which is kept aside first), and the agent gets the shared text from then on — so what it reads is what it read before.

func ImportServer

func ImportServer(name string) (*Result, error)

ImportServer takes a server the agents have into the library: the agents that have it as it is get the library's from then on, the same entry.

func ImportSkill

func ImportSkill(name string) (*Result, error)

ImportSkill takes a skill the agents have of their own into the library: a folder is moved in, a link to a folder elsewhere is linked to from the library, and the agents that had it get the library's from then on.

func ImportSkills added in v0.1.491

func ImportSkills(names []string) (*Result, error)

ImportSkills is ImportSkill for several skills at once, written to the agents once. One that can't be brought in is said in Unimported, and the others are brought in all the same.

func ImportSubagents

func ImportSubagents(input string, paths, agents []string) (*Result, error)

ImportSubagents adds the subagents at those paths of input (every one with none named) and gives the new ones to the agents; one the library has from there is updated, keeping its name and agents.

func InstallMarketSkill

func InstallMarketSkill(source, id string, agents []string) (*Result, error)

InstallMarketSkill adds a skill from the market, found in its repository, and gives it to the agents named — to every agent that can have skills when none are.

func InstallPlugins

func InstallPlugins(input string, names, agents []string) (*Result, error)

InstallPlugins installs the plugins named (all of them, of one plugin) from what the user gave, and gives them to the agents. One the library has is replaced by this one, keeping the agents it was given to and whether it is on.

func InstallServer

func InstallServer(id string, values map[string]string, agents []string) (*Result, error)

InstallServer adds a market server to the library, filled in with values (by input key), and gives it to the agents named — to every agent that can have it when none are.

func InstallSkills

func InstallSkills(input string, paths, agents []string) (*Result, error)

InstallSkills adds the skills at those paths of the source to the library and gives them to the agents named. One the library has already, or one whose name is taken, is left as it is and said in the result; the others are installed all the same.

func KeepAgentSkill added in v0.1.498

func KeepAgentSkill(name, agentID string) (*Result, error)

KeepAgentSkill settles it the other way: the agent keeps its own, and the library no longer gives it that skill (nor any agent that reads the very same folder).

func KeepAgentSkills added in v0.1.1224

func KeepAgentSkills(names []string, agentID string) (*Result, error)

KeepAgentSkills is KeepAgentSkill for several of one agent's skills at once (#1896).

func MemorySkill

func MemorySkill(id string) (*Result, string, error)

MemorySkill makes the procedure memory with id a skill of the library's own, as Memory's suggestion does once the agents search for it often: a SKILL.md holding its text (and why), named from its words, given to the agents ticked for instructions (the ones memory is published to), or to every agent with skills when none is. The memory is archived then, noted as that skill's (memory.MadeSkill). It answers with the skill's name.

func PluginAgents

func PluginAgents(name string, agents []string) (*Result, error)

PluginAgents sets which agents get a plugin's parts. Each part goes only to the agents that can take it.

func PluginOn

func PluginOn(name string, on bool) (*Result, error)

PluginOn turns a plugin on or off: off takes all its parts from every agent and keeps them in the library.

func PluginServerOn added in v0.1.3245

func PluginServerOn(pluginName string, on bool) (*Result, error)

PluginServerOn hides a plugin's tools from every agent, or shows them again (chengming0v0 on Discord: a plugin's tools no agent should see, the plugin kept for its providers). Hidden, no agent is given the server, nor an app at the MCP router's address, and the agents it had are kept (Paused); shown again, they get it back. With none kept (it was given to none when added, or taken from each agent in the Library), on gives it to the agents the MCP router's entry goes to, or with the router off or given to none, to every agent shown that can take it, as the row's All chip in the Library does.

func ProjectCopy added in v0.1.243

func ProjectCopy(dir string, copy bool) (*Result, error)

ProjectCopy sets whether a project gets copies of its skills rather than links; those there are made again the other way.

func ProjectInstructions

func ProjectInstructions(dir string, c ProjectInstr) (*Result, error)

ProjectInstructions sets a project's own instructions, and the agents whose project file they are written into; no agents, or no text, takes them out of the project's files.

func ProjectServer added in v0.1.629

func ProjectServer(dir, name string, agents []string) (*Result, error)

ProjectServer sets which agents get a library server in a project; none takes it out of the project.

func ProjectServerOff

func ProjectServerOff(dir, name string, agents []string) (*Result, error)

ProjectServerOff sets which agents have a global server turned off in a project; none gives it back to the project as the global set has it.

func ProjectSkill added in v0.1.243

func ProjectSkill(dir, name string, agents []string) (*Result, error)

ProjectSkill sets which agents get a library skill in a project; none takes it out of the project.

func ProjectSkills

func ProjectSkills(dir string, names, agents []string) (*Result, error)

ProjectSkills sets which agents get each of some library skills in a project, in one write: the skills a project's card picks from its menu (POM_JUMPING on X). The project's other skills stay as they are; none takes these out of it.

func ProjectSkillsOff

func ProjectSkillsOff(dir string, names, agents []string) (*Result, error)

ProjectSkillsOff sets which agents have each of some global skills turned off in a project; none gives them back.

func ProjectSubagents

func ProjectSubagents(dir string, names, agents []string) (*Result, error)

ProjectSubagents sets which agents get each of some library subagents in a project; none takes them out of it.

func PublishMemory

func PublishMemory(due bool) (*Result, error)

PublishMemory makes what memory holds now the digest the agents are given (memory.Publish) and, when it changed, writes the instructions into them again: a change the user made to memory. due publishes only when the last was a day ago (memory.PublishDue), for what agents saved meanwhile. nil, nil when nothing changed.

func Put added in v0.1.182

func Put(b *Bundle) (*Result, error)

Put makes the library what b says — its instructions, servers and skills in place of the ones here — and writes it into the agents, which keep whatever of theirs isn't magpie's. The skills are written aside first, and only once all of them are there does any go in; a skill replaced or taken out is kept with the backups, and so is an instructions file that changes. A skill that comes linked to a folder this computer has too is linked to it; else it comes as its files. A skill whose files are as they are here is left alone. The subagents replace the ones here too, unless b is from a magpie that didn't carry them.

func RemoveCommands

func RemoveCommands(names []string) (*Result, error)

RemoveCommands takes the slash commands named out of the library, and the files magpie wrote of them, still as it wrote them, out of every agent.

func RemoveEnv

func RemoveEnv(name string) (*Result, error)

RemoveEnv takes a variable out of the library, and what magpie wrote of it out of every agent.

func RemoveFoundServer added in v0.1.1191

func RemoveFoundServer(name string) (*Result, error)

RemoveFoundServer takes a server the agents have of their own out of every agent that has it as it is (#1618), without bringing it into the library first: its entry goes from each file the agent reads servers from (dsh's other profiles, Claude Desktop's Claude-3p file, Pi's other mcp.json too), each file copied to the backups before it is written, and the rest of each file — the user's other servers, their keys, comments — left as it is. Another server by that name (Others) is another server and stays. One the agent's app puts back each time it starts (Own) is left: taking it out wouldn't last. A file that can't be read now is never written: what it holds is unknown, not nothing.

func RemoveFoundSkill added in v0.1.1119

func RemoveFoundSkill(name string) (*Result, error)

RemoveFoundSkill takes a skill the agents have of their own out of every agent that has it (#1303), without bringing it into the library first: each agent's folder, and its copies of the very same files, go to the backups; its links are taken away. Its entry in the shared ~/.agents/skills, or a folder of it left in the library's own, goes to the backups too, as agents read those. A folder elsewhere that the agents only linked to is left where it is, and so is another skill by that name (Others): that is another skill.

func RemoveFoundSkills added in v0.1.1222

func RemoveFoundSkills(names []string) (*Result, error)

RemoveFoundSkills takes the skills named, of those the agents have of their own, out of every agent in one change, each exactly as RemoveFoundSkill takes one (wongxy on Discord: 批量删除). One that can't be taken out stays, and is said in Unremoved; the others go all the same. Only when none went does the change fail, with the first reason.

func RemoveGoneSkills added in v0.1.1326

func RemoveGoneSkills(names []string) (*Result, error)

RemoveGoneSkills takes out of the library, as RemoveSkills does, the skills named that their sources no longer have; with none named, every such skill. One found in its source again since is left, and said in Unremoved.

func RemoveHooks added in v0.1.1214

func RemoveHooks(names []string) (*Result, error)

RemoveHooks takes the hooks named out of the library, and what magpie wrote of them out of every agent. A name the library hasn't is said in Unremoved, the others gone all the same.

func RemovePlugin

func RemovePlugin(name string) (*Result, error)

RemovePlugin takes a plugin out of the library, every part of it out of every agent and its folder out of the library's.

func RemoveProject added in v0.1.243

func RemoveProject(dir string, keep bool) (*Result, error)

RemoveProject takes every skill magpie placed out of a project, and the project off the list; what's left, it couldn't take away and says why. keep takes the project off the list alone (#514: a project given a few skills or servers once, to keep them): everything magpie put in the folder — skills, servers in the agents' files, its lines in the .gitignore — stays as it is, the user's from then on.

func RemoveServer

func RemoveServer(name string) (*Result, error)

RemoveServer takes a server out of the library and out of every agent magpie gave it to.

func RemoveServerAccount

func RemoveServerAccount(name, id string) (*Result, error)

RemoveServerAccount takes an account away from the server; the one in use going puts the server's own headers back in use.

func RemoveServers added in v0.1.1090

func RemoveServers(names []string) (*Result, error)

RemoveServers takes the servers named out of the library and every agent in one write (#1027), each as RemoveServer does: only the entries magpie wrote (Applied) leave the agents' files, a server of the agent's own by another name stays, and each one's sign-in goes with it. One that can't be taken out stays, and is said in Unremoved.

func RemoveSkill

func RemoveSkill(name string) (*Result, error)

RemoveSkill takes a skill out of the library and every agent; its folder is kept aside with the backups, never just deleted.

func RemoveSkills added in v0.1.599

func RemoveSkills(names []string) (*Result, error)

RemoveSkills takes the skills named out of the library and every agent in one write (#449), each as RemoveSkill does: the folders kept aside together, in one backup, and a folder of the user's only unlinked. One that can't be taken out stays, and is said in Unremoved.

func RemoveSubagents added in v0.1.1258

func RemoveSubagents(names []string) (*Result, error)

RemoveSubagents takes the subagents named out of the library, and the files magpie wrote of them, still as it wrote them, out of every agent.

func Restore added in v0.1.58

func Restore(s *Setup) (*Result, error)

Restore gives the servers and skills to the agents s names and puts the instructions back as they were, then writes the library into the agents. A server or skill s names that the library no longer has is left out and listed in Result.Missing; one added to the library since s was taken is left with the agents it has, as s knows nothing of it. The library's own instructions files that change are kept aside with the agents' files, in the same backup.

func SaveCommand

func SaveCommand(old string, c Command) (*Result, error)

SaveCommand adds a slash command, or replaces the one called old (renaming it: the files magpie wrote by the old name go).

func SaveEnv

func SaveEnv(old string, e EnvVar) (*Result, error)

SaveEnv adds a variable, or replaces the one called old (renaming it).

func SaveHook added in v0.1.1214

func SaveHook(old string, h Hook) (*Result, error)

SaveHook adds a hook, or replaces the one called old (renaming it). An agent it can't be given is left out of it, said in the result.

func SaveInstructions

func SaveInstructions(c InstructionsChange) (*Result, error)

SaveInstructions saves the change and writes it into the agents.

func SaveServer

func SaveServer(old string, s Server) (*Result, error)

SaveServer adds a server, or replaces the one called old (renaming it).

func SaveSkillFile added in v0.1.2825

func SaveSkillFile(name, file, text, was string) (*Result, error)

SaveSkillFile writes text into the file of a library skill at file, and gives the skill to its agents again. was is the text the page opened: when the file holds something else now (an agent, an update or the user changed it since), nothing is written, and the error says so.

func SaveSubagent added in v0.1.1258

func SaveSubagent(old string, s Subagent) (*Result, error)

SaveSubagent adds a subagent, or replaces the one called old (renaming it: the files magpie wrote by the old name go).

func ServerAgents

func ServerAgents(name string, agents []string) (*Result, error)

ServerAgents sets which agents get a server.

func ServerHere

func ServerHere(name string, cmd []string) (*Result, error)

ServerHere starts a synced command server with cmd (a program and its arguments) on this computer alone, the other computers keeping the synced one; with no cmd it goes back to the synced one.

func ServerHub added in v0.1.2242

func ServerHub(name string, direct bool) (*Result, error)

ServerHub shares a server through the hub, or keeps it each agent's own entry (direct); the agents are written again at once, so the entry it had the other way goes.

func ServerLocal added in v0.1.2102

func ServerLocal(name string, on bool) (*Result, error)

ServerLocal keeps a server to this computer, or lets a sync carry it again.

func ServerOn

func ServerOn(name string, on bool) (*Result, error)

ServerOn turns a server off for everyone, or on again as it was (swang20201 on X: a server in the Library could only be removed). Off, no agent is given it, nor a project's, nor an app at the MCP router's address, and the router ends it; the agents it had are kept (Paused), with its command or address, env, headers, tools turned off and magpie's sign-in to it, which stay in the library. On, those agents get it back, none when it had none (it is the router's alone again). A plugin's server is the same switch as its row on the Plugins page.

func ServerTools added in v0.1.1183

func ServerTools(name string, off []string) (*Result, error)

ServerTools sets the tools of a server its agents leave out (nf1qaz2w on Discord); none turns every tool on again.

func SetAutoUpdateSkills

func SetAutoUpdateSkills(on bool) (*Result, error)

SetAutoUpdateSkills turns updating the skills by themselves on or off.

func SetBorrow

func SetBorrow(id string, on bool) (*Result, error)

SetBorrow turns the switch of the Remote magpie id on or off. On, its Library is read at once (UseRemoteLibraries); off, what was taken from it and not changed since is taken out.

func SetMCPHub added in v0.1.1950

func SetMCPHub(on bool) (*Result, error)

SetMCPHub turns the hub on or off: on, each agent that can reach it is given magpie's one entry in place of its servers; off, their own entries again, and the servers the hub started are ended.

func SetMemoryInInstructions

func SetMemoryInInstructions(on bool) (*Result, error)

SetMemoryInInstructions gives the agents ticked for instructions memory's digest, or takes it out of them, at once.

func SetRemoteMCP added in v0.1.3135

func SetRemoteMCP(id string, on bool) (*Result, error)

SetRemoteMCP turns the switch of the Remote magpie id on or off. On, it is asked again at its next model list (provider.AskRemoteHub asks at once); off, its server is taken out of the library and the agents.

func SetServer

func SetServer(name string, o ServerOpts) (*Result, error)

SetServer changes settings of a server already in the library, keeping the rest of it as it is.

func SetSkillHow added in v0.1.1015

func SetSkillHow(agent, how string) (*Result, error)

SetSkillHow sets the way the library gives its skills to every agent (agent "") or to one ("" for how the library does it); the agents' links and copies are made again the new way.

func SetSkillRouter added in v0.1.3353

func SetSkillRouter(on bool) (*Result, error)

SetSkillRouter turns the router on or off: on, each agent that can take it is given magpie-skills in place of the links of the skills it lists; off, their own links again.

func SetSkillsWhere added in v0.1.2761

func SetSkillsWhere(where string) (*Result, error)

SetSkillsWhere sets where the library's skills go: SkillsInAgents or SkillsInShared. Every skill is put in ~/.agents/skills, or taken out of it, at the sync it runs.

func SkillAgents

func SkillAgents(name string, agents []string) (*Result, error)

SkillAgents sets which agents get a skill.

func SkillHere added in v0.1.1955

func SkillHere(name string, on bool) (*Result, error)

SkillHere turns a skill on or off on this computer alone. Which agents it is ticked for stays as it is, and so does every other computer's.

func SkillNote added in v0.1.2863

func SkillNote(name, note string) (*Result, error)

SkillNote sets the user's note on a skill; "" takes it away.

func SkillRouterHow added in v0.1.3353

func SkillRouterHow(name string, direct bool) (*Result, error)

SkillRouterHow lists a skill in the router, or keeps it each agent's own link (direct); the agents are written again at once.

func SomeHooksAgents added in v0.1.1214

func SomeHooksAgents(names, agents []string, on bool) (*Result, error)

SomeHooksAgents gives the hooks named to the agents, or takes them from them, each to the agents that can take it: an agent's own event stays that agent's alone.

func SomeServersAgents added in v0.1.1090

func SomeServersAgents(names, agents []string, on bool) (*Result, error)

SomeServersAgents does as EveryServerAgents for the servers named alone: the ones picked on the page (#1027).

func SomeSkillsAgents added in v0.1.856

func SomeSkillsAgents(names, agents []string, on bool) (*Result, error)

SomeSkillsAgents does as EverySkillAgents for the skills named alone: a repository's skills, from its group's chips (#787).

func SubagentAgentsSet added in v0.1.1258

func SubagentAgentsSet(name string, agents []string) (*Result, error)

SubagentAgentsSet sets which agents get a subagent.

func Sync

func Sync() (*Result, error)

Sync writes the library into the agents again: after an agent is installed, or a profile brings another library in. magpie does one at every start, and the Library page waits on the lock for each read and change: held for the whole sync, through every agent's skills, the first operations after opening magpie took seconds (#1624, Hipple). It lets go after each agent's part, for whatever waits to go first.

func SyncLinked added in v0.1.1227

func SyncLinked() (*Result, error)

SyncLinked writes the instructions into the agents again when the set they get is kept in a file of the user's that changed since it was last looked at — edited by hand, or by another tool that keeps it — and not otherwise: nil, nil. The first look at a file only notes it.

func UngroupSkills added in v0.1.896

func UngroupSkills(name string, names []string) (*Result, error)

UngroupSkills takes the group called name away; its skills go back to the groups by source. With names, only those leave it.

func UpdatePlugin

func UpdatePlugin(name string) (*Result, error)

UpdatePlugin fetches a plugin again from where it came from and replaces its parts, keeping the agents it is given to and whether it is on.

func UpdateSkill

func UpdateSkill(name string, replace bool) (*Result, error)

UpdateSkill fetches a skill from GitHub again, in place: the agents' links go on pointing at it. One changed here since it was fetched is an *EditedError unless replace is set, and then the changed version is kept with the backups (#1449).

func UpdateSkills added in v0.1.151

func UpdateSkills() (*Result, error)

UpdateSkills fetches again every skill that came from GitHub, each repository once, and writes the agents once. A skill that couldn't be fetched is said in Unupdated, as is one changed here since it was fetched, which is left as it is; the others are updated all the same.

func UpdateSomeSkills added in v0.1.240

func UpdateSomeSkills(names []string) (*Result, error)

UpdateSomeSkills is UpdateSkills for the skills named only: those a check found GitHub to have changed.

func UseLibrarySkill added in v0.1.498

func UseLibrarySkill(name, agentID string) (*Result, error)

UseLibrarySkill settles an agent's own skill that stands in the way of the library's by that name for the library's: the agent's folder is kept aside with the backups, and the library's linked in its place.

func UseLibrarySkills added in v0.1.1224

func UseLibrarySkills(names []string, agentID string) (*Result, error)

UseLibrarySkills is UseLibrarySkill for several of one agent's skills at once, as the Library's warning settles them together (#1896). Claude Desktop's own skills (Anthropic's built in, or made there) aren't put aside: they are listed in its manifest, not only a folder, so only KeepAgentSkills settles those.

func UseServerAccount

func UseServerAccount(name, id string) (*Result, error)

UseServerAccount puts an account of the server in use: "" is the server's own headers.

func Woken added in v0.1.2043

func Woken() (*Result, error)

Woken writes the library into the agents of each distro it names that was seen stopped and runs now: what was ticked for them while it was stopped, kept in library.json, reaches them once the user starts it. Asking whether a distro runs (wsl.exe -l --running) doesn't start it. nil, nil when no such distro started.

type SearchError added in v0.1.1188

type SearchError struct {
	Source string // skills.sh, the MCP Registry
	Err    error
}

SearchError is a source the market searches that didn't answer; what the market has of its own is still listed beside it (#1589).

func (*SearchError) Error added in v0.1.1188

func (e *SearchError) Error() string

func (*SearchError) Unwrap added in v0.1.1188

func (e *SearchError) Unwrap() error

type Server

type Server struct {
	Name   string `json:"name"`
	Bundle string `json:"bundle,omitempty"` // the Claude Code plugin it came with (plugin.go)
	// Transport is stdio for a command, http (streamable) or sse for a URL.
	Transport string            `json:"transport"`
	Command   string            `json:"command,omitempty"`
	Args      []string          `json:"args,omitempty"`
	Env       map[string]string `json:"env,omitempty"`
	URL       string            `json:"url,omitempty"`
	Headers   map[string]string `json:"headers,omitempty"`
	Agents    []string          `json:"agents"`
	// DisabledTools are the server's tools its agents leave out, by the
	// names the server gives them, written in each agent's own way where
	// it has one (mcp_tools_off.go)
	DisabledTools []string `json:"disabledTools,omitempty"`
	// OAuth is an OAuth app of the user's own that magpie signs in to the
	// server as, for one whose sign-in doesn't let magpie register itself
	// (GitHub's, 新v学员 on Discord). It is magpie's alone: the agents are
	// given the server as before.
	OAuth *OAuthApp `json:"oauth,omitempty"`
	// Accounts are further sets of headers for the server (Elorynth on X:
	// several keys, one in use), each laid over Headers, and Account is the
	// one the agents are given ("" for Headers as they are). magpie's own
	// OAuth sign-ins to the server have their accounts in mcpauth.
	Accounts []Account `json:"accounts,omitempty"`
	Account  string    `json:"account,omitempty"`
	// StartupTimeout is the seconds an agent waits for the server to start
	// and list its tools: Codex's startup_timeout_sec (#3168), the only
	// agent given it. 0 leaves it to the agent (Codex's own is 30s).
	StartupTimeout int `json:"startupTimeout,omitempty"`
	// Local keeps the server to this computer (huhuy72219405 on X: a
	// server of a program or folder only this computer has). A backup or
	// a sync never carries it, and one coming in neither takes it away nor
	// puts another computer's of that name in its place (carry.go).
	Local bool `json:"local,omitempty"`
	// Plugin is the plugin (plugin.Name) whose tools the server is: the
	// gateway serves them at its URL, and the hub calls the plugin itself
	// (plugin_tools.go)
	Plugin string `json:"plugin,omitempty"`
	// Hidden is a server turned off in the Library (ServerOn), or a
	// plugin's whose tools were hidden from every agent on the Plugins
	// page (PluginServerOn, chengming0v0 on Discord): no agent is given
	// it, nor a project, nor an app at the MCP router's address. Paused are the agents it had, given back when it is shown
	// again. Both go once the server has an agent again (save).
	Hidden bool     `json:"hidden,omitempty"`
	Paused []string `json:"paused,omitempty"`
	// Bridge is the Remote magpie (its provider id) whose MCP router the
	// server is, given a server of its own (bridge_mcp.go)
	Bridge string `json:"bridge,omitempty"`
	// Hub is how the MCP hub (Library.MCPHub) gives the server: "" shares
	// it through the hub's one entry, as every server was before;
	// HubDirect keeps it the agents' own entry, written as with the hub
	// off, for a server that reads its project from the folder it is
	// started in, or keeps a session's state (#4382, cuipengcx90).
	Hub string `json:"hub,omitempty"`
	// Note is the user's own word on what the server is for (youyo.p on
	// Discord: with many of them, which is which). Only the library keeps
	// it, and a sync carries it; no agent is given it (TestNoteNeverGiven).
	Note string `json:"note,omitempty"`
	// Shared is set when this computer starts the server its own way
	// (#3836, #6426; jinpwng on X: one server on a Mac and in WSL, each
	// with its own path): Command, Args and Env are then this computer's,
	// and Shared is what a sync carries and brings for them. Never carried
	// itself (mcp_here.go).
	Shared *Start `json:"shared,omitempty"`
	// contains filtered or unexported fields
}

Server is one MCP server: a command magpie's agents start, or a URL they reach.

func ServerOf added in v0.1.136

func ServerOf(name string, cmd []string) (Server, error)

ServerOf is a server as it is typed: a URL, or a command and its arguments.

func (*Server) HasEnvRefs added in v0.1.1112

func (s *Server) HasEnvRefs() bool

HasEnvRefs says whether the server's headers or environment reference a variable.

func (*Server) Remote

func (s *Server) Remote() bool

Remote reports whether the server is reached by URL.

type ServerHealth added in v0.1.794

type ServerHealth struct {
	// State is ok (it answered, with Tools tools), auth (it asks for a
	// sign-in or a key) or error (Why says what went wrong)
	State string `json:"state"`
	Tools int    `json:"tools"`
	// ToolList is each tool's name and what it says it does, as tools/list
	// gave them, for the page to list (nf1qaz2w on Discord); at most
	// maxToolList, while Tools counts every one
	ToolList []Tool `json:"toolList,omitempty"`
	// Why is the kind of error, for the page to put in its own words:
	// notfound, start, exited, timeout, http, refused, unreachable,
	// protocol, home (exits in home, works in a project: Project),
	// novar (a ${NAME} magpie's environment hasn't: Detail names
	// them), wsldown (a command only agents in WSL start, whose distros,
	// Detail, aren't running: it wasn't checked), nobrowser (it listed its
	// Tools, and starts a Chrome the container it runs in hasn't: Detail
	// is its option for one it can reach, mcp_browser.go)
	Why    string `json:"why,omitempty"`
	Code   int    `json:"code,omitempty"`   // the exit code, or the HTTP status
	Detail string `json:"detail,omitempty"` // the last line it wrote to stderr, or the error's text
	// OAuth is a refusal that named a sign-in (WWW-Authenticate), which
	// magpie can do itself for a streamable HTTP server
	OAuth bool `json:"oauth,omitempty"`
	// SignIn is magpie's sign-in to a streamable HTTP server as the check
	// left it: one whose renewed token the server refused has run out
	// since, and the page's tag says so (新v学员 on Discord)
	SignIn *mcpauth.Status `json:"signIn,omitempty"`
	// AgentSignIn are the agents signed in to a server that refused
	// magpie's check on their own (Claude Code's /mcp, mcp_agent_signin.go),
	// by id: they use it, though the check, without their tokens, was asked
	// to sign in (CyberCaius on Discord)
	AgentSignIn []string `json:"agentSignIn,omitempty"`
	// Step is what a server that timed out was asked and didn't answer
	// (initialize, notifications/initialized, tools/list, or connect: an
	// SSE server's stream), and Waited how long it was waited for, in ms
	Step   string `json:"step,omitempty"`
	Waited int64  `json:"waited,omitempty"`
	// Checked are where a command was started, in order, for one that agents
	// in WSL have (mcp_check_wsl.go): "" for this machine, a distro's name
	// for its agents there. A failure is the last one's; none for a
	// command only this machine's agents start.
	Checked []string `json:"checked,omitempty"`
	// Project is a command that exited in home and listed its tools in a
	// project folder, where the agents given it directly start it
	// (inProject); Detail is what it said in home. Why "home" is that
	// command run by magpie for its agents, in home (inHome).
	Project bool  `json:"project,omitempty"`
	At      int64 `json:"at"` // when it was checked, unix ms
}

ServerHealth is what a check of one server found.

func CheckServer added in v0.1.794

func CheckServer(ctx context.Context, s *Server) ServerHealth

CheckServer connects to one server and asks it for its tools.

type ServerOpts

type ServerOpts struct {
	Headers  map[string]string
	Env      map[string]string
	NoHeader []string // header-=K
	NoEnv    []string // env-=K
	Timeout  *int
	Agents   []string // the words of agents=, for the caller to resolve
	HasAgent bool
	Local    *bool
}

ServerOpts are the settings a server takes beside its command or URL, typed as key=value words on the command line (#6111, Abandon332 on X): header=K=V (or K: V), env=K=V, timeout=SECS, agents=a,b, --local. A word the line means as the child's own argument comes after "--".

func SplitServerWords

func SplitServerWords(words []string) (cmd []string, o ServerOpts, err error)

SplitServerWords takes the options out of the words typed after a server's name and leaves its command or URL. Words after a "--" are the command's, however they look. A word that looks like a setting of magpie's but isn't one it knows is refused rather than handed to the program.

func (ServerOpts) Apply

func (o ServerOpts) Apply(s *Server) error

Apply puts the options on s, which is a command or a URL server: a header on a command, or an env on a URL, is an error rather than dropped.

type ServerView

type ServerView struct {
	*Server
	Icon string `json:"icon,omitempty"`
	// Problems are the agents it couldn't be given to, and why
	Problems map[string]string `json:"problems,omitempty"`
	// SignIn is magpie's sign-in to a streamable HTTP server, which the
	// agents then use (#615)
	SignIn *mcpauth.Status `json:"signIn,omitempty"`
}

ServerView is a library server, and what each agent it's on made of it.

type ServersConfig added in v0.1.1160

type ServersConfig struct {
	File    string   `json:"file"`
	Text    string   `json:"text"`
	Skipped []string `json:"skipped,omitempty"`
}

ServersConfig is what an agent's project file would hold with the library's servers called names in it, as magpie writes them into a project it has (syncProjectMCP): for the user to paste into a project magpie doesn't keep (#1478, xiaozhu1337: 不建项目、一次性添加项目级 MCP). File is the file in the project, Text the file whole, and Skipped the servers the agent can't reach that way (SSE for Codex or Pi).

func ConfigOfServers added in v0.1.1160

func ConfigOfServers(agent string, names []string) (*ServersConfig, error)

ConfigOfServers writes the servers into a fresh file in agent's project format, in a folder of its own, and reads it back: the same encoder, the same references to variables, a server magpie is signed in to through the gateway as a project of magpie's is given it.

type SetView added in v0.1.181

type SetView struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Text   string `json:"text"`
	Active bool   `json:"active,omitempty"`
	File   string `json:"file,omitempty"` // the user's own file it is kept in
}

SetView is one set of shared instructions as the page shows it.

type Setup added in v0.1.58

type Setup struct {
	Instructions SetupInstructions   `json:"instructions"`
	MCP          map[string][]string `json:"mcp"`    // server → the agents that get it
	Skills       map[string][]string `json:"skills"` // skill → the agents that get it
}

Setup is which agents get what from the library, and the instructions, as a profile keeps them to switch back to. The servers and the skills themselves stay in the library: a setup only names them.

func Snapshot added in v0.1.58

func Snapshot() (*Setup, error)

Snapshot is the library's setup as it is now.

func (*Setup) Empty added in v0.1.58

func (s *Setup) Empty() bool

Empty reports whether the library had nothing in it when s was taken.

func (*Setup) GivesInstructions added in v0.1.58

func (s *Setup) GivesInstructions() bool

GivesInstructions reports whether any agent gets instructions from it.

func (*Setup) On added in v0.1.58

func (s *Setup) On() (servers, skills int)

On counts the servers and the skills a setup gives to at least one agent.

func (*Setup) Summary added in v0.1.58

func (s *Setup) Summary() string

Summary is what a setup gives out, in a few words: the servers and skills given to at least one agent, and whether any agent gets the instructions.

type SetupInstructions added in v0.1.58

type SetupInstructions struct {
	Set    string            `json:"set,omitempty"` // the set it is the text of
	Shared string            `json:"shared,omitempty"`
	Agents []string          `json:"agents"`
	Extra  map[string]string `json:"extra,omitempty"`
}

SetupInstructions is the shared text, the agents it is written to, and what each agent gets besides.

type Skill

type Skill struct {
	Name   string   `json:"name"`
	Bundle string   `json:"bundle,omitempty"` // the plugin it came with (plugin.go)
	Source *Source  `json:"source,omitempty"`
	Agents []string `json:"agents"`
	// Hash is of the skill's files as last fetched from GitHub, and Commit
	// the last commit to have touched its folder there, once a check has
	// found the two to agree: together they tell whether GitHub has
	// changed the skill since. For one from another git repository,
	// Commit is the commit of the repository it was fetched at.
	Hash   string `json:"hash,omitempty"`
	Commit string `json:"commit,omitempty"`
	// Own is Hash leaving aside what installing the skill's dependencies
	// writes (ownHash): set as it is fetched, so a lock file the install
	// writes again isn't taken for a change of the user's
	Own string `json:"own,omitempty"`
	// Pending is a skill a sync brought by its source (skill_carry.go)
	// that isn't fetched from there on this computer yet: Hash and Commit
	// are the version the other computer has, its folder what came with
	// the sync or the older version here. The next sync, or Update, fetches
	// it; an update clears it.
	Pending bool `json:"pending,omitempty"`
	// Missing are the files another computer has of the skill that a sync
	// left out as too big to carry (CarriedSkill.Left), which this one
	// doesn't have: it carries them on as left out, so its sync never
	// takes them from the computer that has them (#5715), and says so.
	Missing []string `json:"missing,omitempty"`
	// From is the repository one not installed from GitHub was found to
	// come from (skill_from.go), only to group it with the rest of it
	From string `json:"from,omitempty"`
	// Gone is when an update or a check found its source without it: it
	// was removed there (skill_gone.go). Kept on this computer only.
	Gone string `json:"gone,omitempty"`
	// OffHere turns the skill off on this computer alone (hanslin1666 on
	// Discord): no agent here gets it, whatever Agents says. Agents is
	// what a sync carries and stays as the other computers have it; this
	// is never carried (Collect leaves it out) and a sync keeps it (Put).
	OffHere bool `json:"offHere,omitempty"`
	// Called is the name its SKILL.md gives, when the library keeps it
	// under another because a skill from elsewhere had that name first
	// (skill_beside.go). Its SKILL.md is named as the library names it.
	Called string `json:"called,omitempty"`
	// Note is the user's own word on what the skill is for or when to
	// use it, beside its SKILL.md's description (youyo.p on Discord).
	// Only the library keeps it, and a sync carries it; no agent is
	// given it: the skill's folder is the agents', and this isn't in it.
	Note string `json:"note,omitempty"`
	// Router is "direct" for a skill the skill router leaves out: each
	// agent keeps its own link of it (skill_router.go). A sync carries it.
	Router string `json:"router,omitempty"`
	// Home is where the skill was in the agents before it was brought in
	// from them (ImportSkill): removed from the library, it goes back there
	// as it was (BeiWeiji on X). This computer's own: a sync never carries
	// it, and keeps it for the same skill (Put).
	Home *SkillHome `json:"home,omitempty"`
}

Skill is a folder with a SKILL.md, kept in the library and linked into the agents that get it.

type SkillCheck added in v0.1.240

type SkillCheck struct {
	Name string `json:"name"`
	// Status is current when GitHub has the skill as the library does,
	// update when it has changed it since, gone when it was read without
	// the skill (removed there, skill_gone.go), and unknown when it
	// couldn't be told (Error says why)
	Status  string `json:"status"`
	Commit  string `json:"commit,omitempty"`  // the last commit to touch the skill's folder
	Date    string `json:"date,omitempty"`    // when it was made
	Message string `json:"message,omitempty"` // its first line
	// URL shows what changed: the commits since the one installed, or the
	// folder's history when which that was isn't known
	URL   string `json:"url,omitempty"`
	Error string `json:"error,omitempty"`
	// Limited is set when it couldn't be told because GitHub's rate limit
	// was used up, for the page to say so in its own words
	Limited *Limited `json:"limited,omitempty"`
}

SkillCheck is what a check for updates found of one skill from GitHub.

func CheckSkills added in v0.1.240

func CheckSkills() ([]SkillCheck, error)

CheckSkills asks GitHub, for every skill installed from there, for the last commit to touch its folder, and tells whether it's newer than what the library has: by the commit a skill is known to be at, or, while that isn't known yet, by fetching the repository once and comparing the folder's files with the skill's. A skill GitHub couldn't be asked about is unknown, and the others are checked all the same; once GitHub limits requests, the rest aren't asked about. A skill from another git repository is checked with the user's git (checkGitSkill). Each repository, and each folder the user added skills from, is also looked in for skills added beside them since (skillnew.go).

type SkillFile added in v0.1.2825

type SkillFile struct {
	File  string   `json:"file"`  // its place in the skill's folder, with /
	Text  string   `json:"text"`  // what it holds
	Path  string   `json:"path"`  // the skill's folder
	Files []string `json:"files"` // the skill's text files, SKILL.md first
}

SkillFile is one file of a library skill as the page reads it.

func ReadSkillFile added in v0.1.2825

func ReadSkillFile(name, file string) (*SkillFile, error)

ReadSkillFile is the file of a library skill at file (SKILL.md when empty), with the skill's other text files listed.

type SkillGroup added in v0.1.896

type SkillGroup struct {
	Name   string   `json:"name"`
	Skills []string `json:"skills"`
}

SkillGroup is a group the user made of some skills (#791, mintonight: 能不能在选择后自己创建分组呢): the page shows it as a group of its own, above the ones by source, with its skills taken out of theirs. It is only how the page shows them; the agents get each skill as before.

type SkillHome

type SkillHome struct {
	// Dir is the folder that was moved into the library, put back there.
	// Empty when the library only linked to it where it is.
	Dir string `json:"dir,omitempty"`
	// Entries are what each agent that had it had in its skills folder
	Entries []HomeEntry `json:"entries,omitempty"`
}

SkillHome is where a skill brought in from the agents was (Skill.Home).

type SkillView

type SkillView struct {
	Name        string            `json:"name"`
	Bundle      string            `json:"bundle,omitempty"` // the plugin it came with
	Description string            `json:"description"`
	Source      string            `json:"source,omitempty"`
	Kind        string            `json:"kind"`             // github, git, folder, or "" for one kept in the library
	Origin      string            `json:"origin,omitempty"` // on GitHub, as CC Switch installed it: it can be updated from there
	Repo        string            `json:"repo,omitempty"`   // the repository it came from, however it came in, for the page to group by
	Icon        string            `json:"icon,omitempty"`
	Agents      []string          `json:"agents"`
	Missing     bool              `json:"missing,omitempty"` // its folder is gone
	Problems    map[string]string `json:"problems,omitempty"`
	Check       *SkillCheck       `json:"check,omitempty"` // what the last check for updates found
	// Always are the agents that have it whatever the library gives them:
	// it is kept in ~/.agents/skills, which they read themselves (#595)
	Always []string `json:"always,omitempty"`
	// Shared is its entry in ~/.agents/skills when it is kept there:
	// HandOverSkills moves it into the library's own folder
	Shared string `json:"shared,omitempty"`
	// SharedElsewhere: that entry only links to a folder kept elsewhere,
	// which stays there when it's handed over; only the link goes
	SharedElsewhere bool `json:"sharedElsewhere,omitempty"`
	// Behind are the agents given it as a copy whose copy differs from it,
	// till the next sync makes it again
	Behind []string `json:"behind,omitempty"`
	// Edited is set for one from GitHub changed here since it was fetched,
	// in the library or in an agent's copy: an update replaces that, so
	// the page asks first (#1449)
	Edited bool `json:"edited,omitempty"`
	// Pending is one a sync brought by its source and not yet fetched
	// from there on this computer (Skill.Pending): Update tries again
	Pending bool `json:"pending,omitempty"`
	// Gone is when its source was found without it: removed there, the
	// page offers to take it out (skill_gone.go)
	Gone string `json:"gone,omitempty"`
	// OffHere is set when it is turned off on this computer alone: Agents
	// are still the ones a sync carries to the others
	OffHere bool `json:"offHere,omitempty"`
	// Note is the user's own note on it (Skill.Note)
	Note string `json:"note,omitempty"`
	// Manual: its SKILL.md sets disable-model-invocation (meta.Manual)
	Manual bool `json:"manual,omitempty"`
	// Router is "direct" for one the skill router leaves out (Skill.Router)
	Router string `json:"router,omitempty"`
	// Back are the agents it was brought in from: Remove gives it back
	// to them as they had it (Skill.Home)
	Back []string `json:"back,omitempty"`
}

SkillView is a library skill as the page shows it.

type Source

type Source struct {
	Kind string `json:"kind"`           // github | git | folder
	Repo string `json:"repo,omitempty"` // owner/repo for github, the address git fetches for git
	Ref  string `json:"ref,omitempty"`
	Path string `json:"path,omitempty"` // in the repository
	Dir  string `json:"dir,omitempty"`  // the folder, for kind folder
	// Via is the app's own steady link a folder skill was linked through
	// while that link leads nowhere and Dir is the version folder found in
	// its place (skill_moved.go); the library goes back to it once it
	// leads to the skill again
	Via string `json:"via,omitempty"`
}

Source is where a skill came from: a GitHub repository it can be updated from, another git repository (fetched with the user's own git), or a folder on this machine the library links to, so that editing the folder is editing the skill.

func (*Source) String

func (s *Source) String() string

type Start

type Start struct {
	Command string            `json:"command"`
	Args    []string          `json:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty"`
}

Start is how a command server is started: its program, the program's arguments and its environment.

type Subagent added in v0.1.1258

type Subagent struct {
	Name        string `json:"name"`
	Bundle      string `json:"bundle,omitempty"` // the plugin it came with (plugin.go)
	Description string `json:"description"`
	Prompt      string `json:"prompt"`
	// Model is the model or routing group the subagent runs on, as the
	// agent names it; "" leaves it to the agent
	Model  string   `json:"model,omitempty"`
	Skills []string `json:"skills,omitempty"`
	MCP    []string `json:"mcp,omitempty"`
	Agents []string `json:"agents"`
	// From is the file it was imported from, its Path the file's in the
	// repository, and FromHash what it said then (subagent_import.go)
	From     *Source `json:"from,omitempty"`
	FromHash string  `json:"fromHash,omitempty"`
}

Subagent is one the agents ticked for it are given.

type SubagentAgentView added in v0.1.1258

type SubagentAgentView struct {
	ID string `json:"id"`
	// Dir is where its subagents are; No is why magpie can't give it any
	Dir string `json:"dir,omitempty"`
	No  string `json:"no,omitempty"`
	WSL bool   `json:"wsl,omitempty"`
	// Skills and MCP: its subagents take skills, servers of their own;
	// one that doesn't uses all the agent has
	Skills bool `json:"skills,omitempty"`
	MCP    bool `json:"mcp,omitempty"`
	// Model: its subagents run on a model of their own when one is set;
	// one that doesn't runs them on the model the agent picks
	Model bool `json:"model,omitempty"`
}

SubagentAgentView is an agent the Subagents tab lists.

type SubagentCandidate

type SubagentCandidate struct {
	Path        string `json:"path"` // the file's, in the repository or the folder
	Name        string `json:"name"`
	Description string `json:"description"`
	// State is, against the library: "" a new one, "have" it has this one
	// as it is there, "update" it has it from here as it was before, to
	// be updated, "edited" it has it from here changed since, left alone
	State string `json:"state,omitempty"`
	// As is the name the library has it by, or adds it by, when not Name
	As string `json:"as,omitempty"`
	// contains filtered or unexported fields
}

SubagentCandidate is one subagent found.

type SubagentFile added in v0.1.1258

type SubagentFile struct {
	Name string `json:"name"`
	Path string `json:"path"`
	Hash string `json:"hash"`
}

SubagentFile is a file magpie wrote for a subagent, and the hash of what it wrote there.

type SubagentLeft

type SubagentLeft struct {
	Path  string `json:"path"`
	Error string `json:"error"`
}

SubagentLeft is a file left out.

type SubagentProbe

type SubagentProbe struct {
	Source     string              `json:"source"`
	Kind       string              `json:"kind"`
	Candidates []SubagentCandidate `json:"candidates"`
	// Left are the files that look like subagents and can't be one, with why
	Left []SubagentLeft `json:"left,omitempty"`
	// contains filtered or unexported fields
}

SubagentProbe is what was found at an address.

func ProbeSubagents

func ProbeSubagents(input string) (*SubagentProbe, error)

ProbeSubagents is the subagents at input; nothing is written.

type SubagentView added in v0.1.1258

type SubagentView struct {
	*Subagent
	// Files are, for each agent it was written to, the file
	Files map[string]string `json:"files,omitempty"`
	// Problems are the agents it couldn't be given to, and why
	Problems map[string]string `json:"problems,omitempty"`
}

SubagentView is a library subagent, and where each agent has it.

type SubagentsImported

type SubagentsImported struct {
	Added   []string `json:"added,omitempty"`
	Updated []string `json:"updated,omitempty"`
	Had     []string `json:"had,omitempty"`
	// Kept are the ones changed here since, left as they are
	Kept []string `json:"kept,omitempty"`
}

SubagentsImported is what an import did, by the library's names.

type TakenFile

type TakenFile struct {
	Path string `json:"path"`
	// Body is the file as it was
	Body string `json:"body"`
	// Hash is of the description and prompt read from it
	Hash string `json:"hash"`
}

TakenFile is an agent's own file a command was imported from.

type Target

type Target struct {
	Agent *agent.Agent
	// Instructions is the file the agent reads before every conversation;
	// Override, when it exists, is read instead of it (Codex's
	// AGENTS.override.md), which the page warns of.
	Instructions, Override string
	// Field, when it is set, says the instructions are not the file itself
	// but the string at this key path of the JSON file Instructions names
	// (WorkBuddy's personalization.customPrompt): instr_field.go.
	Field  string
	MCP    *mcpFile
	Skills string // the folder the agent finds skills in
	// SkillsAlso are agents whose skills this one reads as well, as
	// OpenCode reads Claude Code's.
	SkillsAlso []string
	// MCPVia is the extension the agent reads its MCP servers through, for
	// one that has none of its own.
	MCPVia string
	// Note is what the page says of the agent's instructions file.
	Note string
	// Copy is an agent that gets a copy of each skill, made again when
	// the library's changes, rather than a link: one in a WSL distro whose
	// skills folder is on a Windows drive (wslStored), LiveAgent, and on
	// Windows one that skips a junction (skipsJunctions).
	Copy bool
	// Store, for an agent in a WSL distro, is magpie's folder there
	// (wslStoreRel) holding one copy of each skill given to the distro's
	// agents, as magpie opens it: each agent gets a link the distro makes
	// to that copy, as it can't follow one to a Windows folder
	// (wsl_skills.go).
	Store string
	// Desktop are Claude Desktop's skills-plugin folders, one for each
	// account (desktop_skills.go): each gets a copy of the skills and their
	// entries in its manifest.json. Skills is the first one's skills.
	Desktop []string
	// Settings is Claude Code's settings.json, whose permissions.deny
	// leaves out the tools of a server turned off (mcp_tools_off.go)
	Settings string
	// Gone is an agent no longer installed here that still has what magpie
	// gave it (held): a sync only takes things out of it, as they are
	// unticked, and gives it nothing.
	Gone bool
	// SharedToo is an agent that reads ~/.agents/skills besides its own
	// folder only from some version on (Pi, omp: sharedSince), with that
	// version here; the others that always do are in readsShared
	SharedToo bool
	// Profile says the instructions file is the user's profile to the
	// agent, not instructions alone (Alma's USER.md): magpie adds its part
	// after the user's, but never moves the user's own lines out of it
	// (ImportInstructions), as the agent reads who its owner is there.
	Profile bool
	// Unreached, for an agent in a WSL distro, is why its folder there
	// can't be opened (agent.WSLOpen): a link the distro couldn't
	// resolve. Nothing is written to it; each sync says so.
	Unreached error
}

Target is where one agent keeps each of the three: an empty path is something it has no user-wide place for.

func Targets

func Targets() []*Target

Targets are the agents on this machine that magpie can give any of the three to, in the order the rest of magpie lists them.

type Tool added in v0.1.1179

type Tool struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

Tool is one tool a server listed: its name, and the first paragraph of its description, cut short.

type View

type View struct {
	Agents  []AgentView  `json:"agents"`
	Servers []ServerView `json:"servers"`
	// Hooks are the library's hooks, and HookAgents what each agent on
	// this computer can take of them (hooks.go)
	Hooks      []HookView      `json:"hooks"`
	HookAgents []HookAgentView `json:"hookAgents"`
	// Env are the library's variables, and EnvAgents what each agent on
	// this computer can take of them (env.go)
	Env       []EnvView      `json:"env"`
	EnvAgents []EnvAgentView `json:"envAgents"`
	// Subagents are the library's subagents, and SubagentAgents what
	// each agent on this computer makes of them (subagents.go)
	Subagents      []SubagentView      `json:"subagents"`
	SubagentAgents []SubagentAgentView `json:"subagentAgents"`
	// Commands are the library's slash commands, and CommandAgents what
	// the agents that can take them do with them
	Commands      []CommandView      `json:"commands"`
	CommandAgents []CommandAgentView `json:"commandAgents"`
	FoundServers  []Found            `json:"foundServers"`
	// Plugins are the plugins kept as one item each (plugin.go)
	Plugins     []PluginView `json:"plugins"`
	Skills      []SkillView  `json:"skills"`
	FoundSkills []FoundSkill `json:"foundSkills"`
	// NewSkills are skills a check found its skills' repositories, or
	// the folders they were added from, to have beside them since, to
	// add or set aside
	NewSkills []NewSkill `json:"newSkills"`
	// CheckFolders is whether a check looks in folders the user added
	// skills from, which the page then offers with no remote skill
	CheckFolders bool              `json:"checkFolders,omitempty"`
	Projects     []ProjectView     `json:"projects"`
	Instructions *InstructionsView `json:"instructions"`
	Dir          string            `json:"dir"`
	Backups      string            `json:"backups"`
	SkillGroups  []SkillGroup      `json:"skillGroups"`
	CopySkills   bool              `json:"copySkills"` // the library gives skills as copies (#896)
	// SharedSkills: every skill on here is in ~/.agents/skills too
	// (skills_shared.go), at SharedDir
	SharedSkills bool   `json:"sharedSkills"`
	SharedDir    string `json:"sharedDir"`
	// AutoUpdateSkills: the skills from GitHub and git repositories are
	// updated by themselves (skill_autoupdate.go)
	AutoUpdateSkills bool `json:"autoUpdateSkills"`
	// MCPHub: the agents are given magpie's one MCP server in place of
	// the library's (#2679), at HubPath<agent> on the gateway
	MCPHub  bool   `json:"mcpHub"`
	HubPath string `json:"hubPath"`
	// SkillRouter: the agents are given magpie's one skill, magpie-skills,
	// listing their skills in place of a link of each (skill_router.go)
	SkillRouter bool `json:"skillRouter"`
	// HubNote is what the router says of itself to the agents (settings'
	// RouterNote), and HubName what it says with none: this computer's
	// name, to an agent on another computer (gateway.hubWhere)
	HubNote string `json:"hubNote"`
	HubName string `json:"hubName"`
	// HubAllTools: every agent is given the router's tools whole, none on
	// demand (settings' RouterAllTools, gateway.hubOnDemand)
	HubAllTools bool `json:"hubAllTools"`
	// CheckDue is set when the skills from GitHub weren't checked for
	// updates since magpie started, or not for a while: the page checks
	// them as it shows them (#1449)
	CheckDue bool `json:"checkDue,omitempty"`
	// Partial is a glance (Glance): FoundSkills and each skill's Behind
	// aren't read yet
	Partial bool `json:"partial,omitempty"`
}

View is the Library page.

func Glance added in v0.1.1163

func Glance(problems []Problem) (*View, error)

Glance is the page but for what takes reading the agents' skill folders through: the skills the agents have of their own, and which copies are out of date (Partial). The page shows it at once, and Read's after it (0day404, #541): on a machine with many big skills in many agents, that part can take minutes the first time.

func Read

func Read(problems []Problem) (*View, error)

Read is the whole page: the library, and what's found in the agents. problems are those of the last change, for the page to keep showing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL