diff --git a/CHANGELOG.md b/CHANGELOG.md index c43f63138..91de914e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Only write entries that are worth mentioning to users. ## Unreleased - Tool: Add `ReadMediaFile` tool for reading image/video files; `ReadFile` now focuses on text files only +- Skills: Flow skills now also register as `/skill:` commands (in addition to `/flow:`) ## 0.82 (2026-01-21) diff --git a/docs/en/customization/skills.md b/docs/en/customization/skills.md index 74433c46b..a23208580 100644 --- a/docs/en/customization/skills.md +++ b/docs/en/customization/skills.md @@ -239,9 +239,15 @@ D -> END **Executing a flow skill** +Flow skills can be invoked in two ways: + +- `/flow:`: Execute the flow. The Agent will start from the `BEGIN` node and process each node according to the flow diagram definition until reaching the `END` node +- `/skill:`: Like a standard skill, sends the `SKILL.md` content to the Agent as a prompt (does not automatically execute the flow) + ```sh -# Execute in Kimi CLI +# Execute the flow /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. +# Load as a standard skill +/skill:code-review +``` diff --git a/docs/en/reference/slash-commands.md b/docs/en/reference/slash-commands.md index 4c0d22838..7d1bb0cbc 100644 --- a/docs/en/reference/slash-commands.md +++ b/docs/en/reference/slash-commands.md @@ -108,7 +108,7 @@ When the context is too long, Kimi CLI will automatically trigger compaction. Th ### `/skill:` -Load a specific skill, sending the `SKILL.md` content to the Agent as a prompt. +Load a specific skill, sending the `SKILL.md` content to the Agent as a prompt. This command works for both standard skills and flow skills. For example: @@ -118,6 +118,10 @@ 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. +::: tip +Flow skills can also be invoked via `/skill:`, which loads the content as a standard skill without automatically executing the flow. To execute the flow, use `/flow:` instead. +::: + ### `/flow:` 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. @@ -127,6 +131,10 @@ For example: - `/flow:code-review`: Execute code review workflow - `/flow:release`: Execute release workflow +::: tip +Flow skills can also be invoked via `/skill:`, which loads the content as a standard skill without automatically executing the flow. +::: + See [Agent Skills](../customization/skills.md#flow-skills) for details. ## Others diff --git a/docs/en/release-notes/changelog.md b/docs/en/release-notes/changelog.md index f16c73a8e..a8e7358ae 100644 --- a/docs/en/release-notes/changelog.md +++ b/docs/en/release-notes/changelog.md @@ -5,6 +5,7 @@ This page documents the changes in each Kimi CLI release. ## Unreleased - Tool: Add `ReadMediaFile` tool for reading image/video files; `ReadFile` now focuses on text files only +- Skills: Flow skills now also register as `/skill:` commands (in addition to `/flow:`) ## 0.82 (2026-01-21) diff --git a/docs/zh/customization/skills.md b/docs/zh/customization/skills.md index 883bf23bf..d76477c3f 100644 --- a/docs/zh/customization/skills.md +++ b/docs/zh/customization/skills.md @@ -239,9 +239,15 @@ D -> END **执行 Flow Skill** +Flow Skill 可以通过两种方式调用: + +- `/flow:`:执行流程,Agent 会从 `BEGIN` 节点开始,按照流程图定义依次处理每个节点,直到到达 `END` 节点 +- `/skill:`:与普通 Skill 一样,将 `SKILL.md` 内容作为提示词发送给 Agent(不自动执行流程) + ```sh -# 在 Kimi CLI 中执行 +# 执行流程 /flow:code-review -``` -执行后,Agent 会从 `BEGIN` 节点开始,按照流程图定义依次处理每个节点,直到到达 `END` 节点。 +# 作为普通 Skill 加载 +/skill:code-review +``` diff --git a/docs/zh/reference/slash-commands.md b/docs/zh/reference/slash-commands.md index 17649d915..6cec18766 100644 --- a/docs/zh/reference/slash-commands.md +++ b/docs/zh/reference/slash-commands.md @@ -108,7 +108,7 @@ ### `/skill:` -加载指定的 Skill,将 `SKILL.md` 内容作为提示词发送给 Agent。 +加载指定的 Skill,将 `SKILL.md` 内容作为提示词发送给 Agent。此命令适用于普通 Skill 和 Flow Skill。 例如: @@ -118,6 +118,10 @@ 命令后面可以附带额外的文本,这些内容会追加到 Skill 提示词之后。详见 [Agent Skills](../customization/skills.md)。 +::: tip 提示 +Flow Skill 也可以通过 `/skill:` 调用,此时作为普通 Skill 加载内容,不会自动执行流程。如需执行流程,请使用 `/flow:`。 +::: + ### `/flow:` 执行指定的 Flow Skill。Flow Skill 在 `SKILL.md` 中内嵌 Agent Flow 流程图,执行后 Agent 会从 `BEGIN` 节点开始,按照流程图定义依次处理每个节点,直到到达 `END` 节点。 @@ -127,6 +131,10 @@ - `/flow:code-review`:执行代码审查工作流 - `/flow:release`:执行发布工作流 +::: tip 提示 +Flow Skill 也可以通过 `/skill:` 调用,此时作为普通 Skill 加载内容,不会自动执行流程。 +::: + 详见 [Agent Skills](../customization/skills.md#flow-skills)。 ## 其他 diff --git a/docs/zh/release-notes/changelog.md b/docs/zh/release-notes/changelog.md index 43b7169b2..c2666912f 100644 --- a/docs/zh/release-notes/changelog.md +++ b/docs/zh/release-notes/changelog.md @@ -5,6 +5,7 @@ ## 未发布 - Tool:添加 `ReadMediaFile` 工具用于读取图片/视频文件;`ReadFile` 现在仅用于读取文本文件 +- Skills:Flow Skills 现在也注册为 `/skill:` 命令(除了 `/flow:`) ## 0.82 (2026-01-21) diff --git a/src/kimi_cli/soul/kimisoul.py b/src/kimi_cli/soul/kimisoul.py index 848c10145..c44775b6d 100644 --- a/src/kimi_cli/soul/kimisoul.py +++ b/src/kimi_cli/soul/kimisoul.py @@ -225,7 +225,7 @@ def _build_slash_commands(self) -> list[SlashCommand[Any]]: seen_names = {cmd.name for cmd in commands} for skill in self._runtime.skills.values(): - if skill.type != "standard": + if skill.type not in ("standard", "flow"): continue name = f"{SKILL_COMMAND_PREFIX}{skill.name}" if name in seen_names: diff --git a/tests/test_kimisoul_slash_commands.py b/tests/test_kimisoul_slash_commands.py new file mode 100644 index 000000000..118e6dd2d --- /dev/null +++ b/tests/test_kimisoul_slash_commands.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from pathlib import Path + +from kaos.path import KaosPath +from kosong.tooling.empty import EmptyToolset + +from kimi_cli.skill import Skill +from kimi_cli.skill.flow import Flow, FlowEdge, FlowNode +from kimi_cli.soul.agent import Agent, Runtime +from kimi_cli.soul.context import Context +from kimi_cli.soul.kimisoul import KimiSoul + + +def _make_flow() -> Flow: + nodes = { + "BEGIN": FlowNode(id="BEGIN", label="Begin", kind="begin"), + "END": FlowNode(id="END", label="End", kind="end"), + } + outgoing = { + "BEGIN": [FlowEdge(src="BEGIN", dst="END", label=None)], + "END": [], + } + return Flow(nodes=nodes, outgoing=outgoing, begin_id="BEGIN", end_id="END") + + +def test_flow_skill_registers_skill_and_flow_commands(runtime: Runtime, tmp_path: Path) -> None: + flow = _make_flow() + skill_dir = tmp_path / "flow-skill" + skill_dir.mkdir() + flow_skill = Skill( + name="flow-skill", + description="Flow skill", + type="flow", + dir=KaosPath.unsafe_from_local_path(skill_dir), + flow=flow, + ) + runtime.skills = {"flow-skill": flow_skill} + + agent = Agent( + name="Test Agent", + system_prompt="Test system prompt.", + toolset=EmptyToolset(), + runtime=runtime, + ) + soul = KimiSoul(agent, context=Context(file_backend=tmp_path / "history.jsonl")) + + command_names = {cmd.name for cmd in soul.available_slash_commands} + assert "skill:flow-skill" in command_names + assert "flow:flow-skill" in command_names