Skip to content

CLAUDE.md context lost after /compact — re-inject project instructions #24460

Description

@bosgeluk

Problem

After running /compact, the contents of CLAUDE.md (project instructions) are summarized along with the rest of the conversation history. This means project-specific rules, conventions, and constraints defined in CLAUDE.md may be partially or fully lost after compaction.

This is particularly problematic for projects with detailed governance rules (commit conventions, push procedures, naming conventions, security rules, etc.) that must be followed consistently throughout the entire session — including after a compact.

Expected behavior

CLAUDE.md project instructions should be re-injected in full after /compact, similar to how they are injected at conversation start. They are not conversation history — they are persistent project context that should survive compaction.

Current workaround

After every /compact, the user must manually say "read CLAUDE.md" to restore the project instructions. This is easy to forget and defeats the purpose of having a persistent project configuration file.

Proposal

Treat CLAUDE.md content as a system-level invariant that is always present in context, not as part of the conversation history that gets compacted. After /compact, re-inject the full CLAUDE.md content automatically.

Environment

  • Claude Code CLI
  • Observed with Claude Opus 4.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions