preToolUse hook updated_input silently discarded for Write tool (file creation/edit)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

A preToolUse hook that returns updated_input to rewrite a Write tool call’s content field is received and logged correctly, but the rewrite is never applied — the file is written with the original, unmodified content instead.

This is the same failure pattern already reported for the Task tool (updated_input silently ignored for the Task tool) and for beforeSubmitPrompt (updated_input is silently stripped), but reproduces independently on the Write tool specifically, on current builds.

Steps to Reproduce

  1. Open a workspace in Cursor IDE with a project-tier hook at .cursor/hooks.json:
{
  "version": 1,
  "hooks": {
    "preToolUse": [
      { "command": "./.cursor/hooks/probe.sh" }
    ]
  }
}
  1. .cursor/hooks/probe.sh:
#!/bin/bash
set -euo pipefail
input=$(cat)
echo "$input" | jq -c '{
  permission: "ask",
  updated_input: (.tool_input + { content: "REDACTED_BY_HOOK_MARKER" })
}'
  1. In the Cursor IDE chat/agent panel, ask the agent to create a file with known content, e.g.:

Create a file named test-output-ide.txt containing exactly this text and nothing else: ORIGINAL_UNMODIFIED_CONTENT_SENTINEL

  1. Note: no approval prompt is shown despite the hook returning permission: “ask” (separately tracked in 161342) — the write proceeds immediately.

  2. Open the written file and observe its contents.

Expected Behavior

Per the documented updated_input contract, the content field returned by the hook should be what’s actually written to disk, consistent with how updated_input is honored for Shell-type tool calls (confirmed working in our testing).

Operating System

MacOS

Version Information

Cursor IDE: 3.12.10 (macOS arm64)
cursor-agent CLI: 2026.07.09-a3815c0
Hook source: project-level .cursor/hooks.json
OS: macOS darwin 25.5.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Thanks for the detailed report and clean repro. I reproduced this on my end, so it’s confirmed on our side: for the Write tool, a preToolUse hook’s updated_input.content is silently dropped and the file is written with the original text. On Write, updated_input currently only applies file_path (Shell’s command/cwd/timeout do work, which is why Shell honored it for you). I’ve reported this to our team so Write matches the documented updated_input contract.

Workaround that works today: use an afterFileEdit hook to do the content rewrite directly on the file after the write completes. I tested it and the change gets applied. Caveat: the original content briefly lands on disk before the afterFileEdit hook rewrites it, so if you need the original to never touch disk, instead have preToolUse deny the write with an agent_message telling the agent to re-issue with corrected content.

The missing approval prompt you noted is expected for now: permission: "ask" is accepted by the schema but not enforced for preToolUse today (see the hooks docs).

Let me know if either workaround unblocks you!