docs: name the message field in the hooks payload guide (#9913)

Co-authored-by: Douwe M Osinga <douwe@sidewalklabs.com>
This commit is contained in:
Ken Jo
2026-06-29 05:24:32 +09:00
committed by GitHub
parent 71280996d4
commit ec0ae7e12c
@@ -151,7 +151,18 @@ The matcher is a regular expression matched against the most relevant string for
## Hook Payload
When a hook runs, goose writes a JSON payload to the command's stdin. The payload always includes the event name and session ID, and may include fields such as the tool name, tool input, user message, last assistant message, or working directory.
When a hook runs, goose writes a JSON payload to the command's stdin. Every payload includes the event name and session ID. The remaining fields are only present when they apply to the event, so a hook should treat them as optional.
| Field | Description |
|---|---|
| `event` | Name of the event that fired, such as `PostToolUse` or `UserPromptSubmit`. |
| `session_id` | ID of the current goose session. |
| `matcher_context` | String the rule's `matcher` is tested against (for example, the tool name on tool events or the prompt text on `UserPromptSubmit`). |
| `tool_name` | Name of the tool, on tool events. |
| `tool_input` | Input arguments passed to the tool, on tool events. |
| `message` | Prompt text the user submitted, on `UserPromptSubmit`. |
| `last_assistant_message` | Final assistant text for the turn, on `Stop` when there is assistant output. |
| `working_dir` | Working directory of the session, on tool events. |
Example payload for a tool event:
@@ -166,6 +177,17 @@ Example payload for a tool event:
}
```
Example payload for a prompt event, where the submitted prompt is in `message`:
```json
{
"event": "UserPromptSubmit",
"session_id": "abc-123",
"matcher_context": "summarize this file",
"message": "summarize this file"
}
```
Example payload for a `Stop` event after an assistant reply:
```json