[DOCS] Inconsistent documentation regarding `once: true` support for Agent hooks
Documentation Type
Unclear/confusing documentation
Documentation Location
- https://code.claude.com/docs/en/hooks#hooks-in-skills-agents-and-slash-commands - https://code.claude.com/docs/en/sub-agents#hooks-in-subagent-frontmatter
Section/Topic
The configuration of lifecycle hooks within custom subagents, specifically the availability of the once: true execution flag.
Current Documentation
In hooks.md:
"Additional option for skills and slash commands:once: Set totrueto run the hook only once per session. After the first successful execution, the hook is removed. Note: This option is currently only supported for skills and slash commands, not for agents."
In sub-agents.md:
The example code for a code-reviewer agent explicitly includes the flag:
hooks:
PreToolUse:
- matcher: "Bash"
hooks:
- type: command
command: "./scripts/validate-command.sh $TOOL_INPUT"
once: true
What's Wrong or Missing?
There is a direct contradiction between the reference documentation and the feature guide. The Hooks reference states that once: true is specifically not supported for agents, while the Sub-agents guide uses it as a primary code example for agent-scoped hooks. This leaves the user unsure if the feature is implemented for agents or if the example provided will fail/be ignored.
Suggested Improvement
- Verify Functionality: Determine if the
onceflag is actually supported in the Subagent runner. - Align Documentation:
- If
once: trueis supported for agents: Remove the restrictive note inhooks.md. - If
once: trueis not supported for agents: Removeonce: truefrom the code example insub-agents.mdto avoid leading users into non-functional configurations.
Impact
High - Prevents users from using a feature
Additional Context
This inconsistency appears to be a result of the rapid evolution of the hooks system across different component types (Skills, Commands, and Agents). Ensuring parity or clearly documented limitations is critical for users building automated verification workflows.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