Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .agents/skills/gen-changelog/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
name: gen-changelog
description: Generate changelog entries for code changes. Use when user wants to add changelog entries, update CHANGELOG.md, or document changes made in the current branch compared to main.
description: Generate changelog entries for code changes.
---

# Generate Changelog

根据当前分支相对于 main 分支的修改,在根目录 CHANGELOG.md 或相应 package/sdk 等目录的 CHANGELOG.md 文件中添加更新日志条目,遵循现有的格式和风格。
4 changes: 1 addition & 3 deletions .agents/skills/gen-docs/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
---
name: gen-docs
description: Update Kimi CLI user documentation. Use when user wants to update docs, sync documentation with code changes, or ensure docs reflect recent commits and changelog updates.
description: Update Kimi CLI user documentation.
---

# Generate/Update Documentation

现在我们正在为当前项目 Kimi CLI 编写和维护用户文档,文档内容在 docs 目录下,docs/AGENTS.md 中有对文档的说明。

我们现在对代码库有了一些修改,请你参考最近的 git commit、staged changes、changelog.md 等的内容,根据 AGENTS.md 中的信息,必要时找到实际的代码全文,确保理解了所有变更对产品用户体验的真实改变,然后逐页、逐段地检查和更新文档内容。
Expand Down
11 changes: 0 additions & 11 deletions .agents/skills/pr/SKILL.md

This file was deleted.

14 changes: 14 additions & 0 deletions .agents/skills/pull-request/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: pull-request
description: Create and submit a GitHub Pull Request.
type: flow
---

```mermaid
flowchart TB
A(["BEGIN"]) --> B["当前分支有没有 dirty change?"]
B -- 有 --> D(["END"])
B -- 没有 --> n1["确保当前分支是一个不同于 main 的独立分支"]
n1 --> n2["根据当前分支相对于 main 分支的修改,push 并提交一个 PR(利用 gh 命令),用英文编写 PR 标题和 description,描述所做的更改。PR title 要符合先前的 commit message 规范(PR title 就是 squash merge 之后的 commit message)。"]
n2 --> D
```
43 changes: 21 additions & 22 deletions .agents/skills/release/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
---
name: release
description: Execute the release workflow for Kimi CLI packages. Use when user wants to release a new version, bump version numbers, create release PRs, or prepare packages for publishing.
description: Execute the release workflow for Kimi CLI packages.
type: flow
---

# Release Workflow

