claude-code - 💡(How to fix) Fix [FEATURE] `/declutter` command for surgical context pruning of completed subtasks [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48984Fetched 2026-04-17 08:54:02
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
0
Timeline (top)
commented ×2labeled ×2

Root Cause

The root cause is that /compact is a blunt instrument — it discards everything, including still-relevant context, when the real need is to shed only the completed work.

Code Example

/declutter forget specifics about A1
/declutter A1
/declutter last subtask

---

User explains the refactor goal and lists files F1F10   (context: 20%)
User walks CC through refactoring F1, tests pass         (context: 80%)
/declutter forget specifics of F1 refactor               (context: 55%)
User walks CC through refactoring F2, tests pass         (context: 85%)
/declutter forget specifics of F2 refactor               (context: 60%)
...

---

User explains the refactor goal and lists files F1F10   (context: 50%)
User walks CC through refactoring F1, tests pass         (context: 80%)
/compact                                                  (context: 5%)
User re-explains the entire refactor goal and F2F10     (context: 40%)
User walks CC through refactoring F2, tests pass         (context: 80%)
/compact                                                  (context: 5%)
...
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

When working on a large task with many subtasks in Claude Code, the current /compact command forces a full context reset whenever the context window fills up. This creates a painful and repetitive cycle:

  1. User explains the parent task and all subtasks (~50% context used)
  2. User works through a subtask to completion (~80% context used)
  3. /compact resets context to ~5%
  4. User must re-explain the entire parent task and remaining subtasks before continuing
  5. Repeat for every subtask

The re-explanation overhead compounds with each subtask. For a task with 10 subtasks, you may re-explain the same parent context 8–9 times. This wastes time, tokens, and breaks flow.

The root cause is that /compact is a blunt instrument — it discards everything, including still-relevant context, when the real need is to shed only the completed work.

Proposed Solution

A /declutter command that performs selective, scoped context compression — targeting only the portion of context the user specifies, while leaving everything else intact.

/declutter forget specifics about A1
/declutter A1
/declutter last subtask

The command would:

  • Summarise only the specified scope down to a brief outcome (e.g. "Completed A1: implemented X, created files Y and Z")
  • Leave all other context — the parent task, remaining subtasks, prior decisions — fully intact
  • Optionally show a preview of what will be summarised before committing (/declutter --preview)
  • Confirm what was pruned so the user can verify nothing important was lost

Conceptually, this is the difference between a git commit (closing a chapter of work cleanly) and deleting your entire working directory.

Alternative Solutions

  • /compact (current): Full reset. Solves the token problem but destroys all parent context, requiring expensive re-explanation each cycle.
  • Manual copy-paste: Some users paste a task list at the top of each new session. Fragile and tedious.
  • Splitting into separate sessions: Loses continuity entirely; Claude has no memory of prior subtask outcomes.

None of these preserve the parent task context while shedding completed-subtask detail.

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

Working on a large refactor across 10 files, each treated as a subtask:

User explains the refactor goal and lists files F1–F10   (context: 20%)
User walks CC through refactoring F1, tests pass         (context: 80%)
/declutter forget specifics of F1 refactor               (context: 55%)
User walks CC through refactoring F2, tests pass         (context: 85%)
/declutter forget specifics of F2 refactor               (context: 60%)
...

vs. the current flow:

User explains the refactor goal and lists files F1–F10   (context: 50%)
User walks CC through refactoring F1, tests pass         (context: 80%)
/compact                                                  (context: 5%)
User re-explains the entire refactor goal and F2–F10     (context: 40%)
User walks CC through refactoring F2, tests pass         (context: 80%)
/compact                                                  (context: 5%)
...

The /declutter flow avoids 9 full re-explanations across a 10-subtask session.

Additional Context

  • This mirrors how developers already manage cognitive load: a git commit signals "this chapter is closed, I don't need to hold those details in my head anymore." /declutter gives Claude the same signal.
  • A --preview flag would make the feature safe and trustworthy — users can see exactly what Claude is about to summarise before it's gone.
  • Could complement rather than replace /compact/declutter for routine hygiene during flow, /compact as a last resort when context is critically full.

extent analysis

TL;DR

Implement a /declutter command that performs selective, scoped context compression to avoid re-explanation overhead when working on large tasks with many subtasks.

Guidance

  • Introduce a new /declutter command that targets only the portion of context the user specifies, leaving everything else intact.
  • Design the command to summarize the specified scope down to a brief outcome and optionally show a preview of what will be summarized before committing.
  • Consider adding a --preview flag to make the feature safe and trustworthy, allowing users to verify what will be pruned.
  • Evaluate the feasibility of implementing /declutter as a complement to the existing /compact command, using /declutter for routine hygiene and /compact as a last resort.

Example

/declutter forget specifics about A1

This command would summarize the specifics of subtask A1 and leave the rest of the context intact.

Notes

The implementation of /declutter would require careful consideration of how to determine the scope of context to be summarized and how to ensure that important information is not lost.

Recommendation

Apply workaround: Implement the proposed /declutter command to improve the user experience when working on large tasks with many subtasks. This would provide a more targeted and efficient way to manage context, reducing the need for re-explanation and improving overall productivity.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [FEATURE] `/declutter` command for surgical context pruning of completed subtasks [2 comments, 2 participants]