Skip to content

Conversation

@ajjucoder
Copy link

Summary

This PR adds a new documentation file (COMPACTION.md) that provides best practices for preserving context during Claude Code's auto-compaction feature.

Problem

When Claude Code reaches ~95% token capacity, it auto-compacts the conversation history. Without proper guidance, this can cause loss of:

  • Current task state and progress
  • File modifications made during the session
  • Technical decisions and their rationale
  • Error messages and their resolutions

Solution

This guide provides users with recommended instructions to add to their ~/.claude/CLAUDE.md configuration file, including:

  • What context to preserve in full detail
  • What can be safely summarized
  • A structured template for post-compaction context
  • Priority ordering when space is limited

Testing

I have personally used these instructions across multiple long-running Claude Code sessions and confirmed they significantly improve context retention after compaction.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant