---
title: "compact-1"
description: "Compaction · Waitlist compact-1 fits an agent's conversation into your token budget while keeping key text unchanged."
canonical: https://caveman.so/models/compact-1
last-updated: 2026-11-30
---

# compact-1

Compaction · Waitlist

compact-1 fits an agent's conversation into your token budget while keeping key text unchanged.

Join the compact-1 waitlist on this page · [Explore Caveman Cloud](https://caveman.so/cloud)

1M tokens free each month per organization.

Sample: an over-budget coding conversation comes back inside its budget with the system prompt, every user message and
the agent's latest turns unchanged; the long tool outputs keep the lines that matter (the ledger-db timeout, the
`Charge` function) and the rest is stored, back by handle.

## What it does

Keep the exact words your agent needs.

### Keeps your instructions

Keep every user message and constraint, along with the exact text of the latest turns.

### Keeps useful tool output

Keep older tool output your agent is likely to need next. Retrieve text it left out.

### Keeps your prompt cache working

Keep the start of the conversation unchanged so your provider can reuse its prompt cache.

## How it is measured

One build on 13 and 14 Oct 2026, holdout splits run once, against reimplementations of each tool's method, with token
counts estimated locally.

- **Evidence kept: 64.2** weighted recall at 15% of the history, 600 holdout cases; the next best, pi's method, kept
  45.0.
- **Cost per task: $0.078** against $0.103 with no compaction at nearly the same reward (0.374 against 0.379),
  Long-Horizon-Terminal-Bench 1.0, 28 tasks, one seed, a gpt-6-luna agent. Every compactor saved about a quarter and
  none separated from another; with gpt-6.1-sol, which compacts about once a run, the saving was about 5%.
- **Speed: 3.8 ms** p50 per compaction, one CPU core; LLM summaries took 5.7 to 17 s in the same benchmark.

### Evidence kept, by method

Weighted recall at 15% of the history, 600 holdout cases. Each arm reimplements that tool's method; none is the shipped
tool.

| Method | Evidence kept |
|---|---:|
| compact-1 | 64.2 |
| pi's method | 45.0 |
| Factory's method | 42.5 |
| OpenHands summary | 39.2 |
| OpenCode's method | 28.9 |
| Codex's method | 26.6 |

### Questions about the run so far

1,786 state questions, answered by a model from each history: 68.0% from compact-1's history, 68.7% from the full
history.

## API reference

Use your Caveman Cloud key to call the model.

- **Endpoint:** `POST /v1/compact`
- **You send:** `messages` (OpenAI or Anthropic shape), `budget_tokens`
- **You get back:** your messages in your shape, token counts, `recovery_handles`, `model`
- **Size limit:** up to 8 MB a call
- **Storage:** dropped spans stored for recovery; `zdr` stores nothing
- **Runs:** Caveman Cloud only
- **Free each month:** 1M tokens

```sh
curl https://gateway.caveman.so/v1/compact \
  -H "Authorization: Bearer $CAVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "..."}], "budget_tokens": 48000}'
```

## Caveman models

Each model cuts a different cost: input, conversation history or model calls.

- [trim-1](https://caveman.so/models/trim-1), input tokens: keeps the exact lines that answer your agent's question.
  On GitHub.
- compact-1, conversation history: fits your agent's history into its token budget in 3.8 ms. Waitlist. This page.
- [router-1](https://caveman.so/models/router-1), model choice: matches the model and effort to each call.
  Waitlist.

[Explore Caveman Cloud](https://caveman.so/cloud)

## Questions

Answers about retrieving text and fitting conversation history into your token budget.

### Can dropped text come back?

Yes. Every dropped span is stored and comes back by handle, listed in the response's `recovery_handles`. Send `zdr`
and nothing is stored.

### What if the history already fits?

It comes back as sent. The budget is counted after the leading system messages.

### Why not summarize?

LLM summaries took 5.7 to 17 s in the same benchmark, and an agent often needs the exact text back: in our own
sessions, a real compaction was followed by a re-read within ten turns 28% of the time in Claude Code and 33% in Codex
(aggregates only). compact-1 keeps the original text instead.

### How is it different from trim-1?

compact-1 fits a whole agent history inside the token budget you set. trim-1 cuts one payload against a question.

## Start with compact-1

Join the compact-1 waitlist on this page · [Explore Caveman Cloud](https://caveman.so/cloud)

1M tokens free each month per organization.
