You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Event hooks: run a command when a session blocks, finishes, exits or a run fails #170
Event hooks: run a user-configured command when something happens to a session. For example: session becomes blocked or waiting for approval, an agent finishes, a run command fails, a session exits.
Motivation
A frequent want is "ping my phone when an agent needs me". Today that needs CSM to grow a feature per destination: Telegram, Slack, ntfy, a sound.
Herdr's plugin system is the heavy version:
a manifest of actions, event hooks, panes and link handlers;
distribution from GitHub, plus a marketplace;
the cookbook includes agent-telegram-notify.
The event hook is the piece that gives most of the value for least cost.
Proposal (deliberately smaller than plugins)
Configuration. Settings ▸ Hooks: a list of { event, command }. The command is an argv array, run without a shell (CLAUDE.md, "Never interpolate a value into a command line").
Context. Passed as environment variables plus a JSON payload on stdin: session id, name, folder, alert message, and for runs the run label and exit code.
Not as argv substitution: the alert text comes from terminal output and is untrusted.
Execution.
Off the UI thread (Task.Run), with a timeout (e.g. 10 s), so output can't stall CSM.
An event source now exists (#190). The OSC 7501 transitions into blocked (with kind: permission/question/auth), done and error are exactly the hook triggers this issue proposes, and they are no longer regex guesses. Pass the record id, app and decoded msg to the hook as environment variables (CSM_STATUS_ID, …), never on the command line. The same applies to anything else that comes from terminal output.
Activity
AThraen commentedon Nov 5, 2026
Cross-links for the Herdr-inspired batch:
Orchestration semantics were added to #132, and detection notes to #154.
AThraen commentedon Nov 10, 2026
An event source now exists (#190). The OSC 7501 transitions into
blocked(withkind: permission/question/auth),doneanderrorare exactly the hook triggers this issue proposes, and they are no longer regex guesses. Pass the recordid,appand decodedmsgto the hook as environment variables (CSM_STATUS_ID, …), never on the command line. The same applies to anything else that comes from terminal output.