Mindket

Billion Context

Newversion 2 · updated
Star6358

Overview

ranxianglei’s local proxy for long coding-agent sessions. It folds old conversation into summaries that can be unfolded later, so one session can run for days in a small window. Works with Claude Code, Codex, OpenCode, pi, DeepSeek’s dsh and about twenty more.

Billion Context is an open-source project on GitHub in the Developer category, listed by Mindket. It is free. This is version 2, last updated on . Install it from GitHub as its README says. Get Mindket’s setup notes on your Mindket account, as a zip.

At a glance

Runs in
  • 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
Start with
npm install -g billion-context --prefix=~/.local

Platform

OpenCodeCoding agent
Claude CodeCoding agent
Claude DesktopDesktop app
CodexCoding agent
Gemini CLICoding agent
CopilotAI chat

And 2 more in Where to use it

About

What it is

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

Who it suits

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.

Where to use it

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

How to set it up

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

How to use it

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.

Example

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%)

For newcomers and experts

If you are new. 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.

For experts. 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.

Good to know

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 and files

README

Billion Context: setup notes

This kit holds setup notes only. Mindket wrote them. The Billion Context proxy and its plugins install from ranxianglei's repository: https://github.com/ranxianglei/billion-context

These notes are not made or endorsed by ranxianglei. The LICENSE file and the package entry name ranxianglei as the author.

License: MIT plus one additional term. The LICENSE file opens with "Copyright (c) 2026 ranxianglei" and the MIT text, then adds an Additional Term headed "Attribution on Product Surfaces". Source: https://github.com/ranxianglei/billion-context/blob/master/LICENSE

