gitmyhub

context-scope

Swift ★ 29 updated 9d ago

A local-first macOS debugger for LLM context windows, token usage, tool calls, and agent execution.

ContextScope is a macOS app that intercepts your AI API calls locally and shows you a live breakdown of what fills the model's context window, with warnings before you hit limits.

SwiftmacOSSQLiteXcodesetup: hardcomplexity 3/5

ContextScope is a macOS application that lets developers watch exactly what gets sent to an AI language model during a conversation or agent run. It works by acting as a local proxy: you point your existing AI code at a local address on your Mac instead of directly at the API provider, and ContextScope intercepts and visualizes everything that passes through, then forwards the request to the real service. Nothing is sent anywhere except your original request to your model provider.

The main visualization is a live view of the context window as it fills up, broken down by type: system instructions, conversation history, tool definitions, retrieved content, and tool outputs. The tool shows how much of the available context space each category is consuming and fires warnings when usage crosses 70, 85, or 95 percent. Alongside that, there is an execution graph showing the sequence of model calls and tool calls in your agent run, plus a timeline replay feature that lets you scrub back through any completed run to see what the model had in front of it at each step.

Setup requires pointing your code at a local URL. In Python that means passing "http://127.0.0.1:4319/v1" as the base URL to the OpenAI client library; the same works with Node.js or any tool that accepts an OpenAI-compatible endpoint. API keys are stored in the macOS Keychain and are never written to logs or exports. All captured data stays in a local SQLite database on your machine.

The project runs on macOS 14 or later and currently requires building from source using Xcode 15 or later. A demo mode is available without an API key, offering a few pre-recorded scenarios including a healthy request, a bloated context example, and a runaway tool loop.

All features are listed as in development; this is a pre-release project with no signed binary available yet. The README notes that signed releases and a Homebrew install option are planned.

Where it fits