Skip to content

hooks/cursor/rtk-rewrite.sh writes nothing to stdout on its jq-missing, rtk-missing and too-old exits #5323

Backlog

Description

@KuSh

hooks/cursor/README.md says the hook returns {} when no rewrite applies because "Cursor requires JSON output for all code paths", and every later exit in the script prints {}. The first three do not: when jq is missing, when rtk is missing, or when rtk --version is below the floor, the script writes a warning to stderr and exits 0 with empty stdout.

Measured with {"tool_input":{"command":"git status"}} on stdin and the real release binaries on PATH:

rtk develop after #5131
0.22.2 empty stdout, exit 0 empty stdout, exit 0
0.23.0, 0.24.0 {}, exit 0 empty stdout, exit 0
0.25.0 rewrite JSON rewrite JSON

Cursor's hooks page (https://cursor.com/docs/agent/hooks) says exit 0 means "use the JSON output" and that invalid JSON blocks a permission hook such as preToolUse, but it does not say what an empty answer does. It lists "no output" as a failure only when failClosed is true.

Current rtk installs the native rtk hook cursor, so this script reaches users only when they copy it by hand. The fix is echo '{}' before the exit 0 of each of the three branches, with a test that runs the script with jq or rtk removed from PATH and with an old rtk --version, and asserts stdout is {}.

Activity

  1. added
    bug
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcursorhooks

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions