Watch what your AI agents spawn
Watch what your AI agents spawn
aimon is a terminal user interface tool designed to monitor and manage processes spawned by AI coding agents. Its primary function is to detect orphaned child processes that remain running after an agent session ends or is interrupted, such as test runners, MCP servers, or build workers. These orphaned processes can consume memory and system resources without being visible in standard terminal multiplexers like tmux. aimon tracks process trees, identifies orphans after a configurable grace period, and warns the user before memory pressure reaches a critical level. Under critical conditions, it can automatically terminate the heaviest offending process tree using SIGTERM followed by SIGKILL, and all kills are logged to a local file and trigger native notifications. The tool supports a range of AI coding agents, including Claude Code, Codex, Gemini CLI, Aider, OpenCode, cursor-agent, Amp, Goose, Crush, Qwen, Copilot, and Droid. It detects these agents both inside and outside tmux sessions. aimon displays processes in an agent-aware tree view, and the user can manually intervene via a popup interface where rows are pre-marked, space toggles selection, enter fires the kill, and escape cancels. The kill interface avoids accidental termination by tracking the cursor position relative to the sorting order. Protected processes such as shells and editors are never targeted. The tool also offers a daemon mode for headless operation, and various configuration flags allow adjustment of memory thresholds, orphan grace period, tick interval, and auto kill behavior. Typical use cases involve developers who frequently run AI coding agents and encounter leftover processes that silently consume RAM, causing system slowdowns or swap file growth. aimon runs in the background or as a visible TUI, providing real time visibility into what agents have spawned and what remains. The workflow involves starting aimon alongside agent usage; it continuously monitors process ancestry, groups children by their originating agent, marks orphans, and either alerts the user or automatically reaps them based on the configured auto kill policy. The user can also review logged kills to audit past terminations. Technical requirements are minimal: aimon is distributed as static musl binaries for Linux, universal binaries for macOS, and x86_64 binaries for Windows. The binary is approximately 600 KB in size, uses roughly 6 MB of resident memory, and consumes about 0.1 percent CPU when idle. It supports macOS kernel pressure level monitoring, Linux PSI, and a Windows fallback. Sampling rate slows by 2.5 times when the terminal loses focus. The tool honors the NO_COLOR environment variable.