1. 首先从 AGENTS.md 和 .github/workflows/release*.yml 中理解本项目的发版自动化流程。
2. 检查每个 packages、sdks 和根目录的包是否在上次发版(根据 tag 确认)后有变更。
- 注意 `packages/kimi-code` 是薄包装包,需要与根包 `kimi-cli` 同步版本。
3. 如果有变更,对于每个变更的包,跟我确认新的版本号(遵循语义化版本规范),并更新相应的:
- pyproject.toml
- CHANGELOG.md(要保留 Unreleased 标题)
- 中英文档的 breaking-changes.md 文件中的版本号
- 若变更的是根包版本,同时同步更新:
- `packages/kimi-code/pyproject.toml` 的 `version`
- `packages/kimi-code/pyproject.toml` 的 `dependencies` 中 `kimi-cli==<version>`
4. 运行 `uv sync`。
5. 运行 gen-docs skill 中的指示以确保文档是最新的。
6. 开一个新的分支叫 `bump-<package>-<new-version>`,提交所有更改并推送到远程仓库。
- 如果一次有多个包需要发版,可以合并在一个分支升级版本号,分支名适当编写即可。
7. 用 gh 命令开一个 Pull Request,描述所做的更改。
8. 持续检查这个 PR 的状态,直到被合并。
9. 合并后,切到 main 分支,拉取最新的更改。
10. 提示我最终发布 tag 所需的 git tag 命令,我会自行 tag + push tags。
- 说明:单个数字 tag 会同时发布 `kimi-cli` 与 `kimi-code`。
```mermaid
flowchart TB
A(["BEGIN"]) --> B["从 AGENTS.md 和 .github/workflows/release*.yml 中理解本项目的发版自动化流程"]
B --> C["检查每个 packages、sdks 和根目录的包是否在上次发版(根据 tag 确认)后有变更。注意 packages/kimi-code 是薄包装包,需要与根包 kimi-cli 同步版本。"]
C --> D{"有变更的包?"}
D -- 没有 --> Z(["END"])
D -- 有 --> E["对于每个变更的包,跟用户确认新的版本号(遵循语义化版本规范)"]
E --> F["更新相应的 pyproject.toml、CHANGELOG.md(保留 Unreleased 标题)、中英文档的 breaking-changes.md 文件中的版本号"]
F --> G{"变更的是根包版本?"}
G -- 是 --> H["同步更新 packages/kimi-code/pyproject.toml 的 version 和 dependencies 中 kimi-cli==&lt;version&gt;"]
H --> I["运行 uv sync"]
G -- 否 --> I
I --> J["运行 gen-docs skill 中的指示以确保文档是最新的"]
J --> K["开一个新分支 bump-&lt;package&gt;-&lt;new-version&gt;(多个包可合并在一个分支,分支名适当编写)"]
K --> L["提交所有更改,推送到远程仓库,并用 gh 命令开一个 Pull Request,描述所做的更改"]
L --> N["持续检查这个 PR 的状态,直到被合并"]
N --> O["合并后,切到 main 分支,拉取最新的更改,并提示用户最终发布 tag 所需的 git tag 命令(用户会自行 tag + push tags)。说明:单个数字 tag 会同时发布 kimi-cli 与 kimi-code。"]
O --> Z
```
4 changes: 1 addition & 3 deletions .agents/skills/translate-docs/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
---
name: translate-docs
description: Translate and sync bilingual documentation. Use when user wants to translate docs between Chinese and English, sync translations, or ensure bilingual documentation consistency.
description: Translate and sync bilingual documentation.
---

# Translate Documentation

现在我们正在为当前项目 Kimi CLI 编写和维护用户文档,文档内容在 docs 目录下,docs/AGENTS.md 中有对文档的说明。

中文文档和英文 changelog 已经确保是正确符合预期的,现在请你逐页、逐段地翻译文档内容,确保中英双语保持同步。
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ shell UI, ACP server mode for IDE integrations, and MCP tool loading.
and slash command autocomplete; it is the default interactive experience.
- **Slash commands**: Soul-level commands live in `src/kimi_cli/soul/slash.py`; shell-level
commands live in `src/kimi_cli/ui/shell/slash.py`. The shell UI exposes both and dispatches
based on the registry. Skills are registered as soul-level commands; running
`/skill:<skill-name>` loads the skill's `SKILL.md` as a user prompt.
based on the registry. Standard skills register `/skill:<skill-name>` and load `SKILL.md`
as a user prompt; flow skills register `/flow:<skill-name>` and execute the embedded flow.

## Major modules and interfaces

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Only write entries that are worth mentioning to users.

## Unreleased

- Skills: Add flow skill type with embedded Agent Flow (Mermaid/D2) in SKILL.md, invoked via `/flow:<skill-name>` commands
- CLI: Remove `--prompt-flow` option; use flow skills instead
- Core: Replace `/begin` command with `/flow:<skill-name>` commands for flow skills

## 0.80 (2026-01-20)

- Wire: Add `initialize` method for exchanging client/server info, external tools registration and slash commands advertisement
Expand Down
56 changes: 56 additions & 0 deletions docs/en/customization/skills.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,59 @@ For regular conversations, the Agent will automatically decide whether to read s
:::

Skills allow you to codify your team's best practices and project standards, ensuring the AI always follows consistent standards.

## Flow skills

Flow skills are a special skill type that embed an Agent Flow diagram in `SKILL.md`, used to define multi-step automated workflows. Unlike standard skills, flow skills are invoked via `/flow:<name>` commands and automatically execute multiple conversation turns following the flow diagram.

**Creating a flow skill**

To create a flow skill, set `type: flow` in the frontmatter and include a Mermaid or D2 code block in the content:

````markdown
---
name: code-review
description: Code review workflow
type: flow
---

```mermaid
flowchart TD
A([BEGIN]) --> B[Analyze code changes, list all modified files and features]
B --> C{Is code quality acceptable?}
C -->|Yes| D[Generate code review report]
C -->|No| E[List issues and propose improvements]
E --> B
D --> F([END])
```
````

**Flow diagram format**

Both Mermaid and D2 formats are supported:

- **Mermaid**: Use ` ```mermaid ` code block, [Mermaid Playground](https://www.mermaidchart.com/play) can be used for editing and preview
- **D2**: Use ` ```d2 ` code block, [D2 Playground](https://play.d2lang.com) can be used for editing and preview

Flow diagrams must contain one `BEGIN` node and one `END` node. Regular node text is sent to the Agent as a prompt; decision nodes require the Agent to output `<choice>branch name</choice>` in the output to select the next step.

**D2 format example**

```
BEGIN -> B -> C
B: Analyze existing code, write design doc for XXX feature
C: Review if design doc is detailed enough
C -> B: No
C -> D: Yes
D: Start implementation
D -> END
```

**Executing a flow skill**

```sh
# Execute in Kimi CLI
/flow:code-review
```

After execution, the Agent will start from the `BEGIN` node and process each node according to the flow diagram definition until reaching the `END` node.
52 changes: 1 addition & 51 deletions docs/en/reference/kimi-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,57 +77,7 @@ When using `--prompt` (or `--command`), Kimi CLI exits after processing the quer

[Ralph](https://ghuntley.com/ralph/) is a technique that puts an agent in a loop: the same prompt is fed again and again so the agent can keep iterating one big task.

When `--max-ralph-iterations` is not `0`, Kimi CLI enters Ralph Loop mode and automatically loops through task execution based on an internal Prompt Flow, until the agent outputs `<choice>STOP</choice>` or the iteration limit is reached.

::: info Note
Ralph Loop is mutually exclusive with the `--prompt-flow` option and cannot be used together.
:::

## Prompt Flow

| Option | Description |
|--------|-------------|
| `--prompt-flow PATH` | Load a D2 (`.d2`) or Mermaid (`.mmd`) flowchart file as a Prompt Flow |

Prompt Flow is a prompt workflow description method based on flowcharts, where each node corresponds to one conversation turn. After loading, you can start the flow execution with the `/begin` slash command. Both D2 and Mermaid flowchart formats are supported. You can edit and preview D2 flowcharts at [D2 Playground](https://play.d2lang.com), and Mermaid flowcharts at [Mermaid Playground](https://www.mermaidchart.com/play).

D2 flowchart example (`example.d2` file):

```
BEGIN -> B -> C
B: Analyze existing code, write design doc for XXX feature in design.md
C: Review design.md, is it detailed enough?
C -> B: No
C -> D: Yes
D: Start implementation
D -> END
```

Mermaid flowchart example (`example.mmd` file):

```
flowchart TD
A([BEGIN]) --> B[Analyze existing code, write design doc for XXX feature in design.md]
B --> C{Review design.md, is it detailed enough?}
C -->|Yes| D[Start implementation]
C -->|No| B
D --> F([END])
```

```mermaid
flowchart TD
A([BEGIN]) --> B[Analyze existing code, write design doc for XXX feature in design.md]
B --> C{Review design.md, is it detailed enough?}
C -->|Yes| D[Start implementation]
C -->|No| B
D --> F([END])
```

During node processing, decision nodes require the agent to output `<choice>branch name</choice>` to select the next node.

::: info Note
`--prompt-flow` is mutually exclusive with Ralph Loop mode and cannot be used together.
:::
When `--max-ralph-iterations` is not `0`, Kimi CLI enters Ralph Loop mode and automatically loops through task execution until the agent outputs `<choice>STOP</choice>` or the iteration limit is reached.

## UI modes

Expand Down
17 changes: 11 additions & 6 deletions docs/en/reference/slash-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ For example:

You can append additional text after the command, which will be added to the skill prompt. See [Agent Skills](../customization/skills.md) for details.

### `/flow:<name>`

Execute a specific flow skill. Flow skills embed an Agent Flow diagram in `SKILL.md`. After execution, the Agent will start from the `BEGIN` node and process each node according to the flow diagram definition until reaching the `END` node.

For example:

- `/flow:code-review`: Execute code review workflow
- `/flow:release`: Execute release workflow

See [Agent Skills](../customization/skills.md#flow-skills) for details.

## Others

### `/init`
Expand All @@ -134,12 +145,6 @@ Toggle YOLO mode. When enabled, all operations are automatically approved and a
YOLO mode skips all confirmations. Make sure you understand the potential risks.
:::

### `/begin`

Start Prompt Flow execution.

This command is only available when a flowchart has been loaded via `--prompt-flow`. After execution, the agent will start from the `BEGIN` node and process each node according to the flowchart definition until reaching the `END` node. See [`kimi` command](./kimi-command.md#prompt-flow) for details.

## Command completion

After typing `/` in the input box, a list of available commands is automatically displayed. Continue typing to filter commands with fuzzy matching support, press Enter to select.
Expand Down
4 changes: 4 additions & 0 deletions docs/en/release-notes/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This page documents the changes in each Kimi CLI release.

## Unreleased

- Skills: Add flow skill type with embedded Agent Flow (Mermaid/D2) in SKILL.md, invoked via `/flow:<skill-name>` commands
- CLI: Remove `--prompt-flow` option; use flow skills instead
- Core: Replace `/begin` command with `/flow:<skill-name>` commands for flow skills

## 0.80 (2026-01-20)

- Wire: Add `initialize` method for exchanging client/server info, external tools registration and slash commands advertisement
Expand Down
56 changes: 56 additions & 0 deletions docs/zh/customization/skills.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,59 @@ description: Git 提交信息规范,使用 Conventional Commits 格式
:::

Skills 让你可以将团队的最佳实践和项目规范固化下来,确保 AI 始终遵循一致的标准。

## Flow Skills

Flow Skill 是一种特殊的 Skill 类型,它在 `SKILL.md` 中内嵌 Agent Flow 流程图,用于定义多步骤的自动化工作流。与普通 Skill 不同,Flow Skill 通过 `/flow:<name>` 命令调用,会按照流程图自动执行多个对话轮次。

**创建 Flow Skill**

创建 Flow Skill 需要在 Frontmatter 中设置 `type: flow`,并在内容中包含 Mermaid 或 D2 格式的流程图代码块:

````markdown
---
name: code-review
description: 代码审查工作流
type: flow
---

```mermaid
flowchart TD
A([BEGIN]) --> B[分析代码变更,列出所有修改的文件和功能]
B --> C{代码质量是否达标?}
C -->|是| D[生成代码审查报告]
C -->|否| E[列出问题并提出改进建议]
E --> B
D --> F([END])
```
````

**流程图格式**

支持 Mermaid 和 D2 两种格式:

- **Mermaid**:使用 ` ```mermaid ` 代码块,[Mermaid Playground](https://www.mermaidchart.com/play) 可用于编辑和预览
- **D2**:使用 ` ```d2 ` 代码块,[D2 Playground](https://play.d2lang.com) 可用于编辑和预览

流程图必须包含一个 `BEGIN` 节点和一个 `END` 节点。普通节点的文本作为提示词发送给 Agent;分支节点需要 Agent 在输出中使用 `<choice>分支名</choice>` 选择下一步。

**D2 格式示例**

```
BEGIN -> B -> C
B: 分析现有代码,为 XXX 功能编写设计文档
C: Review 设计文档是否足够详细
C -> B: 否
C -> D: 是
D: 开始实现
D -> END
```

**执行 Flow Skill**

```sh
# 在 Kimi CLI 中执行
/flow:code-review
```

执行后,Agent 会从 `BEGIN` 节点开始,按照流程图定义依次处理每个节点,直到到达 `END` 节点。
Loading
Loading