kill

An emergency command for stopping running sub-agents when they overload the computer. Sub-agents are helper processes working on separate tasks or parts of a task.

In plain words
What is it for?
Use it to stabilize the machine automatically, stop a chosen number of newest agents, or stop all running sub-agents.
Why use it?
It reduces memory and CPU pressure during out-of-memory events, runaway checks, or heavy swapping, while preserving the stopped agents' worktrees for recovery.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/skyfox675/agents-skills/kill
Clone the repo
git clone --depth 1 https://github.com/skyfox675/agents-skills

Made for: Claude Code.

Per session 65 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 954 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00065 $0.00954
Opus 5 $0.00032 $0.00477
Sonnet 5 $0.00013 $0.00191
Haiku 4.5 $0.00006 $0.00095

Measured 3d ago against content hash b75f1c6adb92, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

kill scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/kill.md · 30 lines

How it starts

The opening of the file, as written. The whole thing — 30 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/kill — emergency agent load-shedding

Arguments: $ARGUMENTS — empty means stabilize automatically (kill newest-first until pressure recovers); a number kills exactly that many newest agents; all stops every running sub-agent. This is an emergency command: act immediately, measure, report after — do not ask for confirmation mid-incident.

Why newest-first (LIFO): the newest agents have invested the least work; the oldest are closest to a push or PR. Killing newest-first sheds the same load while destroying the least progress — and killed agents' worktrees survive, so their work is salvageable either way (see step 5).

Steps

  1. Measure once, fast. Memory pressure (memory_pressure on macOS — read the percentage and state; vm_stat for compressor/swap activity; on Linux, free -m + /proc/pressure/memory), load average (uptime), and the top memory consumers (ps aux | sort -rk4 — look for agent-spawned trees: test runners like vitest/playwright/jest workers, bundlers, language servers spawned under worktree paths). One snapshot is enough — the situation is degrading while you measure.

  2. Stop new spending immediately. No new dispatches, no new pushes (each push may fan out a pre-push hook test suite — that is usually the very load source). If an orchestration loop is running, hold all free slots (see orchestrating-slots backpressure).

  3. Kill newest-first, in waves. List running sub-agents (TaskList / your harness's running-task view), order by start time descending:

    • Stop the newest agent via the harness (TaskStop or equivalent) — graceful, the harness records the kill.
    • Then sweep its orphans: hook-spawned processes (test runners, watchers) under that agent's worktree path that survived the parent — kill (TERM) the process group first, escalate to -9 only for survivors after a few seconds.
    • Wave size: 1–2 agents, then re-measure (step 4). With an explicit count or all, do the whole batch in one wave.
    • Never touch: your own session's process tree, other operators' processes, anything not descended from an agent you started. When in doubt about a process's owner, leave it — a missed orphan costs memory; killing the wrong tree costs someone else's work.

Read the full file on GitHub · 30 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 30 lines · 65 tokens per session scan A b75f1c6adb92

Subscribe to this mod's changes

kill is a command published in the GitHub repository skyfox675/agents-skills (10 stars, last pushed 1mo ago), licensed MIT. It adds 65 tokens to every session and 954 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.