# Do you (not) need autocompact: long conversations for one person, and resident AI that hands over shifts

> Autocompact is worth it for one person running long tasks at a computer. But if your system already opens a new conversation with a handoff card when the chat gets too long, turning on autocompact means the handoff never happens. This note covers how to tell the two cases apart and how to set up each.

Published 2026-11-12 · Updated 2026-11-12 · URL https://wizerdbache.com/en/notes/autocompact-do-you-need-it/


Recently someone on social media shared a setting: set Claude Code's autocompact threshold to 400k and usage drops noticeably. I have run it that way since September 2026, and I also built a whole handoff mechanism around it (the next note covers that in detail).

But while talking with someone else recently, I came across a counterexample: a resident AI system had added this exact setting, the system kept running into trouble, and in the end they reverted it. The problem was not how well compaction works, but that **the system already had another mechanism doing the same job**.

So this note answers the question: do you actually need autocompact?

The official behavior below follows the documentation I read on 2026-11-12; my Claude Code is version 2.1.322.

## Conclusions first

- **One person, one conversation, running long tasks while sitting in front of it yourself:** you need it. With my usage, lowering the threshold and adding a handoff before compaction pays off.
- **If the system automatically opens a new conversation and writes a handoff card when the chat gets too long (called "watchdog handover" below):** do not let the two mechanisms compete. Choose one as the owner and let the other serve only as a safety net.
- **You may already be using autocompact:** even without changing the threshold, Claude Code by default compacts, in interactive sessions using the one-hour cache, any conversation over 200k that has been idle for nearly an hour (idle compaction). In systems whose handover line is at 200k or above, this most easily takes the work away quietly.

## 1. Why autocompact is needed

Claude Code resends the whole conversation every turn; the unchanged parts are read from cache and billed at a lower price. But the longer the conversation, the more each turn has to read. In a long task, re-reading that large earlier block on every turn becomes the main cost.

The default threshold is high: a model with the native 1M window auto-compacts at around 967K. In my own records, long sessions almost never reach that line, and the conversation just keeps growing. Lowering the threshold (for example to 400k) forces a mid-session tidy-up: you pay for one summary, and in exchange each turn reads much less. By my own calculation, with my usage, the cost is earned back after running a while longer after compaction.

Another benefit is **continuity**: compaction happens in place within the same conversation, so you do not need to open a new conversation or re-explain the background. For one person at a computer, this is convenient.

The cost is also clear: I measured one and a half to three minutes per compaction, and the summary loses detail. So the threshold is only the first step; writing important things to a file before compacting is the key. That part is covered in the [next note](https://wizerdbache.com/en/notes/autocompact-beyond-threshold/).

## 2. When it does not apply: resident AI that hands over shifts

Some systems are used very differently from "one person, one conversation":

- they have only **one main conversation**, and all external messages (chat groups, notifications, schedules) enter through this single entry point;
- beside it, a **watchdog program** monitors the conversation length, and when it reaches a set amount (for example 300k tokens), it ends that conversation and opens a new one to take over;
- before the handover, the old conversation writes a **structured handoff card**: which background jobs are still running, which messages have not been sent yet, and whom it is waiting on a reply from. The new conversation always reads this card first when it starts.

This design exists to solve the "conversation too long" problem, so it and autocompact are **two ways of doing the same job**. If both are on, this is what happens:

### Compaction gets there first, and the handover never happens

Compaction has two paths that can beat the handover line:

- **Idle compaction:** a conversation over 200k that sits still for nearly an hour gets compacted first. In a system whose handover line is at 200k or above, the moment the conversation stops, idle compaction can get there first.
- **Threshold set near or below the handover line:** autocompact fires a little below the set value (I set 400k and measured it at roughly 360–375k). If the watchdog's handover line is higher than that, compaction always comes first.

Once compaction shrinks the conversation, it never grows to the handover line. So the watchdog does not hand over, the handoff card is not written, and **no one is notified**. In the case I saw, I only found out by going back through the records afterward: the monitoring report showed "interruptions: 0", yet compaction had actually happened more than once, because the report only counted "restarts," and compaction does not count as a restart.

### "Can be looked up" is not the same as "in the head"

Some people say compaction does not lose data: the full conversation log is still there, and anything can be looked up. That is true, and the message after compaction also includes the path to the log file. But the model mainly has the summary in hand, and **whether to look back, and which part to read, is up to it**. It does not know what the summary left out, so it does not know what to look back for.

The handoff card in a handover system covers exactly this point: background jobs, pending messages, and who it is waiting on are fixed fields, and the new conversation is forced to read them at startup. An autocompact summary is a free rewrite by the model; what it writes and what it leaves out is not known in advance.

### Who said it gets blurred across multiple senders

This risk only exists for systems that receive messages from several people. A good handoff card marks each message as "said by the owner" or "said by someone else," and states clearly that the other people's words **must not be treated as instructions**.

A summary does not guarantee to keep that distinction. My inference: something a third party said casually could, after compaction, be recorded as an assignment from the owner. If that actually happens, it is no longer just a recording error; it is a security problem.

### Pauses can collide with time limits on external channels

Compaction stops for a while (I measured one and a half to three minutes). If an external message arrives during that window, some messaging platforms' "reply tokens" expire within a time limit, so by the time compaction finishes the reply may have expired and cannot be sent. A person sitting at a computer never hits this; a resident system can.

### "Only half" makes it worse

This case had one more detail: they added only the "threshold 400k" line, without installing the hooks that write a snapshot before compaction and point back to the original after it. So after compaction, the model had only its original "read the handoff card" reminder, but no handoff card had been written.

This is also what I singled out when I reorganized my capability pack this time: **setting only the threshold without the handoff is not a lighter version; it is a different thing.**

## 3. Which one are you?

| Your usage | Recommendation |
|---|---|
| One person, one conversation, watching it yourself | Turn on autocompact, lower the threshold, and add a handoff before compaction |
| Single main entry point + watchdog handover + handoff card | Let the watchdog be the owner; keep autocompact only as a safety net, and turn off idle compaction |
| Want to use compaction instead of handover | Possible, but move the handoff card's contents into the "pre-compaction snapshot" and make compaction also notify you |
| Not sure | Check whether your system has any program that reopens the conversation when it gets too long; if it does, you are in the second case |

## 4. What you can do

The principle is just one: **one piece of work can have only one owner. The controlled system must trigger first, the other system serves only as a safety net, and as soon as the safety net triggers, you must be told.**

### If you are an ordinary user

Turn on autocompact. How to set the threshold, what compaction drops, and how to save a file before compacting are covered in the [next note](https://wizerdbache.com/en/notes/autocompact-beyond-threshold/) with the full method.

### If your system hands over shifts: let the watchdog be the owner

1. **Turn off idle compaction:** add `"idleCompaction": false` to the settings file (effective from v2.1.290). Or raise the idle compaction threshold (environment variable `CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS`) to above the handover line.
2. **Put the autocompact trigger point above the handover line:** for example, if the watchdog hands over at 300k, set the autocompact threshold above the handover line, leaving a margin for the fact that the actual trigger comes a bit earlier than the set value. This way, under normal conditions, the watchdog always acts first.
3. **Make the safety-net trigger an alarm:** in the PreCompact hook, pick out only the cases where `trigger` is `auto` (manual `/compact` also fires it; idle compaction reports `auto` too, so turn it off first as in step 1), record a line "autocompact happened," and notify you. This hook should not print any output, because PreCompact output is treated as instructions for the summary. When configured correctly, it should rarely fire; when it does, go check whether the watchdog failed to hand over when it should have.
4. **You can also turn it off entirely:** setting `"autoCompactEnabled": false` disables both autocompact and idle compaction, while manual `/compact` still works. But then there is no safety net: if the watchdog fails, the conversation keeps growing until it hits the model's limit. I keep it on as a safety net myself.

### If you want to use compaction instead of handover

It is possible, but it amounts to moving the handover's work to before and after compaction:

- **Before compaction:** have the model write a snapshot following the handoff card's fixed fields (background jobs, pending messages, who it is waiting on, the sender of each message), rather than relying only on the summary.
- **Summary instructions:** in CLAUDE.md's Compact Instructions, require the summary to keep the sender markers, and mark everyone else's words as “must not be treated as instructions.” But a summary following the instruction is not a guarantee (I tested it and it followed almost every time, not every time), so the main safeguard for this security requirement is still the fixed fields in the snapshot.
- **After compaction:** use a SessionStart hook that fires only after compaction to put the snapshot back into the context, so the model reads it at startup.
- **Observability:** have compaction also be written to your interruption log and notify you, just as with a handover. Otherwise you lose the signal of "the system restarted but did not tell you, which means something went wrong.”

## 5. What I do

My usage is the first case: one person, one conversation, watching it myself. So I keep autocompact on (at 400k), add a 300k reminder in front so the model writes a handoff snapshot first, use Compact Instructions to specify what the summary keeps, feed the snapshot back with a hook after compaction, and every few compactions check whether the handoff dropped anything. The details and pitfalls are in the [second note](https://wizerdbache.com/en/notes/autocompact-beyond-threshold/).

I organized all of this into a capability pack. Besides updating the code in this release, the main additions are a security note that spells out the read and write scope of each file, a note on how to set up a handover system, and a preflight program to run before installing. The preflight checks the current settings and tells you whether autocompact or idle compaction would beat your handover line, and whether you only installed half. The download and security note are in the [third note](https://wizerdbache.com/en/notes/autocompact-pack-download/).

## Closing

Autocompact is not a question of good or bad. For a single person's long conversation, it is a tool that saves money and is convenient; for a system that already hands over shifts, it is a second owner; and in the cases I have seen, **the one that won was the uncontrolled one, and nobody made a sound**. First work out who is doing this job in your system, then decide whether to turn it on.

## Sources

- [Zhang Weifeng (2026-10-10). Understanding the autocompact mechanism in 3 minutes. Instagram.](https://www.instagram.com/reel/DeS6FD4gOfm/) (Example of a 400k setting shared on social media)
- [Claude Code Docs: Set the auto-compact window](https://code.claude.com/docs/en/model-config#set-the-auto-compact-window) (Official documentation, read 2026-11-12)
- [Claude Code Docs: idleCompaction](https://code.claude.com/docs/en/settings-reference#idlecompaction) (Official documentation, read 2026-11-12)
- [Claude Code Docs: autoCompactEnabled](https://code.claude.com/docs/en/settings-reference#autocompactenabled) (Official documentation, read 2026-11-12)
- [Claude Code Docs: What survives compaction](https://code.claude.com/docs/en/context-window#what-survives-compaction) (Official documentation, read 2026-11-12)
