Skip to content

Commit f4ab7da

Browse files
fix: restore Python source from fork point 3bad72e instead of main
The branch forked from 3bad72e, so src/kimi_cli/, docs/, tests/ and other Python files should match that commit, not the latest main. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fe44b01 commit f4ab7da

86 files changed

Lines changed: 498 additions & 5432 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,6 @@ Only write entries that are worth mentioning to users.
1111

1212
## Unreleased
1313

14-
- ReadFile: Add total line count to every read response and support negative `line_offset` for tail mode — the tool now reports `Total lines in file: N.` in its message so the model can plan subsequent reads; negative `line_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)
15-
- Shell: Fix black background on inline code and code blocks in Markdown rendering — `NEUTRAL_MARKDOWN_THEME` now overrides all Rich default `markdown.*` styles to `"none"`, preventing Rich's built-in `"cyan on black"` from leaking through on non-black terminals
16-
17-
## 1.30.0 (2026-04-02)
18-
19-
- Shell: Refine idle background completion auto-trigger — resumed shell sessions no longer auto-start a foreground turn from stale pending background notifications before the user sends a message, and fresh background completions now wait briefly while the user is actively typing to avoid stealing the prompt or breaking CJK IME composition
20-
- Core: Fix interrupted foreground turns leaving unbalanced wire events — `TurnEnd` is now emitted even when a turn exits via cancellation or step interruption, preventing dirty session wire logs from accumulating across resume cycles
21-
- Core: Improve session startup resilience — `--continue`/`--resume` now tolerate malformed `context.jsonl` records and corrupted subagent, background-task, or notification artifacts; the CLI skips invalid persisted state where possible instead of failing to restore the session
22-
- CLI: Improve `kimi export` session export UX — `kimi export` now previews the previous session for the current working directory and asks for confirmation, showing the session ID, title, and last user-message time; adds `--yes` to skip confirmation; also fixes explicit session-ID invocations where `--output` after the argument was incorrectly parsed as a subcommand
23-
- Grep: Add `include_ignored` parameter to search files excluded by `.gitignore` — when set to `true`, ripgrep's `--no-ignore` flag is enabled, allowing searches in gitignored artifacts such as build outputs or `node_modules`; sensitive files (like `.env`) remain filtered by the sensitive-file protection layer; defaults to `false` to preserve existing behavior
24-
- Core: Add sensitive file protection to Grep and Read tools — `.env`, SSH private keys (`id_rsa`, `id_ed25519`, `id_ecdsa`), and cloud credentials (`.aws/credentials`, `.gcp/credentials`) are now detected and blocked; Grep filters them from results with a warning, Read rejects them outright; `.env.example`/`.env.sample`/`.env.template` are exempted
25-
- Core: Fix parallel foreground subagent approval requests hanging the session — in interactive shell mode, `_set_active_approval_sink` no longer flushes pending approval requests to the live view sink (which cannot render approval modals); requests stay in the pending queue for the prompt modal path; also adds a 300-second timeout to `wait_for_response` so that any unresolved approval request eventually raises `ApprovalCancelledError` instead of hanging forever
26-
- CLI: Add `--session`/`--resume` (`-S`/`-r`) flag to resume sessions — without an argument opens an interactive session picker (shell UI only); with a session ID resumes that specific session; replaces the reverted `--pick-session`/`--list-sessions` design with a unified optional-value flag
27-
- CLI: Add CJK-safe `shorten()` utility — replaces all `textwrap.shorten` calls so that CJK text without spaces is truncated gracefully instead of collapsing to just the placeholder
28-
- Core: Fix skills in brand directories (e.g. `~/.kimi/skills/`) silently disappearing when a generic directory (`~/.config/agents/skills/`) exists but is empty — skill directory discovery now searches brand and generic directory groups independently and merges both results, instead of stopping at the first existing directory across all candidates
29-
- Core: Add `merge_all_available_skills` config option — when enabled, skills from all existing brand directories (`~/.kimi/skills/`, `~/.claude/skills/`, `~/.codex/skills/`) are loaded and merged instead of using only the first one found; same-name skills follow priority order kimi > claude > codex; disabled by default
30-
- CLI: Add `--plan` flag and `default_plan_mode` config option — start new sessions in plan mode via `kimi --plan` or by setting `default_plan_mode = true` in `~/.kimi/config.toml`; resumed sessions preserve their existing plan mode state
31-
- Shell: Add `/undo` and `/fork` commands for session forking — `/undo` lets you pick a previous turn and fork a new session with the selected message pre-filled for re-editing; `/fork` duplicates the entire session history into a new session; the original session is always preserved
32-
- CLI: Add `-r` as a short alias for `--session` and print a resume hint (`kimi -r <session-id>`) whenever a session exits — covers normal exit, Ctrl-C, `/undo`, `/fork`, and `/sessions` switch so users can always find their way back
33-
- Core: Fix `custom_headers` not being passed to non-Kimi providers — OpenAI, Anthropic, Google GenAI, and Vertex AI providers now correctly forward custom headers configured in `providers.*.custom_headers`
34-
35-
## 1.29.0 (2026-04-01)
36-
3714
- Core: Support hierarchical `AGENTS.md` loading — the CLI now discovers and merges `AGENTS.md` files from the git project root down to the working directory, including `.kimi/AGENTS.md` at each level; deeper files take priority under a 32 KiB budget cap, ensuring the most specific instructions are never truncated
3815
- Core: Fix empty sessions lingering on disk after exit — sessions created but never used are now cleaned up on all exit paths (failure exit, session switch, unexpected errors), not just on successful exit
3916
- Shell: Add `KIMI_CLI_PASTE_CHAR_THRESHOLD` and `KIMI_CLI_PASTE_LINE_THRESHOLD` environment variables to control when pasted text is folded into a placeholder — lowering these thresholds works around CJK input method breakage after multiline paste on some terminals (e.g., XShell over SSH)

docs/en/configuration/config-files.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ The configuration file contains the following top-level configuration items:
2727
| `default_model` | `string` | Default model name, must be a model defined in `models` |
2828
| `default_thinking` | `boolean` | Whether to enable thinking mode by default (defaults to `false`) |
2929
| `default_yolo` | `boolean` | Whether to enable YOLO (auto-approve) mode by default (defaults to `false`) |
30-
| `default_plan_mode` | `boolean` | Whether to start new sessions in plan mode by default (defaults to `false`); resumed sessions preserve their existing state |
3130
| `default_editor` | `string` | Default external editor command (e.g. `"vim"`, `"code --wait"`), auto-detects when empty |
3231
| `theme` | `string` | Terminal color theme, either `"dark"` or `"light"` (defaults to `"dark"`) |
33-
| `merge_all_available_skills` | `boolean` | Whether to merge skills from all brand directories (defaults to `false`); see [Skills configuration](../customization/skills.md) |
3432
| `providers` | `table` | API provider configuration |
3533
| `models` | `table` | Model configuration |
3634
| `loop_control` | `table` | Agent loop control parameters |
@@ -44,10 +42,8 @@ The configuration file contains the following top-level configuration items:
4442
default_model = "kimi-for-coding"
4543
default_thinking = false
4644
default_yolo = false
47-
default_plan_mode = false
4845
default_editor = ""
4946
theme = "dark"
50-
merge_all_available_skills = false
5147

5248
[providers.kimi-for-coding]
5349
type = "kimi"

docs/en/configuration/data-locations.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ Wire message log file, stores Wire events during the session in JSON Lines (JSON
9999

100100
Session state file, stores the session's runtime state, including:
101101

102-
- `title`: User-set session title
103102
- `approval`: Approval decision state (YOLO mode on/off, auto-approved operation types)
104103
- `plan_mode`: Plan mode on/off status
105104
- `plan_session_id`: Unique identifier for the current plan session, used to associate the plan file

docs/en/configuration/overrides.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@ The model specified by `--model` must be defined in the configuration file's `mo
3636
| `--thinking` | Enable thinking mode |
3737
| `--no-thinking` | Disable thinking mode |
3838
| `--yolo, --yes, -y` | Auto-approve all operations |
39-
| `--plan` | Start in plan mode |
4039

