explaingit

yonghaozhao722/cc-sanitizer

Analysis updated 2026-05-18

39TypeScriptAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A CLI tool that fixes a session error in Claude Code caused by switching between third-party and official AI models.

Mindmap

mindmap
  root((CC-Sanitizer))
    What it does
      Fixes signature errors
      Removes unsigned thinking blocks
      Preserves conversation history
    Tech stack
      TypeScript
      Node.js
    Use cases
      Fix broken sessions
      Scan for suspect blocks
      Backup and restore
    Audience
      Claude Code users
    Setup
      Run via npx
      No install required

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

Fix a Claude Code session that broke after switching from a third-party model like GLM or DeepSeek back to an official Anthropic model.

USE CASE 2

Scan your Claude Code project files to check which sessions contain unsigned thinking blocks.

USE CASE 3

Preview and safely strip problematic data from a session file with automatic backup and restore support.

What is it built with?

TypeScriptNode.js

How does it compare?

yonghaozhao722/cc-sanitizerchaos-xxl/zelda-hyrule-uicoasty-ai/open-cowork
Stars393939
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyeasyeasy
Complexity2/52/53/5
Audiencedeveloperdevelopervibe coder

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

How do you get it running?

Difficulty · easy Time to first run · 5min

No installation needed, runs directly with npx.

MIT license: free to use, modify, and redistribute, including commercially, as long as you keep the copyright notice.

In plain English

CC-Sanitizer is a small command-line tool that fixes a specific error in Claude Code, the AI coding assistant from Anthropic. The error appears when you switch between unofficial third-party AI models (such as GLM or DeepSeek) and official Anthropic models within the same session. The third-party models produce a type of internal data called thinking blocks, but without the cryptographic signature that Anthropic's models require. When you switch back to an official model, Claude Code rejects the session with a 400 error about an invalid signature. The tool fixes this by reading the session files that Claude Code stores on your computer and removing the problematic thinking blocks. Your conversation history, text responses, and tool calls are all kept intact, only the unsigned thinking entries are stripped out. There are three commands. The scan command reads your session files and reports which thinking blocks have valid signatures and which are suspect. The strip command removes thinking blocks from a session file, with options for a dry-run preview, automatic backup creation, and a mode that only removes blocks lacking a valid signature. The restore command recovers the previous version of a file from the backup that strip creates by default. All three commands accept a file path, a session ID, or a project name. If you run scan with no arguments, it scans every Claude Code project on your machine. The tool detects suspect blocks by checking whether the signature field is a base64 string between 600 and 1200 characters long, which is the range Anthropic's server-generated signatures fall into. The README notes this is a heuristic and could miss a third-party block that happens to produce a plausible-looking string. No installation is required, you can run it directly with npx. It works on Windows, macOS, and Linux and is released under the MIT license.

Copy-paste prompts

Prompt 1
Run the scan command on all my Claude Code projects and explain what it finds.
Prompt 2
Show me how to do a dry-run strip on a specific session file before actually modifying it.
Prompt 3
Explain why switching between third-party and official Claude models causes a 400 signature error.
Prompt 4
Walk me through restoring a session file from its backup after running strip.

Frequently asked questions

What is cc-sanitizer?

A CLI tool that fixes a session error in Claude Code caused by switching between third-party and official AI models.

What language is cc-sanitizer written in?

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

What license does cc-sanitizer use?

MIT license: free to use, modify, and redistribute, including commercially, as long as you keep the copyright notice.

How hard is cc-sanitizer to set up?

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

Who is cc-sanitizer for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.