Mindket

Billion Context 上下文压缩代理

新上架第 2 版 · 更新于
星标6358

概览

ranxianglei 做的本地代理,用于编程智能体的长会话。它把旧的对话折叠成以后还能展开的摘要,让一个会话在小窗口里也能连续跑上好几天。支持 Claude Code、Codex、OpenCode、pi、DeepSeek 的 dsh,另外还支持大约二十个客户端。

Billion Context 上下文压缩代理 是一款 GitHub 上的开源项目,属于开发类,由 Mindket 上架。可免费获取。当前为第 2 版,最近更新于 。按它的 README 从 GitHub 安装。Mindket 的设置说明可在你的 Mindket 账户获取,以 zip 压缩包下载。

速览

用在
  • Native plugin: bili plugin install plus the client’s name, then you start the client as usual. Offered for pi, omp, OpenCode, dsh, Kimi Code, Hermes, ZCode and Claude Code
  • Launcher: bili plus the client’s name starts the proxy and the client together, and edits no real config file
  • URL prefix: put http://localhost:8787/bili/ in front of the client’s base URL, for any client that lets you edit it
先运行
npm install -g billion-context --prefix=~/.local

平台

OpenCode编程智能体
Claude Code编程智能体
Claude Desktop桌面应用
Codex编程智能体
Gemini CLI编程智能体
CopilotAI 对话

用在哪里里还有 2 个

关于

它是什么

Billion Context is a proxy that runs on your computer between a coding agent and the model it calls. The model gets four tools to manage its own history: compress, decompress, search_context and acp_status. It folds a range of old messages into a summary, and it can unfold that range or search the summaries when exact detail matters. Its maker, ranxianglei, describes it as a context-compression plugin for month-long single sessions, small context windows (a 100K window is enough) and token savings (5x fewer tokens). Those figures are the maker’s claims.

  1. Your agent sends its request to the local proxy
  2. The proxy adds the context tools and a growth nudge
  3. The model folds old messages into a summary
  4. The proxy sends the shorter request to the real API
  5. Decompress brings exact detail back when needed

适合谁

Developers who leave a coding agent on one task for hours or days and watch old tool output fill the window. It also suits people on models with small windows. People who pay per token get a cache report that shows what each fold saved. Skip it if your sessions are short, or if you do not want a local proxy that updates itself. Exact recall of one sentence buried in a huge document is also weaker: the maker’s own benchmark loses ground there.

Who uses it, and how
IndustryWho uses itHow they use itExample
Software teamsDevelopers running long agent sessionsRoute the agent through the proxy so old tool output is folded away as the session growsA developer on a long refactor keeps one session going instead of restarting when the window fills.
Smaller or cheaper modelsPeople whose model has a window of 100K or lessLet the model compress its own history so a small window stays usableA user on a 100K model keeps working past the point where the full history would not fit.
Agent researchPeople testing very long agent tasksPut the proxy in front of the agent to test long-horizon memoryThe benchmark in its repository fed a 1.48M-token log through it, where the run without compression failed.

用在哪里

The README names 21 clients in its table and lists launchers for three more. The topic dsh-plugin on the repository points at dsh, an open-source project from DeepSeek AI for running agents. A client connects by one of three routes.

  • Native plugin: bili plugin install plus the client’s name, then you start the client as usual. Offered for pi, omp, OpenCode, dsh, Kimi Code, Hermes, ZCode and Claude Code
  • Launcher: bili plus the client’s name starts the proxy and the client together, and edits no real config file
  • URL prefix: put http://localhost:8787/bili/ in front of the client’s base URL, for any client that lets you edit it
How each client connects
ClientRouteNote
Claude CodeLauncher, native install or plugin marketplaceWith the native install, the Claude Desktop app’s Code tab bypasses the proxy
Codex CLILauncherThe plugin install alone adds tools but routes no traffic
OpenCode, pi, ompLauncher or native installNative install turns OpenCode’s own auto-compaction off
DeepSeek’s dshLauncher or dsh plugin adddsh’s own auto-compaction is turned off
Kimi Code, HermesLauncher or native installThe Kimi Code native install needs 2.0.0 or later
ZCodeNative install, or a proxy and CA path set in its settingsIt has no bili launcher
Gemini CLI, Qwen Code, aider, Copilot CLI, goose and othersLauncher, and for several the URL prefixNo native plugin. A personal Google login for Gemini CLI is not covered
Cline, Roo Code, Continue, OpenHands, Cursor, WarpURL prefixWorks with an API key, not a sign-in

如何设置

Get it saves a zip of Minda’s setup notes in your downloads folder, with each client’s steps from ranxianglei’s README and docs. The main route is one npm install, then one command for your client.

What you need first
NeedDetail
Node.js20 or later, as the package’s engines field says. Below 22.5 the session index downloads a SQLite engine from the npm registry once, about 11 MB
A coding agentOne from the table above, signed in or holding your own API key
PortsA manually started proxy uses 8787. Launchers and native plugins start their own from 18787 up
  1. Install the package. On Linux and macOS use the user-level prefix, and on Windows run the plain command.
  2. Run bili --version, and add ~/.local/bin to your PATH if the command is not found.
  3. Run the launcher or the native install for your client, and restart the client after a native install.
npm install -g billion-context --prefix=~/.local
npm install -g billion-context

The launcher is the lightest route. It edits no config, and traffic goes direct again the moment you stop running the command.

bili claude

Claude Code can also add it from inside a session, as a plugin marketplace.

/plugin marketplace add ranxianglei/billion-context
/plugin install billion-context@billion-context
/billion-context:bili-setup

如何使用

Work in your client as before. The model decides when to compress. By default the proxy nudges it as the conversation grows, in steps of about 50K tokens. It also folds on its own as a hard backstop when a request alone would overflow the window. The first fold comes 50K tokens past the starting content, so a large system prompt and tool list push it later.

In OpenCode, dsh and Hermes, typing /acp shows the status panel for the current conversation. The /acp-cache command prints a cache report with a health verdict and the net tokens saved per fold. The maker’s rule of thumb: compression itself costs 2 percent or less, and a healthy session sits at 95 to 97 percent cache hits. A local page at http://localhost:8787 adds logs and a config editor.

示例

You use Claude Code with an API key and want proof that the proxy answers before a long session, so you start it in one terminal and ask for its health from another.

# terminal 1
bili

# terminal 2
curl -s http://localhost:8787/__bili/health

The README shows this answer, naming the upstream the proxy forwards to:

{"ok":true,"upstream":"https://api.anthropic.com"}

Then you point Claude Code at the proxy and send a message. In this manual mode CONFIGURATION.md also asks you to set CLAUDE_CODE_AUTO_COMPACT_WINDOW to bili’s window for your model, so Claude Code’s own auto-compact does not fire first.

export ANTHROPIC_BASE_URL="http://localhost:8787/bili/https://api.anthropic.com"
claude

As the conversation grows, the log at ~/.local/state/billion-context/bili.log shows a line for each round and a compress event, in the README’s format:

[acp-usage] round N input=X cached=Y (cache hit Z%)

新手与专家

新手:A model can only read so much at once, and a long coding session eventually passes that limit, after which the README says the session degrades or dies. Billion Context lets the model fold old parts into summaries and unfold them again. Start small. Try the launcher with the one agent you use daily, on a throwaway project.

专家:With a native plugin or a launcher, the agent registers the tools and runs compress itself. On the plain URL route the proxy runs compress on its side. Session state is keyed on the conversation id the client gives, such as Claude Code’s x-claude-code-session-id header. A client that sends none gets prefix affinity, which reattaches a request only when its history matches a stored session byte for byte.

By default the model your agent already uses writes the summaries. An optional external summary chain in the config names up to 16 other models, each with its own key. It never falls back to the main model when a reference does not resolve.

LongMemEval-S accuracy, as the maker’s repository reports it
Full context, no compression83.2%
Billion Context79.2%
Embedding plus rerank62.6%
BM2556.4%
Embedding46.4%

That run sits in the repository’s benchmarks folder, which calls it an independent third-party evaluation of version 0.1.202 with DeepSeek V4.1 Flash as the base model. It names no evaluator and is published in the maker’s own repository, so read it as the maker’s claim. The same write-up reports 71.1 percent lower cost than full context for independent sessions, and a 1.48M-token test where full context failed on all 199 items. Its trade-off line says exact needle questions fall from 69.0 percent for full context to 27.0 percent.

注意事项

The proxy sees every prompt and reply you route through it. It also changes itself over time.

  • Where requests go: to the model API your client already uses. Billion Context has no model of its own, and the README and CONFIGURATION.md name no server run by the maker in that path
  • Your keys: the Authorization or API-key header is forwarded untouched. The README says the raw key is never stored, only a 12-character hash
  • What it stores: raw messages and summaries under ~/.local/share/billion-context/ as plain JSON plus a SQLite index, unencrypted unless you set BILI_ENCRYPTION_KEY
  • Local web page: http://localhost:8787 listens on loopback with no login. By default every bili instance on a machine shares one store, and any of them can read every session
  • External summary chain: text goes to the providers you name, with keys kept in a private credentials file
  • TLS interception: some launchers, and the proxy setup for clients such as ZCode, decrypt the HTTPS traffic to your model host so the proxy can read it. They use a root CA that bili makes at ~/.local/share/billion-context/ca/root-ca.pem. CONFIGURATION.md says it is not a system-wide install, only the client you point at it trusts it, and only listed model hosts are decrypted while other traffic passes through still encrypted. A root CA can sign certificates, so keep that folder as private as a password file. Deleting it makes bili create a new one. The Claude Code launcher needs no CA
  • Self-update: it checks npm every 3 minutes and installs a newer version on its own after a random delay of 15 minutes to 48 hours. ACP_AUTO_UPDATE=0 turns that off. A separate advisory check can force-install a named version even then, and BILI_ADVISORY_CHECK=0 turns it off
  • Other fetches: the update policy file from the repository, a plain GET that CONFIGURATION.md says sends no query parameters or device id, and the blog panel, refreshed from GitHub about once an hour
  • No login on shared use: the --host 0.0.0.0 flag and the Docker image listen with no authentication
  • Limits: the README’s Status section calls the project early and says to expect rough edges. The master branch can break, so install from npm. Compression is lossy, as the exact-recall drop above shows
  • Removal: bili plugin remove undoes a native install. The README gives no command that removes the package or its folders
  • License: MIT plus an Additional Term. GitHub shows no standard license because of it, and the npm entry lists MIT. Any product or service that includes the software and that end users see or use, commercial or open source, must credit billion-context with a link on its home page, documentation or About page. Server-side use with no user-facing surface can carry the notice in its shipped documentation. As we read it, setting this up for your own coding is not such a product, but read the LICENSE file before you ship something on top of it. Minda’s listing is notes only and ships none of the software

README 和文件

README

Billion Context:安装说明

这个工具包里只有安装说明,由 Mindket 编写。Billion Context 代理和它的插件要从 ranxianglei 的仓库安装,地址是 https://github.com/ranxianglei/billion-context

这些说明不是 ranxianglei 写的,也没有得到 ranxianglei 的认可。LICENSE 文件和包的条目都把 ranxianglei 列为作者。

许可证:MIT 加一条附加条款。LICENSE 文件开头是“Copyright (c) 2026 ranxianglei”和 MIT 文本,后面加了一条标题为“Attribution on Product Surfaces”的附加条款。来源见 https://github.com/ranxianglei/billion-context/blob/master/LICENSE

因为这条额外的条款,GitHub 没有把这个文件识别为某种标准许可证。npm 包的条目 https://registry.npmjs.org/billion-context/latest 写的是 MIT。README 的原话是“This project is MIT-licensed plus one additional term”。用大白话说,这条条款要求:

  • 如果你把这个软件(包括它的内核 acp-kernel)用在终端用户能看到或与之交互的产品或服务里,不论商业还是开源,都必须注明出处。
  • 出处至少要放在一个地方:产品首页、产品文档,或者“关于”“鸣谢”“致谢”页面。
  • 要写明这个产品使用了 billion-context,用到 acp-kernel 时也要写明它,并附上链接。两个链接分别是 https://github.com/ranxianglei/billion-context 和 https://github.com/ranxianglei/acp-kernel
  • 纯服务器端或嵌入式的使用,如果没有面向用户的界面,把这些声明放在随产品发布的文档里就满足条款。

