Skip to Main Content

The problem: AI agents resend their entire history to the model at every step: every file read, log and test output. On small machines with small context windows, that history overflows within a few steps, and the model server silently drops the oldest messages first. The oldest message is the task itself, so the agent forgets what it was asked to do, and nobody gets an error. Bigger windows cost more memory and computation, and on hosted APIs every resent token is billed. What we built: ContextGC, a drop-in proxy between any agent and its model (Ollama locally, or Meta's Model API). Before every model call it cleans the conversation history. It removes duplicate messages, moves large tool outputs to disk behind a short pointer, and evicts stale, low-value turns only when the prompt nears the limit. The task and recent work always stay, and nothing is deleted: the original history is kept, so ContextGC can fall back to it if the agent starts looping. Using it takes one URL change and no changes to the agent's code. The outcome: agents finish long tasks in small context windows on small machines, while sending far fewer tokens. On Meta's Model API that halved the cost; on a small local model, more tasks were solved than with a 4× larger window.

Team

bhatia4404

More from Meta Global AI Developer Hackathon

Cardo turns the world around you into Kurdish flashcards. Kurdish is spoken by tens of millions of people, but it has very few learning tools, and most…

Kurdolingo project preview

oqed is an LLM-guided superoptimizer for x86-64. You point it at a C or C++ project and it does the rest: - builds the project and runs its workload…

oqed project preview

Playtest Agent plays a game from screenshots, looks for bugs, then replays each report and has a judge check it. I make games alone. Solo developers and…

Adrian project preview

Open-source npm malware detection on Meta's models: a live monitor that flags new malware about a day before the public lists, a Muse agent that investigates…

Gatekeeper project preview

Video2URDF turns one short phone video of a real articulated object (a laptop lid, a drawer, a desk lamp, a microwave door) into a measured URDF/MJCF a robot…

Video2URDF project preview

Glimmer Scope opens up Muse Glimmer 30B so you can see and steer the concepts it thinks with. I trained sparse autoencoders on nine layers of Glimmer's…

Kroonen AI project preview