perf(edge-worker): load only essential MCP tools at session start to cut Linear startup latency - #1369
Open
TropicalDog17 wants to merge 2 commits into
Open
perf(edge-worker): load only essential MCP tools at session start to cut Linear startup latency#1369TropicalDog17 wants to merge 2 commits into
TropicalDog17 wants to merge 2 commits into
Conversation
…-startup latency The official Linear MCP registers ~50 verbose tools whose combined descriptions alone exceed the Claude Agent SDK's ~10%-of-context threshold, silently enabling MCP tool-search auto mode. That deferred every MCP tool — including Cyrus's own local ones — behind an on-demand ToolSearch, so turn 1 stalled on remote round-trips before the agent could act on the issue. Mark the small, local cyrus-tools and cyrus-docs servers alwaysLoad so they're exempt from the auto-defer bucket, while leaving the large remote Linear catalog deferred (its 50 tools would otherwise bloat turn-1 context; the issue essentials are already injected into the prompt).
Author
|
Hi can you review for me @Connoropolous |
TropicalDog17
pushed a commit
to TropicalDog17/cyrus
that referenced
this pull request
Jul 18, 2026
…ream gh pr create defaults a fork's PR to the upstream parent repo, which silently opened PRs on cyrusagents/cyrus (e.g. cyrusagents#1376, cyrusagents#1369). Derive the target from origin via --repo/--head so the PR always lands on the fork. Claude-Session: https://claude.ai/code/session_01Y7j2xZhmHbNhMRq6665PXy
TropicalDog17
added a commit
to TropicalDog17/cyrus
that referenced
this pull request
Jul 18, 2026
…ream (#50) gh pr create defaults a fork's PR to the upstream parent repo, which silently opened PRs on cyrusagents/cyrus (e.g. cyrusagents#1376, cyrusagents#1369). Derive the target from origin via --repo/--head so the PR always lands on the fork. Claude-Session: https://claude.ai/code/session_01Y7j2xZhmHbNhMRq6665PXy Co-authored-by: tropicaldog17 <tropicaldog17aa@gmail.com>
Contributor
|
have you verified that this has the intended effect? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a session starts, the agent often spends close to a minute running tool-search round-trips against Linear's remote MCP server before it can read or update the issue — a visible stall at the top of every session.
Root cause: the official Linear MCP (
mcp.linear.app) registers ~50 verbose tools. Their combined tool descriptions on their own push past the Claude Agent SDK's ~10%-of-context threshold, which silently flips the SDK into MCP tool-search auto mode. In that mode every MCP tool — including Cyrus's own local ones — is deferred behind an on-demandToolSearch. Because the Linear server is remote, discovering those deferred schemas costs real network round-trips, so turn 1 stalls before the agent can do anything with the issue.Fix
Load only the essential, local tools into turn-1 context; defer the large remote catalog.
cyrus-tools,cyrus-docs) withalwaysLoad: true, exempting them from the auto-defer bucket. These are the tools Cyrus's workflow actually depends on (agent-session/feedback management, file uploads, issue relations, docs search) and they're served locally, so there's no round-trip cost and negligible context.linearserver deferred (noalwaysLoad). Its ~50 tools would otherwise bloat turn-1 context, and the issue essentials the agent needs on turn 1 — title, description, state, priority, URL, and comment threads — are already injected into the prompt by the standard session template. The long tail of Linear operations remains reachable on demand viaToolSearchwhen genuinely needed.The SDK only exposes
alwaysLoadper-server (not per-tool for remote HTTP servers), so curating the essentials into always-loaded local servers is the mechanism that satisfies both goals: lean turn-1 context and no startup tool-search stall for the tools Cyrus relies on.Why this is safe
mcp__cyrus-tools/mcp__cyrus-docsare already in the default allowed-tool lists — no permission changes./settings/toolscatalog needs no update.Testing
packages/edge-worker/test/McpConfigService.alwaysLoad.test.ts— assertscyrus-tools/cyrus-docsarealwaysLoad, the remotelinearserver is left deferred, and CLI mode (no Linear client) still always-loadscyrus-docs. All 3 pass.McpConfigServicetypechecks clean and lints clean.Changelog
Added an entry under
## [Unreleased] → ### Changeddescribing the faster session startup.