按我们的理解,用这个代理配合你自己的编程智能体,并不是在为别人做产品,所以这条条款关系到的是在它之上发布东西的人。Mindket 上架的只是链接到仓库的说明,不包含这个软件的任何部分。在它之上做东西之前,请先读 LICENSE 文件。这些说明不构成法律意见。

会安装什么

  • npm 包 billion-context。它会把 bili 命令加进你的 PATH,bili-proxy 是它的别名。
  • bili 是一个本地代理,夹在你的编程智能体和它的模型 API 之间。它往对话里加入四个上下文工具(compress、decompress、search_context、acp_status),并把旧消息折叠成摘要。
  • 每个客户端走以下三种途径之一:
  • 写进客户端自身设置的原生插件(bili plugin install <client>)
  • 同时启动代理和客户端的启动器(bili <client>)
  • 改一下 URL,在客户端的 base URL 前面加上 http://localhost:8787/bili/
  • 这个工具包里的东西都不会自己运行。说明只告诉你该输入哪条命令。

事先需要准备

  • Node.js 20 或更高版本。包的 engines 字段写的是 >=20,见 https://registry.npmjs.org/billion-context/latest
  • 在 Node 22.5 或更高版本上,会话索引用的 SQLite 引擎是内置的。在更旧的运行时上,CONFIGURATION.md 说 bili 会从 npm 注册表下载一次引擎(大约 11 MB),storage.sqliteAutoDownload 可以关掉这一步。来源见 https://github.com/ranxianglei/billion-context/blob/master/CONFIGURATION.md
  • README 的 Docker 说明用的是 node:24-slim 基础镜像,并告诉你不要把镜像换成 Node 20。见 setup/docker.md。
  • 一个出现在 README 客户端表里的编程智能体,并且已经能用你自己的模型账户或 API 密钥正常工作。
  • 端口:手动启动的代理(bili start 或直接运行 bili)占用 8787。原生钩子或启动器会在另一个从 18787 开始的区间里启动自己的代理。

主安装命令

Linux 和 macOS,用用户级前缀(不用 sudo):

npm install -g billion-context --prefix=~/.local

Windows,以及用 nvm 或 Homebrew 装的 Node,默认前缀本来就是用户可写的:

npm install -g billion-context

README 说,在 Linux 和 macOS 上,bili 命令会装到 ~/.local/bin。如果它还不在你的 PATH 里,就把 export PATH="$HOME/.local/bin:$PATH" 加进 ~/.bashrc 或 ~/.zshrc。

各智能体的说明

  • setup/claude-code.md
  • setup/codex.md
  • setup/opencode.md
  • setup/pi.md
  • setup/omp.md
  • setup/dsh.md(DeepSeek Harness)
  • setup/kimi-code.md
  • setup/hermes.md
  • setup/zcode.md
  • setup/gemini-family.md(Gemini CLI、iFlow CLI、Qwen Code、Antigravity)
  • setup/other-launchers.md(aider、GitHub Copilot CLI、Amp、Crush、Zed、goose、jcode、MiniMax Code、CodeBuddy、Qoder、Trae)
  • setup/url-prefix.md(任何有 base URL 设置的客户端)
  • setup/docker.md
  • setup/windows.md

文件存放在哪里

README 列出了下面这些位置,都在你的用户主目录下。根 CA 的路径出自 CONFIGURATION.md。

  • 配置:~/.config/billion-context/billion-context.json
  • 会话状态:~/.local/share/billion-context/
  • 日志:~/.local/state/billion-context/bili.log,满 10 MB 时轮换
  • 走 TLS 拦截途径的客户端会用到 bili 生成的根 CA:~/.local/share/billion-context/ca/root-ca.pem

根 CA 对你意味着什么:一个设置成信任它的客户端,会让代理能解密这个客户端发往你模型服务器的 HTTPS 流量,读到提示词和回复。CONFIGURATION.md 说,这个 CA 是在你的电脑上生成的,不是装进整个系统的,只有你指向它的那个客户端信任它。它还说只解密列出的模型服务器,其他所有 HTTPS 流量仍然加密,原样经隧道通过。根 CA 能签发证书,所以要像保管密码文件一样保管好 ca 文件夹。删掉 CA 文件再重启代理,就会生成新的。Claude Code 的启动器走 /bili/ URL 途径,不需要 CA。

