Claude Desktop agent mode creates hundreds of junk sessions via scheduled task heartbeat

Resolved 💬 3 comments Opened Apr 4, 2026 by CyPack Closed Apr 8, 2026

Description

Claude Desktop's "Local Agent Mode" spawns a Claude Code CLI process that creates new sessions every ~15 minutes with periodic heartbeat messages. Over time, this produces hundreds of junk sessions that pollute the session list and waste disk space.

Reproduction

  1. Open Claude Desktop (Linux, v1.1.7714)
  2. Use Agent Mode (the CC CLI process spawned with --allowedTools mcp__computer-use)
  3. Leave it running for several hours
  4. Check session list with claude-sessions list

Observed Behavior

  • Every ~15 minutes, a new session is created with content like:
## Current Time
Saturday 14:00 (weekend)

## Detected Signals
- [INFO] No Recent Activity: No user activity for 4 day(s)

## Memory Stats
Total: 0 | Recent: 0 | Avg importance: 0.00

## User Activity
No activity for 4 day(s).
  • Sessions are created with entrypoint: "sdk-cli" and userType: "external"
  • Each session is a separate .jsonl file in ~/.claude/projects/
  • After a few days: 443 junk sessions out of 536 total (83% of all sessions)
  • Total disk: ~2.9 MB of junk session files

Expected Behavior

The agent mode scheduled task system should either:

  1. Not create new sessions for heartbeat/signal checks when there's no user activity
  2. Reuse the same session for periodic checks instead of spawning new ones
  3. Have a configurable maximum for signal session creation
  4. Auto-cleanup old signal sessions

Process Details

The offending CC CLI process:

/home/user/.config/Claude/claude-code/2.1.87/claude \
  --output-format stream-json --verbose \
  --input-format stream-json \
  --model claude-opus-4-6 \
  --permission-prompt-tool stdio \
  --resume <session-id> \
  --allowedTools mcp__computer-use \
  --permission-mode default \
  --allow-dangerously-skip-permissions \
  --include-partial-messages

Parent process: Claude Desktop Electron app.

Impact

  • Session list unusable — real sessions buried under hundreds of junk entries
  • Disk accumulation — ~2.9 MB for 443 sessions, grows indefinitely
  • Memory/swap — the long-running CC process (12+ hours) accumulated 110 MB swap
  • No auto-cleanup — sessions persist forever unless manually deleted

Workaround

Kill the agent mode CC process and delete junk sessions:

# Find and kill the agent mode CC process
ps aux | grep "claude.*--allowedTools.*computer-use" | grep -v grep | awk '{print $2}' | xargs kill

# Delete junk sessions
find ~/.claude/projects/ -name "*.jsonl" -exec sh -c 'head -3 "$1" | grep -q "Current Time" && rm "$1"' _ {} \;

Environment

  • Claude Desktop: v1.1.7714 (Electron, Linux/Fedora 43)
  • Claude Code CLI: v2.1.87 (bundled with Desktop)
  • OS: Fedora 43 (Linux 6.19.8)
  • The schedule skill is enabled in the agent mode skills plugin manifest

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