MoonshotAI / MoonshotAI/kimi-code
PreToolUse hooks: input mutation via `updatedInput`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
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 😄
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by locating the PreToolUse hook protocol and the handling of permissionDecision, then trace how tool inputs reach execution. Done means an allowed hook can provide updatedInput and the tool runs with the mutated parameters without a retry.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100