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: a bottom-style dashboard with a live memory graph, sortable runs, kill confirmation, session tree and history
clawtop on sample data (kills simulated). Also: the 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 Interactive bottom-style screen: live memory graph, sortable runs, kill, session tree, history. Prints status instead when there is no terminal.
clawtop status One-shot printout: VM and gateway memory plus every agent run stack. --json for scripts.
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.5.0

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.5.0
File Size Uploaded Provenance Actions
clawtop-0.5.0.tar.gz 36.7 kB With provenance Details for clawtop-0.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 77.8 kB

Release files / clawtop-0.5.0.tar.gz

Download URL clawtop-0.5.0.tar.gz
Size 36.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c378428b392392562bc4eb9aa7055569aff31f6fd8533555aa8bd1bd3cc385a6
BLAKE2b-256 checksum
How to use checksums
d410d92390776d7e259163d2e0016985692af5a3f79d55c347f3b3a4e56affd1
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 19, 2026.

Transparency log

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

Download URL clawtop-0.5.0-py3-none-any.whl
Size 41.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4b8002392169177f2ca26d6ec54adb522f37a3f1bedf0f66ea2202ba9250d27
BLAKE2b-256 checksum
How to use checksums
f805ca707269e3c5a6d4b5413394a4ca49ebc714eaddceb68d6c0956cebaf7d4
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 19, 2026.

Transparency log

Security for clawtop 0.5.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for clawtop-0.5.0.tar.gz

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 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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