claude-code - 💡(How to fix) Fix Local Agent Mode sessions accumulate without cleanup, leaking ~100+ headless `claude` processes

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…

The Claude desktop app spawns headless claude CLI sessions for Local Agent Mode but does not appear to reap them. Over a 2-day uptime, ~56 background agent sessions (each a disclaimer wrapper + claude Node child = ~112 processes) accumulated, plus their subagent/MCP children.

Root Cause

The Claude desktop app spawns headless claude CLI sessions for Local Agent Mode but does not appear to reap them. Over a 2-day uptime, ~56 background agent sessions (each a disclaimer wrapper + claude Node child = ~112 processes) accumulated, plus their subagent/MCP children.

Fix Action

Workaround

Quitting and relaunching the desktop app clears them, but state is lost.

RAW_BUFFERClick to expand / collapse

Summary

The Claude desktop app spawns headless claude CLI sessions for Local Agent Mode but does not appear to reap them. Over a 2-day uptime, ~56 background agent sessions (each a disclaimer wrapper + claude Node child = ~112 processes) accumulated, plus their subagent/MCP children.

Environment

  • Claude desktop app: 1.6259.1
  • Bundled claude-code CLI: 2.1.128 (from ~/Library/Application Support/Claude/claude-code/2.1.128/)
  • macOS 26.4.1 (arm64)
  • Two interactive claude CLI sessions also running (unrelated, accounted for ~4 of the processes)

Observed

  • ps -axo pid,ppid,command | awk '/[c]laude/' | wc -l -> 162 claude processes
  • 56 of them are direct children of the desktop app (/Applications/Claude.app/Contents/MacOS/Claude, PID 52218)
  • All 56 share the Local Agent Mode invocation pattern:
    • --input-format stream-json --output-format stream-json
    • --allow-dangerously-skip-permissions --permission-mode auto
    • --allowedTools mcp__computer-use,mcp__ccd_session__spawn_task,mcp__ccd_session__mark_chapter,mcp__ccd_session_mgmt__list_sessions
    • --plugin-dir paths under local-agent-mode-sessions/
  • Process ETIMEs span from ~1 minute to 1 day 18 hours -- sessions clearly persist long after their work completes
  • Aggregate memory: ~12 GB resident across the family (each ~200 MB RSS, 19-20 threads, 80-100 ports)

Expected

Local Agent Mode sessions should be reaped after task completion, or at minimum on a sane idle timeout. They should not accumulate indefinitely across the desktop app lifetime.

Workaround

Quitting and relaunching the desktop app clears them, but state is lost.

Notes

This is the first user-visible symptom for me -- caught it at 24 GB memory used, 19 GB swap. On lower-memory machines this would degrade the system noticeably.

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 Local Agent Mode sessions accumulate without cleanup, leaking ~100+ headless `claude` processes