Claude Code's compaction discards data that's still on disk

Published: (February 22, 2026 at 12:14 AM EST)
1 min read
Source: Dev.to

Source: Dev.to

What happened

Compaction removed physical files that metadata still referenced. This is a metadata↔disk ordering/race condition—deletion happened before durable metadata confirmation, leaving live references to missing data.

Why it matters

  • Silent corruption: apps expect compaction to be safe.
  • When files disappear while indexes still point at them, you can get lost vectors, corrupted sessions, or errors that only surface under load or during recovery.

Takeaway for builders

  • Stop blind deletes.
  • Use a retention window and two‑phase deletes (mark → confirm → delete).
  • Employ fsync/atomic renames.
  • Implement end‑to‑end integrity checks and frequent snapshots.
  • Run chaos tests for compaction.

Reference: Claude Code’s compaction discarded data still on disk — bug report & discussion

0 views
Back to Blog

Related posts

Read more »

Does anyone here us HCL DX?

!pichttps://media2.dev.to/dynamic/image/width=256,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farti...