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
@@ -349,51 +349,83 @@ ECA allows to totally customize the prompt sent to LLM via the `behavior` config
349
349
}
350
350
}
351
351
```
352
-
352
+
353
353
## Hooks
354
354
355
-
Hooks are actions that can run before or after an specific event, useful to notify after prompt finished or to block a tool call doing some check in a script.
355
+
Hooks are shell actions that run before or after specific events, useful for notifications, injecting context, modifying inputs, or blocking tool calls.
356
+
357
+
### Hook Types
358
+
359
+
| Type | When | Can Modify |
360
+
|------|------|------------|
361
+
|`sessionStart`| Server initialized | - |
362
+
|`sessionEnd`| Server shutting down | - |
363
+
|`chatStart`| New chat or resumed chat | Can inject `additionalContext`|
364
+
|`chatEnd`| Chat deleted | - |
365
+
|`preRequest`| Before prompt sent to LLM | Can rewrite prompt, inject context, stop request |
366
+
|`postRequest`| After prompt finished | - |
367
+
|`preToolCall`| Before tool execution | Can modify args, override approval, reject |
368
+
|`postToolCall`| After tool execution | Can inject context for next LLM turn |
369
+
370
+
### Hook Options
356
371
357
-
Allowed hook types:
372
+
-**`matcher`**: Regex for `server__tool-name`, only for `*ToolCall` hooks.
373
+
-**`visible`**: Show hook execution in chat (default: `true`).
374
+
-**`runOnError`**: For `postToolCall`, run even if tool errored (default: `false`).
358
375
359
-
-`preRequest`: Run before prompt is sent to LLM, if a hook output is provided, append to user prompt.
360
-
-`postRequest`: Run after prompt is finished, when chat come back to idle state.
361
-
-`preToolCall`: Run before a tool is called, if a hook exit with status `2`, reject the tool call.
362
-
-`postToolCall`: Run after a tool was called.
376
+
### Execution Details
363
377
364
-
__Input__: Hooks will receive input as json with information from that event, like tool name, args or user prompt.
0 commit comments