claude-code - 💡(How to fix) Fix Post-compaction: stale skill ARGUMENTS re-surfaced as fresh prompt; last user message dropped from summary [2 comments, 3 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#50724Fetched 2026-04-20 12:14:49
View on GitHub
Comments
2
Participants
3
Timeline
7
Reactions
1
Timeline (top)
labeled ×4commented ×2cross-referenced ×1

Root Cause

Root cause (two bugs compounded)

Fix Action

Fix / Workaround

2. Compaction summary dropped the last unanswered user message. The summary (This session is being continued...) reconstructed dispatched tasks and recent assistant work but did not include the user's most recent text message ("que es la 277?"). Combined with bug #1, this left the stale ARGUMENTS as the only prompt-shaped signal in the rebuilt context.

Workaround (user side)

Code Example

### Skill: investigate-first
Path: projectSettings:investigate-first
...
ARGUMENTS: porque estabs buscando en argentina? no entiendo.
RAW_BUFFERClick to expand / collapse

Claude Code version: 2.1.114 Plugins active: superpowers 5.0.7, claude-code-warp 2.0.0 (both register SessionStart hooks)

What happened

After an automatic context compaction, the assistant resumed by answering a /investigate-first invocation from ~17 hours earlier, ignoring the user's most recent prompt entirely.

Timeline

Time (UTC)Event
T-17hUser invokes /investigate-first "porque estabas buscando en argentina?" — resolved same turn.
T-0User sends new, unrelated prompt: "que es la 277?"
T+100sAutomatic context compaction fires.
T+110sRunning SessionStart hooks… takes 1m 49s (typical <5s).
T+230sAssistant answers: "No te sigo, no recuerdo haber buscado nada en Argentina..." — replying to the 17h-old invocation, not the current prompt.

Root cause (two bugs compounded)

1. Skill ARGUMENTS leak across compaction. The <system-reminder> re-injected for the investigate-first skill after compaction contained the ARGUMENTS: value from the prior day's invocation. The assistant had no way to distinguish "historical" args from "pending" args and treated the stale value as the current user input.

Evidence from the re-injected reminder:

### Skill: investigate-first
Path: projectSettings:investigate-first
...
ARGUMENTS: porque estabs buscando en argentina? no entiendo.

That literal string comes from a user record timestamped ~17 hours before the current turn.

2. Compaction summary dropped the last unanswered user message. The summary (This session is being continued...) reconstructed dispatched tasks and recent assistant work but did not include the user's most recent text message ("que es la 277?"). Combined with bug #1, this left the stale ARGUMENTS as the only prompt-shaped signal in the rebuilt context.

Suggested fixes

  • Re-injected skill system-reminders should either (a) omit ARGUMENTS from prior turns, or (b) tag them with the turn/timestamp they originated in so the assistant can distinguish historical from pending.
  • The compaction summarizer should preserve the most recent unanswered user prompt verbatim, not only summarize it.
  • Investigate why SessionStart hooks took 1m 49s post-compaction — may or may not be related, but signals fragility in restoration.

Workaround (user side)

After a compaction, read the session JSONL at ~/.claude/projects/<cwd-hash>/<session-id>.jsonl and use the most recent type: user text record (excluding the compaction continuation record) as the real prompt to answer.

extent analysis

TL;DR

To fix the issue, modify the re-injected skill system-reminders to either omit ARGUMENTS from prior turns or tag them with the turn/timestamp they originated in, and update the compaction summarizer to preserve the most recent unanswered user prompt verbatim.

Guidance

  • Investigate the SessionStart hooks to determine why they took 1m 49s post-compaction, as this may indicate a related issue.
  • Modify the re-injected skill system-reminders to include a timestamp or turn identifier for ARGUMENTS values, allowing the assistant to distinguish historical from pending inputs.
  • Update the compaction summarizer to preserve the most recent unanswered user prompt verbatim, rather than summarizing it, to ensure the assistant receives the correct input.
  • Consider implementing a workaround on the user side by reading the session JSONL file and using the most recent type: user text record as the real prompt to answer.

Example

No code snippet is provided, as the issue does not include specific code that needs to be modified. However, the suggested fixes imply changes to the superpowers and claude-code-warp plugins, which register SessionStart hooks.

Notes

The issue appears to be caused by two compounded bugs, and addressing both is necessary to fully resolve the problem. The suggested fixes and workaround provide a starting point for resolving the issue, but further investigation and testing may be required to ensure a complete solution.

Recommendation

Apply the suggested fixes to the re-injected skill system-reminders and the compaction summarizer, as these changes address the root causes of the issue and provide a more robust solution than a workaround.

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 Post-compaction: stale skill ARGUMENTS re-surfaced as fresh prompt; last user message dropped from summary [2 comments, 3 participants]