back to projects

dotfiles agent & exit-code hooks

custom tmux alert system in my dotfiles: AI coding agents and long commands raise status-bar icons when they need attention or finish, and clear when you switch back.

dotfiles agent & exit-code hooks

stack

ShellShelltmuxtmuxNeovimNeovim

about

something i wanted to showcase from my dotfiles

a hook system i built that surfaces what’s happening in other tmux windows on the status bar. when a coding agent stops and is waiting for input, a thin per-agent wrapper fires, sets a tmux window option, and writes to an alerts file which the status bar reads, showing me which session needs attention. Claude Code, Codex, and Copilot hook in through their own shell wrappers; OpenCode, which exposes no shell hooks, only a plugin API, feeds the same alerts through a dedicated plugin i published separately. the same machinery also handles command exit codes: a zsh precmd hook flags any command that finishes while you’re away, highlighting the window tab green or red and showing a pass/fail icon for other sessions. alerts clear automatically when you switch back, and adding a new agent is just another pair of wrapper scripts.

features

  • per-agent status-bar icons and colours for Claude, Codex, OpenCode, and Copilot when an agent waits for input
  • command exit-code alerts: pass/fail icons and window-tab colours for long commands that finish while you're away
  • zsh preexec/precmd hooks with zero overhead on the command itself
  • status-bar entries show session:command for context across other sessions; same-session alerts just highlight the tab
  • alerts clear automatically on switching back to the window
  • thin wrapper-per-agent design over shared core scripts, so a new agent is a new pair of wrappers
  • built on plain shell, zsh, and tmux primitives, no daemons or dependencies