feat(server): consolidate per-spec triggers into MCP instructions#16
Merged
Conversation
Move USE/DO NOT USE routing guidance from each tool's description into the server's `instructions` field, attached once per loaded spec. Per-tool descriptions now carry only the command's own description, so spec-level triggers aren't paid once per command in every tool schema. Measured against the 12-tool gosymdb spec: 4,817 → 3,279 tokens at session start (~32% reduction). Scales linearly with tools per spec. No spec format change — `triggers` stays at the spec top level. Existing specs on disk work unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 tasks
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.
Summary
USE THIS TOOL/DO NOT USEblock once per command. With 12 commands on the gosymdb spec, ~8KB of pure repetition rode in every tool schema.instructionsfield, with one section per loaded spec. Per-tool descriptions carry onlycommand.description.triggersstays at the top ofCliToolSpec. Existing specs on disk work unchanged.Measured impact
Probed the new build's stdio output against the gosymdb spec (12 tools):
Scales linearly with commands-per-spec, so multi-spec setups benefit proportionally more.
Test plan
pnpm run typecheckcleanpnpm run lint— only pre-existing schema.ts complexity warnings, untouched herepnpm test— 187/187 passpnpm run test:coverage— 93.55% statements (above 90% target)pnpm run buildcleanpnpm run check:versionsok at 0.1.3dist/cli-bridge.jsagainst the local gosymdb spec via stdio: confirmedinstructionscarries the per-spec## gosymdb (gosymdb_index, …)section and tool descriptions no longer containUSE THIS TOOL./Users/steve/src/cfgee(which hasalwaysLoad: truefor cli-bridge) — verify gosymdb_* tools appear at session start and the model reaches for them on Go-codebase tasks.🤖 Generated with Claude Code