MoonshotAI / MoonshotAI/kimi-cli

UserPromptSubmit hook receives empty prompt when input comes from shell UI

Open
#2,303 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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?

1.44.0

Which open platform/subscription were you using?

Kimi Code (managed:kimi-code)

Which model were you using?

kimi-code/kimi-for-coding (Kimi-k2.6)

What platform is your computer?

macOS Sonoma 14.7 (Apple Silicon M1 Max), Darwin 23.6.0 arm64

What issue are you seeing?

The UserPromptSubmit hook always receives "prompt": "" even when the user types plain text in the interactive shell. The matcher_value is also empty, so regex-based prompt filtering hooks never match.

What steps can reproduce the bug?
  1. Add a UserPromptSubmit hook to config.toml:
 [[hooks]]
 event = "UserPromptSubmit"
 command = "cat > /tmp/prompt_payload.json"
 timeout = 5
  1. Start an interactive shell session:
 uv run python -m kimi_cli
  1. Type any plain text message (e.g., hello world) and submit.
  2. Inspect the captured payload:
    cat /tmp/prompt_payload.json
    Actual result:
{
  "hook_event_name": "UserPromptSubmit",
  "session_id": "abc123",
  "cwd": "/Users/...",
  "prompt": ""
}
What is the expected behavior?

The prompt field should contain the actual user input text ("hello world"). The matcher_value passed to the hook engine should also be the user's text so that regex matchers work correctly.

Additional information

No response

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 with the interactive entry point run by uv run python -m kimi_cli and trace the UserPromptSubmit hook payload and matcher value for shell-entered text. Reproduce the issue with the provided config.toml hook and /tmp/prompt_payload.json capture. Done means the payload and matcher contain the submitted text, and the reproduction confirms regex matchers can match it.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.