Claude Code subagent hooks: scope and workspace trust
Inspect when agent-specific hooks load and the project trust requirement.
Inspect agent-specific and session-wide hooks · Project frontmatter hooks require folder trust · Stop becomes a subagent event
At a glance
This page inspects one configuration or restoration contract from official documentation. No actual skill, subagent, hook or restoration was executed. Local checks use synthetic inputs and are not complete product tests.
Runtime and applicability
- Article type
- Spec file
- Verified
- Applies to
- Claude Code Applies to the documented Claude Code configuration and version contract.
- Tools
File locations
| Path | Scope | How it is read |
|---|---|---|
.claude/agents/<name>.md | The configuration or session operation described here. | Read by Claude Code under the relevant loading and event contract; not enabled in this run. |
When to use
- Inspect when agent-specific hooks load and the project trust requirement.
When not to use
- Establish required inputs, permission scope and recovery points before execution.
Inspect agent-specific and session-wide hooks
Frontmatter hooks run while that subagent is active and are cleaned up at completion. Session-wide tool-event hooks in settings.json also fire for subagent tool calls, as do managed and plugin hooks. Inspecting the agent file alone does not establish the full verification chain.
Project frontmatter hooks require folder trust
Project-level frontmatter hooks require workspace trust for the folder containing the agent file. Without trust, the subagent still runs but hooks are skipped with a debug error; parent-folder trust and a -p session are insufficient. User-level ~/.claude/agents/ and --agents definitions do not require that step, though their sources still need review.
Stop becomes a subagent event
When invoked as a subagent, frontmatter Stop hooks become SubagentStop at runtime. Record launch, hook loading and check execution separately; a task result does not verify hook success. No trust dialog or hook was operated here. Stop relying on the check when it is skipped, its script is absent or the event mismatches.
Sources
All links are official pages; verification dates are listed per source, and links point to the version checked.