---
title: "Self-Compacting Language Model Agents"
description: "Long agent traces of chains of thought and tool calls accumulate stale content that anchors later generations and outgrow context window. SELFCOMPACT lets the model itself decide when and how to compact rather than using fixed-interval compaction triggered at a token threshold. It pairs a compaction tool that summarizes accumulated context with a lightweight rubric for when to fire, such as resolved sub-task or converging trajectory, and when to suppress, such as mid-derivation or stuck. Both are needed: the tool alone is unevenly used across open-weight models, while a rubric closes a meta-cognitive gap without training. On six math and agentic-search benchmarks across seven models, SELFCOMPACT matches or exceeds fixed-interval summarization at a fraction of the token cost, improving over no summarization by up to 18.1 points on math and 5–9 points on agentic search at 30–70% lower per-question cost."
---

# Self-Compacting Language Model Agents

[Apple](https://yomu.fyi/company/apple) · Oct 12, 2026

**Type:** Problem & solution

## Summary

Long agent traces of chains of thought and tool calls accumulate stale content that anchors later generations and outgrow context window. SELFCOMPACT lets the model itself decide when and how to compact rather than using fixed-interval compaction triggered at a token threshold. It pairs a compaction tool that summarizes accumulated context with a lightweight rubric for when to fire, such as resolved sub-task or converging trajectory, and when to suppress, such as mid-derivation or stuck. Both are needed: the tool alone is unevenly used across open-weight models, while a rubric closes a meta-cognitive gap without training. On six math and agentic-search benchmarks across seven models, SELFCOMPACT matches or exceeds fixed-interval summarization at a fraction of the token cost, improving over no summarization by up to 18.1 points on math and 5–9 points on agentic search at 30–70% lower per-question cost.

## Context

Long agent traces made of chains of thought and tool calls accumulate stale content that anchors later generations and can outgrow the context window. Prior scaffolds use fixed-interval compaction at a token threshold, which ignores trajectory structure and risks discarding partial results mid-derivation or mid-search. The paper frames the ability to judge when context is degrading as a meta-cognitive gap that unprompted models cannot reliably close on their own.

## Approach / What changed

SELFCOMPACT pairs two inference-time elements: a compaction tool the model invokes to summarize accumulated context, and a lightweight rubric specifying when to fire (a sub-task has resolved, or the trajectory is converging) and when to suppress (mid-derivation, or when stuck). Both elements are needed: the tool alone is unevenly used across open-weight models and is often invoked at unhelpful moments or not at all, while the rubric alone cannot act. Together they elicit adaptive compaction without fine-tuning or external supervision.

## Takeaways

- SELFCOMPACT is a scaffold that lets the model decide when and how to compact, without fine-tuning or external supervision.
- It combines a compaction tool for summarizing accumulated context with a rubric that fires when a sub-task resolves or the trajectory converges and suppresses mid-derivation or when stuck.
- On six benchmarks and seven models, it matches or exceeds fixed-interval summarization at a fraction of token cost, improving over no summarization by up to 18.1 points on math and 5–9 points on agentic search at 30–70% lower per-question cost.

## FAQ

### When does SELFCOMPACT choose to fire or suppress compaction?

The rubric fires when a sub-task has resolved or the trajectory is converging. It suppresses mid-derivation or when the model is stuck, avoiding discard of partial results while allowing summarization at useful breakpoints.

### Why is a rubric needed in addition to the compaction tool?

The tool alone is unevenly used across open-weight models and is often invoked at unhelpful moments or not at all. The rubric alone cannot act, so both are needed to elicit adaptive compaction without fine-tuning or external supervision.

### What did the evaluation compare against, and what were the results?

The evaluation covered six benchmarks on competitive math and agentic search across seven models. SELFCOMPACT matched or exceeded fixed-interval summarization at a fraction of token cost, improving over no summarization by up to 18.1 points on math and 5–9 points on agentic search at 30–70% lower per-question cost.

**Tags:** [Agent Memory](https://yomu.fyi/topic/agent-memory), [AI Agents](https://yomu.fyi/topic/ai-agents), [LLMs](https://yomu.fyi/topic/llm)

- Source: [Apple](https://machinelearning.apple.com/research/self-compacting-language-agents)
- Source URL: https://machinelearning.apple.com/research/self-compacting-language-agents
- Ingested by Yomu: 2026-10-13T00:00:21.573Z

[Read original post](https://machinelearning.apple.com/research/self-compacting-language-agents)
