LibreAI / AI Agents / billion-context
// agents · ranxianglei/billion-context

billion-context

billion-context is an open-source ai agents project by ranxianglei (ranxianglei/billion-context on GitHub). It has 7,016 GitHub stars and 575 forks, is released under the MIT license, and was last updated on GitHub on 12 November 2026.

Context compression for long coding sessions — 5x fewer tokens, month-long single sessions, MIT

★ 7.0k stars⑂ 575 forksMITupdated 2026-11
▦ visual — this project's README ships no embeddable screenshot,
so here's a placeholder. The guide below is complete regardless.
// project facts

Project facts

GitHub stars
7,016
Forks
575
License
MIT
Last updated on GitHub
12 November 2026
Category
AI Agents
Listing
Full install guide
Official site
npm package
// how it works

How it works

  1. Install it globally

    Install the package from npm into your local prefix.

  2. Point your agent at it

    It sits between your agent and the model API — follow the setup for your agent in the README.

  3. Work a long session

    Let the model compress consumed context into layered summaries as the session grows.

// features

Why people love it

Model-driven compression

The model decides when and what to compress — no hard truncation limit.

5x fewer tokens

About five times fewer tokens per session, with month-long single sessions.

Reversible, cache-friendly

Summaries can be decompressed on demand, and the cache prefix stays intact.

Works with any agent

Claude Code, Codex, OpenCode, Pi, Gemini CLI, Kimi, Qwen, Copilot CLI and more.

Benchmarked in the open

A published paper and a 1,500-item third-party evaluation back the claims.

// run it

Run it yourself

  1. Step 1 — Install globally

    Install the package from npm.

    npm install -g billion-context --prefix=~/.local
  2. Step 2 — Launch your agent through it

    One bili command brings up the proxy and the client together — no config file is touched.

    bili claude
  3. Step 3 — Check cache health

    A healthy session keeps a 95–97% prefix-cache hit rate; the README FAQ explains the checks.

    /acp-cache
// use cases

What you can build

  • Keep a coding session alive for days without losing context
  • Cut token costs on long agent runs
  • Run marathon refactors in a single session
  • Compare compression against full context with the published benchmarks

Two more from the same shelf: claude-mem — Give your coding agents a persistent memory that, and mem0 — Drop-in persistent memory infrastructure for AI. Browse every AI Agents tool in the catalogue to compare the category. Before running a model locally, check how much VRAM you need for local LLMs — model size has to match your hardware.

// faq

Questions, answered

What does billion-context do?

It compresses consumed conversation into layered summaries as a coding session grows, so one session can run for days through a single context window.

How much does it save?

About 5x fewer tokens; the third-party benchmark shows 58.3% lower cost than full context on ContextBench.

Which agents does it work with?

Claude Code, Codex, OpenCode, Pi, Gemini CLI, Kimi, Qwen Code, Copilot CLI, TRAE, Crush, Zed, Aider and more.

Is compression lossy?

Summaries are high-fidelity and reversible — they can be decompressed on demand.

Is it free?

Yes — MIT, including the paper itself.

// keep exploring

Similar tools

AI Agents

claude-mem

Give your coding agents a persistent memory that survives every session.

★ 97.9k starsApache-2.0
View guide →
AI Agents

mem0

Drop-in persistent memory infrastructure for AI agents and apps.

★ 66.8k starsApache-2.0
View guide →
AI Agents

OpenHands

Open-source AI-driven development platform: autonomous software agents in a sandbox

★ 90.3k starsMIT
View guide →
AI Agents

magic-context

Self-managing, unbounded context and long-term memory for coding agents: one session, for life.

★ 2.3k starsMIT
View guide →
Agents

xerj

AI-native search that indexes code, docs, and PDFs with 40x fewer tokens than grep.

★ 2.6k starsApache-2.0
View guide →
AI Agents

paritok-4b-v1

Compression gateway that cuts AI coding agents' token bills up to 85%.

★ 1.5k starsApache-2.0
View guide →
// alternatives

Alternatives in AI Agents

The most-starred other AI Agents projects in the LibreAI catalogue — the realistic shortlist if billion-context is not the right fit.

  • openclaw★ 391.6k

    A personal AI that really does things — on any OS, with your data staying yours.

  • Skills For Real Engineers★ 322.7k

    Matt Pocock's engineering skills for coding agents — grill the spec first, then build it right, MIT

  • superpowers★ 294.9k

    An agentic skills framework & software development methodology that works.

  • ECC★ 275.2k

    Agent harness optimization system with skills, memory and security for Claude Code, Codex and more

  • hermes-agent★ 252.0k

    The agent that grows with you — a Python framework for adaptive AI agents.

// more in agents

More in AI Agents

Nearby AI Agents projects in the catalogue, closest in stars to billion-context — keep exploring the shelf either side of it.

  • agent-native★ 7.0k

    A framework for building agentic apps

  • open-multi-agent★ 7.0k

    Open Multi Agent — a self-hosted TypeScript agent runtime with durable approvals and verifiable run records.

  • openvla★ 7.1k

    Open-source 7B vision-language-action model and codebase for generalist robot manipulation.

  • AppAgent★ 6.9k

    AppAgent — Tencent's multimodal agent that learns smartphone apps by exploration, then operates them.

  • Product-Manager-Skills★ 7.2k

    Product Management skills framework built on battle-tested methods for Claude Code, Cowork, Codex, and AI agents.

  • x402★ 6.7k

    A payments protocol for the internet — built on plain HTTP.

Get billion-context

Free and open — grab the source, star the repo, and start creating.