Feature: Auto-infer focus topic during auto-compaction
Problem
When auto-compaction triggers, there's no way to dynamically specify a focus topic. The /compact focus on [topic] command works great manually, but auto-compaction loses context about what the user is currently working on.
Current workarounds and their limitations
| Workaround | Limitation |
|------------|-----------|
| SessionStart hook with compact matcher | Static — can't know the current task |
| CLAUDE.md "Compact Instructions" section | Project-level, not conversation-specific |
| Manual /compact focus on [topic] | Requires user to anticipate compaction timing |
Proposed Solution
Add an option to auto-infer the focus topic from the current conversation before compaction runs. Something like:
{
"autoCompactFocus": "infer"
}
When set to "infer", Claude would briefly summarize the current task/focus area before compacting, and use that as the focus topic — similar to what /compact focus on [topic] does, but automatically.
Possible values
| Value | Behavior |
|-------|----------|
| "infer" | Auto-summarize current task as focus topic |
| "string" | Static default focus (like a hook, but built-in) |
| null (default) | Current behavior — no focus topic |
Why This Matters
Long sessions on a specific task (e.g., debugging a tricky auth flow, refactoring a service) accumulate highly relevant context. When auto-compaction fires at the threshold, it doesn't know what's important right now — so it may drop recent debugging insights or domain-specific decisions that are critical to the active task.
Auto-inferring the focus would make compaction context-aware with zero user effort.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