Skip to main content

clawtop

ci docs license: MIT PyPI python 3.11+

htop for OpenClaw. See where your gateway's memory goes, per agent run; stop the runaway ones safely; keep your sessions tidy.

Animated tour of clawtop top: live memory graph, sortable runs, kill confirmation, session tree and history
clawtop top on sample data (kills simulated). Also: the 1:38 video walkthrough (install from PyPI, then the whole screen).

Documentation: https://khiladisngh.github.io/clawtop/

Why

Many OpenClaw runtimes (CLI backends such as Claude CLI or Gemini CLI, and ACP harnesses) start a separate process for every agent run, plus the MCP servers and helpers that run uses. In the author's setup each such stack is roughly 0.5 to 0.7 GB. A burst of runs, or a few that hang on a tool call, can push the gateway past the VM's RAM; the event loop then stalls in swap and restarts fail. clawtop makes that visible and fixable in one command. It is not tied to one runtime: runs are recognised by structure, not by program name.

  • Memory per run, measured so the numbers add up to the gateway's cgroup total.
  • Real idleness where the runtime exposes it (Claude Code's transcript today), so a busy long-lived run is not flagged and a stuck one is. Where it doesn't, idle time is shown as -, never guessed.
  • Safe kills. Only processes the gateway spawned can be selected, whole stacks die together (SIGTERM, then SIGKILL), and PID reuse is guarded.
  • Sessions through the supported openclaw sessions CLI: list, tree (subagents under their parent, with titles), archive, prune.
  • History: a per-minute sampler and clawtop history to see what a spike looked like.
  • Works from Windows: it forwards into your WSL distro.

Install

On the Linux or WSL machine that runs the gateway (needs uv and Python 3.11+):

uv tool install clawtop
clawtop
clawtop sampler install     # optional: per-minute memory history via a systemd user timer

On a Windows host, install it there too; every command is forwarded into WSL (your default WSL distro and user; override with CLAWTOP_WSL_DISTRO and CLAWTOP_WSL_USER). See Install.

Usage

Command What it does
clawtop / status VM and gateway memory plus every agent run stack. --json for scripts.
clawtop top Interactive htop-style screen: live memory graph, sortable runs, kill, session tree, history.
clawtop kill Interactive picker: choose rows by number, stale or all.
clawtop kill PID... Kill specific stacks by leader PID.
clawtop kill --idle 30 Kill runs with no transcript activity for 30 minutes.
clawtop kill --older-than 120 Kill runs older than 2 hours.
clawtop kill --orphans Kill gateway-spawned stacks whose parent is gone.
clawtop history --last 6h Memory sparkline, the peak, and the stacks alive at the peak.
clawtop sessions list [--titles] Open sessions, longest idle first.
clawtop sessions tree Sessions per agent, subagents nested under their parent.
clawtop sessions archive KEY... Archive specific sessions.
clawtop sessions prune Archive open subagent sessions idle for 6h (--idle-hours, --kind, --agent).
clawtop sampler install|uninstall Manage the per-minute sampler timer.

kill and sessions archive|prune ask for confirmation; --yes skips it and --dry-run previews. prune only touches subagent sessions unless you pass --kind, because channel and main sessions hold conversation context. Full options: CLI reference.

Try it without a gateway

scripts/demo.py runs the real CLI against made-up sample data (the video above uses it); kill and archive are simulated:

git clone https://github.com/khiladisngh/clawtop && cd clawtop && uv sync
uv run python scripts/demo.py sessions tree
CLAWTOP_DEMO_ANSWERS="stale;y" uv run python scripts/demo.py kill

Keep the gateway from running out of memory

clawtop shows problems; systemd limits and a concurrency cap stop them taking the VM down. See Harden the gateway.

Limits

  • Linux only (reads /proc and cgroup v2); on Windows it needs WSL.
  • It looks for the systemd user unit openclaw-gateway.
  • Runtimes that run inside the gateway (openclaw, codex, copilot, muse) have no process per run, so there is no stack to list; their memory is part of the gateway's "main".
  • Verified on Claude CLI only. Other process-per-run runtimes (Gemini CLI, ACP harnesses) are recognised by the same structural rules, but I have not seen them on a real gateway. Please report what you see. See Concepts.
  • A run stack cannot be mapped to an OpenClaw session key (the gateway does not expose it), so clawtop shows the runtime and agent instead of guessing.
  • Runs are found by agent workspace (from your OpenClaw config), so the config must declare them.

Development

uv sync
uv run ruff check . && uv run ruff format --check .
uv run pyright
uv run pytest --cov
uv run zensical serve     # docs at http://localhost:8000

The /proc parser tests build a fake /proc tree and need Linux; they are skipped on Windows and run in CI. See CONTRIBUTING.md.

License

MIT

Metadata

Release files for clawtop 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clawtop 0.4.1
File Size Uploaded
clawtop-0.4.1.tar.gz 32.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clawtop 0.4.1
File Interpreter ABI Platform
clawtop-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 70.3 kB

Release files / clawtop-0.4.1.tar.gz

Download URL clawtop-0.4.1.tar.gz
Size 32.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e6def6cc53d7b0f182160cb9974213baa426262713dd9a04d282b42c6c523ee9
BLAKE2b-256 checksum
How to use checksums
9ed9835704058d8b5729ebd6cb9fafca043d98924d0b81677314e80b9c6f82a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / clawtop-0.4.1-py3-none-any.whl

Download URL clawtop-0.4.1-py3-none-any.whl
Size 37.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d01fa1ba51e9e75e2e9870db96d9de1a74da36c7c38b3dbf2a0b5b0effb1ab93
BLAKE2b-256 checksum
How to use checksums
5ede5469fbedcf418af2ed66aca12659b3d4fca0bc59c1e3d45296b474bae88a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page