Harness Notes

Compaction

Updated 2026-11-24,

On this page

What each harness does when the conversation outgrows the context window: when it compacts, what it keeps, and how you can steer it.

When it happens

QuestionCursor Agentchecked at 2026.10.12-d47ca18
Automatic compaction, and when

Yes. When a chat's context window gets close to full, Cursor summarizes older parts of the conversation to make room, and this also happens partway through long tool-calling turns. Cursor does not publish the exact trigger percentage or token count. Its servers decide when to compact, and the preCompact hook reports the current context_usage_percent, context_tokens and context_window_size each time it happens.

The preCompact example payload (85%, 120000 of 128000 tokens) is only an illustration, not the threshold.

Change the trigger or turn it off

Not supported

No. There is no setting, flag or environment variable to change when automatic summarization triggers or to turn it off. The only lever is a bigger window: pick a larger-context model variant in /model or with --model 'model[context=1m]', or use /max-mode on legacy request-based plans.

Compact by hand

Run /summarize in an interactive session to summarize the conversation and free up context. /compress and /compact are aliases. The command takes no instructions, so you can't tell it what to keep, and it says No active session. if the chat has no turns yet.

See how full the context is

The prompt bar footer shows how full the context window is as a percentage (set AGENT_CLI_HIDE_PROMPT_BAR=true to hide the bar). Run /context for a breakdown by category: system prompt, tools, rules, skills, MCP, subagents, summarized conversation and conversation. The /context command isn't in the slash-command reference table, but it's covered in the CLI changelog and present in CLI 2026.10.12.

What it does

QuestionCursor Agentchecked at 2026.10.12-d47ca18
What replaces the conversation

Partly

Cursor's backend writes the summary, not your local CLI. The CLI sends a summarize action and shows Summarizing while it runs. Older messages are replaced by a summary that counts as 'Summarized conversation' in the context breakdown, and your latest message is kept word for word. Cursor doesn't document which model writes the summary, and for teams that don't allow data storage, summarization fails rather than storing data.

What survives

Partly

The system prompt, tool definitions, rules, skills, MCP instructions and subagent docs are counted separately from the conversation, so summarization doesn't touch them. Since September 2026 your most recent message is kept word for word after summarization. In CLI 2026.10.12 the session also stores todos, plans and invoked skill blocks outside the summarized turns. Cursor doesn't document exactly how many recent turns or files are kept.

Trimming without summarising

Not documented

Cursor doesn't describe any separate step that trims old tool outputs without summarizing, and there is no setting to control one. The only documented ways to free context are automatic summarization and /summarize.

The full history afterwards

Yes. Each chat's ~/.cursor/chats/<hash>/<chatId>/store.db keeps summary archives that hold the messages that were summarized, and a JSONL copy is written to ~/.cursor/projects/<slug>/agent-transcripts/<chatId>/. After summarizing, the CLI shows the summary in a cyan Summary box in the chat. If summarization fails or you press Stop during it, the earlier conversation is kept.

The store.db and JSONL formats are internal and undocumented.

Shaping it

QuestionCursor Agentchecked at 2026.10.12-d47ca18
Customise the summary or hook in

Partly

You can't change the summary prompt. A preCompact hook in hooks.json runs before every compaction and receives trigger (auto or manual), usage numbers and messages_to_compact. It can only observe: it can return a user_message to show you, but it can't block or change the compaction. A Claude Code PreCompact hook is mapped to preCompact. There is no post-compaction hook.

When a request overflows anyway

Since v2026.10.08, a session that hits the context limit summarizes and then continues the turn instead of getting stuck. An earlier fix (v2026.09.15) stopped long Claude and GPT turns from re-compacting on every step without freeing any space.

Notes and sources

Cursor Agent, 7 sources
Automatic compaction, and when, 3
Change the trigger or turn it off, 3
Compact by hand, 2
See how full the context is, 2
What replaces the conversation, 2
What survives, 2
Trimming without summarising, 1
The full history afterwards, 2
Customise the summary or hook in, 2
When a request overflows anyway, 1