MoonshotAI / MoonshotAI/kimi-cli
Feature Request: Add an option to pass initial prompt while keeping interactive mode
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
Current Behavior
Currently, the --prompt (or -p) option is designed for single-shot execution: CLI processes the prompt and then exits immediately without entering the interactive shell.
kimi -p "Explain this codebase" # executes and exits
This is confirmed by the documentation:
"When using
--prompt(or--command), Kimi Code CLI exits after processing the query."
Desired Behavior
It would be very useful to have an option (e.g. --prompt-interactive, --init-prompt, or a special value for --prompt) that allows users to pass an initial user message when launching the CLI, but then keep the interactive session open for follow-up questions.
For example:
# Hypothetical usage
kimi --prompt-interactive "Analyze the dependency graph of src/main.js"
# Or
kimi -p "Analyze the dependency graph of src/main.js" --interactive
After the AI responds to the initial prompt, the user can continue typing follow-up questions in the same session.
Use Cases
- Shell aliases / wrapper scripts: Users can create shortcuts like
kimi-code-reviewthat automatically seed a specific prompt but still allow interactive refinement. - IDE integrations: External editors could launch Kimi with a pre-filled context (e.g. current file, selected lines) and let the developer continue the conversation.
- Session initialization: Quickly start a session with a complex multi-line prompt without having to paste it manually after the shell starts.
Possible Implementation Ideas
- Add a new flag like
--prompt-interactive TEXTor--init-prompt TEXT. - Alternatively, make
--promptbehavior depend on whether--printis present: without--print, enter interactive mode after handling the initial prompt. (However, this would be a breaking change.) - Or support reading from a special file descriptor / here-document that gets injected as the first user message while keeping stdin open for the interactive TTY.
Workarounds Tried
- Custom Agent with
system_prompt_pathworks for fixed context, but not for dynamic initial prompts. - Two-step process (
kimi -S session -p "..."thenkimi -C) works but is cumbersome and splits the conversation into two commands. - Piping via
echo "..." | kimidoes not work because the CLI detects non-TTY stdin and skips interactive mode.
Thanks for considering this!
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 with the existing CLI handling for --prompt and the non-TTY check, using the input-and-commands documentation as the behavioral reference. Decide how an initial message can be processed while preserving the interactive session and stdin; done means the initial prompt receives a response and follow-up questions remain available without breaking current single-shot behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100