Session list polluted with internal summary-generation sessions
Description
When a conversation ends, Claude Code spawns a new session to generate the conversation summary and decide whether /resume should auto-continue. This new session is saved as a regular conversation file (UUID.jsonl in ~/.claude/projects/PROJECT/) and appears in the /resume list alongside real conversations.
The first "user message" in these zombie sessions is the internal summary generation prompt:
Context: This summary will be shown in a list to help users and Claude choose which conversations are relevant.
Please write a concise, factual summary of this conversation. Output ONLY the summary - no preamble. [...]
User: Analyze this conversation and determine: Does the assistant have more autonomous work to do RIGHT NOW?
Conversation:
[
{ ...full JSON of the original conversation... }
]
CONTINUE (should_continue: true) ONLY IF the assistant explicitly states what it will do next [...]
STOP (should_continue: false) in ALL other cases [...]
<img width="1215" height="904" alt="Image" src="https://github.com/user-attachments/assets/d51a91dd-37c2-4bd0-a5e6-1627baa7e59f" />
As you can see, every past session in directory, but one (censored), got affected by this bug
Impact
/resumelist becomes completely unusable — flooded with 8-36KB zombie sessions that all show the same "Context: This summary will be shown..." text- In my case: 42 zombie sessions vs 57 real ones (42% pollution) in a single project
- Zombies are spawned in batches (e.g., 15 sessions created within 3 minutes at session end)
- No way to distinguish them in the UI except by file size
- The zombie sessions contain the full JSON of the original conversation embedded in the prompt, wasting disk space
Expected behavior
Internal summary-generation sessions should either:
- Run within the existing session context (not spawn a new one), or
- Be cleaned up after summary is generated, or
- Be prefixed (like
agent-*.jsonlfiles) so they're filtered from/resumelist
Steps to reproduce
- Have multiple conversations in a project over several days
- End sessions normally
- Open
/resume— most entries show "Context: This summary will be shown in a list..." instead of actual conversation summaries
Workaround
Manual cleanup — identify and delete jsonl files where first user message starts with the summary prompt:
DIR="$HOME/.claude/projects/YOUR-PROJECT"
for f in "$DIR"/*.jsonl; do
[[ "$(basename "$f")" == agent-* ]] && continue
first=$(python3 -c "
import sys,json
for line in open('$f'):
try:
m=json.loads(line.strip())
if m.get('type')=='user':
c=m.get('message',{}).get('content','')
if isinstance(c,list):
for x in c:
if isinstance(x,dict) and x.get('type')=='text': print(x['text'][:80]);sys.exit()
elif isinstance(c,str): print(c[:80]);sys.exit()
except: pass
" 2>/dev/null)
echo "$first" | grep -q "Context: This summary will be shown" && rm "$f" && echo "DEL: $(basename $f)"
done
Environment
- Claude Code version: 2.1.87
- Platform: Linux (CachyOS/Arch)
- Shell: fish
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