4140
`--thinking` / `--no-thinking` overrides the thinking state saved from the last session. If not specified, uses the last session's state.
4241

43-
`--plan` enables plan mode for new sessions; when resuming an existing session, it forces plan mode on. You can also set `default_plan_mode = true` in the config file to start new sessions in plan mode by default.
44-
4542
## Environment variable overrides
4643

4744
Environment variables can override provider and model settings without modifying the configuration file. This is particularly useful in the following scenarios:

docs/en/customization/agents.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,12 @@ When `run_in_background=true`, the command is launched as a background task and
215215
### `ReadFile`
216216

217217
- **Path**: `kimi_cli.tools.file:ReadFile`
218-
- **Description**: Read text file content. Max 1000 lines per read, max 2000 characters per line. Files outside working directory require absolute paths. Every read returns the total number of lines in the file.
218+
- **Description**: Read text file content. Max 1000 lines per read, max 2000 characters per line. Files outside working directory require absolute paths.
219219

220220
| Parameter | Type | Description |
221221
|-----------|------|-------------|
222222
| `path` | string | File path |
223-
| `line_offset` | int | Starting line number, default 1. Supports negative values to read from the end of the file (e.g. `-100` reads the last 100 lines); absolute value cannot exceed 1000 |
223+
| `line_offset` | int | Starting line number, default 1 |
224224
| `n_lines` | int | Number of lines to read, default/max 1000 |
225225

226226
### `ReadMediaFile`

docs/en/customization/skills.md

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,54 +19,39 @@ For details about plugins, see the [Plugins](./plugins.md) documentation.
1919

2020
## Skill discovery
2121

22-
Kimi Code CLI uses a layered loading mechanism to discover skills, loading in the following priority order (earlier ones take priority for skills with the same name):
22+
Kimi Code CLI uses a layered loading mechanism to discover skills, loading in the following priority order (later ones override skills with the same name):
2323

2424
**Built-in skills**
2525

2626
Skills shipped with the package, providing basic capabilities.
2727

2828
**User-level skills**
2929

30-
Stored in the user's home directory, effective across all projects. Candidate directories are split into two groups; within each group, the first existing directory is selected, and results from both groups are merged independently (brand group has higher specificity and priority):
30+
Stored in the user's home directory, effective across all projects. Kimi Code CLI checks the following directories in priority order and uses the first one that exists:
3131

32-
- **Brand group** (mutually exclusive):
33-
1. `~/.kimi/skills/`
34-
2. `~/.claude/skills/`
35-
3. `~/.codex/skills/`
36-
- **Generic group** (mutually exclusive):
37-
1. `~/.config/agents/skills/` (recommended)
38-
2. `~/.agents/skills/`
39-
40-
Both groups are searched independently and results are merged. When a skill with the same name exists in both groups, the brand group version takes priority.
41-
42-
To load skills from all existing brand directories instead of only the first one, enable `merge_all_available_skills` in your config file:
43-
44-
```toml
45-
merge_all_available_skills = true
46-
```
47-
48-
When enabled, all existing brand directories are loaded and merged, with same-name skills resolved by priority: kimi > claude > codex. The generic group is not affected.
32+
1. `~/.config/agents/skills/` (recommended)
33+
2. `~/.agents/skills/`
34+
3. `~/.kimi/skills/`
35+
4. `~/.claude/skills/`
36+
5. `~/.codex/skills/`
4937

5038
**Project-level skills**
5139

