
Sipcode
io.github.Anuj7411由 GitHub 账号 Anuj7411 发布v1.7.1更新于 Oct 24, 2026
Context hygiene for Claude Code: drift detection, re-read dedup, and token analytics.
概览
本地 CLI 兼 MCP 服务器,帮助保持 Claude Code 会话精简:漂移检测、重复读取去重与 token 用量分析。
- 可以做什么
- 检查会话健康度与相对自身基线的漂移,可按会话、目录或代理筛选
- 查看 token 与花费分析:当日用量、月末预测、趋势、单会话溯源与前后对比
- 读取 OpenAI Codex 会话日志,分析花费、用量限额与版本回归
- 运行可复现的基准测试,并审计仓库对 AI 的友好度
- 向项目安装上下文卫生组件:清单文件、回复规则与代理钩子
- 适用场景
- 适合长时间使用 Claude Code、希望减少重复读取文件与上下文膨胀,或想在本地查看 token 花费和 Codex 套餐限额的人。短时、一次性的会话则不必安装。
- 运行要求
- 以本地 npm 包运行(npx 或全局安装),需要 Node.js 20 或更高版本;读取压缩的 Codex 日志需 Node.js 22.15 或更高。代理钩子与规则需要已安装 Claude Code;Codex CLI 为可选,用于 Codex 分析。未声明任何 API 密钥或环境变量。
安装
在 SourceWeft 中
- 打开 控制台中的 Sipcode,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Sipcode
Keep Claude Code's context clean for sharper answers and lower cost, automatically.
[npm] [GitHub stars] [npm downloads per month] [MIT licensed] [2409 tests passing] [zero network calls]
Install in 30 seconds
That is it. Your next Claude Code session will use Sipcode automatically. Verify a few minutes later:
If the output reads no drift, context health stable, Sipcode is doing its job.
Already installed? Keep it fresh. Sipcode makes zero network calls, so it can't pop an "update available" notice. Build a weekly habit: run
sipcode update(ornpm i -g sipcode@latest) to pull the latest fixes. Full details in Updating Sipcode.
What is Sipcode?
Sipcode is a free command-line tool that sits between you and Claude Code. It does three things:
- It watches Claude Code's context window and warns you when it starts to bloat (we call this "context rot")
- It catches duplicate file reads and other waste before they reach Claude, so you pay less for the same answers
- It gives you receipts. Every saving is measurable in your terminal.
It is open source under the MIT license. It makes zero network calls during normal use. Your data never leaves your laptop.
How Sipcode compares
Sipcode is complementary to memory tools that persist context across sessions (Tool A in the table). Sipcode keeps each individual session clean. They solve different problems. Run both for maximum effect.
Full feature-by-feature comparison with tool names revealed: anuj7411.github.io/sipcode/compare
Why you probably want it
If you use Claude Code for real work, you have already felt this:
- Long sessions get expensive fast. A two-hour session on Claude Max can burn through your daily plan
- Quality drops as the context window fills. Claude starts re-reading files, repeating itself, losing the thread of what you asked
- You cannot tell what is bloat and what is signal
Sipcode measures the bloat, then removes the parts Claude does not need. Run sipcode benchmark on any machine and you will see the same 62.6% median reduction on the locked 20-task corpus. That corpus is synthetic: scripted pairs of Claude Code transcripts (without and with Sipcode), not recordings of live sessions. It shows what Sipcode's mechanisms remove from a modeled session. Your own number depends on your workload, and sipcode impact measures it on your real sessions.
The two-minute tour
After installing, here are the five commands that show you what Sipcode is doing.
1. sipcode drift
Tells you if your current Claude Code session is drifting from your normal usage pattern. Bloated context, repeated reads, stale signals are all flagged here.
By default it checks your most recent session, across Claude Code and Codex. --session <id> checks a specific one, --here limits it to sessions from the folder you are in, and --agent claude-code or --agent codex picks the tool.
2. sipcode proxy --stats
Shows what Sipcode caught in the current session, broken down by rewriter.
3. sipcode benchmark
Runs the locked 20-task corpus and produces a reproducible savings number. Anyone, anywhere can run this and get 62.6%. The transcripts are scripted, not recorded from live sessions, so read it as a model of Sipcode's mechanisms rather than a measured bill (see METHODOLOGY).
4. sipcode today
Daily spend summary. Tokens used, sessions, output ratio, comparison to your 30-day median.
5. sipcode forecast
Month-end projection based on your last 14 days.
Codex
Sipcode also reads OpenAI Codex CLI session logs (~/.codex/sessions and ~/.codex/archived_sessions, or the folder CODEX_HOME points to). For Codex this is spend analytics and usage limits: Sipcode reports what your Codex sessions used, where the tokens went, and how close you are to your plan's limits. It does not change what Codex does.
Commands that read Codex: stats, today, forecast, trend, impact, why, receipt, drift, regress and limits (Codex only), plus the session tools in the MCP server (they take an optional agent input: "claude-code" or "codex") and get_codex_limits.
-
--agent codexshows Codex only.--agent claude-codeshows Claude Code only. -
With no
--agentflag and both tools installed,stats,today,forecast,trendandimpactprint one section per tool.stats,todayandforecastend with one combined line, in this shape: -
why,receiptanddriftreport on the most recent session across both tools. When the other tool has a recent session too, a one-line hint names it and the flag that shows it. -
--hereworks for Codex too: it matches the working folder Codex recorded for each session. -
--jsoncovers one tool per call. Without--agentit covers Claude Code and prints a note on stderr when Codex logs exist too. Add--agent codexfor Codex JSON. -
With no
--agentflag on a machine with Cursor and Codex, Sipcode shows Codex (it does not read Cursor's session logs).
How Codex tokens are counted. Sipcode reads Codex's per-request usage records, or, in logs from older Codex versions, the change in the running total Codex logs after each request. Cached input is part of Codex's input count, so Sipcode never bills cached tokens twice. A request copied into a resumed or forked session file is counted once. On the maintainer's machine, Sipcode's per-file totals equal Codex's own final total_token_usage on all 15 real session logs, and an independent counter that shares no code with Sipcode (scripts/verify-counts.mjs) cross-checks every period command against the same logs.
Prices. Codex models are priced from OpenAI's API price table (developers.openai.com/api/docs/pricing, and each Codex model's page under developers.openai.com/api/docs/models, as of 2026-10-09), including the long-context rate for prompts over 272,000 input tokens. A model with no known price is shown as unpriced: its tokens are still counted, a line under the cost says how many were left out of it, and it is never shown as $0.
Not supported for Codex yet: writing rules to AGENTS.md (rules, and the rules step of init), registering the MCP server in Codex, the proxy and hooks (proxy, hygiene), estimate and benchmark. rules --agent codex and estimate --agent codex stop with error E009 instead of showing Claude Code data.
Compressed Codex logs. Codex compresses older session logs to .jsonl.zst. Sipcode reads them exactly like plain logs on Node.js 22.15 or newer. On an older Node.js it skips them, and every report starts with a warning that says how many it could not read and that reading them needs Node.js 22.15 or newer. A damaged or unreadable log gets the same kind of warning. With --json the warning is a note on stderr and the JSON is unchanged.
Codex limits: sipcode limits
Codex writes your plan's usage-limit readings into its own logs after each request. sipcode limits reads them, with zero network calls, and answers three questions: when will I hit my limit, what used it, and did it shrink.
Example output of sipcode limits --since all (the tokens-per-1% history here goes back further than the default 90 days):
- Every limit window the logs report (5-hour, weekly, 30-day): percent used, reset time, and when it runs out at this pace. The pace is the percent used divided by the time since the period started, counted up to now, so the estimate moves later while you are not using Codex. "as of" is your last Codex request: the percent is only as fresh as that.
- What used it: the current period's top 5 sessions and projects (folder name only), plus Codex's automatic reviews as one line. Each rise in the percent is shared by the requests made since the previous rise, in proportion to their tokens. A rise with no request on this computer shows as
unattributed, because limits are shared with your other devices and Codex cloud. - Did it shrink: how many tokens 1% of the limit bought in each finished period with at least 20% used, compared only within one model (a period counts when 90% or more of its tokens came from one model). Periods that started on the same day also show their start time (
Jul 5 16:39).Possible limit cutappears when a period bought at most half the median of at least two earlier periods. It always says "possible": Codex use on another device raises the percent without local tokens. - Options:
--json;--since <window>(default90d), how far back the tokens-per-1% history goes;--herenarrows only the "what used it" list to sessions from the current folder (limits are account-wide). sipcode todayadds one line for the Codex limit closest to running out, when Codex has logged limit readings.today --jsonis unchanged.- MCP:
get_codex_limits(optionalsince) returns the same JSON assipcode limits --json. - Claude Code's logs do not record limits, so
limits --agent claude-codestops with error E009.
Did it get worse after an update? sipcode regress
sipcode regress checks your own Claude Code and Codex logs for regressions that arrive with an update, and names the version that brought each one. Each version is compared with your other versions, so no outside baseline is needed, and nothing leaves your machine.
Example output (one machine's logs; your numbers will differ):
- A finding outside the known catalog is a signal worth reporting, not proof of a bug. A Codex finding could also be a limit change on your plan at the same time, and Codex on your other devices or in the cloud shares the same limit.
- Subagent and Agent SDK requests are left out: their cache policy differs by design.
--bug-reportadds a block to paste into a GitHub issue: token counts, versions, dates and short session ids only. Review it before posting.--jsonfor scripts,--agent claude-codeor--agent codexfor one tool,--min-n <n>for the minimum requests per version a check needs (default 20).- If no logs can be read (for example a sandbox blocks the folders), it prints "Nothing to analyse ... This is NOT a clean result." and exits with code 2. With too little data it says "Not enough data to compare versions yet". When one tool was compared and the other was read but had too little data, it names that tool ("Not enough data to compare Codex versions yet"), so a missing finding for it is not a clean result.
- An independent counter that shares no code with Sipcode (
scripts/verify-counts.mjs) recomputes the coverage, every check's table and the findings ofregress --jsonfrom the same logs.
Use Sipcode inside Codex
The Sipcode plugin lets you ask Codex about your own usage in plain words, in the ChatGPT desktop app or in the Codex CLI. Each answer comes from the sipcode command on your computer, reading your local logs.
Step 1. Install Sipcode once (Node.js 20 or newer), in a terminal:
The plugin runs this installed sipcode. It does not use npx, because Codex's sandbox usually blocks downloads.
Step 2. Add the plugin. Follow the path that matches how you use Codex.
If you use Codex only in the ChatGPT desktop app (typing codex in a terminal says it is not recognized):
-
Open a terminal (PowerShell on Windows, Terminal on macOS) and run these two commands:
npxruns OpenAI's Codex CLI (npm package@openai/codex) without installing it; the first run downloads it, which can take a minute. The first command adds this repository as a plugin marketplace namedsipcode, the second installs the Sipcode plugin from it. Both write to~/.codex, the folder the desktop app reads its plugins from. -
Quit the ChatGPT desktop app completely and open it again.
-
Open Plugins and check that Sipcode is there (pick the
sipcodemarketplace as the source if the list does not show it). If it is not marked as installed, install it from there. -
Start a new chat.
OpenAI's docs do not describe a button in the desktop app for adding a marketplace from GitHub on a personal account, which is why this path uses the CLI command once. You do not need to keep the CLI installed.
If you have the Codex CLI (codex --version works):
- Run
codex plugin marketplace add Anuj7411/sipcode. - Run
codex plugin add sipcode@sipcode, or open/pluginsin Codex, choose thesipcodemarketplace and install Sipcode. - Start a new Codex session. If you also use the desktop app, quit and reopen it.
Step 3. Ask:
- If Codex's sandbox blocks
~/.codexor~/.claude, the plugin asks for permission to run the command with read access instead of reporting an empty result. - Dollar figures are at API prices; on a ChatGPT plan you are not billed per token.
- Answers show numbers the way the
sipcodeterminal output does: dollars to the cent, whole percents, and times in your local time zone, never raw JSON values. - The plugin is instructions only (four skills): no hooks, no MCP server, no network calls.
- Ask in a new, short chat. Codex re-sends the whole conversation with every request, so the same question asked at the end of a long work chat uses far more of your limit than in a fresh one. Each answer runs one Sipcode command, with no extra checks first.
- To update the plugin later, run
npx -y @openai/codex plugin marketplace upgrade sipcode(orcodex plugin marketplace upgrade sipcode), then restart the desktop app and start a new chat (a chat keeps the skill instructions it started with). Update thesipcodecommand itself withnpm i -g sipcode@latest.
How to install (more detail)
Sipcode works on Mac, Linux, and Windows. You need Node.js 20 or newer, and Node.js 22.15 or newer to read the session logs Codex compresses (.jsonl.zst).
Step 1. Install Node.js
Skip this step if you already have Node.js. Otherwise:
- Mac:
brew install node - Linux: open nodejs.org/en/download, choose the LTS version, Linux and nvm, and run the commands shown there. (The
nodejspackage in Ubuntu's and Debian's own repositories is often older than Node 20.) - Windows: Download from nodejs.org
Verify it worked:
You should see v20.0.0 or higher.
Step 2. Install Sipcode globally
This downloads Sipcode from npm and makes the sipcode command available everywhere.
If you see permission errors on Mac or Linux, try:
Verify it installed:
You should see 1.7.2 or higher.
Step 3. Run sipcode init to wire it into Claude Code
This command does four things:
- Creates a small
.sipcode/manifest.mdfile in your current project so Claude knows what your project is about - Adds a small block to your
CLAUDE.md(or creates one) with rules that keep Claude's replies terse - Installs the Sipcode hook into Claude Code, which is the thing that actually saves tokens
- Marks the date so
sipcode impactcan show you before-and-after savings later
You will see a checklist as it runs. Each step shows a checkmark when it completes.
The two questions it asks (and what to pick):
1. Manifest budget. How lean to keep the project summary Sipcode injects.
- tighten (recommended): auto-trims low-signal sections so the summary stays lean, and never blocks you.
- strict: hard-caps the manifest at 2k tokens and refuses if it would go over.
- off: no cap, the manifest can grow to any size.
2. Output compression rules. How terse Claude's replies are in this project.
- default (recommended): diff-style edits, no "here's what I did" preamble.
- strict: telegraphic, clipped replies, for power users who want maximum brevity.
- verbose: extra context and explanation, good while you are still learning the tool.
- skip: don't install reply rules at all.
Not sure? Take the recommended option in each. You can change either choice later: run sipcode rules --mode <default|strict|verbose> for the reply style, or re-run sipcode manifest to regenerate the summary.
Step 4. Open a new Claude Code session
Sipcode picks up automatically on the next tool call Claude makes. No restart needed in most cases. To be safe, you can close any existing Claude Code window and open a fresh one.
Now Claude Code will be using Sipcode in the background.
Step 5. After about an hour of work, check it
If drift says "no drift" and proxy --stats shows a few dozen rewrites with savings, everything is working.
Updating Sipcode
Sipcode never checks for updates on its own. That would require a network call, and zero network calls in normal use is a guaranteed property of the codebase (a test fails the build otherwise). Updating is always a manual, explicit step.
To update to the latest version:
Or use the built-in helper:
After updating, confirm with sipcode --version and see what changed in the CHANGELOG. The MCP config never needs re-pasting; Claude asks the server for its tools on every reconnect, so new tools appear automatically.
Release cadence: patch releases ship whenever a fix or improvement is ready, often within a day or two of a reported issue. Since Sipcode can't notify you (zero network calls), a good habit is to run sipcode update about once a week. It's a one-second check, and --run upgrades you on the spot if something's new. Watch or star the repo to catch releases too.
What you get
Frequently asked questions
Is it really free?
Yes. MIT license. No tracking. No telemetry sent to us. No paid tier. You can read every line of source code on GitHub.
Does it send my code anywhere?
No. Sipcode makes zero network calls during normal use. Everything runs locally on your machine. We have a privacy test that fails if any network code is imported into the source.
To make repeat runs fast, Sipcode keeps a few caches on your own disk under ~/.sipcode/ (token counts per session log for today and forecast, per-session metrics for drift). They never hold message text, are never uploaded, and are rebuilt automatically if you delete them. PRIVACY.md lists exactly what is stored and where.
How is it different from other context tools?
See the comparison page. The short version: Sipcode is the only one with a published reproducible benchmark, zero false-dedup by architecture, and mid-session install support.
What is "context rot"?
When Claude's context window fills up with stale, repeated, or off-topic information, the quality of its answers drops. Sipcode measures this with sipcode drift and removes most of the waste with the proxy hook.
Does it work with Cursor or other AI tools?
The proxy, hooks and rules work with Claude Code. Sipcode also reads OpenAI Codex session logs for spend analytics (stats, today, forecast, trend, impact, why, receipt, drift); see Codex for what works and what is not supported for Codex yet. Inside Codex itself, the Sipcode plugin answers spend, limit and regression questions (see Use Sipcode inside Codex). For Cursor, sipcode rules --agent cursor writes the output-compression rules to Cursor's rules file; Cursor's session logs are not read.
How do I update?
Or run sipcode update to see your version and the command, or sipcode update --run to update in place. Sipcode never auto-checks for updates (zero network calls), so updating is always explicit. See the CHANGELOG for what changed.
How do I uninstall?
Commands
Run any of them with --help for full options.
Tip: which sessions do these report on? By default, why, stats, today, forecast, trend, impact, receipt and drift look across all your projects, not just the folder you are standing in. So if you run sipcode why inside project A but project B had the most recent activity, you will see project B. To scope any of them to the project you are currently in, add --here (for example, sipcode why --here or sipcode today --here). The same goes for Codex sessions. Use sipcode why --list to see every session and pick a specific one with --session <id>.
Requirements
- Node.js 20 or newer. Node.js 22.15 or newer to read the session logs Codex compresses (
.jsonl.zst); on an older Node.js they are skipped, with a warning at the top of each report. - Claude Code installed (for the proxy hook). Sipcode also works as standalone CLI tools (benchmark, score, etc.) without Claude Code installed.
- Optional: OpenAI Codex CLI, for Codex spend analytics.
License
MIT. See LICENSE.
Acknowledgments
Built with care for the indie developers who burn through their Claude Max plan in two hours. The 62.6% benchmark methodology is documented in benchmark/METHODOLOGY.md. Anthropic's published research on context-window quality informs the integrity-scoring approach.
来源:README.md,提交 2eaf33c
工具
0版本历史
3- v1.7.1最新Oct 12, 2026
- v1.7.0Oct 10, 2026
- v1.6.20Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分