Skip to content

PreToolUse hooks: input mutation via updatedInput #345

Description

@simeq

I thought about connecting rtk to Kimi Code CLI, but the current PreToolUse hook protocol makes it less efficient to do. To change a call, a hook can only block it with permissionDecision: "deny" and hope that the model tries again with the right command. It would be great to have a way to change the tool input and still let execution go on.

The idea

Instead of blocking and suggesting a fix:

{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "deny",
    "permissionDecisionReason": "Use `rtk git status` instead"
  }
}

I'd like to return the rewritten input directly:

{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "allow",
    "updatedInput": {
      "command": "rtk git status"
    }
  }
}

The tool runs with the mutated parameters. No block, no retry loop, no wasted tokens.


Claude Code supports this. Their hook protocol has updatedInput alongside permissionDecision — the decision controls permission flow, while updatedInput independently mutates tool parameters.


Would love to hear if this fits; I'm happy to create PR if needed 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions