ACGC (Agent Context Garbage Collector) is a lightweight sidecar for agentic AI systems. It dynamically selects, compresses, and retrieves relevant context within a fixed token budget using a memory DAG, semantic recall, and archival retrieval. Evaluations show 46–82% lower token usage while maintaining or improving quality—making agents cheaper, faster, and more memory-efficient without major application changes.
I built ACGC (Agent Context Garbage Collector) because I kept running into the same problem with agentic systems: the model was rarely starved of context — it was usually drowning in it.
The common approach is to keep appending more history, tool outputs, retrieved documents, memories, and intermediate state into the prompt. That works for a while, but as agents become longer-running and more stateful, context starts becoming expensive, noisy, and harder to reason over. You end up paying for a lot of tokens that may have little relevance to the task at hand.
The question that led to ACGC was simple:
Can an agent retain a large amount of memory without having to carry all of that memory inside every prompt?
ACGC sits alongside an existing agent stack as a lightweight sidecar. Instead of treating context as one ever-growing buffer, it manages it as a memory system. Information can be organized into a memory DAG, relevant memories can be recalled semantically, older information can move into an archive, and the final context is compiled according to a fixed token budget before being sent to the model.
The important part for me was that this shouldn't require rewriting an existing agent framework. The goal was to make context management an infrastructure concern that could sit beside the application rather than become deeply coupled to it.
The project evolved quite a bit while building it. Initially, I thought the problem was mostly about summarization and deleting old context. That turned out to be too simplistic. Recency isn't the same as relevance, and aggressively compressing memory can remove exactly the details an agent needs several turns later.
So the design gradually shifted from “garbage collect old tokens” to “compile the best possible context for the current task.”
That meant combining:
* structured memory relationships through a DAG,
* semantic recall for older or distant information,
* archival memory instead of permanent deletion,
* and token-budget-aware context compilation.
A big part of the work has also been testing whether this holds up outside our own examples. We extensively evaluated ACGC using external long-context and memory benchmarks, especially LoCoMo and LongMemEval, alongside our own ablations and golden datasets. The goal was to measure not just token reduction, but whether the system could still preserve the information needed for long-range recall, multi-turn reasoning, and memory-dependent questions.
Across our evaluations, ACGC reduced context/token usage by roughly 46–82% while maintaining or, in some cases, improving response quality.
The metric I ultimately care about is less “how many tokens did we remove?” and more:
How much useful intelligence are we getting per token sent to the model?
ACGC is still evolving, and I'm especially interested in feedback from people building long-running agents, coding agents, copilots, or systems where context keeps accumulating over time.
Would love to hear how others are currently handling context growth and memory in production agents.