[codex] Emit assistant reply text in Stop hooks (#9968)

This commit is contained in:
Max Novich
2026-06-24 10:03:01 -07:00
committed by GitHub
parent 2acae3b243
commit e51d70f1fa
3 changed files with 133 additions and 21 deletions
@@ -133,7 +133,7 @@ Use `${PLUGIN_ROOT}` in a command to reference the plugin directory. goose also
|---|---|---|
| `SessionStart` | A session starts | None |
| `SessionEnd` | A session ends | None |
| `Stop` | goose receives a stop event | None |
| `Stop` | goose finishes a turn or receives a stop event | None |
| `UserPromptSubmit` | The user submits a prompt | Prompt text |
| `PreToolUse` | Before goose runs a tool | Tool name |
| `PostToolUse` | After a tool succeeds | Tool name |
@@ -151,7 +151,7 @@ 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, or working directory.
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.
Example payload for a tool event:
@@ -166,6 +166,16 @@ Example payload for a tool event:
}
```
Example payload for a `Stop` event after an assistant reply:
```json
{
"event": "Stop",
"session_id": "abc-123",
"last_assistant_message": "Done. I updated the file and ran the tests."
}
```
Example script that reads the payload:
```bash