Skip to content

feat(server): consolidate per-spec triggers into MCP instructions#16

Merged
walkindude merged 2 commits into
masterfrom
chore/instructions-dedup-triggers
May 4, 2026
Merged

feat(server): consolidate per-spec triggers into MCP instructions#16
walkindude merged 2 commits into
masterfrom
chore/instructions-dedup-triggers

Conversation

@walkindude
Copy link
Copy Markdown
Owner

Summary

  • Per-tool descriptions duplicated the same spec-level USE THIS TOOL / DO NOT USE block once per command. With 12 commands on the gosymdb spec, ~8KB of pure repetition rode in every tool schema.
  • Move the routing guidance into the MCP server's top-level instructions field, with one section per loaded spec. Per-tool descriptions carry only command.description.
  • No spec format change — triggers stays at the top of CliToolSpec. Existing specs on disk work unchanged.

Measured impact

Probed the new build's stdio output against the gosymdb spec (12 tools):

chars tokens (cl100k)
Old: tool schemas + instructions ~19,968 ~4,817
New: tool schemas + instructions 12,823 3,279
Savings −7,145 −1,538 (~32%)

Scales linearly with commands-per-spec, so multi-spec setups benefit proportionally more.

Test plan

  • pnpm run typecheck clean
  • pnpm run lint — only pre-existing schema.ts complexity warnings, untouched here
  • pnpm test — 187/187 pass
  • pnpm run test:coverage — 93.55% statements (above 90% target)
  • pnpm run build clean
  • pnpm run check:versions ok at 0.1.3
  • Probed the built dist/cli-bridge.js against the local gosymdb spec via stdio: confirmed instructions carries the per-spec ## gosymdb (gosymdb_index, …) section and tool descriptions no longer contain USE THIS TOOL.
  • Fresh Claude Code session inside /Users/steve/src/cfgee (which has alwaysLoad: true for cli-bridge) — verify gosymdb_* tools appear at session start and the model reaches for them on Go-codebase tasks.

🤖 Generated with Claude Code

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>
@walkindude walkindude merged commit 5a58c8d into master May 4, 2026
11 checks passed
@walkindude walkindude deleted the chore/instructions-dedup-triggers branch May 4, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant