Zhang-Wei (Discord, v0.1.1327) saw every GitHub sync fail with "GitHub sync: HTTP 422: Sorry, your input was too large to process. Consider creating the blob in a local clone of the repository and then pushing it to GitHub." Their exported backup is 50.8 MB; with the library's sync off it works.93b87d000sends a backup as one base64 blob in one POST /git/blobs, so 50.8 MB is about 68 MB of request body. GitHub documents 100 MB per blob (on read) but no request size for creating one; a 19 MB file's Contents PUT (about 25 MB of body) did go through. A backup over 16 MiB (githubPart) now goes up in parts, in the same one commit: magpie.magpie-backup.parts/1, /2, ... beside it, and at the backup's own path a short list (format magpie-backup, version 2, split github-parts, total size, each part's blob SHA and size). The version is the list's blob SHA, and the list names each part by blob SHA, so one version pins one whole set. get() reads the list, downloads each part by that SHA (as large single files already were), checks each part's git blob SHA and the sizes, and returns the backup whole; a list that doesn't add up or a part that isn't the one named is an error. A write removes the parts the list at the head named and the new backup doesn't use, in the same commit (only paths known to be there, so the tree never names a missing path). Blobs already sent are kept across a non-fast-forward retry. The errChanged check at the head, the ref update without force and the three rebuilds are unchanged. Backups up to 16 MiB stay one file; the 64 MiB total (four parts) stays, the bound the library's skill budget is sized for. An empty repository's first backup in parts skips the Contents API and follows the README note commit. Why parts, not compression: the sealed bundle is uncompressed JSON with skill files base64 inside, so compressing would shrink it, but that is a backup format change for every backend and every export, every other computer would need the new magpie even for WebDAV and S3, and it still bounds nothing on GitHub's side. Parts keep the format and touch GitHub only. Older magpies: the list opens in backup.Open (unchanged sinceefbe5660b) as format magpie-backup with no kdf and version 2, so it says "this backup was made by a newer magpie; update magpie to open it" and stops: not ErrCorrupt or ErrNotBackup, so no rebuild over it and no replace offered. A backup in one file, from any magpie, still reads. Library: nothing found that shouldn't be carried, so no second commit. readSkills already skips .git and caps skill files at 32 MiB (about 57 MiB sealed). The skills on this machine (~/.claude/skills, 64 skills, 43 MB; ~/.agents/skills) hold no node_modules, __pycache__ or .venv; the large files are real assets (images). Leaving node_modules out could break a skill that ships its dependencies. Zhang-Wei's folders weren't seen. Tests (fixture only, no network): the fixture refuses a blob POST over 24 MiB with GitHub's text, and serves any blob by SHA. New in github_parts_test.go: TestGitHubSplitBackup (50.8 MB in four parts, one commit, byte for byte back, errNotModified, stale put errChanged, then two parts and back to one file with no part left), TestGitHubOneFileBackupStillReads (old small and 30 MB single files read; parts replace one), TestGitHubPartsOlderMagpie, TestGitHubPartsDamaged, TestGitHubPartsBranchMovedMeanwhile, TestGitHubEmptyRepositoryPartsBackup and TestGitHubSyncLargeLibrary (a ~38 MB instruction text syncs to a second computer through Now). TestGitHubLargeBackup now uses 15 MB, to keep covering one blob over the Contents API's limit. docs/subsystems/sync-backup.md says how parts work and names the tests. Record, at base origin/maine435b8867plus this change (Go 1.26.8, GOMODCACHE/GOCACHE pinned): - gofmt -l internal/davsync: nothing. go vet ./... (darwin): clean. GOOS=linux go vet -tags nogui ./internal/davsync/..., GOOS=windows go vet ./internal/davsync/...: clean. - go test -tags nogui -count=1 ./internal/davsync/... ./internal/settings/... ./internal/cli/... ./internal/backup/... ./internal/library/...: all ok (davsync 58s, settings 30s, cli 47s, backup 8s, library 127s). Red on the old github.go (new tests, a shim for the new names): every new test fails, the split ones with the reporter's 422 text, OlderMagpie with "not a magpie backup" (the old code wrote the backup as is). Broken by hand on the new code, each red: - stale parts kept: TestGitHubSplitBackup - part SHA not checked: TestGitHubPartsDamaged/a_part_changed - blobs sent again on retry: PartsBranchMovedMeanwhile/another_file - version check at the head skipped: SplitBackup, PartsBranchMoved/ the_backup, and the older Remote, LargeBackup, BranchMoved tests - no split (threshold at 64 MiB): SplitBackup, OneFileBackupStillReads, PartsOlderMagpie, PartsDamaged - sizes not added up: PartsDamaged/sizes - list's format "magpie-backup-parts": PartsOlderMagpie - empty repository tries the Contents API first: EmptyRepositoryPartsBackup - list's version 1: OlderMagpie still passes, since old Open also stops on the missing kdf; version 2 is a second guard, not the only one. Not tried: the real GitHub API (no test repository here); the 16 MiB part is chosen under the largest body seen accepted, not a documented limit. The full go test ./... and internal/gui's tests were not run: the disk had under 500 MB free. -race not run; no goroutine was added.
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 |
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
- Identify the affected subsystem and the actual runtime path, including plugin or built-in ownership.
- Compare the claimed before/after behavior with the base and head implementation. Trace relevant callers and state transitions beyond the changed lines.
- Check that changed contracts appear in the owning reference and that source links still resolve.
- 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.