会话文件里存着对话内容。CONFIGURATION.md 说,除非你设置 BILI_ENCRYPTION_KEY,这些文件都是普通 JSON。默认会在旁边写一个 SQLite 索引(index.db),清理旧会话则要你自己开启(BILI_SESSION_GC=1)。本地网页 http://localhost:8787 和 /__bili/* JSON 端点都只监听本机回环地址,没有登录。

它自己发出的网络请求

除了你的模型流量,README 和 CONFIGURATION.md 还描述了代理自己去获取或执行的五件事。

  • 自动更新:它在启动时以及之后每 3 分钟检查一次 npm,发现新版本后,在 15 分钟到 48 小时之间的随机延迟后就地安装。用 ACP_AUTO_UPDATE=0 关掉它,或者用 --no-auto-update 只关这一次运行。
  • 更新策略:它从仓库获取 auto-update-policy.json。CONFIGURATION.md 的原话是“Zero telemetry: plain GET, no query parameters, no device id.”,意思是不做遥测:普通 GET 请求,不带查询参数,也不带设备 ID。
  • 安全公告:它会轮询 npm 包 billion-context-advisories。一条匹配的公告即使在自动更新关闭时,也能强制安装某个指定版本。用 BILI_ADVISORY_CHECK=0 关掉它。
  • 博客面板:联网时,网页的 Blog 视图大约每小时从 GitHub master 刷新一次。
  • SQLite 引擎:在低于 22.5 的 Node 上、又没有装引擎时,就是上面说的那次从 npm 注册表的一次性下载。

CONFIGURATION.md 里“zero telemetry”这句话,说的只是策略文件的那个请求。2026 年 11 月 2 日读到的 README、CLIENTS.md 和 CONFIGURATION.md 都没有更宽泛的遥测说明,既没说有,也没说没有。

Docker 镜像默认关闭自动更新(ACP_AUTO_UPDATE=0)。

更新或移除

  • 立即更新:bili update 会检查并安装新版本,不受频率限制。
  • 移除原生安装:bili plugin remove <client>。配置快照会存到 .bili-bak。
  • 启动器和 URL 途径:不再用启动器命令、环境变量或 /bili/ 前缀,流量就立刻恢复直连,这是 README 常见问题里的说法。
  • README 没有给出移除 npm 包或删除上述文件夹的命令。npm 自己的文档讲了怎么移除全局包 https://docs.npmjs.com/cli/commands/npm-uninstall
  • 删除一个已存的会话:bili sessions rm <id>。bili sessions ls 会列出所有会话。

来源

文件
README.md  8 KB
setup/claude-code.md  3 KB
setup/codex.md  2 KB
setup/docker.md  2 KB
setup/dsh.md  3 KB
setup/gemini-family.md  2 KB
setup/hermes.md  2 KB
setup/kimi-code.md  1 KB
setup/omp.md  1 KB
setup/opencode.md  2 KB
setup/other-launchers.md  3 KB
setup/pi.md  2 KB
setup/url-prefix.md  3 KB
setup/windows.md  2 KB
setup/zcode.md  2 KB

15 个文件,共 39 KB,以 zip 压缩包下载。

更新内容

  • 第 2 版 · 2026-11-09

    Updated by Mindket to the current version of this kit.

  • 第 1 版 · 2026-11-03

同类产品对比

同一分类里与本产品共有主题最多的已上架 GitHub 项目。

产品星标活跃度语言许可证最近更新
Billion Context 上下文压缩代理 本页6,358活跃TypeScript—
Archify共有 dsh-plugin94,756活跃JavaScriptApache-2.0
Ruflo 智能体协调层共有 dsh-plugin81,187——MIT—
数据为 Mindket 在 2026-11-08 至 2026-11-11 期间读取的数值。 活跃度依据各项目在 GitHub 上的最近更新:30 天内为活跃,180 天内为更新较少,超过 180 天为久未更新。

评价

还没有评分

