Compaction loses operational knowledge, causing repeated user corrections

Resolved 💬 3 comments Opened May 2, 2026 by logimania Closed May 2, 2026

Problem

When context compaction occurs during a session, Claude Code loses all operational knowledge gained during the conversation. This forces the user to re-teach the same information repeatedly, significantly reducing productivity.

What gets lost

Compaction preserves high-level summaries (e.g., "strategy was changed from X to Y") but drops practical operational details:

  • Server connection info: SSH host, paths, node binary locations
  • Database schemas: column names, date formats (e.g., YYYYMMDD vs YYYY-MM-DD)
  • Service management: systemd service names, restart commands, which operations require sudo
  • Deploy workflows: build → scp → commit → push → restart (as a single workflow)
  • Display preferences: how the user wants data formatted and presented
  • Environment context: whether the user is on the server or local machine

Impact

In a real session today, compaction caused:

  1. Wasted ~30 minutes re-discovering VPS connection info, DB schema, and service management
  2. Incorrectly reported "zero bets today" due to wrong date format in query
  3. Manually killed a running service instead of using systemctl restart, causing a service outage
  4. Repeatedly added unnecessary ssh/! prefixes when the user was already on the server
  5. User had to correct the same mistakes 5+ times in a single session

Current workaround

Manually saving operational knowledge to the memory system. But this is reactive — knowledge only gets saved after the user corrects a mistake, not proactively when it's first learned.

Suggestions

  1. Auto-extract operational facts before compaction: Identify connection strings, paths, schemas, commands, and user-corrected behaviors and persist them automatically
  2. Compaction should preserve corrections: When a user corrects Claude's behavior, these should be treated as high-priority retention items
  3. Proactive memory saving: When Claude learns something environment-specific, save to memory immediately rather than waiting for compaction to lose it
  4. Same problem exists across agent switches and new sessions: Operational knowledge doesn't transfer, requiring re-teaching for every new context

Environment

  • Claude Code CLI on Windows 11
  • Model: Claude Opus 4.6 (1M context)
  • Project involves SSH to VPS, systemd services, SQLite databases, Node.js deployment

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