MoonshotAI / MoonshotAI/kimi-cli

[Bug] UserPromptSubmit hook event sends empty prompt field

Open
#1,779 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
11.4k
Forks
1.3k
Avg merge
9h 47m
Merged PRs (30d)
2

Description

Bug Description

The UserPromptSubmit hook event passes an empty string for the prompt field in the stdin JSON payload, regardless of what the user actually typed.

Steps to Reproduce

  1. Configure a hook in ~/.kimi/config.toml:
[[hooks]]
event = "UserPromptSubmit"
command = "/path/to/capture-script.sh"
timeout = 10
  1. Create a capture script that logs stdin:
#!/bin/bash
INPUT=$(cat)
echo "$INPUT" >> /tmp/kimi-hook-debug.log
  1. Open Kimi CLI, type any message (e.g., "hello world"), and submit.

Expected Behavior

The hook should receive the user's actual prompt text:

{"hook_event_name": "UserPromptSubmit", "session_id": "...", "cwd": "/Users/...", "prompt": "hello world"}

Actual Behavior

The prompt field is always an empty string:

{"hook_event_name": "UserPromptSubmit", "session_id": "a072f750-4106-4abc-86cd-1728396cd387", "cwd": "/Users/linnian", "prompt": ""}

Impact

Third-party integrations that rely on hook events to track user prompts (e.g., Vibe Island) cannot read the prompt content, making prompt-related features non-functional.

Environment

  • Kimi CLI version: latest (kimi-for-coding powered by kimi-k2.5)
  • OS: macOS (Darwin arm64)
  • Config format: ~/.kimi/config.toml with [[hooks]] array syntax

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the UserPromptSubmit hook dispatch and the code that constructs the stdin JSON payload; the issue does not name source files. Reproduce with the ~/.kimi/config.toml hook and capture script, then verify that the submitted text appears in the prompt field.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.