← All projects
02

claude-top

Swift · open source · MIT

Find out which Claude Code session is eating your Mac.

Activity Monitor knows about processes. It has never heard of a session.

What it is

When you are running a dozen Claude Code sessions the unit of work is a session, not a process, and nothing on the machine reports at that level. You can see that something is holding 291% CPU. You cannot see that it is one session running nine test workers, or that a worktree you walked away from yesterday still has a watcher and two containers alive.

claude-top reports per session: CPU, memory, how many processes and how many containers. Then it separates what is still attached to a live session from what is not.

load 55.6 (10 cores, 5.5x oversubscribed)
Claude sessionsCPURAMPROCDOCK
reader-app::terms-page291%281M70
9x vitest worker287%
tradebot::device-identify118%489M133
platform::qa-testing4%26M51
Orphaned — no live session12%225M201
feed-service::ui-improvements3%30M6217h
platform::qa-testing0%20M5121h
One session, and the nine workers it is holding

How it attributes

Claude Code already stamps every process it spawns with a socket path naming the session that owns it. On macOS the environment of any same-uid process is readable, so reading that stamp is a lookup rather than a guess, and it survives both reparenting and the session dying.

Four tiers, first hit wins:

  • The environment stamp — exact, and survives the session that set it.
  • The process tree — walked up to a stamped ancestor.
  • The worktree path — which checkout the process is working in.
  • Container labels — Docker Compose and Testcontainers.

Two decisions worth knowing

Orphans are named, not hidden
Anything resolving to a worktree with no live session is an orphan, listed with its age. That is usually the answer to why the fans are on.
Unattributed, never guessed
What resolves to nothing is reported as unattributed. A number assigned to the wrong session is worse than a number nobody claims.

Getting it

It is open source under MIT, with no third-party dependencies. It builds from a terminal with swift build, and every file is reviewable in git. There is a terminal binary and a SwiftUI menu bar app. macOS 14 or newer; docker and claude on your PATH are optional, and without them the matching tiers report nothing rather than failing.

Swift 6 · SPM, no third-party dependencies · CLI and a SwiftUI menu bar app · macOS 14+
View on GitHub →