terminate-agentlisted
Install: claude install-skill the-cloud-clockwork/agentihooks
# Terminate Agent
`agentihooks terminate-agent` owns process discovery, exact matching, PID-reuse
checks, process-group validation, caller protection, signal escalation, and
exit verification. Do not construct `ps`, `pgrep`, `pkill`, or `kill` commands.
## List
```bash
agentihooks terminate-agent --list --type any
```
Use `--type claude` or `--type codex` when requested. Report the table exactly.
The table carries registered sessions and unregistered agent processes. It
leaves out zombies, sessions recorded in another process namespace and an
unregistered `claude -p` or `--print` run, which has no session to end.
## Resolve safely
Run the deterministic dry-run before every termination:
```bash
agentihooks terminate-agent "<exact-name-or-uuid>" --type <claude|codex|any> --dry-run
```
Exit zero with `result=validated signal=none` is the completion criterion. A
duplicate name requires the operator to select one UUID. A Codex process shared
by multiple UUIDs requires the operator to choose whether all listed sessions
may be terminated; only then add `--force-shared` to both commands.
If the operator requested only a dry-run, report the resolved PID, PGID, member
PIDs, and `signal=none`, then stop.
## Terminate
After a successful dry-run, reuse the exact selector and options:
```bash
agentihooks terminate-agent "<exact-name-or-uuid>" --type <claude|codex|any>
```
The command sends SIGTERM, waits a bounded interval, revalidates identity before
SIGKILL when required, a