Skip to content

Working-state continuity: survive compaction and /clear (the long-session "goes dumb" problem) #70555

Description

@alfmarkel

Summary

Working state doesn't survive context compaction or /clear. On long sessions the assistant slowly "goes dumb" — re-deriving things, forgetting in-flight threads, repeating work — and after a /clear it has no idea where we just were. The forgetting and the resulting confident-but-wrong guessing are the same problem. I've built a hook-layer workaround that fixes it, and I think the pattern belongs in the product.

The problem (two failure modes, both chronic)

  1. Long-session degradation. As context fills and auto-compaction summarizes, granular working state gets compressed away — which file is mid-edit, what was just deployed-but-not-committed, the exact next action. The assistant quietly re-derives, forgets in-flight threads, and repeats work. You usually don't notice until it's already lost.
  2. Cold-start amnesia after /clear or compaction. A fresh session reloads CLAUDE.md but has no sense of where we just were. The user spends real effort re-orienting ("where are we, why aren't we moving forward?"). That handoff across the clear boundary is the single weakest link.

The hidden cost isn't just time — when the model loses real state it guesses to fill the gap, which is exactly how you get hallucinated/invented state.

Why existing tools don't close it

  • CLAUDE.md / project memory — great for static facts; wrong home for dynamic working state, and nothing keeps it short or current.
  • Auto-compaction summary — a narrative recap, not a structured/actionable current focus / last action / next action / live state object.
  • No working-state object survives BOTH compaction and /clear as a distinct, always-first, model-maintained scratchpad.

What I built as a workaround (maps directly onto features you could ship)

  1. Pinned "RIGHT NOW" block at the top of the auto-loaded memory index (~5 lines: current focus, last action, next action, live state — branch/URLs/IDs). First thing in context every session.
  2. PreCompact hook that snapshots working state the instant before compaction — leads with the RIGHT NOW block (pulled live from memory), then appends tracked-only git status so deployed-but-uncommitted work can't be silently lost. Also increments a compaction counter.
  3. SessionStart hook that re-injects that snapshot, but only if recent (≤2h), so a stale file doesn't pollute a genuinely fresh start.
  4. Watchdog (UserPromptSubmit hook) that reads the compaction counter + elapsed time and proactively nudges a checkpoint-and-/clear before degradation gets bad.
  5. Wrap discipline that rewrites the RIGHT NOW block at session end.

It works — but no user should have to hand-roll PowerShell hooks and a memory taxonomy to keep their agent from going senile mid-task.

Concrete feature requests

  • A first-class "working scratchpad" — short, structured, model-maintained (current focus, next action, live artifacts), always re-injected first, updated automatically, and guaranteed to survive both compaction and /clear, kept distinct from the conversation summary.
  • Automatic pre-compaction capture of that scratchpad + uncommitted/deployed working state (built-in, not a user hook).
  • Surface compaction to the user with a one-click "checkpoint & restart" flow, instead of silent degradation noticed only once the assistant is already lost.
  • A guaranteed pinned-top region in CLAUDE.md/memory that's always first in context.

Before/after

Before: a mid-session compaction left the assistant having forgotten I'd just deployed a Lambda but not committed it — so it either redid the work or assumed it was committed and moved on, leaving real drift between deployed and source. After: the first thing in the new context is "you deployed X, it's uncommitted, commit it" + the exact next action. A relearn-for-an-hour event became a two-line handoff.

Happy to share the full hook scripts and memory layout if useful.

(Filed by a daily heavy user; also sent via email to the feedback address. Cross-posting here because this is where the product team actually lives.)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions