explaingit

ashutosh160798/context-scope

24SwiftAudience · developerComplexity · 3/5Setup · hard

TLDR

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.

Mindmap

mindmap
  root((ContextScope))
    How it works
      Local proxy intercept
      Forwards to real API
      SQLite local storage
    Visualizations
      Context window breakdown
      Usage warnings
      Execution graph
      Timeline replay
    Context categories
      System instructions
      Conversation history
      Tool definitions
      Tool outputs
    Setup
      macOS 14 or later
      Build from Xcode 15
      OpenAI-compatible endpoint
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Debug why an AI agent run is consuming too much context by watching the breakdown live as your code runs

USE CASE 2

Catch context overflow before it causes silent truncation by setting up the 70/85/95 percent warnings

USE CASE 3

Replay a completed agent run step by step to understand what the model saw at each decision point

USE CASE 4

Drop ContextScope into any OpenAI-compatible Python or Node.js project by changing just the base URL

Tech stack

SwiftmacOSSQLiteXcode

Getting it running

Difficulty · hard Time to first run · 1h+

Requires macOS 14+, Xcode 15 to build from source, no signed binary or Homebrew install available yet.

No license information was provided in the explanation.

In plain English

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.

Copy-paste prompts

Prompt 1
I'm building a Python AI agent with the OpenAI SDK and I want to use ContextScope to monitor my context window. How do I point my client at the local proxy URL and what do I need to change in my code?
Prompt 2
ContextScope shows my tool definitions are consuming 40 percent of the context. What strategies can I use to reduce tool definition size in my agent?
Prompt 3
How do I build ContextScope from source on macOS using Xcode 15 and run the demo mode without an API key to see what the visualizations look like?
Prompt 4
My agent keeps hitting the context limit unexpectedly. How can I use ContextScope's timeline replay to find which step caused the context to balloon?
Open on GitHub → Explain another repo

← ashutosh160798 on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.