Files
magpie/docs/subsystems
yetone a97c8191bc workbuddy: with the provider left out of the names, a model's id is its name (elis_pina on X)
WorkBuddy's model list read "GLM-5.3:workbuddy/glm-5.3" with Provider in
model names Off. WorkBuddy (5.5.6 renderer, getModelDisplayName) shows
every custom model as "name:id" unless the name is empty or equal to
the id, and magpie wrote the catalog id (provider/model) as the id. So
the provider came back after the colon whatever the names said.

- agent (buddyIDs): for WorkBuddy and WorkBuddy AI under Off or Own,
  each magpie entry in models.json gets the name as its id too, so the
  list shows "GLM-5.3" alone. The catalog id stays when two models
  share a name, when the name is another model's id, when the entries
  point at a magpie on another machine or in WSL, and in On mode.
  A model turned off in WorkBuddy, its default effort and a reply limit
  typed in carry across the change of id: an old id is mapped back
  through every label form (Label, PlainName, the list's name).
- provider.AgentNamed: the catalog id of the one model an agent's list
  names so.
- gateway (namedFor): a request with WorkBuddy's or WorkBuddy AI's key
  for such a name goes to that model before any other resolution, so a
  bare id that another provider serves first is not asked instead. The
  reply keeps the name that was asked for. Other agents' keys are not
  mapped.

Siblings: CodeBuddy Code shares the writer and keeps catalog ids. Its
settings.json names the model by the catalog id (codebuddy.go), and its
CLI picker shows the name alone (no name:id template in its bundle).

What users meet: a change of mode, or of a model's name, changes the
id. WorkBuddy then picks another model for a session that had the old
one, as it does for any model that leaves its list.

Run:
- Unit tests: TestWorkBuddyNamesAreIDsWithoutProvider covers Off, Own,
  back to On, WorkBuddy AI and CodeBuddy. TestWorkBuddyAsksByName uses
  the real handler: a name equal to a bare id that a provider listed
  first serves (hidden from WorkBuddy) reaches the named model, and
  OpenCode's key for the same name does not.
- Broken by hand (on mica), each red:
  - buddyIDs always returning the catalog id: the test sees
    id deepseek/pro under Off.
  - namedFor's mapping skipped: the request went to provider "first".
  - The old-id mapping skipped: Own lost disabled.
- Sandbox HOME, built binary:
  - magpie provider add zai (fake upstream) and magpie workbuddy
    provider magpie wrote "zai/glm-5.3 | GLM-5.3 · Z.ai".
  - magpie model suffix workbuddy off rewrote the file to
    "GLM-5.3 | GLM-5.3".
  - magpie serve on a spare port, then a curl with magpie-workbuddy for
    "GLM-5.2" reached upstream as glm-5.2 (reply model GLM-5.2).
  - WorkBuddy 5.5.6's own CLI (app.asar.unpacked/cli/bin/codebuddy -p
    --model GLM-5.3), with HOME set to the sandbox, answered "pong", and
    upstream saw glm-5.3, streamed.
- Full suite on mote at this tree (go test -count=1 -timeout 45m ./...):
  every package ok (agent 369s, gateway 1062s, provider 230s,
  sessions 254s), log kept whole. The doc line in agent-wiring.md was
  added after the run; no test reads that file. gofmt -l is empty,
  and go vet ./... passes. On mica, GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./..., and the linux nogui and windows
  builds pass.
- That suite ran at base ac0b5c287. The change was then rebased onto
  5211fd3ba (usage currency; no file in common). At the pushed head,
  on mica: go build, go vet of agent, gateway and provider, and
  -run "WorkBuddy|CodeBuddy|AgentSuffix|Labels" in those three
  packages all pass.

Not tried: WorkBuddy's window itself (the name:id rule is read from
its renderer source, not seen on screen), and WorkBuddy AI's app.
2026-11-13 22:49:39 +08:00
..
2026-11-10 03:25:44 +08:00

Subsystem design references

These pages describe current responsibilities, runtime paths, state, and contracts. Start with the subsystem relevant to your task, then follow its source links to verify the implementation you change.

Subsystem Reference
Built-in subscriptions moving to plugins Provider and plugin ownership
Built-in plugins: registry, lifecycle, plugins.yml, presets, settings schemas, the window's kernel (slots, error boundary, kit) Plugin runtime
Plugins that run on the gateway's requests and replies Gateway middleware
Tools that plugins give, offered to every agent as an MCP server Plugin tools
Plugins that await context recall and observe completed replies Asynchronous gateway request hooks
Claude subscription turns across Claude Code runs Claude subscription bridge
How the gateway picks a provider, key or account, and falls back Gateway routing and fallback
Gateway Session Aggregation Gateway Session Aggregation
Connecting an agent's config to the gateway, drift, disconnect, WSL twins Agent wiring
Providers, keys, subscription accounts, refresh and allowance Providers and accounts
Instructions, MCP servers, skills and RTK written into agents Library
One MCP server, magpie, given to every agent in place of the Library's servers MCP router
Memory shared by every agent: the memory MCP server, the digest in instructions, the Memory tab Memory
One skill, magpie-skills, listing the Library's skills in place of each agent's own Skill router
Tray, panel, window, magpie web and the page's JSON API GUI app shell
Encrypted backups and setup synchronization over WebDAV, S3 or GitHub Sync and backup

A subsystem can span several packages or repositories. Its reference describes the behavior those parts provide together; it does not need to list every function.

Maintain a reference

Update the owning reference in the same PR when a change alters a documented responsibility, interface, state transition, runtime path, compatibility rule, or failure behavior. An internal refactor that preserves these contracts does not require a prose change.

Keep each fact in one reference and link to it from agent instructions or other pages. Link to source files and named symbols rather than copying implementation details that change frequently. Explain field meanings and constraints that signatures alone do not express.

For a new reference, include the responsibilities and boundaries, source of truth, main runtime paths, state transitions, important constraints, and existing verification commands. Include failure and compatibility behavior where relevant. Document current behavior separately from proposed changes; the proposal belongs in its issue or PR.

Describe a PR's semantic changes

For each affected subsystem, explain the observable change with its trigger and before/after behavior. Include changes to interfaces, state, compatibility, and failure behavior when relevant. Link the affected reference, implementation, and verification evidence. State when a refactor preserves the documented behavior.

For example, a change to plugin adoption should explain which migration state and account condition trigger it, which implementation handles requests before and after adoption, and which test exercises that transition.

This is an author-provided explanation that a reviewer verifies against the diff and surrounding code. It is not an automatically proven compatibility verdict.

Review a change

  1. Identify the affected subsystem and the actual runtime path, including plugin or built-in ownership.
  2. Compare the claimed before/after behavior with the base and head implementation. Trace relevant callers and state transitions beyond the changed lines.
  3. Check that changed contracts appear in the owning reference and that source links still resolve.
  4. Check that the cited tests or runtime evidence exercise the claimed behavior. Report checks that were not run.

A documentation update alone does not prove the implementation. Existing tests and runtime evidence remain necessary for behavior changes.