Repository navigation
Darling and Lite's MCP server instructions drop from ~86KB/52KB to under 8KB each (#3898) - #4039
Merged
Merged
Conversation
…l suite reported) Instructions and tool-description cuts plus the two new instructions-budget tests, as lane L left them. Unverified: its final full Darling run never reported. A later lane or the coordinator finishes, verifies and opens the PR. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GdmA4ND1wLSqA91ax1m4xv
The prior WIP commit trimmed the MCP server instructions correctly, but left two unrelated defects behind: - Lite/Mcp/McpMemoryTools.cs: get_memory_pressure_events's own description pointed to the "Interpreting Memory Pressure Events" section of the server instructions for "actionable interpretation and suggested follow-up tools" - a section this same phase renamed and gutted. Inlined the follow-up-tool guidance (get_memory_grants / get_memory_clerks for process pressure, get_server_properties for system-only pressure) directly into the tool's own description instead, matching Darling's get_memory_pressure_events, which never pointed at the instructions to begin with. - Lite.Tests/McpDescriptionTruthPinTests.cs: the WIP rewrote GetCpuUtilization_NamesBothSourceCadences_AndNotAFifteenSecondRingBuffer to expect an inline `note = "..."` literal in each SKU's own get_cpu_utilization body. Both SKUs still build that payload through the shared TrendPayloads.CpuUtilization/CpuCadenceNote (#3960), so the rewritten pin failed against current, unmodified production code on both SKUs. Reverted to the original assertion, which reads the one shared constant. - Darling/Darling.Tests/DarlingMcpDataToolsTests.cs: the WIP's ServerListSql_EnabledServers_WithLastCollection assertion had reverted from #3976's LEFT JOIN LATERAL freshness probe back to a stale MAX(cl.collection_time) expectation, unrelated to #3898. Production code was never touched and still uses the LATERAL probe; restored the matching assertions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GdmA4ND1wLSqA91ax1m4xv
erikdarlingdata
marked this pull request as ready for review
September 23, 2026 13:32
This was referenced Sep 23, 2026
erikdarlingdata
added a commit
that referenced
this pull request
Sep 23, 2026
…ntries in their sections (#4080) Adds 42 entries and 42 link refs (#3992, #3995, #3996, #3998, #4001, #4002, #4003, #4007, #4010, #4011, #4013, #4015, #4020, #4022, #4025, #4029, #4030, #4031, #4036, #4038, #4039, #4040, #4044, #4047, #4048, #4049, #4050, #4051, #4055, #4061, #4063, #4064, #4065, #4066, #4067, #4068, #4069, #4070, #4071, #4073, #4074, #4078). Each PR's entry was buffered, and this lands every entry whose PR was merged on origin/dev when it ran. #3989 left 26 entries under bare 'Changed' and 'Fixed' lines above '### Added'. They move into '### Changed' and '### Fixed', below the new entries, and one blank line stays under [Unreleased]. Claude-Session: https://claude.ai/code/session_01Ua31ugERL5DmhFVRtf6keQ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Refs #3898.
Why
#3898 measured the MCP surface at ~100k tokens of context before the first call: 336 KB of
tools/list(157 tools) plus 86 KB of server instructions. Erik's ruling adopted D1-D10; Phase 2 is the core-instructions
cut (D5): the instructions drop their per-tool "Tool Reference" tables and prose, because a tool's own
description in
tools/listis the authoritative surface for what it does and what it takes, and nothingenforced that a duplicated copy in the instructions stayed in sync with it (#3696, #3821 both drifted). D6
requires Lite to move in lockstep with Darling, no Lite-only profile.
A previous lane (WIP on this branch, commit
77b48e0d) did the bulk of this work and stopped at its deadlinebefore its full suite reported. This PR merges
origin/dev, verifies the phase against the checklist below,fixes what verification found, and runs both full suites.
What changes
Instructions (
Lite/Mcp/McpInstructions.cs,Darling/.../Mcp/DarlingMcpInstructions.cs): the per-familyMarkdown tables and prose (wait-type-to-tool mapping, tool relationships, the numbered "Recommended Workflow",
per-tool descriptions) are gone. What stays: the read-only preamble, the collection-cadence note, a one-line
tool census, the
statusenvelope vocabulary (empty/unavailable/not_collected/precondition/error/invalid), theas_of/hours_backanchor rule, and a short "Workflow" arrow-chain. Darling additionally keeps itsPostgreSQL-wait-instrument-tiers paragraph and the partial-update reminder for
update_alert_settings/update_mute_rule/ Custom Views (no Lite equivalent tools exist, so no parity gap).Content-reachability verification (the main risk in this phase). I checked every removed block against
where its content had to end up, per file:
get_collection_health'sanalysis_caveatsclause -> moved into the tool's own description(
DarlingMcpDataTools.cs/Lite/Mcp/McpHealthTools.cs), pin updated(
CollectionCaveatLedgerTests.BothDescriptions_CarryTheAnalysisCaveatsClause_WithoutASplice).get_ag_health's per-replica-column trap (operational_state/recovery_healthLOCAL-only,connected_stateprimary-only) -> moved intoDarlingMcpAgTools.cs's own description, pin updated(
DarlingMcpAgToolsSurfaceTests).get_blocking/get_deadlocks/get_deadlock_detail'sdedup_keydisplay-name scoping -> moved onto theparameter's own
[Description], pin updated (DarlingMcpBlockingToolsTests).get_sweep_reports's mute semantics / "at most one daily rollup" cadence fact -> moved intoDarlingMcpFleetSweepTools.cs's description, pin updated.get_query_store_clutter's capture-mode facts -> moved intoDarlingMcpQueryStoreClutterTools.cs, pinupdated.
add_servers/remove_server/mute_analysis_finding/compare_analysis/the plan tools'create_statementcaveat -> each was already fully stated in the tool's own description; the instructions row was pure
duplication, safe to cut outright. Pins updated to check only the description.
replacement. These are discovery/workflow shortcuts, not facts a tool needs to be used correctly, and
cutting them matches the design intent (D5's "one-line census, not a re-description"). Judgment call, flagged
for the coordinator.
Found and fixed in this PR (not in the WIP's original diff):
get_memory_pressure_eventshad a dangling pointer. Lite's tool description ended with "...see the'Interpreting Memory Pressure Events' section of the server instructions" for "actionable interpretation and
suggested follow-up tools" - but this same phase renamed that section to "Memory pressure signals" and
deleted the per-signal follow-up-tool tables and the "Patterns" section it promised. Darling's twin
(
DarlingMcpMemoryGrantTools.cs) never had this pointer; its description was already self-contained. Fixedby inlining the follow-up guidance directly into Lite's description (
Lite/Mcp/McpMemoryTools.cs): checkget_memory_grants/get_memory_clerksfor process pressure,get_server_propertiesfor system-onlypressure. No test pinned the old text, so nothing else needed updating.
McpDescriptionTruthPinTests.csrewroteGetCpuUtilization_NamesBothSourceCadences_AndNotAFifteenSecondRingBufferto expect an inlinenote = "..."literal in each SKU's ownget_cpu_utilizationbody. Both SKUs still build that payloadthrough the shared
TrendPayloads.CpuUtilization/CpuCadenceNoteconstant (The rest of the trend family still returns every collection: a week of get_tempdb_trend is 2 MB, get_memory_trend 1.5 MB, get_wait_trend 1.1 MB #3960) - production code wasnever touched, so the rewritten pin failed against both files. Reverted to the original assertion, which
reads the one shared constant.
DarlingMcpDataToolsTests.ServerListSql_EnabledServers_WithLastCollectionhad reverted from list_servers and the viewer's last-collection reads plan every retained collection_log chunk: ~170 ms of cold planning on 19 chunks, several times that at 60 #3976's
LEFT JOIN LATERALfreshness probe back to a staleMAX(cl.collection_time)expectation.
DarlingDataReader.ServerListSqlwas never touched by the WIP and still uses the LATERALprobe; restored the matching assertions.
Root cause for (2) and (3) isn't obvious from the WIP's history (neither file relates to #3898's actual scope);
flagged for the coordinator in case it points at a tooling issue worth a census.
Measured
Instructions, actual runtime
.Length(via reflection against the built assemblies), before =origin/dev,after = this branch:
McpInstructions.Text)DarlingMcpInstructions.Text, no peers)Both are now under D2's 8,000-character instructions budget, pinned by the new
*McpInstructionsBudgetTests. Darling has only 8 characters of headroom - worth flagging for whoevertouches these instructions next (Phase 4's
/corework included).tools/list(this phase's scope is instructions, not tool descriptions, but three tools gained content thatmigrated out of the instructions - blob-to-blob byte size via
git show, so line-ending-neutral):DarlingMcpAgTools.csDarlingMcpFleetSweepTools.csLite/Mcp/McpMemoryTools.csTotal
tools/listgrowth: ~399 bytes across both SKUs combined - negligible against the instructions savings.Tool count is unchanged (Lite 88, Darling 158, 87 shared, 1 Lite-only (
get_blocked_process_reports, whichDarling exposes as
get_blocking) - all verified by direct reflection count, matching the census sentences inboth instructions texts exactly).
Test plan
dotnet build Lite.Tests/Lite.Tests.csproj -c Debug- Build succeeded, 0 Warning(s), 0 Error(s)dotnet build Darling/Darling.Tests/Darling.Tests.csproj -c Debug- Build succeeded, 0 Warning(s), 0 Error(s)McpInstructionsBudgetTests,McpDescriptionTruthPinTests,CompareAnalysisDispersionTests): Total: 9, Failed: 0DarlingMcpInstructionsBudgetTests,AnalysisFactsReadRunsDetectorParityTests,CollectionCaveatLedgerTests,CollectionCaveatLedgerParityTests,DarlingMcpAgToolsSurfaceTests,DarlingMcpBlockingToolsSurfaceAndSqlTests,DarlingMcpDataToolsSurfaceAndSqlTests,DarlingMcpFleetSweepToolsTests,DarlingMcpPlanToolsSurfaceAndSqlTests,DarlingMcpServerAdminToolsSurfaceTests,DarlingMcpToolsTests,DarlingPeerDisclosureTests,QueryStoreClutterTests): Total: 316, Failed: 0, Skipped: 1DarlingMcpAgToolsLivePostgresTests,DarlingMcpBlockingToolsLivePostgresTests,DarlingMcpDataToolsLivePostgresTests,DarlingMcpPlanToolsLivePostgresTests,DarlingMcpServerAdminToolsLivePostgresTests, and the rest of the 613 skipped) - not run against a liverig. Nothing in this PR (the WIP's original diff or my three fixes) touches PostgreSQL-dependent
behavior; every change is instructions text or tool/parameter
[Description]strings plus twotest-assertion reverts against untouched production code. Judged low-risk given the deadline, but
unchecked per the standing orders.
per Erik's ruling, not Phase 2. Not run here; still pending for whoever opens Phase 3.
Issues filed
None. Both defects found during verification were small and in-lane (a dangling doc pointer, two reverted pin
assertions) and are fixed in this PR per the no-deferrals rule.
What the coordinator should double-check
get_memory_pressure_events's description (inlining specific follow-up tools rather than pointingback at the instructions) is a judgment call on wording, not just mechanics - worth a read.
ServerListSql) had nothing to do withThe MCP surface costs ~100k tokens of context before the first call: 157 tools, 336 KB of tools/list, 86 KB of instructions #3898's scope. I couldn't find an obvious mechanism for how they got into this branch; if this pattern shows
up in other lanes' WIP it might be worth a census.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GdmA4ND1wLSqA91ax1m4xv