[Bug] Bridge reconnect re-injects full agent/skill/tool listings, inflating Messages token count per turn

Status Open
Reported on v2.1.241
Maintainer reply None cached
Activity 0 comments · opened Aug 23, 2026

Bug Description
Per-turn bootstrap re-injects full agent/skill/tool listings into "Messages" token count, inflating /context even for trivial turns

Version: Claude Code v2.1.241 (macOS, Ghostty terminal)

Summary
In a session with only 3 trivial user turns (".", "/model sonnet", "/context"), /context reported 102.1k/967k tokens (11%), with 36.9k tokens (3.8%) sitting in the "Messages" category alone — disproportionate for that little real conversation content.

Inspecting the session's raw JSONL (~/.claude/projects/<hash>/<session-id>.jsonl), I found that at least 2 of the 3 turns triggered a full "cold bootstrap" sequence: agent-setting / mode / permission-mode / atis-latch / bridge-session (same bridgeSessionId, format cse_..., lastSequenceNum: 0) / file-history-snapshot, followed by a batch of type: "attachment" entries that resend, in full:

  • deferred_tools_delta (~18 deferred tool names)
  • agent_listing_delta (all ~13 agent type descriptions, including built-ins)
  • mcp_instructions_delta (connected MCP server instructions)
  • skill_listing (all ~39 skill descriptions)

These attachment entries count toward the "Messages" category in /context (not "Skills"/"Custom agents"/"System tools", which stayed small and separate in the same session). Both full bootstraps happened 6 seconds apart, same bridgeSessionId — consistent with reconnecting to the session bridge (possibly tied to cross-session/Remote Control infrastructure) each time the terminal tab regains focus after being backgrounded, even though Remote Control is not explicitly enabled (remoteControlAtStartup is unset/false in my settings.json).

This looks like the same root cause as #50998 ("Repeated context injection via JSONL attachments causes linear token bloat across long sessions") — content stored once in the JSONL but re-transmitted on subsequent turns — but the specific trigger here (bridge-session reconnect on tab-focus, independent of active Remote Control use) doesn't appear to be covered by that issue or by #45419 (/branch context inflation).

Reproduction

  1. Open several interactive claude sessions in separate terminal tabs (tested in Ghostty; not terminal-specific per the CLI docs).
  2. In one tab, send a trivial input (e.g. "."), then switch to another tab and back, then send another trivial input.
  3. Run /context and inspect the "Messages" breakdown, or grep the session's .jsonl for agent_listing_delta / skill_listing / deferred_tools_delta occurrences — each full recurrence indicates a re-send.

Expected: full listings are sent once per session (or reused from a stored value), and subsequent turns only send deltas of what actually changed.
Actual: full listings appear to be resent on bridge reconnect, inflating "Messages" token count without any corresponding growth in real conversation content.

Additional note: checked ~/.claude.json and found replBridgePlaceholders entries per running claude process (with pid/procStart/createdAt), suggesting some baseline bridge registration runs by default per session regardless of whether Remote Control is actively enabled — this might be the actual surface to fix/gate, separate from the Remote Control toggle itself.

Related: #50998, #45419, #42861/#37589 (remoteControlEnabled/remoteControlAtStartup persistence requests — related infra, not the same bug).

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.241
  • Feedback ID: 0559920c-233a-4c4f-8564-c54a36dc08e1

Errors

[]

View original on GitHub ↗