slimdex — an MCP server that reduces token usage and has several useful tools #832
Siddhukaushik
started this conversation in
Show and tell
Replies: 1 comment
|
That built-in-tool gravity is probably the most useful result here. I would separate “bytes avoided before the first correct edit” from total session savings; otherwise retrieval quality and the model’s willingness to obey MCP instructions get mixed together. Did the 15-tool lean profile change tool selection at all, or only schema overhead? |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I kept watching agents burn context on the same thing: to change one function, read the whole file. Then pay for that file again on every later turn, because the conversation is re-sent each time.
slimdex is a local MCP server — 30 tools — that tries to make the narrow path the easy one. Instead of a file-reading tool, it exposes retrieval shaped like the questions agents actually ask.
Finding things without opening files
find_definition,find_references,search_symbols(fuzzy, ranked exact→prefix→substring→subsequence), andsearch_codeall answer inpath:line:colrather than file contents.search_intenthandles the case where you know what the code does but not what it's called — BM25 ranking over symbols, no embeddings, no external service.context_packbundles a whole topic — ranked symbols, how they connect, and the top bodies under a token budget — into one call, instead of ten calls that each get re-costed on every subsequent turn.Reading narrowly, and actually following through
get_file_skeletonreturns signatures with bodies elided and nesting preserved, thenget_symbol_context names:[...]pulls only the bodies that turned out to matter — several in a single call. On a 6,200-line, 313 KB file this was ~34,000 chars across 8 calls versus 3–4 forced full reads (~78–85k tokens). The bug's diagnosis was visible in the skeleton's signatures before a single body was opened.A repeat
read_lines/outline_fileon an unchanged file answers with a pointer to the earlier call instead of the body — the same file doesn't get bought twice.Knowing what a change breaks, before making it
This is the part I use most and mentioned least. Before touching a symbol:
dep_graph—imports/dependents, BFS to a given depth, or a Mermaid diagram of the neighbourhoodget_context— opt-in definition / signature / callers / imports / dependents, budgetedfind_tests— which references live in test files, so you run only the covering tests, or see that none cover it and treat that as riskchanged_files— which symbols a dirty tree's hunks actually land inEditing without re-sending the code
replace_symbolrewrites a function or method addressed by name, so the old body is never re-sent purely so a tool can locate the edit. Output tokens cost roughly 4–5× input, so this is where the money is — and the leak is otherwise invisible, because the expensive path still produces a correct edit.statsreports read follow-through and write discipline explicitly:External edits are inferred from content hashes moving between
index_reporuns, so that number is honest about its limits: it sees that bytes changed, never which tool changed them.Across sessions, not just within one
briefopens a session with a repo summary, journal-derived focus, and saved conclusions checked against the live index (✓ live / ⚠ maybe stale).recapreconstructs what prior sessions did from the tool-call journal even if nothing was explicitly saved.memory_save/search/list/deletepersist conclusions;digest_save/digest_getstore an architecture cheat-sheet with a per-file freshness verdict. A long session compounds roughly quadratically, so the real fix is ending it and starting informed — that only works if the next session can pick up what the last one learned.The uncomfortable part: advice loses to reflex
The retrieval guidance ships in the server's MCP
instructionsrather than a README nobody injects. It still wasn't enough. Three audit sessions read "usereplace_symbol" on every turn and reached for the built-inEditanyway — the built-ins are shorter, always present, and heavily represented in training.Nothing inside slimdex can fix that, because MCP is additive: a server exposes tools, it cannot wrap or replace a client's built-in
Read/Edit/Write, and there's no capability negotiation where a server registers as the implementation of editing. So there's an optionalPreToolUsehook (install_hook) that sits where the deciding signals actually exist at call time — how much old code you're about to re-send, and whether a definition covers it. Claude Code only; other clients have no equivalent, so it's one client's integration, not a universal fix.Numbers, with the caveats attached
Self-measured on my own repos: ~55–60% on navigation-heavy work, ~45% on output-heavy work, ~50% averaged. The single-giant-file case above hit 85–90% on exploration specifically. The scaling law seems to be that the saving tracks how much irrelevant code the naive path would have dragged in — one huge file is the best case, a repo of tiny files roughly breaks even.
These are single sessions, self-measured, no repetitions or variance, and
statscounts characters rather than tokens (÷3.5–4). Not a benchmark. Parsing is regex-based rather than tree-sitter, which is a real limitation and the README says where it breaks down. There's also aleanprofile that advertises 15 tools instead of 30, because the tool schemas themselves are re-sent every turn.Registry:
io.github.Siddhukaushik/slimdex-mcp· npm:slimdex-mcp· MITI'd be curious whether the narrow-retrieval framing holds up on codebases larger than the ones I've tested against, and where it falls over.
All reactions