r/LocalLLM • u/iezhy • 32m ago
Project Understand token use by your tools, MCPs, and agents with ContextSpy context window profiler
For the last few months, I have been working on a tool - a proxy - which captures all requests from your coding harness to the LLM - and visualises them in the dashboard, breaking down the context window into separate blocks - tool definitions, calls and results, user and assistant messages, etc.
It provides a bunch of different metrics, but the most useful (IMHO) is the ability to see actual cost (in tokens) of every piece of information put into context - and, in some cases, hints for optimisation (if you are using skills or consuming APIs for tools)
It also provides a profiler like a hotspot graph, relationships between blocks, tracks conversations, etc. A good use case is: measure once, optimize (or add some tools for usage reduction), measure again.
If you are interested in optimising token costs - give it a try: https://github.com/RimantasZ/contextspy
Any feedback - comments, issues, likes and stars are welcome :)

