Reduce monthly LLM API bills by routing mechanical agent actions away from the model
Compress long tool output and logs before sending them to the language model
Give an AI agent causal memory so it stops repeating earlier mistakes
| djlougen/hive | chandar-lab/semantic-wm | jujishou/codex-switch | |
|---|---|---|---|
| Stars | 30 | 30 | 30 |
| Language | Python | Python | Python |
| Setup difficulty | easy | hard | easy |
| Complexity | 3/5 | 5/5 | 2/5 |
| Audience | developer | researcher | developer |
Figures from each repo's GitHub metadata at analysis time.
Installed via pip, components are optional and lazy-imported.
Hive is a Python library that acts as a layer between an AI coding agent and the large language model it relies on. Large language models charge based on the number of tokens, which are roughly word-sized chunks of text, that get sent with each request. AI agents tend to send far more tokens than necessary because they include entire files, long test logs, and repeated context in every message. Hive intercepts those requests before they reach the model and strips them down. It does this in three ways. First, it classifies certain requests as mechanical decisions, meaning they do not require any AI reasoning at all, for example reading a file or running tests. Those actions get handled directly on the CPU without calling the model. According to the README, around 35% of agent calls fall into this category. Second, it compresses the remaining messages by labeling each piece of context as critical, debug output, tool output, error, or general information, then discarding or summarizing the low-priority parts. The README gives an example of a 5,000-line test log being compressed to 30 tokens. Third, it maintains a causal memory that tracks what the agent has already fixed and why, so the agent does not forget earlier decisions and repeat the same mistakes. The main class is called HiveStack. You initialize it and call a single method that handles routing, compression, and memory lookup in one step. You can also use each component independently if you only want compression or only want the memory system. The README is aimed at developers building or running AI agents at scale and frames the library around cost savings, with example numbers comparing monthly API bills before and after. It has been tested on specific hardware configurations. The library is installable via pip and released under the MIT License.
A Python library that sits between an AI agent and its language model to cut token costs by routing simple actions to the CPU and compressing bloated context.
Mainly Python. The stack also includes Python.
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.
Setup difficulty is rated easy, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.