Cursor CLI hooks

@andrewh this confirms that bug I’m waiting for someone to fix - it was documented and implemented in the parameters, but the source code in your product (I asked Claude to look at the CLI install folder) simply discards it:

More Claude research:

Summary of Findings

1. Which hooks are actually implemented and working in the CLI?

Working hooks (these have executor wrappers that call them):

  • beforeShellExecution :white_check_mark: - via ShellExecutorWithHooks / ShellStreamExecutorWithHooks

  • afterShellExecution :white_check_mark: - via same

  • beforeMCPExecution :white_check_mark: - via McpToolExecutorWithHooks

  • afterMCPExecution :white_check_mark: - via same

  • afterFileEdit :white_check_mark: - via WriteExecutorWithHooks

NOT implemented in CLI (types exist but no code calls them):

  • stop :cross_mark: - No caller found

  • beforeSubmitPrompt :cross_mark: - No caller found

  • afterAgentResponse :cross_mark: - No caller found

  • afterAgentThought :cross_mark: - No caller found

  • beforeReadFile :cross_mark: - No caller found

  • beforeTabFileRead :cross_mark: - Tab-specific, not relevant to CLI

  • afterTabFileEdit :cross_mark: - Tab-specific, not relevant to CLI

The hooksConfigLease with hasHookForStep() is returned from the shared services, but it’s only used to check if any hooks are configured - the agent loop itself never calls any hooks directly. It only works through the resource accessor wrappers.

2 Likes