clawtop
htop for OpenClaw. See where your gateway's memory goes, per agent run; stop the runaway ones safely; keep your sessions tidy.
clawtop top on sample data (kills simulated). Also:
a 1:43 video walkthrough
of the command-line tools.
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 sessionsCLI: list, tree (subagents under their parent, with titles), archive, prune. - History: a per-minute sampler and
clawtop historyto 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 git+https://github.com/khiladisngh/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
/procand 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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clawtop-0.4.0.tar.gz | 32.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clawtop-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 70.2 kB
Release files / clawtop-0.4.0.tar.gz
| Download URL | clawtop-0.4.0.tar.gz |
|---|---|
| Size | 32.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
103baa9e99dc993c496844903f01fd5182ecaa65ff0b7c1061208e7acaa0c0f6
|
|
BLAKE2b-256 checksum How to use checksums |
481d2625df4032515485a202cb8a454c018c2e103ba2322f4c9e2dbe33fa5a39
|
| 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 logRelease files / clawtop-0.4.0-py3-none-any.whl
| Download URL | clawtop-0.4.0-py3-none-any.whl |
|---|---|
| Size | 37.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
680426000f56704ca38ef2e61c425146e7061e8b9db06fb3136083df3d4d7edf
|
|
BLAKE2b-256 checksum How to use checksums |
71acae20f9689c9f758295f44ed23798f0055a9ad1fbf310f15d65bc7efb4f5a
|
| 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