whatisgithub

What is ccswitch-context-guard?

geekchongv/ccswitch-context-guard — explained in plain English

Analysis updated 2026-05-18

4TypeScriptAudience · developerComplexity · 3/5Setup · easy

In one sentence

A local proxy that automatically prevents Claude Code and Claude Desktop from crashing when a conversation gets too long for the model's context limit.

Mindmap

mindmap
  root((CCProxy Agent))
    What it does
      Token budget guarding
      Automatic retry
      Vision to text conversion
    Tech stack
      TypeScript
      Node.js
      Claude CLI
      ccswitch
    Use cases
      Prevent context limit crashes
      Auto retry failed requests
      Monitor proxy via dashboard
    Audience
      Claude Code developers
      ccswitch users

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

What do people build with it?

USE CASE 1

Prevent Claude Code sessions from crashing due to exceeding the context window.

USE CASE 2

Automatically retry a failed request with a safer token budget after a context error.

USE CASE 3

Route images sent to Claude Desktop through a vision model for text only downstream models.

What is it built with?

TypeScriptNode.js

How does it compare?

geekchongv/ccswitch-context-guard0labs-in/vision-linkalfons-fhl/cursor-plan2api
Stars444
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasymoderatemoderate
Complexity3/53/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Ships as a portable Windows EXE and macOS app, running from source needs Node.js.

So what is it?

CCProxy Agent is a small local safety layer that sits between the Claude Code or Claude Desktop AI coding tools and another tool called ccswitch, which routes requests to different underlying AI models. It exists to solve one specific, annoying problem: AI models have a maximum amount of text they can handle in one conversation, called a context window, and when a session gets too long or a request asks for too much output, the model returns an error and the whole session can crash, losing your work. CCProxy Agent quietly checks the size of each outgoing request before it leaves your machine and lowers the requested output length so the total, combined with what you already typed, stays under the model's limit. If an error still slips through, it reads the details from that error message, recalculates a safer limit, and automatically retries the request once instead of making you restart. It also handles a few related problems, such as trimming old tool results that are no longer needed, warning you when a conversation is getting close to its limit, and converting images sent to Claude Desktop into a text description so models that cannot see images can still respond sensibly. You can run it as a ready made Windows executable or a macOS app, both of which create their own local settings file the first time you start them, or you can run it from source code using Node.js. Once running, it briefly changes your Claude CLI or Claude Desktop settings to point at itself, and restores your original settings automatically when you close it. It also includes a small built in web dashboard on your own computer where you can see its status, adjust settings, and watch live logs of what it is doing. This is an independent, community built project, not an official tool from Anthropic or the ccswitch project. It is aimed at developers who already use Claude Code or Claude Desktop with ccswitch and have run into context length crashes, and setup requires comfort with running a background application or, for the source install, basic command line and Node.js use.

Copy-paste prompts

Prompt 1
Help me install CCProxy Agent and connect it to my existing ccswitch setup.
Prompt 2
Explain how CCProxy Agent calculates a safe max_tokens value before sending a request.
Prompt 3
Walk me through configuring the token policy settings in CCProxy Agent's config.json.
Prompt 4
What does CCProxy Agent's vision routing feature do for Claude Desktop image inputs?

Frequently asked questions

What is ccswitch-context-guard?

A local proxy that automatically prevents Claude Code and Claude Desktop from crashing when a conversation gets too long for the model's context limit.

What language is ccswitch-context-guard written in?

Mainly TypeScript. The stack also includes TypeScript, Node.js.

How hard is ccswitch-context-guard to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is ccswitch-context-guard for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.