# Sipcode

> An open-source CLI toolkit that keeps Claude Code's context clean by trimming token waste, detecting context rot, and providing spend analytics — all locally with zero telemetry.

Sipcode is a free, MIT-licensed command-line toolkit built by Anuj Ojha that sits between you and Claude Code to automatically reduce context bloat, lower token costs, and improve answer quality. It runs entirely on your local machine with zero network calls during normal use, and requires no account or telemetry. The project is written in TypeScript, available on npm, and currently at version v1.6.16.

## What It Is

Sipcode is a context-management layer for Claude Code — Anthropic's terminal-based AI coding assistant. As Claude Code sessions grow longer, the context window fills with stale, repeated, or verbose tool output, a phenomenon Sipcode calls "context rot." The toolkit intercepts tool calls before they reach Claude, rewrites bulky outputs into compact forms, deduplicates repeated file reads, and alerts you when a session starts drifting from your normal usage baseline. According to the project's own reproducible benchmark run on a locked 20-task corpus, Sipcode achieves a 62.6% median token reduction.

## Three-Layer Architecture

Sipcode organizes its work into three distinct layers:

- **Valve (proxy hook):** A `PreToolUse` hook that rewrites verbose commands — `git diff`, `git log`, `grep -r`, and others — into compact equivalents before Claude ever processes them. The project reports reductions of up to 94% for `git diff` and 80% for `grep -r` on its benchmark corpus.
- **Meter (analytics):** Reads local Claude Code `.jsonl` transcript files to report daily spend, session output ratios, duplicate reads, idle context, and month-end projections. All analysis is local; no data leaves the machine.
- **Drift detector:** Compares the latest session's token-per-turn rate and cache-reuse percentage against a rolling baseline of recent sessions. It stays silent unless a meaningful regression is detected, then names the specific signal and suggests a fix.

## MCP Integration for Claude Desktop

Beyond the terminal, Sipcode ships 15 MCP (Model Context Protocol) tools that register with Claude Desktop. This lets users ask Claude natural-language questions like "how am I doing today?" or "how much will I spend this month?" and have Claude route those queries to tools like `get_today_summary` and `forecast_monthly_spend`. The MCP server is installed separately via `npx sipcode-mcp` and makes zero network calls, reading only the local transcript files Claude Code already writes.

## Setup Path

Installation requires Node.js 18 or newer and takes under two minutes:

1. `npm i -g sipcode` — installs the global CLI from npm
2. `sipcode init` — creates a project manifest, updates `CLAUDE.md` with terse-reply rules, and installs the proxy hook into Claude Code
3. Verify with `sipcode drift` after a session

The proxy hook activates on the next Claude Code tool call. Uninstalling is equally straightforward with `sipcode proxy --uninstall` followed by `npm uninstall -g sipcode`.

## Update: v1.6.16 — F-CACHE-DEFER + F-NATIVE-GREP

The latest release, v1.6.16 (published June 22, 2026), is named "F-CACHE-DEFER + F-NATIVE-GREP," indicating new rewriter features targeting cache deferral and native grep handling. The project homepage still references v1.6.15 while the GitHub release page shows v1.6.16, suggesting active, rapid iteration. The repository was created in May 2026 and has seen consistent pushes since, with 1,363 tests passing as of the README. The project's GitHub topics include `context-engineering`, `drift-detection`, `token-optimization`, `mcp-server`, and `ast`, reflecting the breadth of its current feature surface.

## Tradeoffs to Know

The project is explicit about its current scope limits. The proxy hook only works inside Claude Code — Claude Desktop's pipeline is closed to this kind of interception, so Desktop users get only the MCP analytics tools. Sipcode also does not claim to improve Claude's answer quality directly; it cites published Anthropic research on context-window quality effects but measures only the tokens it saves, not downstream quality outcomes. The benchmark number (62.6%) is reproducible via `npx sipcode benchmark` on any machine, but real-world savings will vary by workload.

## Features
- Context rot detection via drift monitoring
- PreToolUse proxy hook that rewrites verbose tool outputs
- Re-read deduplication to skip files already in context
- Compression-integrity scoring showing signal retained per rewrite
- Daily and monthly spend analytics from local transcripts
- Month-end spend forecasting
- 15 MCP tools for Claude Desktop integration
- AST-aware file reads returning only the requested symbol
- Reproducible 20-task benchmark corpus (62.6% median savings)
- Zero network calls and zero telemetry
- Per-session forensics with sipcode why
- Repo AI-friendliness audit with sipcode score
- Shareable PDF session receipts

## Integrations
Claude Code, Claude Desktop, MCP (Model Context Protocol), npm, Node.js

## Platforms
WINDOWS, MACOS, LINUX, API, CLI

## Pricing
Open Source

## Version
v1.6.16

## Links
- Website: https://anuj7411.github.io/sipcode
- Documentation: https://github.com/Anuj7411/sipcode#readme
- Repository: https://github.com/Anuj7411/sipcode
- EveryDev.ai: https://www.everydev.ai/tools/sipcode
