Bug Report Running Compact At Usage Limit Destroys Context

by Viktoria Ivanova 59 views

Hey guys! Let's dive into a pesky bug report we've got on our hands. It's a real head-scratcher, especially for those of you who rely on Claude for longer coding sessions. We're going to break down the issue, how to reproduce it, what should happen, and what's actually happening. So, buckle up and let's get started!

Environment Details

Before we jump into the nitty-gritty, here’s the setup where this bug was spotted:

  • Platform: Anthropic API (This is key, as it helps us narrow down the scope of the issue.)
  • Claude CLI Version: 1.0.67 (Claude Code) (Knowing the version is crucial for pinpointing if it's a recent bug or something older.)
  • Operating System: Debian Trixie (The OS can sometimes play a role in these kinds of issues.)
  • Terminal: VSCode (VSCode is a popular terminal, so this is good info to have.)

Why Environment Details Matter

Providing environment details is super important when reporting bugs. It helps the developers recreate the issue on their end, which is the first step in squashing it. Think of it like giving a doctor your symptoms – the more details, the better the diagnosis!

Bug Description: The Case of the Vanishing Context

Alright, here's the heart of the matter. The bug description is clear: when you hit the usage limit and then run the /compact command, your entire session history gets wiped out. Poof! Gone. Instead of the conversation being compacted, it’s replaced with a message saying:

====================================================== Previous Conversation Compacted ======================================================
● Compact summary
  ⎿  This session is being continued from a previous conversation that ran out of context. The conversation is summarized below:
     Claude AI usage limit reached|1754161200.

This is not what we want, right? You're expecting the conversation to be summarized and made more concise, not completely erased. Imagine working on a complex project and losing all that context – it's a coder's worst nightmare!

The Impact of Losing Context

Losing context in a coding session is like forgetting where you parked your car in a massive parking lot. You know you were working on something important, but all the details are fuzzy. This can lead to:

  • Wasted time: You have to retrace your steps and figure out where you left off.
  • Frustration: It's incredibly frustrating to lose work, especially when you're in the zone.
  • Reduced productivity: Constantly losing context breaks your flow and makes it harder to focus.

That's why this bug is a big deal and needs fixing ASAP.

Steps to Reproduce: How to Make the Bug Appear

So, how do you make this bug happen? Here are the steps:

  1. Reach the Usage Limit: This means using Claude enough that you hit the maximum amount of context allowed.
  2. Run /compact: Once you've hit the limit, you try to compact the conversation to free up space.

That's it! Simple, but devastating. By following these two steps, you can reliably trigger the bug.

Why Reproducible Steps are Crucial

Giving clear, reproducible steps is like providing a recipe for the bug. Developers need to be able to make the bug happen on their own machines to understand what's going wrong. Without these steps, it's like trying to fix a car without knowing what's broken.

Expected Behavior: What Should Happen

Let's talk about what should happen when you run /compact. The expected behavior is that the conversation gets summarized and compacted, reducing the amount of context used. This allows you to continue the conversation without losing important information.

Think of it like tidying up your workspace. You're not throwing everything away; you're just organizing it to make room for more. The /compact command should do the same for your Claude sessions.

The Importance of Clear Expectations

Defining the expected behavior is crucial because it sets a benchmark. It tells the developers what the command is supposed to do, which helps them identify where the actual behavior deviates. It's like having a blueprint for a house – you know what the final product should look like.

Actual Behavior: The Harsh Reality

Now, for the actual behavior. Instead of compacting the conversation, the entire session gets replaced with the