Files
magpie/docs/subsystems
yetone df2b819c67 library: Antigravity and Crush get copies of skills on Windows (#6610, #5107)
On Windows without the right to make a symlink, magpie links a skill with
a junction. Go 1.23+ lists a junction as ModeIrregular, neither a folder
nor a symlink, and Antigravity (the app and agy: customizations'
discoverInSubDirsFiltered) and Crush (internal/skills on fastwalk, which
follows only a ModeSymlink) keep only folders and symlinks, so a
junctioned skill never showed in them. dsh, pi and the other Node, Bun,
Rust and Python agents follow a junction.

Checked against the real apps on xiaomi-gpu (Windows 11) in a sandbox
USERPROFILE: Antigravity 2.30.0's language_server.exe (--standalone)
GetAllSkills lists a skill in a folder and one behind a symlink, not one
behind a junction. crush v0.101.0's `crush run` request to a local
capture server listed the folder and the symlink, not the junction. On
macOS agy 1.5.8 (ACP session/new, available_commands_update) takes a
symlink that leads out of ~/.gemini/config, so #6610's "confined to the
folder" filter doesn't touch magpie's links there.

- junctionBlind (agy, antigravity, crush) and skipsJunctions: on Windows
  these targets have Copy, so they get marked copies, made again when
  the library's changes, and the Library page shows "Only ever takes
  copies" for them. A junction an older magpie made becomes a copy.
- inShared: a link in ~/.agents/skills is no skill to them, so Crush,
  which reads that folder too, gets its own copy.
- A project's .agents/skills entry that one of them reads is a copy
  (syncFolder's per-entry flag); one no such agent reads is a link again.
- takeEdits takes an edit made in a project's copy into the library, as
  one in an agent's copy is, so a copy a user edits isn't undone by the
  next sync (Project.Copy's copies too, which were made again over an
  edit before).
- behind lists these agents' stale copies.

Run:
- go vet ./internal/library, GOOS=windows and GOOS=linux go vet, gofmt -l:
  clean (mote).
- go test -count=1 ./internal/library: ok on mote (macOS) 107.9s and on
  xiaomi-gpu (Windows 11) 440.0s, at this change on 0caa09b3d.
- go test -run JunctionBlind ./internal/library: ok on mote and on the
  Windows box (-v: all four new tests PASS, TestJunctionIsALink too).
- After rebasing on be7d22edd: go test ./internal/library on mote, ok.

Broken by hand:
- Without `t.Copy = skipsJunctions(a.ID)`, the inShared check and the
  project per-entry copy: TestJunctionBlindAgentsGetCopies,
  ...AgentSkipsSharedLink and ...ProjectCopies red on mote; on Windows
  TestJunctionBlindJunctionBecomesCopy red (both entries stay junctions,
  Lstat mode 2684354563 attrs, not a dir).
- Without the project loop in takeEdits: TestJunctionBlindProjectCopies
  red, the user's edit replaced by the library's.

Not tried: magpie's own binary syncing a real Antigravity on Windows end
to end (the apps were checked against a folder, a symlink and a junction
made by hand; magpie's copy is a plain folder, which the test checks a Go
ReadDir sees as one). Antigravity and Crush on Linux (symlinks there,
which both take). The full go test ./... suite.
2026-11-14 15:05:21 +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.