Skip to content

docs(agent): document per-event extra keys in shell-hook wire protocol - #49382

Closed
ken-jo wants to merge 1 commit into
NousResearch:mainfrom
ken-jo:docs/hook-payload-fields
Closed

docs(agent): document per-event extra keys in shell-hook wire protocol#49382
ken-jo wants to merge 1 commit into
NousResearch:mainfrom
ken-jo:docs/hook-payload-fields

Conversation

@ken-jo

@ken-jo ken-jo commented Jun 20, 2026

Copy link
Copy Markdown

The shell-hook wire-protocol docstring in agent/shell_hooks.py documents the top-level stdin shape, including the extra object, but not which keys each event puts inside it. Since _serialize_payload folds all non-top-level kwargs into extra, the genuinely useful per-event fields (tool result/status, the subagent child id, session-end flags) are only reachable there, and a hook author can't discover them without reading the emit sites.

This adds a short per-event table right after the extra line listing the common keys for post_tool_call, subagent_stop, on_session_end, and on_session_start. Field names verified against the emit sites in model_tools.py, tools/delegate_tool.py, agent/turn_finalizer.py, and agent/conversation_loop.py.

Docstring-only; no code change. Happy to move it to the README or a docs page instead, or trim/expand the key list if you'd prefer.

Closes #49370

@alt-glitch alt-glitch added type/docs Documentation improvements comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have labels Jun 20, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Closing as a duplicate of #49392, which documents the same shell-hook per-event extra keys in agent/shell_hooks.py more completely (all six hook sites with source files and full key lists). Thanks — your version covered the same ground.

@ken-jo

ken-jo commented Jun 21, 2026

Copy link
Copy Markdown
Author

Thanks @teknium1 — fair call, #49392 did read as more complete at the time. Two things for the record, and a small ask:

This is the canonical/first version. #49382 was opened 2026-06-20 02:51, ~29 min before #49392 (03:20), and both close #49370. The #49392 author confirmed it in their own thread:

#49382 (by @ken-jo) was opened ~29 minutes earlier and is the canonical version.

It's now strictly more complete than #49392. I just pushed a follow-up to this branch that documents all six shell-hook lifecycle sites — including subagent_start, which #49392 omits — each with its emitting source file and full extra-key list, plus the parent/child session_id trap generalized to both subagent events. It also corrects two things in #49392's reference: pre_tool_call is emitted from hermes_cli/plugins.py (not model_tools.py), and the post_tool_call payload key is result (not tool_output). Tests pass; docstring-only.

Since #49944 is salvaging older validated docs PRs with authorship preserved, could this canonical version be the one reopened/salvaged? Happy to rebase onto current main. Either way, glad the docs land.

@ken-jo

ken-jo commented Jun 21, 2026

Copy link
Copy Markdown
Author

Since I can't reopen this as the author (GitHub blocks author-reopen on a maintainer-closed PR), I've carried the completed canonical version forward in #49969 — it now covers all six shell-hook sites (incl. subagent_start, which #49392 omits), with source files + full extra-key lists. Continuing the discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have type/docs Documentation improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs]: shell-hook stdin extra object — per-event contents (tool result, subagent child id) not documented

3 participants