Every bridge run started Claude Code with
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 (there since the bridge's
first commit, 702477525, not added for #5582). With it, or
DISABLE_TELEMETRY or DO_NOT_TRACK, Claude Code 2.1.316 reads none of its
GrowthBook flags (its privacy level must be "default"), and Message
Threads are on by one of them, tengu_curious_tower. So every turn sent
the whole history again, every image in it (#4496's slow turns).
A turn's run (claudeRunEnv) now leaves the quiet variables out, so Claude
Code reads the account's own flags as a plain claude does. Updates and
error reports stay off (DISABLE_AUTOUPDATER, DISABLE_ERROR_REPORTING,
which the flags don't need). A quiet variable the user set, in magpie's
environment or in their Claude Code's settings.json env, is passed as
they set it (their telemetry choice; the run reads no settings of its
own). WSL runs get DO_NOT_TRACK too. The one-off runs (model test,
warm-up, /usage) keep the switch: no history, and an interactive one
would send probeQuotaStatus's request as it starts (#5582).
The issue's patch set CLAUDE_CODE_TETHER_LIVE=1 instead. Not taken: in
2.1.316 that variable wins over the account's flag (ryr(): the env value
is returned before tengu_curious_tower is read), so it would turn threads
on for accounts Anthropic hasn't given them, or has turned them off for.
Here nothing is forced; an account without the flag goes whole, as its
own claude does. Nothing of magpie's sends a request; CLAUDE_CODE_ENTRYPOINT
is untouched.
Run:
- Real Team account (sandbox CLAUDE_CONFIG_DIR + HOME, the keychain item
copied to the sandbox's name and deleted after, token not rotated),
claude 2.1.316 -p stream-json, haiku, one process, a 3 MB noise PNG then
three text turns, bytes to api.anthropic.com per turn through a
counting CONNECT proxy:
magpie's old env (NONESSENTIAL=1): 672, 667, 667, 668 KB
this env (no quiet vars, updater + errors off): 737, 6.3, 2.6, 2.6 KB
Turn 4 answered the codeword from turn 1 both times. The fresh config
had no cached flags; after the run it had 1223, tengu_curious_tower true.
Other traffic with this env: one connection to Datadog's log intake
(1.5 KB), Claude Code's own.
- go test -count=1 -run 'Claude|WSL|Warm|Usage' ./internal/gateway on mote:
ok (139s). The full package queued behind ten suites on mote's lock
and was not run before the tag; the full suite runs after it.
- TestClaudeRunReadsItsFlags: red with the run back on cleanClaudeEnvTTL
(3 of its 4 cases; the one where magpie's env sets them passes on both), green with it.
- gofmt; go vet darwin, linux (nogui), windows of internal/gateway.
Not tried: a run through a sandbox magpie end to end, the interactive
(TUI) mode with a real account (an image turn runs as -p anyway), WSL, an
account whose flag is off.
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
- 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.