写评价

还没有评价。

大家怎么说

Hacker News、Bluesky、X、Reddit、Facebook 和 YouTube 上提到这个项目的帖子和评论,来自每周一次的搜索和 Trendshift。它们不是 Mindket 写的,也未经核实,点开即可在原帖处阅读。

iterativeguybillion-context: Compress Context for Long Coding-Agent Sessions https://osrepos.com/repo/ranxianglei-billion-context?utm_source=bluesky billion-context is a TypeScript proxy plugin built on acp-kernel that incrementally compresses coding-agent conversations, aiming to… new project #opensource3 赞GitHub Trending JS/TS🚀 Skyrocketing! 🚀 (200+ new stars) 📦 ranxianglei / billion-context ⭐ 1,055 (+219) 🗒 TypeScript A context-compression plugin for small context windows (a 100K context is enough), token savings (5x fewer tokens), and month-long single sessions (billions of tokens).上下文压缩插件,兼顾小窗口(100k上下文...1 赞 · 1 条回复GitHub Trending JS/TS🔥 Hot Repo! 🔥 (100+ new stars) 📦 ranxianglei / billion-context ⭐ 4,403 (+185) 🗒 TypeScript A context-compression plugin for month-long single sessions (billions of tokens) ,small context windows (a 100K context is enough) and token savings (5x fewer tokens) .上下文压缩插件,月级长会话会话, 兼顾小窗口(10...1 条回复GitHub Trending🔥 Hot Repo! 🔥 (100+ new stars) 📦 ranxianglei / billion-context ⭐ 4,403 (+185) 🗒 TypeScript A context-compression plugin for month-long single sessions (billions of tokens) ,small context windows (a 100K context is enough) and token savings (5x fewer tokens) .上下文压缩插件,月级长会话会话, 兼顾小窗口(10...GitHub Trending JS/TS🔥 Hot Repo! 🔥 (100+ new stars) 📦 ranxianglei / billion-context ⭐ 2,913 (+176) 🗒 TypeScript A context-compression plugin for month-long single sessions (billions of tokens) ,small context windows (a 100K context is enough) and token savings (5x fewer tokens) .上下文压缩插件,月级长会话会话, 兼顾小窗口(10...GitHub Trending JS/TS🔥 Hot Repo! 🔥 (100+ new stars) 📦 ranxianglei / billion-context ⭐ 1,963 (+137) 🗒 TypeScript A context-compression plugin for small context windows (a 100K context is enough), token savings (5x fewer tokens), and month-long single sessions (billions of tokens).上下文压缩插件,兼顾小窗口(100k上下文足矣)省...

搜索日期

Mindket 的更多商品

查看 Mindket 的全部商品

Huashu Design

alchaincyf · 技能

把你在 AI 智能体里写的一句话需求,变成一份完成的设计:发布动画、可点击的应用原型、可编辑的幻灯片、信息图,或一组小红书图片。可在多种智能体中使用。

新上架29.4k

Guizang PPT Skill

op7418 · 技能

能生成单文件 HTML 幻灯片、幻灯片配图和多平台封面的技能,有两套视觉风格,还带演讲者模式用于排练。适合使用 Claude Code 或 Codex 的演讲者。

新上架29.8k

Claude Code Skills & Plugins

alirezarezvani · 技能

为 Claude Code 和其他编程智能体提供 411 个现成技能,按角色分组,从工程、产品到营销、财务和合规。以插件方式安装。适合开发者和业务团队。

新上架29.8k

开发类的相似商品

查看开发类的全部商品

buzz

block · 工具包

可自行托管的工作空间,人和 AI 智能体在同样的房间里协作,基于 Nostr 中继,把每个动作记录为签名事件。适合想自己运行中继的团队。

新上架37.3k

plannotator

backnotprop · 工具包

把你的 AI 编程智能体的计划、规格和代码改动在浏览器里打开,让你加批注或评论,并把反馈直接发回给智能体。

新上架10.5k

open-code-review

alibaba · 工具包

用 AI 智能体审查 Git 改动:它会读取文件、搜索代码库,再写出对应到具体行的审查意见。适合想在命令行里自动做代码审查的开发者。

新上架50.7k