Background process reminders persist as 'running' after conversation continuation despite being completed
Summary
When a Claude Code conversation is continued (via context summarization), background process system reminders persist showing (status: running) even though the actual processes have completed. This causes significant token waste and user confusion.
Reproduction Steps
- Start a Claude Code session
- Run several background processes:
Bash(command: "sleep 120", run_in_background: true) - Let them complete naturally
- Continue working until context summarization occurs
- In the continued conversation, observe system reminders still showing processes as "running"
Expected Behavior
System reminders should either:
- Not appear for completed processes, OR
- Show accurate status
(status: completed)
Actual Behavior
All background processes from the previous context show as:
Background Bash 734386 (command: sleep 180...) (status: running) Has new output available.
Even though:
jobscommand shows no running processesKillShellreturns: "Shell 734386 is not running, so cannot be killed (status: completed)"
Evidence
I ran KillShell on 27 "running" processes. Every single one returned "status: completed" or "status: killed":
KillShell(734386) → "status: completed"
KillShell(898239) → "status: completed"
KillShell(8ccb12) → "status: completed"
... (24 more, all completed)
Yet the very same response included 27 system reminders all saying "(status: running)".
Root Cause Analysis
The system reminder generator appears to read from stale conversation context state rather than querying the actual shell tracking system that KillShell uses.
┌─────────────────────┐ ┌─────────────────────────────┐
│ Shell Tracking │ │ Conversation Context │
│ System │ │ (Persists across sessions) │
│ │ │ │
│ Knows real status: │ ✗ │ Stores "status: running" │
│ completed/killed/ │ Never │ at time of capture │
│ failed │ syncs │ │
└─────────────────────┘ └─────────────────────────────┘
│ │
▼ ▼
KillShell tool System Reminder Generator
(accurate) (uses stale context state)
Impact
- Token waste: 20-30 reminders × ~75 tokens each = ~2000+ tokens per response
- User confusion: Reminders suggest processes need attention
- Failed cleanup attempts: Users/Claude try to kill already-completed processes
Suggested Fix
Before generating system reminders, query the actual shell tracking system (the same one KillShell uses) to get real-time status. Only include reminders for processes that are actually running.
Alternatively: On conversation continuation, validate stored process IDs against actual running processes and clear stale entries.
Environment
- Claude Code CLI
- macOS Darwin 24.6.0
- Model: claude-opus-4-5-20251101
Workaround
Users can add rules to their CLAUDE.md to:
- Minimize background process usage
- Clean up processes before session ends
- Ignore stale reminders in continued sessions
But this doesn't fix the root cause.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