kimi-lite

module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2026 License: MIT

README

kimi-lite

CI

Go port of the original TypeScript AI coding client.

A single-terminal AI assistant with no Node, Python runtime, or Electron dependencies.

Features

  • Streaming TUI chat — native Bubble Tea interface with multi-line input, history, @-mention file completion, and a two-line footer showing model, git, and context status.
  • Built-in toolsread_file, write_file, str_replace_file, edit, glob, grep, shell, fetch_url, list_directory, web_search, read_video, dispatch_subagent, and TodoList with sandboxed file access.
  • Subagents — delegate focused work to coder, explore, and plan subagents via dispatch_subagent.
  • Lifecycle hooks — run local commands at session_start, turn_start, turn_end, tool_call, tool_result, approval_request, and approval_decision.
  • ACP serverkimi-lite acp speaks JSON-RPC 2.0 over stdio for external agent integration.
  • Risk-aware approvals — every tool call is scored low/medium/high; destructive or sandbox-escaping operations require approval.
  • Context compression/compact summarizes older history using a language-aware token estimator.
  • Observability--pprof runtime profiling and internal metrics collection.
  • MCP support — connect to Model Context Protocol servers via stdio, HTTP, or legacy SSE.
  • All-sessions picker/sessions lists and resumes sessions across all directories, with search and pagination.
  • Multi-modal messages — image content parts are persisted and forwarded to vision-capable models.
  • Language-aware UI — transient status messages before long-running tools match the user's language; reasoning is instructed to stay in the same language.
  • Workspace prompt — the system prompt includes a compact workspace tree with hidden directories collapsed.

Installation

go install github.com/ekhodzitsky/kimi-lite/cmd/kimi-lite@latest

Or build from source:

git clone https://github.com/ekhodzitsky/kimi-lite.git
cd kimi-lite
make build

Configuration

Create ~/.config/kimi-lite/config.toml:

[llm]
provider = "moonshot"
api_key = "YOUR_API_KEY"
model = "kimi-k2.5"
base_url = "https://api.moonshot.cn/v1"
timeout = "60s"

[permission]
risk_threshold = "medium"

[[permission.risk_rules]]
tool = "shell"
level = "high"
message = "shell commands always require approval"

[behavior]
# Load specific skills by name, or leave empty to load every .md file in ~/.config/kimi-lite/skills/.
skills = ["go", "python"]

[ui]
# Built-in "dark" or "light", or a custom JSON theme file name from ~/.config/kimi-lite/themes/.
theme = "dark"
Kimi K2.7 Code or Kimi Code subscription

For the latest Kimi K2.7 Code via the Moonshot API, use the open-platform endpoint:

[llm]
provider = "moonshot"
api_key = "YOUR_MOONSHOT_API_KEY"
model = "kimi-k2.7-code"
base_url = "https://api.moonshot.ai/v1"

If you have a Kimi Code subscription, point at the membership endpoint with the stable kimi-for-coding model ID (the backend routes it to the latest coding model):

[llm]
provider = "moonshot"
api_key = "YOUR_KIMI_CODE_API_KEY"
model = "kimi-for-coding"
base_url = "https://api.kimi.com/coding/v1"

Drop skill files into ~/.config/kimi-lite/skills/ (e.g. go.md, python.md); their contents are appended to the system prompt.

Custom themes are JSON files placed in ~/.config/kimi-lite/themes/; set ui.theme to the file name (without .json) to use them. A theme defines colors such as background, foreground, primary, success, error, and highlight.

Usage

kimi-lite                        # start a new session
kimi-lite --continue             # resume the last session
kimi-lite --session <id>         # resume a specific session
kimi-lite --pprof localhost:6060 # expose runtime profiling endpoints
kimi-lite acp                    # start an ACP server over stdio

Inside the chat:

Command Description
/compact Summarize conversation history
/clear Clear current conversation
/sessions List available sessions

The agent can also dispatch focused subagents (coder, explore, plan) via the dispatch_subagent tool for parallel, isolated work, and run local lifecycle hooks at key events such as tool calls and approvals. Context compression (/compact) uses a language-aware token estimator to keep long conversations within the model's context window.

Quality

  • Tests run with -race on Ubuntu and macOS.
  • Fuzz tests cover hot paths such as token estimation, path validation, and HTTP chunk parsing.
  • goleak verifies no goroutine leaks after long-running smoke tests.
  • make coverage-gate enforces 70% statement coverage.
  • make lint runs golangci-lint with a strict v2 configuration.
  • Reproducible static binaries via make build and cross-compilation via make cross-compile.

Development

make test    # run tests with race detector
make lint    # run golangci-lint
make build   # build binary
make fuzz    # run fuzz smoke tests
make bench   # run benchmarks

Status

This is a Go reimplementation of the original TypeScript client, rewritten with dependency injection, context cancellation, and zero global state. The core feature set is implemented and the API is stabilizing; see CHANGELOG.md for recent additions.

License

MIT — see LICENSE for details.

Directories

Path Synopsis
cmd
kimi-lite command
Command kimi-lite is the AI coding CLI application.
Command kimi-lite is the AI coding CLI application.
internal
acp
Package acp implements an Agent Client Protocol (ACP) server speaking JSON-RPC 2.0 over stdio.
Package acp implements an Agent Client Protocol (ACP) server speaking JSON-RPC 2.0 over stdio.
app
Package app provides the application layer and DI container for kimi-lite.
Package app provides the application layer and DI container for kimi-lite.
config
Package config provides configuration types and loading for kimi-lite.
Package config provides configuration types and loading for kimi-lite.
core/hooks
Package hooks implements lifecycle hook execution for the core agent.
Package hooks implements lifecycle hook execution for the core agent.
core/procgroup
Package procgroup provides cross-platform process-group helpers used by the core executor and lifecycle hook runner.
Package procgroup provides cross-platform process-group helpers used by the core executor and lifecycle hook runner.
core/subagents
Package subagents implements ephemeral, non-persistent subagent runners.
Package subagents implements ephemeral, non-persistent subagent runners.
git
Package git provides an api.GitProvider implementation that shells out to git.
Package git provides an api.GitProvider implementation that shells out to git.
idgen
Package idgen provides a shared ID generation utility.
Package idgen provides a shared ID generation utility.
llm
Package llm provides an OpenAI-compatible LLM client with SSE streaming support.
Package llm provides an OpenAI-compatible LLM client with SSE streaming support.
mcp
Package mcp provides an MCP client implementation using JSON-RPC over stdio.
Package mcp provides an MCP client implementation using JSON-RPC over stdio.
netutil
Package netutil provides network utilities with SSRF-hardening.
Package netutil provides network utilities with SSRF-hardening.
observability
Package observability provides lightweight metrics collection and runtime profiling helpers using only the Go standard library.
Package observability provides lightweight metrics collection and runtime profiling helpers using only the Go standard library.
store
Package store provides SQLite persistence for kimi-lite sessions.
Package store provides SQLite persistence for kimi-lite sessions.
tui
Package tui provides the Terminal UI layer for kimi-lite using Bubble Tea.
Package tui provides the Terminal UI layer for kimi-lite using Bubble Tea.
tui/activity
Package activity renders transient status between the transcript and input.
Package activity renders transient status between the transcript and input.
tui/clipboard
Package clipboard reads and writes image, file, and text data from the system clipboard.
Package clipboard reads and writes image, file, and text data from the system clipboard.
tui/footer
Package footer provides the two-line status footer for the kimi-lite TUI.
Package footer provides the two-line status footer for the kimi-lite TUI.
tui/help
Package help provides the /help overlay for the kimi-lite TUI.
Package help provides the /help overlay for the kimi-lite TUI.
tui/images
Package images detects and renders terminal image protocols.
Package images detects and renders terminal image protocols.
tui/input
Package input provides a multi-line input component for the kimi-lite TUI.
Package input provides a multi-line input component for the kimi-lite TUI.
tui/mentions
Package mentions provides file-path candidate sources for @-mentions.
Package mentions provides file-path candidate sources for @-mentions.
tui/messages
Package messages provides chat message rendering for the kimi-lite TUI.
Package messages provides chat message rendering for the kimi-lite TUI.
tui/search
Package search provides the transcript search overlay for the kimi-lite TUI.
Package search provides the transcript search overlay for the kimi-lite TUI.
tui/sessions
Package sessions provides a TUI picker for browsing and selecting sessions.
Package sessions provides a TUI picker for browsing and selecting sessions.
tui/shell
Package shell provides the quick shell overlay for the kimi-lite TUI.
Package shell provides the quick shell overlay for the kimi-lite TUI.
tui/styles
Package styles provides Lipgloss styles for the kimi-lite TUI.
Package styles provides Lipgloss styles for the kimi-lite TUI.
tui/viewport
Package viewport provides a scrollable output area for the kimi-lite TUI.
Package viewport provides a scrollable output area for the kimi-lite TUI.
tui/welcome
Package welcome renders the empty-state welcome box.
Package welcome renders the empty-state welcome box.
pkg
api
Package api provides public types for kimi-lite.
Package api provides public types for kimi-lite.
scripts
benchregression command
Command benchregression parses Go benchmark output and compares it against a baseline.
Command benchregression parses Go benchmark output and compares it against a baseline.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL