v1.31.0
- Core: Cap
list_directoryoutput as a depth-limited tree to prevent token-limit blowup in large directories — replaces the unbounded flat listing with a 2-level tree (root: 30 entries, child: 10 per subdirectory), dirs-first alphabetical sorting, and"... and N more"truncation hints so the model knows to explore further (fixes #1809) - Shell: Add blocking update gate on interactive shell startup — when a newer version is detected (from the existing background check cache), a blocking prompt appears before the shell loads, offering
[Enter]to upgrade immediately,[q]to continue and be reminded next time, or[s]to skip reminders for that version; respects theKIMI_CLI_NO_AUTO_UPDATEenvironment variable; replaces the previous repeating toast notification for available updates - Auth: Harden OAuth token refresh to prevent unnecessary re-login — 401 errors now trigger automatic token refresh and retry instead of forcing
/login; multiple simultaneous CLI instances coordinate refresh via a cross-process file lock to avoid race conditions; token persistence uses atomic writes withfsyncto prevent corruption; adds dynamic refresh threshold, 5xx retry during token refresh, and proper token revocation cleanup - Core: Fix agent loop silently stopping when model response contains only thinking content — detect think-only responses (reasoning content with no text or tool calls) as an incomplete response error and retry automatically
- Core: Fix crash on streaming mid-flight network disconnection — when the OpenAI SDK raises a base
APIError(instead ofAPIConnectionError) during long-running streams, the error is now correctly classified as retryable, enabling automatic retry and connection recovery instead of an unrecoverable crash - Shell: Exclude empty current session from
/sessionspicker — completely empty sessions (no conversation history and no custom title) are no longer shown in the session list; sessions with a custom title are still displayed - Shell: Fix slash command completion Enter key behavior — accepting a completion now submits in a single Enter press; auto-submit is limited to slash command completions only; file mention completions (
@) accept without submitting so the user can continue editing; re-completion after accepting is suppressed to prevent stale completion state - Shell: Add directory scope toggle to
/sessionspicker — pressCtrl+Ato switch between showing sessions for the current working directory only or across all known directories; uses a new full-screen session picker UI with header scope indicator and footer hint bar - Shell: Add
/btwside question command — ask a quick question during streaming without interrupting the main conversation; uses the same system prompt and tool definitions for prompt cache alignment; responses display in a scrollable modal panel with streaming support - Shell: Redesign bottom dynamic area — split the monolithic
visualize.py(1865 lines) into a modular package (visualize/) with dedicated modules for input routing, interactive prompts, approval/question panels, and btw modal; unify input semantics withclassify_input()for consistent command routing - Shell: Add queue and steer dual-channel input during streaming — Enter queues messages for delivery after the current turn; Ctrl+S injects messages immediately into the running turn's context; queued messages display in the prompt area with count indicator and can be recalled with ↑
- Shell: Add
BtwBegin/BtwEndwire events for cross-client side question support - Shell: Improve elapsed time formatting in spinners — durations over 60 seconds now display as
"1m 23s"instead of"83s"; sub-second durations show"<1s" - Shell: Fix Rich markup injection in btw panel — user questions containing
[/]characters are now escaped to prevent broken rendering or style injection in spinner text and panel titles - Core: Improve error diagnostics — enrich internal logging coverage, include relevant log files and system manifest in
kimi exportarchives, and surface actionable error messages for common failures (auth, network, timeout, quota) - Shell: Gracefully exit with crash report when working directory becomes inaccessible during session — detects CWD loss (external drive unplugged, directory deleted, or filesystem unmounted) and prints a session recovery panel with session ID and work directory before exiting cleanly
- Shell: Use
git ls-filesfor@file mention discovery — file completer now queriesgit ls-files --recurse-submoduleswith a 5-second timeout as the primary discovery mechanism, falling back toos.walkfor non-git repositories; this fixes large repositories (e.g., apache/superset with 65k+ files) where the 1000-file limit caused late-alphabetical directories to be unreachable (fixes #1375) - Core: Add shared
file_filtermodule — unifies file mention logic between shell and web UIs viasrc/kimi_cli/utils/file_filter.py, providing consistent path filtering, ignored directory exclusion, and git-aware file discovery - Shell: Prevent path traversal in file mention scope parameter — the
scopeparameter in file completer requests is now validated to prevent directory traversal attacks - Web: Restore unfiltered directory listing in file browser API — file browser endpoint no longer applies git-aware filtering, ensuring all files are visible in the web UI file picker
- Todo: Refactor SetTodoList to persist state and prevent tool call storms — todos are now persisted to session state (root agent) and independent state files (sub-agents); adds query mode (omit
todosto read current state) and clear mode (pass[]); includes anti-storm guidance in tool description to prevent repeated calls without progress (fixes #1710) - ReadFile: Add total line count to every read response and support negative
line_offsetfor tail mode — the tool now reportsTotal lines in file: N.in its message so the model can plan subsequent reads; negativeline_offset(e.g.-100) reads the last N lines using a sliding window, useful for viewing recent log output without shell commands; the absolute value is capped at 1000 (MAX_LINES) - Shell: Fix black background on inline code and code blocks in Markdown rendering —
NEUTRAL_MARKDOWN_THEMEnow overrides all Rich defaultmarkdown.*styles to"none", preventing Rich's built-in"cyan on black"from leaking through on non-black terminals
Fetched June 4, 2026

