MoonshotAI / MoonshotAI/kimi-cli
UserPromptSubmit hook receives empty prompt when user_input is list[ContentPart]
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
What version of Kimi Code CLI is running?
kimi, version 1.41.0
Which open platform/subscription were you using?
kimi
Which model were you using?
kimi-k2.6
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
Bug: UserPromptSubmit hook receives empty prompt when user_input is list[ContentPart]
The UserPromptSubmit hook receives an empty prompt field when the user's input is formatted as a list of ContentPart o
bjects (which is the default for all messages).
Root cause in kimi_cli/soul/kimisoul.py line 601:
text_input_for_hook = user_input if isinstance(user_input, str) else ""
When user_input is list[ContentPart], it becomes "" and the hook receives empty prompt.
Expected: extract text from ContentPart list like it's done later:
user_message = Message(role="user", content=user_input)
text_input = user_message.extract_text(" ").strip()
Actual hook payload:
{
"hook_event_name": "UserPromptSubmit",
"session_id": "...",
"cwd": "...",
"prompt": ""
}
What steps can reproduce the bug?
- Configure a UserPromptSubmit hook in ~/.kimi/config.toml
- Start Kimi CLI and send any message
- Check the hook's stdin — prompt field is always empty
What is the expected behavior?
The hook should receive the actual text content of the user's message, extracted from ContentPart objects.
Additional information
• Environment: kimi-cli v1.41.0, Windows 11, Python 3.13
• This affects the Beta hooks system introduced in v1.28.0
• The matcher_value parameter also receives empty string, making regex matching ineffective
What is the expected behavior?
No response
Additional information
No response
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
Start in kimi_cli/soul/kimisoul.py around line 601, where text_input_for_hook is prepared, and compare it with the later Message.extract_text(" ").strip() path. Ensure UserPromptSubmit receives the extracted text for list[ContentPart] input and that matcher_value uses the same text. Done means the hook payload contains the user's message instead of an empty prompt.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100