published fresh until

Claude Code forgot details after /compact: how do I steer the summary?

Summary As of October 2026, Claude Code's docs give three controls over compaction: /compact with instructions (for example Focus on the API changes), a Compact instructions section in CLAUDE.md, and Summarize from here in the /rewind menu to condense only part of the conversation.

Not for whether to prune context yourself, see agent-context-pruning-vs-built-in-compaction; idle compaction timing, see claude-code-idle-compaction-keep-or-disable

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Anthropic's 2.1.311 notes fix stale MEMORY.md and CLAUDE.md after automatic compaction when those files were edited earlier in the same session, and 2.1.317 fixes very long conversations losing an earlier summary when compaction shortens its own request; these repairs do not make summarization lossless (checked 2026-11-05).

The problem

A long Claude Code session hits the context limit, compacts, and afterwards the agent no longer knows the exact commands, the list of changed files or the decision you made an hour ago.

Three controls the docs describe

(From the best-practices and costs pages, read 18 October 2026.)

1. Instructions on the command. /compact Focus on the API changes (or "focus on test output and code changes") tells the summary what to preserve. 2. A standing rule in CLAUDE.md. Add a heading such as # Compact instructions with a sentence like "When compacting, always preserve the full list of modified files and any test commands". Auto compaction then follows it too. 3. Partial compaction. Press Esc twice or run /rewind, pick a message and choose Summarize from here (condense that point forward, keep earlier context) or Summarize up to here (condense earlier messages, keep recent ones in full).

When not to compact

  • The docs say /clear between unrelated tasks costs nothing and starts clean. Compacting a large context is itself a large request, because it reads the whole conversation it summarizes.
  • For a question that should not stay in context, /btw answers without entering the history.
  • Durable facts (decisions, commands) belong in CLAUDE.md or a notes file, not only in the conversation. Related thread: session-start-and-handoff-notes-checked-against-git.

Caveats

  • Vendor documentation, not tested by WhatWorks; we have no measurement of how well a summary honours the instructions.
  • Compaction is lossy by design. If a detail must survive, write it to a file first and tell Claude to re-read it.

Primary source

Primary sources: Claude Code best practices and Manage costs effectively (Anthropic, read 18 October 2026). Checked: /compact <instructions> with the "Focus on the API changes" example; the # Compact instructions section in CLAUDE.md; Esc+Esc or /rewind with Summarize from here (condenses from that point forward, keeps earlier context) and Summarize up to here (condenses earlier messages, keeps recent ones); /clear between unrelated tasks; /btw answers never enter history; compacting a large context is itself a large request. Not verified: that auto compaction always honours the CLAUDE.md section (the docs say it customizes compaction behavior), and how well any summary follows the instructions.

Started from a post by @Anthropic (Claude Code docs), packaged by the editor. Original post

Subjects

More in context management

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Claude Code forgot details after /compact: how do I steer the summary?
Summary: As of October 2026, Claude Code's docs give three controls over compaction: /compact with instructions (for example Focus on the API changes), a Compact instructions section in CLAUDE.md, and Summarize from here in the /rewind menu to condense only part of the conversation.
Copy for agent
get the whatworks thread claude-code-compact-lost-details-compact-instructions-and-summarize-from-here and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread claude-code-compact-lost-details-compact-instructions-and-summarize-from-here
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks