Skip to main content

Overview

Hooks let you run a shell command or send an HTTP request when something happens inside EnConvo, such as an agent starting, completing, failing, or using a tool. They are configured with a JSON file, so you can add notifications, logs, local automation, or integrations without building an extension.
Most hooks are fire-and-forget: they run in the background and do not block EnConvo. PreToolUse, Stop, and SubagentStop are the exception during agent runs — the agent waits for them, so they can block a tool call or send the agent back to work. See Blocking Hooks.

Config File

Create your hooks config at:
EnConvo also reads the legacy file at ~/.config/enconvo/hooks.json when the new file does not exist. If both files exist, ~/.enconvo/hooks.json wins. The file is checked again whenever an event fires, so you can edit hooks while EnConvo is running. No restart is required.

Manage Hooks in Settings

Open Settings → Hooks to inspect hooks from ~/.enconvo/hooks.json. The settings panel groups entries by event, lets you toggle an entry on or off, and can open the JSON file for editing. Toggling writes enabled: false or enabled: true on that hook entry without changing the command or webhook definition.

Quick Start

1

Create the hooks folder

2

Create ~/.enconvo/hooks.json

3

Trigger an agent

Start any agent or chat command. When its status changes, EnConvo runs the configured command and appends a line to /tmp/enconvo-hooks.log.

How Hooks Work

When an event fires, EnConvo:
  1. Loads ~/.enconvo/hooks.json.
  2. Falls back to ~/.config/enconvo/hooks.json only if the new file is absent.
  3. Finds entries inside the top-level hooks object whose key matches the event name.
  4. Applies the optional matcher regex.
  5. Skips entries where enabled is false.
  6. Runs every configured hook concurrently.
Hook event names follow the Claude Code and Codex lifecycle set: SessionStart, UserPromptSubmit, PreToolUse, PermissionRequest, PostToolUse, Stop, and SubagentStop. The old EnConvo event names and old flat JSON shape are still readable for existing installs, but new writes use the wrapped Codex-style format.

Configuration Reference

Command Hook

A command hook runs a shell command. EnConvo writes the event payload to the command’s stdin as JSON.

HTTP Hook

An HTTP hook sends the event payload as the JSON request body.

Blocking Hooks

During an agent or bot run, three events run as blocking hooks. The agent waits for every matching hook (they run in parallel) before it continues, and reads their result the same way Claude Code and Codex do. A hook decides in one of two ways:
  • Exit code 2 blocks. The text the command writes to stderr is the reason.
  • Exit code 0 with JSON on stdout. Any other output, exit code, error, or timeout decides nothing, and the run continues as if the hook were not there.
HTTP hooks decide with a 2xx response whose body is the same JSON. When several hooks match, a deny wins over ask, which wins over allow; the reasons are joined, and the last updatedInput is used. A Stop hook can send the agent back at most 5 times in one turn. On the second and later checks, stop_hook_active is true, so a hook can let the agent stop once its instruction has been followed. Stop blocking only applies when the agent finishes normally; a failed or stopped run still fires Stop in the background.
The agent waits for blocking hooks, so a slow PreToolUse hook slows every tool call and a slow Stop hook delays the end of the turn. Keep them fast, set a short timeout, or run slow work in the background (command &).
Blocking hooks receive the regular event payload plus the Claude Code fields at the top level:
Stop and SubagentStop receive stop_hook_active and last_assistant_message instead of the tool fields. Command hooks run in the agent’s working directory.

Block a Dangerous Command

Make the Agent Run Tests Before Finishing

Event Payload

Command hooks receive this JSON on stdin. HTTP hooks receive the same JSON as the request body.

Available Events

Legacy EnConvo names such as run_status_changed and agent_tool_step_changed still work, so existing hook files do not need to be migrated immediately.

Recipes

macOS Notification on Agent Failure

Log Agent Status Changes

Log Agent Tool Calls

Send to Slack

Custom Script

Create a script that reads the event payload from stdin:
Reference it from ~/.enconvo/hooks.json:
Make the script executable:

Troubleshooting

Confirm that ~/.enconvo/hooks.json is valid JSON, the top-level key matches the event name, and the command works when run manually. If you still have ~/.config/enconvo/hooks.json, remember that it is ignored when the new file exists.
Pipe a sample payload into the script:
Only PreToolUse, Stop, and SubagentStop during agent runs, which the agent waits for. Every other hook is fire-and-forget. If any hook fails or times out, EnConvo logs the failure and continues as if the hook were not there.
Prefer absolute paths for scripts and binaries. Shell ~ expansion works when the command is executed through a shell, but absolute paths are easier to debug.

Agents

Learn about EnConvo agents and custom bots

Extension API Reference

Build extensions that emit or listen to events