GitHub does not match the file to a standard license because of that extra term. The npm package entry lists MIT (https://registry.npmjs.org/billion-context/latest). The README says "This project is MIT-licensed plus one additional term". In plain words, the term says:

  • If you use the software, including its kernel acp-kernel, in a product or service that end users can see or interact with, commercial or open source, you must show attribution.
  • The attribution goes in at least one place: the product's home page, its documentation, or an About, Credits or Acknowledgements page.
  • It must say the product uses billion-context (and acp-kernel, where that applies) and link to https://github.com/ranxianglei/billion-context (and https://github.com/ranxianglei/acp-kernel).
  • For purely server-side or embedded use with no user-facing surface, carrying those notices in the shipped documentation satisfies the term.

As we read it, using the proxy with your own coding agent does not build a product for others, so the term matters to people who ship something on top of it. Mindket's listing is notes that link to the repository, and it ships none of the software. Read the LICENSE file before you build on it. These notes are not legal advice.

What installs

  • The npm package billion-context. It puts the bili command on your PATH, with bili-proxy as an alias.
  • bili is a local proxy that sits between your coding agent and its model API. It adds four context tools (compress, decompress, search_context, acp_status) to the conversation and folds old messages into summaries.
  • Per client, one of three routes:
  • a native plugin written into the client's own settings (bili plugin install <client>)
  • a launcher that starts the proxy and the client together (bili <client>)
  • a URL change that prefixes the client's base URL with http://localhost:8787/bili/
  • Nothing from this kit runs on its own. The notes only tell you which command to type.

What you need first

  • Node.js 20 or later. The package's engines field lists >=20 (https://registry.npmjs.org/billion-context/latest).
  • On Node 22.5 or later the SQLite engine for the session index is built in. On an older runtime, CONFIGURATION.md says bili downloads one once (about 11 MB) from the npm registry, and storage.sqliteAutoDownload turns that off. Source: https://github.com/ranxianglei/billion-context/blob/master/CONFIGURATION.md
  • The README's Docker note uses a node:24-slim base and tells you not to switch the image to Node 20. See setup/docker.md.
  • A coding agent from the README's client table, already working with your own model account or API key.
  • Ports: a manually started proxy (bili start or plain bili) owns 8787. A native hook or a launcher starts its own proxy in a separate zone that begins at 18787.

Main install command

Linux and macOS, with a user-level prefix (no sudo):

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

Windows, and nvm or Homebrew Node, where the default prefix is already user-writable:

npm install -g billion-context

The README says that on Linux and macOS the bili command lands in ~/.local/bin, and that you add export PATH="$HOME/.local/bin:$PATH" to ~/.bashrc or ~/.zshrc when it is not on your PATH already.

Per-agent notes

  • 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 (any client with a base URL setting)
  • setup/docker.md
  • setup/windows.md

Where it keeps files

The README names these places, all under your home folder. The root CA path comes from CONFIGURATION.md.

  • Config: ~/.config/billion-context/billion-context.json
  • Session state: ~/.local/share/billion-context/
  • Log: ~/.local/state/billion-context/bili.log, which rotates at 10 MB
  • For a client that goes through a TLS-intercept route, a root CA that bili generates: ~/.local/share/billion-context/ca/root-ca.pem

What the root CA means for you: a client set to trust it lets the proxy decrypt that client's HTTPS traffic to your model host and read the prompts and replies. CONFIGURATION.md says the CA is made on your machine, is not a system-wide install, and is trusted only by the client you point at it. It also says only listed model hosts are decrypted, and all other HTTPS traffic is tunnelled through still encrypted. A root CA can sign certificates, so keep the ca folder as private as a password file. Deleting the CA files and restarting the proxy makes new ones. The Claude Code launcher uses the /bili/ URL route and needs no CA.

Session files hold the conversation. CONFIGURATION.md says they are plain JSON unless you set BILI_ENCRYPTION_KEY, that a SQLite index (index.db) is written beside them by default, and that cleaning up old ones is opt-in (BILI_SESSION_GC=1). The local web page at http://localhost:8787 and the /__bili/* JSON endpoints listen on loopback and have no login.

Network calls it makes itself

Besides your model traffic, the README and CONFIGURATION.md describe five things the proxy fetches or does on its own.

  • Self-update: it checks npm on startup and every 3 minutes and installs a newer version in place after a random delay of 15 minutes to 48 hours. Turn it off with ACP_AUTO_UPDATE=0, or for one run with --no-auto-update.
  • Update policy: it fetches auto-update-policy.json from the repository. CONFIGURATION.md says "Zero telemetry: plain GET, no query parameters, no device id."
  • Advisories: it polls the npm package billion-context-advisories. A matching advisory can force-install a named version even with auto-update off. Turn it off with BILI_ADVISORY_CHECK=0.
  • Blog panel: the web page's Blog view refreshes from GitHub master about once an hour while you are online.
  • SQLite engine: on Node below 22.5 with no engine installed, the one-time download from the npm registry described above.

The "zero telemetry" line in CONFIGURATION.md is about the policy-file request. The README, CLIENTS.md and CONFIGURATION.md, read on 2 November 2026, make no wider telemetry statement either way.

The Docker image has self-update off by default (ACP_AUTO_UPDATE=0).

Update or remove

  • Update now: bili update checks and installs a newer version, bypassing the throttle.
  • Remove a native install: bili plugin remove <client>. Config snapshots go to .bili-bak.
  • Launcher and URL routes: stop using the launcher command, the env vars or the /bili/ prefix, and traffic goes direct again at once, per the README FAQ.
  • The README gives no command that removes the npm package or deletes the folders above. npm's own documentation covers removing a global package: https://docs.npmjs.com/cli/commands/npm-uninstall
  • Delete one stored session: bili sessions rm <id>. bili sessions ls lists them.

Sources

Files
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 files, 39 KB, downloaded as a zip.

What’s new

  • Version 2 · 2026-11-09

    Updated by Mindket to the current version of this kit.

  • Version 1 · 2026-11-03

Compare with similar

Listed GitHub projects in the same category that share the most topics with this one.

ProductStarsActivityLanguageLicenseLast change
Billion Context This page6,358ActiveTypeScript—
ArchifyShares dsh-plugin94,756ActiveJavaScriptApache-2.0
RufloShares dsh-plugin81,187——MIT—
Numbers as Mindket last read them, from 2026-11-08 to 2026-11-11. Activity is read from each project’s last change on GitHub: Active within 30 days, Quiet within 180, Stale after that.

Reviews

No ratings yet

Write a review

No reviews yet.

What people say

Posts and comments that name this project on Hacker News, Bluesky, X, Reddit, Facebook and YouTube, found by a weekly search and on Trendshift. Mindket doesn’t write or check them. Open one to read it where it was posted.

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 likesGitHub 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 like · 1 replyGitHub 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 replyGitHub 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上下文足矣)省...

Searched

More from Mindket

See all from Mindket

Nanosaur2-670M

well9472 · Kit

Makes illustrations from text prompts with a small 670M-parameter diffusion model, run through ComfyUI. Built as a low-budget research model for people who wan…

New

Reads handwritten Arabic text from images and returns it as text. A fine-tuned PaddleOCR-VL model for people digitizing Arabic handwriting.

New

Makes video clips from a text prompt or an image plus text, at up to 720P and 24 frames per second, in the Diffusers format for a single consumer GPU.

New

Similar in Developer

See all in Developer

Wan2.2-S2V-14B

Wan-AI · Kit

Generates cinematic video of a character driven by an audio track, and can also lip-sync existing video. For video creators, animators and researchers with a l…

New

Wan2.2-Animate-14B

Wan-AI · Kit

Animates a character or swaps one into a video by copying a performer's movement and expressions, as one model from the Wan2.2 video family. Use only faces and…

New

d3-turbo

vllm-sr · Kit

Answers choice, yes-or-no, score, box and tracking questions about text, images or video in one call, with a probability for each answer. For people building r…

New