Claude Code consumes 100%+ CPU when idle in terminal
Status Open
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 11 comments · opened Jan 9, 2026
Description
Claude Code (the CLI) consumes 100%+ CPU even when idle in a terminal session. This drains battery significantly on laptops.
Environment
- macOS 26.2 (Darwin 25.2.0)
- Claude Code installed via npm
- Running in terminal (both standalone and within tmux)
Reproduction
- Start
claudein a terminal - Leave it idle (not actively processing a request)
- Observe CPU usage via
ps aux | grep claudeor Activity Monitor
Observed Behavior
$ ps aux | grep claude
user 52191 103.9 1.1 467673200 566032 s007 R+ 8:04AM 34:21.11 claude
user 48497 42.2 0.8 478110720 425616 s004 S+ Mon11AM 69:31.67 claude
Two Claude processes:
- One using 103.9% CPU (started today, running 34 min)
- One using 42.2% CPU (started Monday, running for days)
Stack Sample Analysis
Running sample <pid> shows the process is stuck in a tight loop:
737 uv__run_check (in node) + 136 [0x104f9fc14]
721 node::Environment::CheckImmediate(uv_check_s*) (in node) + 400
720 node::InternalMakeCallback(...)
719 v8::Function::Call(...)
[deep V8/JS execution]
This pattern suggests setImmediate() calls are being rapidly re-scheduled without proper yielding, causing a busy-wait loop instead of sleeping when idle.
Expected Behavior
When Claude Code is idle (waiting for user input), CPU usage should be near 0%.
Workaround
Kill the process: kill <pid>
11 Comments
I have the same problem when I update cc to 2.x.
I just founded the reason.It was because an mcp service linked by claude code (python startup) was using a lot of cpu resources.
For me in a brand new Claude Code installation (Linux), CPU usage is near zero when I'm doing absolutely nothing, however it jumps to about 125% of a CPU core whenever it's trying to be more interactive, like when I start typing
/and it shows suggestions. It will consume all that CPU indefinitely in that state. Even displaying the 3 panels of/helpconsumes that much until I^Cback to an empty prompt, where it drops back to zero. (Not to mention that my initial run consumed 5GB of RAM, but luckily stopping and restarting Claude Code brought that back down to a "low" 512 MB.)Something fundamental is clearly broken in Claude Code. I wanted to migrate from Aider but I guess it would be premature. 🤔
Additional data: Tool execution triggers degradation
Environment: Linux 6.18.5-arch1-1, Claude Code 2.1.12, bundled Bun 1.2.x
Observation: Fresh sessions start healthy, but degrade after tool execution (not just idle time).
Measurements
| State | CPU (main thread) | Syscalls/2s | Notes |
|-------|-------------------|-------------|-------|
| Fresh session (idle) | 5.5% | 9 | Healthy, responsive UI |
| After tool use (docker ops) | 50-60% | 4200+ | Sluggish UI, busy-poll state |
| Previous long-running session | 12-15% | 9000 | Had been running since prior day |
Key finding
Restarting with
--resume(same conversation context) returns to healthy state:This suggests runtime state accumulation, not conversation size. Tool execution appears to trigger the busy-poll mode - possibly event listeners or timers that aren't cleaned up after tool completion.
Thread breakdown during degraded state
The degradation happened within minutes of running bash commands (docker operations), not hours of idle time.
I can trigger the CPU usage by doing some things with tasks + sub-agents pretty much every time. Tool use would make sense
Workaround: auto-kill orphaned processes
Until this is fixed, you can schedule a script to detect and kill orphaned
claudeprocesses (PPID=1, >50% CPU).Script (
~/.local/bin/kill-orphaned-claude.sh):Option 1 — macOS launchd agent (runs every 3 min):
Load with:
launchctl load ~/Library/LaunchAgents/com.user.kill-orphaned-claude.plistOption 2 — cron job (Linux/macOS):
Note: regular
kill(SIGTERM) did not work for me on v2.1.27 —kill -9(SIGKILL) was required.Same issue rapsberry pi 4 with raspbian
Similar or same issue on Windows. Even when idle, waiting for user input consumes ~1 core. Typing something is very choppy. Typing while claude is working even worse.
Same problem with newest 2.1.29 on debian - once the task is done and claude is idling in terminal, it still eats 100% of one CPU core (some busy waiting?)
Here is an strace from my system:
strace.txt
It is not fixed up to stable 2.1.153