Overview
Send SIGTERM to agent process groups and close terminal panes. More forceful thanhcom stop.
Syntax
Agents to kill (names, PIDs,
tag:X, or all)At least one target requiredSpecial Targets
Kill all instances with tracked PIDsIncludes active instances and orphaned processes
Kill all instances and orphans with specific tag
Behavior
Kill Sequence
- Send SIGTERM to process group
- Wait 2 seconds
- Send SIGKILL if still alive
- Close terminal pane (if managed terminal)
- Log stopped event with reason=killed
- Delete instance row from database
Terminal Pane Closing
Managed terminals (kitty, wezterm, tmux) have their panes automatically closed:- Kitty:
kitty @ close-window --match id:<pane-id> - Wezterm:
wezterm cli kill-pane --pane-id <pane-id> - Tmux:
tmux kill-pane -t <pane-id>
Orphan Handling
Kill also terminates orphaned processes (stopped but still running):Examples
Kill Single Agent
Kill Multiple Agents
Kill by Tag
Kill All
Kill by PID
Kill Headless Agent
Permission Denied
Already Dead
Kill Stopped Orphan
Output Patterns
Successful Kill
Already Dead
Permission Denied
No Tracked PID
Pane Close Failed
Exit Codes
All targets killed successfully (or already dead)
- No targets specified
- Target not found
- Permission denied
- No tracked PID (use
hcom stopinstead)
Notes
SIGTERM → SIGKILL: Kill sends SIGTERM to the process group. After 2 seconds, sends SIGKILL to ensure termination. More forceful than
hcom stop.Process Groups: Kill targets the entire process group (-PID), ensuring child processes are terminated too.
Orphan Cleanup:
kill all and kill tag:* include orphaned processes from pidtrack. These are stopped agents whose processes are still running.Pane Closing: Only works for managed terminals (kitty, wezterm, tmux). Other terminals receive SIGTERM only.
Resume Preserved: Kill logs a
life.stopped event with reason=killed. Agent can be resumed with hcom r <name>.No Tracked PID: Agents without tracked PIDs cannot be killed. Use
hcom stop <name> for graceful disconnect instead.Remote Instances: Cannot kill remote instances (from other devices). Those are managed on their origin device.
Headless Agents: Headless instances have no terminal pane, so kill only sends SIGTERM/SIGKILL without pane close.
Kill vs Stop
| Feature | hcom kill | hcom stop |
|---|---|---|
| Signal | SIGTERM → SIGKILL (2s) | TCP notify (interactive) or SIGTERM (headless) |
| Force | Yes | Graceful |
| Pane close | Yes (managed terminals) | No |
| Orphans | Includes orphans | Active only |
| Speed | Immediate | Waits for tool |
| Resume | Yes | Yes |
kill when:
- Agent is unresponsive
- Need to free terminal pane immediately
- Cleaning up orphaned processes
stop when:
- Agent is responsive
- Want graceful shutdown
- Inside AI tool (self-stop)
Related Commands
hcom stop- Graceful disconnecthcom r- Resume killed agentshcom list- View active agentshcom status- Check for orphaned processes