explaingit

aimaghsoodi/foveance

Analysis updated 2026-05-18

21PythonAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A Python tool that compresses repeated text sent to AI models, cutting input tokens by up to 82% without losing any information.

Mindmap

mindmap
  root((Foveance))
    What it does
      Lossless token compression
      Reduces repeated context
      Wraps coding agents
    Tech stack
      Python
      pip package
    Use cases
      Wrap Claude Code or Cursor
      Compress messages in code
      View savings dashboard
      Try built in demo
    Audience
      Developers
      AI agent builders
    Setup
      pip install foveance
      Run wrap command
      Optional ML extras

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Wrap an existing coding agent like Claude Code or Cursor to automatically cut its token usage.

USE CASE 2

Compress a list of chat messages in your own Python code before sending them to a model.

USE CASE 3

Run a local dashboard to see how many tokens and how much cost are being saved.

USE CASE 4

Try a built in demo to see the compression work without needing an API key.

What is it built with?

Pythonpip

How does it compare?

aimaghsoodi/foveance0whitedev/detranspiler2951461586/mulerun-pool
Stars212121
LanguagePythonPythonPython
Setup difficultyeasyhardmoderate
Complexity2/54/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

In plain English

Foveance is a Python tool that shrinks how much text you send to an AI model without losing any of the information in it. AI coding assistants and chat agents tend to resend their entire conversation history on every single turn, including the same file listings and repeated error messages, and you pay for all of that repeated text each time. Foveance works like a compression tool such as gzip: it finds text that already appeared earlier and replaces the repeat with a short reference back to it, so the model still receives every fact, just without the repetition. According to the README, this approach cuts the number of input tokens by up to 82 percent while staying fully reversible, meaning nothing is summarized or dropped, and the compressed text can be turned back into the exact original. The project's own benchmarks claim it beats other compression methods that are lossy, meaning they can quietly drop facts to save space, and even report that answer accuracy on test questions went up slightly once the repeated text was removed. There are three ways to use it. You can wrap an existing coding agent, such as Claude Code, Codex, Cursor, or aider, with one command, which runs the tool exactly as before but compresses traffic behind the scenes and shows a local dashboard of tokens saved. You can call a single Python function directly in your own code to compress a list of chat messages before sending them to a model. Or you can run a built in demo command to see the tool work on a sample without needing an API key. Installation is a simple pip install, with an optional extra package for machine learning features used in benchmarking. The project is released under the Apache 2.0 license and includes public benchmark scripts and result files so its performance claims can be checked.

Copy-paste prompts

Prompt 1
Help me install foveance and wrap Claude Code with it to reduce token usage.
Prompt 2
Show me how to use the compress function in my own Python script.
Prompt 3
Explain how foveance stays lossless while still reducing tokens.
Prompt 4
Walk me through running the foveance demo command.
Prompt 5
Help me understand the benchmark results comparing foveance to other compression methods.

Frequently asked questions

What is foveance?

A Python tool that compresses repeated text sent to AI models, cutting input tokens by up to 82% without losing any information.

What language is foveance written in?

Mainly Python. The stack also includes Python, pip.

How hard is foveance to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is foveance for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.