Hooks: document whether a UserPromptSubmit prompt was typed by the human

Status Open
Reported on v2.1.293
Maintainer reply None cached
Activity 0 comments · opened Oct 9, 2026

Request

Add a documented field to the UserPromptSubmit hook input (and ideally to transcript entries) that says whether the prompt was typed by the human, as opposed to a background subagent reporting back, a message from another session, a scheduled task, or a message a command posted to the session's own inbox.

Why

A policy hook may want to treat something the human typed as permission for a sensitive step later in the turn or session, for example "make change X and then deploy" granting a production deploy without a second prompt. The hooks documentation says UserPromptSubmit also fires for background subagent reports, cross-session messages and scheduled tasks, and the messaging docs say a command can post to its own session's inbox socket (CLAUDE_CODE_MESSAGING_SOCKET). The hook input carries no field that tells these apart, so a hook cannot safely use the prompt text as the human's own words.

Transcript entries currently carry origin: {kind: "human"} vs {kind: "peer"} and similar, but this is not documented, and the docs note the transcript is written asynchronously, so the entry may not exist yet when the hook runs.

Proposal

  • UserPromptSubmit input gains a field such as prompt_source: "human" | "subagent" | "peer" | "scheduled" | "inbox" (or origin.kind, matching the transcript).
  • Document the transcript origin field and its values.

Environment

Claude Code 2.1.293, Claude desktop app (Code tab), macOS.

View original on GitHub ↗