feat(serve): --compress-tools for MCP tool-description byte-budgeted drop#200
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
8 tasks
Delqhi
pushed a commit
that referenced
this pull request
Jun 16, 2026
Adds a ponytail-tag compressor that shrinks the 47 MCP tool descriptions in serve's tools/list manifest, without changing tool names, schemas, or behavior (AGENTS.md §10). Package: cmd/sin-code/internal/mcpcompress/ Rules (5, ponytail tags): delete -> DeleteHedges (pleasantries: safely, carefully, ...) stdlib -> StdlibPatterns ((via stdlib), Go stdlib ...) native -> DropTrimEncouragement (M6 tail clause: Always prefer over native X) yagni -> YagniPatterns ((experimental), (TBD), reserved) shrink -> ShrinkExamples ((e.g. ...), (such as ...)) Flags added to 'sin-code serve': --compress-tools : apply the default full set --compress-tags : comma-separated override (e.g. 'delete,yagni,shrink') --print-stats : per-tool byte-budget table to stderr Byte-stability: Every Rule, the Pipeline, and the post-pipeline Normalize are deterministic and idempotent. The compressor_test.go golden suite is the canonical pin for stable wire bytes -- prerequisite for the system-prompt hash metric (issue #2). Real-world impact (live JSON-RPC smoke test): sin_execute 80 -> 73 bytes (-7, 8.8%) sin_read 200 -> 167 bytes (-33, 16.5%) sin_write 194 -> 160 bytes (-34, 17.5%) sin_edit 474 -> 441 bytes (-33, 7.0%) TOTAL 3977 -> 3870 (-107, 2.7%) 43 other tools uncompressed (no rule matches -> unchanged). AGENTS.md: §6 (new mcpcompress/ pkg), §10 (ponytail tag contract), §8 (v3.19.0 row), header (last verified v3.19.0). CHANGELOG: Unreleased entry with savings table. Verification (gates green): gofmt -l cmd/sin-code/internal/mcpcompress/ clean go build ./... clean go vet ./cmd/sin-code/... clean go test -race -count=1 ./cmd/sin-code/internal/mcpcompress/ PASS go test -race ./cmd/sin-code/internal/ (serve subset) PASS golangci-lint run ./cmd/sin-code/internal/mcpcompress/ 0 issues govulncheck ./cmd/sin-code/internal/mcpcompress/... No vulns gosec -no-fail -fmt sarif ./cmd/sin-code/internal/mcpcompress/ clean python3 scripts/validate_skill.py --all-bundled --strict 34/34 OK
🏆 CEO Audit — A+ (100.0/100)
📥 Download full report (Markdown)
|
🏆 CEO Audit — A+ (100.0/100)
📥 Download full report (Markdown) Run ID:
|
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.
Closes #173
Implements issue #173: add a
--compress-toolsflag tosin-code servethat shrinks the 47 MCP tool descriptions on the wire, without changing tool names, schemas, or behavior.What is new
Package
cmd/sin-code/internal/mcpcompress/— ponytail-tag compressor with five canonical Rules:DeleteHedgesStdlibPatterns(via stdlib)parentheticals;Go stdlib …adjectivesDropTrimEncouragementAlways prefer over native X/Prefer sin_X over native YYagniPatterns(experimental)/(TBD)/(reserved)parentheticalsShrinkExamples(e.g. …)/(such as …)parenthetical examplesThree new serve flags:
--compress-tools— apply default full tag set--compress-tags <csv>— comma-separated override (e.g.delete,yagni,shrink)--print-stats— emit per-tool byte-budget table to stderrByte-stability
Every Rule, the Pipeline, and the post-pipeline Normalize are deterministic and idempotent. The
compressor_test.gogolden suite pins the wire bytes — prerequisite for the system-prompt hash metric (issue #2). Adding the 6th rule is non-breaking; renaming a tag/rule is a major bump (per AGENTS.md §10).Tool-name safety
The 47 MCP tool
Namefields are public API (AGENTS.md §10) and are NEVER modified.CompressSpecasserts this inTestCompressSpec_NameMutable.Live JSON-RPC smoke test (47 tools, default tag set)
43 other tools' descriptions don't match any conservative pattern and stay byte-identical.
Verification
Docs
mcpcompress/package listed(next) → v3.19.0, header bumped to v3.19.0Ponytail tag setsubsection