Kimi Agent
Integrate Moonshot AI's Kimi CLI with Ralph TUI for AI-assisted coding.
Kimi Agent
The Kimi agent plugin integrates with Moonshot AI's kimi CLI to execute AI coding tasks. It supports streaming JSONL output for subagent tracing and uses --print mode for non-interactive operation.
Kimi supports subagent tracing via stream-json output - Ralph TUI can show tool calls in real-time as Kimi works.
Prerequisites
Install Kimi CLI following the official Getting Started guide:
Or install manually with uv:
Verify installation:
On first run, you need to configure your API source. Run kimi and enter /login to complete setup.
Basic Usage
Run with Kimi
Use the --agent kimi flag:
Select a Model
Override the model with --model:
Configuration
Shorthand Config
The simplest configuration:
Full Config
For advanced control:
Options Reference
| Option | Type | Default | Description |
|---|---|---|---|
model | string | - | Kimi model (e.g., kimi-k2-0711). Leave empty for default. |
timeout | number | 0 | Execution timeout in ms (0 = no timeout) |
command | string | "kimi" | Path to Kimi CLI executable |
Subagent Tracing
Kimi emits structured JSONL via --output-format stream-json (always enabled). Ralph TUI parses this to display:
- Text responses from the model
- Tool invocations (file reads, writes, shell commands)
- Error messages from failed operations
Enabling Tracing
Or toggle in TUI:
- Press
tto cycle through detail levels - Press
T(Shift+T) to toggle the subagent tree panel
How It Works
When Ralph TUI executes a task with Kimi:
- Build command: Constructs
kimi --print --input-format text --output-format stream-json [options] - Pass prompt via stdin: Avoids shell escaping issues with special characters
- Stream output: Captures stdout/stderr in real-time
- Parse JSONL: Extracts structured tool call data
- Detect completion: Watches for process exit
- Handle exit: Reports success, failure, or timeout
CLI Arguments
Ralph TUI builds these arguments:
--print mode enables non-interactive operation: Kimi processes the prompt and exits. It also auto-approves operations (equivalent to --yolo), which is required for Ralph TUI's autonomous workflow.
Windows Compatibility
On Windows, Kimi CLI runs with additional environment variables to avoid encoding issues:
These are injected automatically by Ralph TUI.
Troubleshooting
"Kimi CLI not found"
Ensure Kimi is installed and in your PATH:
"Not logged in"
Kimi CLI requires authentication on first run:
Or use the subcommand:
"Execution timeout"
Increase the timeout for complex tasks:
Encoding errors on Windows
If you see charmap codec errors, ensure Python is configured for UTF-8. Ralph TUI sets this automatically, but you can also set it system-wide:
Next Steps
- Gemini Agent - Google's Gemini CLI
- Claude Agent - Anthropic's Claude Code
- Configuration - Full options reference