Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
fix(tools): key codebase-memory-mcp assets by platform, not upstream naming (#3432)
M Barryd62a3c4ad0be
diff --git a/headroom/tools.json b/headroom/tools.jsonindex de5affb36..84826bdc4 100644--- a/headroom/tools.json+++ b/headroom/tools.json@@ -103,27 +103,45 @@"version": "v0.8.1","binary": "codebase-memory-mcp","source": "DeusData/codebase-memory-mcp",- "_comment": "No Windows build published for v0.8.1.",+ "_comment": "Upstream names its assets arm64/amd64; the registry keys them by PlatformKey.key(), i.e. aarch64/x86_64.","assets": {- "darwin-arm64": {- "url": "https://github.com/DeusData/codebase-memory-mcp/releases/download/v0.8.1/codebase-memory-mcp-darwin-arm64.tar.gz",+ "linux-x86_64-gnu": {+ "url": "https://github.com/DeusData/codebase-memory-mcp/releases/download/v0.8.1/codebase-memory-mcp-linux-amd64.tar.gz","member": "codebase-memory-mcp",- "sha256": "fbd047509852021b5446a11141bcb0a3d1dcaebf6e5112460960f29f052c1c58"+ "sha256": "dbd3b92ea870ef240b63059f26bda15015f76ef9978931bebc3a0f9d09470973"},- "darwin-amd64": {- "url": "https://github.com/DeusData/codebase-memory-mcp/releases/download/v0.8.1/codebase-memory-mcp-darwin-amd64.tar.gz",+ "linux-x86_64-musl": {+ "url": "https://github.com/DeusData/codebase-memory-mcp/releases/download/v0.8.1/codebase-memory-mcp-linux-amd64-portable.tar.gz","member": "codebase-memory-mcp",- "sha256": "fb62da3016ea12b948351208759b5c083fb1446cf6e78d6db8b7cd28fe86fd54"+ "sha256": "6ab87a6c05d049dde57700803ca0ab4199fcf25973a0606618af0fcee73f5abd",+ "_comment": "upstream publishes a separate -portable build of this release; used for musl, where the standard (glibc-linked) linux asset is not expected to run. Not yet run on a musl host."},- "linux-arm64": {+ "linux-aarch64-gnu": {"url": "https://github.com/DeusData/codebase-memory-mcp/releases/download/v0.8.1/codebase-memory-mcp-linux-arm64.tar.gz","member": "codebase-memory-mcp","sha256": "d2f842d1365da5c35d9c5796f57a821c9745267350994346735e1e6e04d46091"},- "linux-amd64": {- "url": "https://github.com/DeusData/codebase-memory-mcp/releases/download/v0.8.1/codebase-memory-mcp-linux-amd64.tar.gz",+ "linux-aarch64-musl": {+ "url": "https://github.com/DeusData/codebase-memory-mcp/releases/download/v0.8.1/codebase-memory-mcp-linux-arm64-portable.tar.gz","member": "codebase-memory-mcp",- "sha256": "dbd3b92ea870ef240b63059f26bda15015f76ef9978931bebc3a0f9d09470973"+ "sha256": "13526acc2a6a0697dff3c763fb443a416589bc10ad8b12015b63d87e515dd72b",+ "_comment": "upstream publishes a separate -portable build of this release; used for musl, where the standard (glibc-linked) linux asset is not expected to run. Not yet run on a musl host."+ },+ "darwin-x86_64": {+ "url": "https://github.com/DeusData/codebase-memory-mcp/releases/download/v0.8.1/codebase-memory-mcp-darwin-amd64.tar.gz",+ "member": "codebase-memory-mcp",+ "sha256": "fb62da3016ea12b948351208759b5c083fb1446cf6e78d6db8b7cd28fe86fd54"+ },+ "darwin-aarch64": {+ "url": "https://github.com/DeusData/codebase-memory-mcp/releases/download/v0.8.1/codebase-memory-mcp-darwin-arm64.tar.gz",+ "member": "codebase-memory-mcp",+ "sha256": "fbd047509852021b5446a11141bcb0a3d1dcaebf6e5112460960f29f052c1c58"+ },+ "windows-x86_64": {+ "url": "https://github.com/DeusData/codebase-memory-mcp/releases/download/v0.8.1/codebase-memory-mcp-windows-amd64.zip",+ "member": "codebase-memory-mcp.exe",+ "sha256": "a602ad090ed3f49d86c55472f73f27ad7055222806a82358f2e08513e027f00f",+ "_comment": "member name follows the difft/scc convention for the windows zip; not yet extracted on a windows host."}}}diff --git a/tests/test_binaries.py b/tests/test_binaries.pyindex db7d48992..4d32a05fb 100644--- a/tests/test_binaries.py+++ b/tests/test_binaries.py@@ -382,3 +382,55 @@ def test_status_reports_every_registered_tool(monkeypatch):assert {"difft", "scc", "ast-grep"} <= namesfor r in rows:assert r["state"] in ("on-path", "cached", "missing", "unsupported-platform")+++# -------- Registry key hygiene ------------------------------------------- #+++def _all_platform_keys() -> set[str]:+ """Every key `PlatformKey.key()` can emit — the only keys a lookup can hit."""+ keys = set()+ for os_ in ("linux", "darwin", "windows"):+ for arch in ("x86_64", "aarch64"):+ libcs = ("gnu", "musl") if os_ == "linux" else ("n/a",)+ for libc in libcs:+ keys.add(binaries.PlatformKey(os_, arch, libc).key())+ return keys+++def test_every_registry_asset_key_is_reachable():+ """Guard against assets filed under a key no platform can produce.++ `_asset_for_platform` does a plain dict lookup on `PlatformKey.key()`, so an+ asset keyed in some upstream project's own naming (`darwin-arm64` rather than+ `darwin-aarch64`) is dead weight: the tool ships a binary and reports+ `unsupported-platform` anyway, on every machine.+ """+ valid = _all_platform_keys()+ for tool, entry in binaries._registry()["tools"].items():+ for key in entry.get("assets", {}):+ assert key in valid, (+ f"{tool}: asset key {key!r} is unreachable; expected one of {sorted(valid)}"+ )+++def test_asset_lookup_matches_declared_platforms():+ """For every real platform, a tool resolves iff it declares that platform.++ Builds the PlatformKey from the platform axes rather than by parsing the+ registry key, so a mis-keyed asset cannot make this pass by round-tripping.+ """+ for tool, entry in binaries._registry()["tools"].items():+ if binaries._is_pypi_tool(tool):+ continue+ assets = entry.get("assets", {})+ for os_ in ("linux", "darwin", "windows"):+ for arch in ("x86_64", "aarch64"):+ for libc in ("gnu", "musl") if os_ == "linux" else ("n/a",):+ plat = binaries.PlatformKey(os_, arch, libc)+ declared = assets.get(plat.key())+ if declared is None:+ with pytest.raises(binaries.PlatformNotSupported):+ binaries._asset_for_platform(tool, plat)+ else:+ assert binaries._asset_for_platform(tool, plat) is declared