52-
Stored in the project directory, only effective within that project's working directory. Similarly split into two groups:
53-
54-
- **Brand group** (mutually exclusive):
55-
1. `.kimi/skills/`
56-
2. `.claude/skills/`
57-
3. `.codex/skills/`
58-
- **Generic group**: `.agents/skills/`
40+
Stored in the project directory, only effective within that project's working directory. Kimi Code CLI checks the following directories in priority order and uses the first one that exists:
5941

60-
The `merge_all_available_skills` config applies to project-level skills as well.
42+
1. `.agents/skills/` (recommended)
43+
2. `.kimi/skills/`
44+
3. `.claude/skills/`
45+
4. `.codex/skills/`
6146

62-
You can also specify additional skills directories with the `--skills-dir` flag. This flag can be specified multiple times, and the directories override the auto-discovered user/project directories:
47+
You can also append additional skills directories with the `--skills-dir` flag. This flag can be specified multiple times, and the directories are merged with the auto-discovered ones:
6348

6449
```sh
6550
kimi --skills-dir /path/to/my-skills --skills-dir /path/to/more-skills
6651
```
6752

6853
::: tip
69-
Skills paths are independent of [`KIMI_SHARE_DIR`](../configuration/env-vars.md#kimi-share-dir). `KIMI_SHARE_DIR` customizes the storage location for configuration, sessions, logs, and other runtime data, but does not affect Skills search paths. Skills are cross-tool shared capability extensions (compatible with Kimi CLI, Claude, Codex, and others), which is a different type of data from application runtime data. To specify custom skills paths, use the `--skills-dir` flag.
54+
Skills paths are independent of [`KIMI_SHARE_DIR`](../configuration/env-vars.md#kimi-share-dir). `KIMI_SHARE_DIR` customizes the storage location for configuration, sessions, logs, and other runtime data, but does not affect Skills search paths. Skills are cross-tool shared capability extensions (compatible with Kimi CLI, Claude, Codex, and others), which is a different type of data from application runtime data. To append additional skills paths, use the `--skills-dir` flag.
7055
:::
7156

7257
## Built-in skills

docs/en/guides/interaction.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,12 @@ In plan mode, the AI can only use read-only tools (`Glob`, `Grep`, `ReadFile`) t
3333

3434
### Entering plan mode
3535

36-
There are four ways to enter plan mode:
36+
There are three ways to enter plan mode:
3737

38-
- **CLI flag**: Use `kimi --plan` to start a new session directly in plan mode
3938
- **Keyboard shortcut**: Press `Shift-Tab` to toggle plan mode
4039
- **Slash command**: Enter `/plan` or `/plan on`
4140
- **AI-initiated**: When facing complex tasks, the AI may request to enter plan mode via the `EnterPlanMode` tool — you can accept or decline
4241

43-
You can also set `default_plan_mode = true` in the config file to start every new session in plan mode by default. See [Configuration files](../configuration/config-files.md).
44-
4542
When plan mode is active, the prompt changes to `📋` and a blue `plan` badge appears in the status bar.
4643

4744
### Reviewing plans
@@ -85,6 +82,8 @@ While the AI is executing a task, you can type and send follow-up messages in th
8582

8683
Steer messages are appended to the context after the current step completes, and the AI will see and respond to your message before the next step begins. Approval requests and question panels are also handled inline with keyboard navigation during agent execution.
8784

85+
Any text you type in the input box during a turn but haven't yet submitted is preserved when the turn ends — it won't be lost. You can press `Enter` to send it as the next message, or continue editing.
86+
8887
::: tip
8988
Steer messages do not interrupt the AI's currently executing step — they are processed between steps. To interrupt immediately, use `Ctrl-C`.
9089
:::

docs/en/guides/sessions.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,14 @@ Use the `--continue` flag to continue the most recent session in the current wor
1616
kimi --continue
1717
```
1818

19-
**Interactively pick a session**
19+
**Switch to a specific session**
2020

21-
Use `--session` (or `--resume`, `-S`, `-r`) without an argument to open an interactive session picker, where you can use arrow keys to select the session to resume:
21+
Use the `--session` flag to switch to a session with a specific ID:
2222

2323
```sh
24-
kimi --session
24+
kimi --session abc123
2525
```
2626

27-
> The interactive picker is only available in shell mode.
28-
29-
**Resume a specific session**
30-
31-
Use `--session` (or `--resume`) with a session ID to resume that specific session:
32-
33-
```sh
34-
kimi -r abc123
35-
```
36-
37-
If the specified session ID does not exist, a new session is created automatically.
38-
3927
**Switch sessions during runtime**
4028

4129
Enter `/sessions` (or `/resume`) to view all sessions in the current working directory, and use arrow keys to select the session you want to switch to:

docs/en/reference/kimi-command.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ The working directory determines the root directory for file operations. Relativ
5555
| Option | Short | Description |
5656
|--------|-------|-------------|
5757
| `--continue` | `-C` | Continue the previous session in the current working directory |
58-
| `--session [ID]` / `--resume [ID]` | `-S` / `-r` | Resume a session. With ID: resume that session (creates new if not found). Without ID: open interactive session picker (shell mode only) |
58+
| `--session ID` | `-S` | Resume session with specified ID, creates new session if not exists |
5959

60-
`--continue` and `--session`/`--resume` are mutually exclusive.
60+
`--continue` and `--session` are mutually exclusive.
6161

6262
## Input and commands
6363

@@ -126,16 +126,6 @@ Default loads `~/.kimi/mcp.json` (if exists). See [Model Context Protocol](../cu
126126
In YOLO mode, all file modifications and shell commands are automatically executed. Use with caution.
127127
:::
128128

129-
## Plan mode
130-
131-
| Option | Description |
132-
|--------|-------------|
133-
| `--plan` | Start a new session in plan mode |
134-
135-
When started with `--plan`, the AI can only use read-only tools to explore the codebase and write an implementation plan. When resuming an existing session, `--plan` forces plan mode on; resuming without `--plan` preserves the session's existing state.
136-
137-
You can also set `default_plan_mode = true` in the config file to start new sessions in plan mode by default. See [Configuration files](../configuration/config-files.md).
138-
139129
## Thinking mode
140130

141131
| Option | Description |
@@ -185,17 +175,16 @@ kimi logout
185175

186176
### `kimi export`
187177

188-
Export session data as a ZIP file. The ZIP contains all files in the session directory (`context.jsonl`, `wire.jsonl`, `state.json`, etc.).
178+
Export the data of a specified session as a ZIP file. The ZIP contains all files in the session directory (`context.jsonl`, `wire.jsonl`, `state.json`, etc.).
189179

190180
```sh
191-
kimi export [<session_id>] [-o <output_path>] [--yes]
181+
kimi export <session_id> [-o <output_path>]
192182
```
193183

194184
| Argument / Option | Description |
195185
|--------|-------------|
196-
| `<session_id>` | Session ID to export. If omitted, the CLI previews the previous session for the current working directory and asks for confirmation before exporting |
186+
| `<session_id>` | Session ID to export |
197187
| `--output, -o` | Output ZIP file path (defaults to `session-<id>.zip` in the current directory) |
198-
| `--yes, -y` | Skip the confirmation prompt when exporting the default previous session |
199188

200189
::: info Added
201190
Added in version 1.20.

docs/en/reference/kimi-vis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ At the top of the session detail page, you can use `Open Dir` to open the curren
6666
You can export session data as a ZIP file for offline analysis or sharing.
6767

6868
- **ZIP download**: Click the download button in the session explorer or session detail page to download the session directory as a ZIP file
69-
- **CLI export**: Use `kimi export [<session_id>]` to export a session as a ZIP file; when `<session_id>` is omitted, the CLI previews the previous session for the current working directory and asks for confirmation
69+
- **CLI export**: Use the `kimi export <session_id>` command to export a specified session as a ZIP file
7070

7171
### Session import
7272

0 commit comments

Comments
 (0)