JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
refactor(mode): hide plan mode for code and team
douran3c92ad08b7f6
diff --git a/docs/en/CLI.md b/docs/en/CLI.mdindex deb624616d..fb502ac997 100644--- a/docs/en/CLI.md+++ b/docs/en/CLI.md@@ -61,11 +61,10 @@ Sets the working mode for the current channel. The Agent uses this when construc|---------|-------------|| `/mode agent.plan` | Agent mode + planning style (default) || `/mode agent.fast` | Agent mode + auto-execution style |-| `/mode code.plan` | Code mode + planning style || `/mode code.normal` | Code mode + direct execution style (default) || `/mode code.team` | Code mode + team style |-> Note: this table is the Gateway controlled-channel whitelist. The TUI local `/mode` command also supports `/mode plan` (equivalent to `agent.plan`), `/mode team.normal` (equivalent to `team`), and `/mode team.plan` (directly sets `team.plan`); those forms are not recognized by Gateway controlled channels.+> Note: this table is the Gateway controlled-channel whitelist. The TUI local `/mode` command also supports `/mode plan` (equivalent to `agent.plan`) and `/mode team.normal` (equivalent to `team`); those forms are not recognized by Gateway controlled channels.**Usage**@@ -73,17 +72,11 @@ Sets the working mode for the current channel. The Agent uses this when construc/mode agent```-or--```text-/mode code.plan-```-The Gateway will:1. Intercept this message2. Cancel tasks in the current session (if mode changes)3. Update `ChannelControlState.mode`-4. Reply with a system message, e.g.: `[Received CLI command], mode changed to code.plan`+4. Reply with a system message, e.g.: `[Received CLI command], mode changed to code.normal`---@@ -95,7 +88,7 @@ Switches secondary style within the current primary mode, more concise than `/mo| Command | When in agent mode | When in code mode ||---------|--------------------|--------------------|-| `/switch plan` | → `agent.plan` | → `code.plan` |+| `/switch plan` | → `agent.plan` | Not supported || `/switch fast` | → `agent.fast` | Not supported || `/switch normal` | Not supported | → `code.normal` || `/switch team` | Not supported | → `code.team` |diff --git a/docs/en/Modes.md b/docs/en/Modes.mdindex 914630a7d1..0b16718e10 100644--- a/docs/en/Modes.md+++ b/docs/en/Modes.md@@ -10,11 +10,9 @@ JiuwenSwarm supports multiple runtime modes, each with its own tool set, permiss|------|------|-------------|| Agent (Plan) | `agent.plan` | Default mode. Full tools + proactive memory, focused on reasoning and planning || Agent (Fast) | `agent.fast` | Full tools + passive memory, focused on quick responses |-| Code (Plan) | `code.plan` | Code mode + coding memory, focused on code generation planning || Code (Normal) | `code.normal` | Code mode + coding memory, focused on code execution || Code (Team) | `code.team` | Team collaboration launched from the Code profile || Team | `team` | Multi-agent collaboration mode, based on the `team` definition in config |-| Team (Plan) | `team.plan` | Team collaboration with planning-oriented team runtime settings |---@@ -29,14 +27,12 @@ Use the following commands during a channel conversation:/mode team # Switch to Team mode/mode agent.plan # Switch directly to Agent Plan sub-mode/mode agent.fast # Switch directly to Agent Fast sub-mode-/mode code.plan # Switch directly to Code Plan sub-mode/mode code.normal # Switch directly to Code Normal sub-mode/mode code.team # Switch directly to Code Team sub-mode/mode team.normal # TUI local form, equivalent to team-/mode team.plan # TUI local form, directly sets Team Plan mode```-> Compatibility: `/mode plan`, `/mode team.normal`, and `/mode team.plan` are TUI-local command forms. Gateway controlled channels accept only `agent`, `code`, `team`, `agent.plan`, `agent.fast`, `code.plan`, `code.normal`, and `code.team`.+> Compatibility: `/mode plan` and `/mode team.normal` are TUI-local command forms. Gateway controlled channels accept `agent`, `code`, `team`, `agent.plan`, `agent.fast`, `code.normal`, and `code.team`.You can also use `/switch` to change sub-modes within the same category:@@ -47,7 +43,7 @@ You can also use `/switch` to change sub-modes within the same category:/switch team # Under Code → code.team```-> The TUI source contains a `/switch` implementation, but the default TUI command registry does not currently register it. In TUI, prefer `/mode ...` for direct switching or `/plan` to enter the current family’s plan sub-mode.+> The TUI source contains a `/switch` implementation, but the default TUI command registry does not currently register it. In TUI, prefer `/mode ...` for direct switching or `/plan` to enter Agent plan mode.---@@ -142,18 +138,14 @@ Modes do more than rename the UI state: they decide which AgentServer runtime pr|------|-----------------|----------------------|--------------------------------|-----------------|| `agent.plan` | Deep Agent (`mode=agent`, `sub_mode=plan`) | Default planning-oriented chat. Best for complex task decomposition, long reasoning, skill evolution, and tasks that benefit from subagents. | Registers `TaskPlanningRail` and `SubagentRail`; enables `SkillEvolutionRail` / `SkillCreateRail` when configured; keeps normal Agent tools such as search, multimodal tools, and skills. | Uses `modes.agent.plan.memory`; defaults to proactive memory (`is_proactive: true`) so context is retrieved and consolidated more actively. || `agent.fast` | Deep Agent (`mode=agent`, `sub_mode=fast`) | Fast response mode. Less orchestration, more direct answering or tool use on demand. | Unregisters `TaskPlanningRail`, `SkillEvolutionRail`, `SkillCreateRail`, and `SubagentRail`; keeps common runtime prompt, safety, permission, search/multimodal/skill tooling. | Uses `modes.agent.fast.memory`; defaults to passive memory (`is_proactive: false`) and usually reads/writes memory on demand. |-| `code.plan` | Code Adapter (`mode=code`, `sub_mode=plan`) | Planning phase for coding work. Useful for reading the project, decomposing edits, and preparing an implementation path. | Uses the Code-specific English system prompt; fixed Rails include `LspRail`, `ProjectMemoryRail`, `CodingMemoryRail`, `AgentModeRail`, `StructuredAskUserRail`, `ConfirmInterruptRail`, filesystem/permission Rails; dynamic Rails/tools come from `modes.code.rails` / `modes.code.tools`. | Does not use the general `MemoryRail`; uses `CodingMemoryRail` and project memory files such as `JIUWENSWARM.md` / `CLAUDE.md`. |-| `code.normal` | Code Adapter (`mode=code`, `sub_mode=normal`) | Execution phase for coding work. Useful for editing files, running commands, verifying changes, and delivering results. | Mostly the same Code Rails/tools as `code.plan`; the difference is the current mode semantics and command flow. Some commands, such as `/init`, auto-switch from `code.plan` to `code.normal` before writing. | Same as `code.plan`: coding memory + project memory. |+| `code.normal` | Code Adapter (`mode=code`, `sub_mode=normal`) | Execution phase for coding work. Useful for editing files, running commands, verifying changes, and delivering results. | Uses the Code-specific English system prompt; fixed Rails include `LspRail`, `ProjectMemoryRail`, `CodingMemoryRail`, `AgentModeRail`, `StructuredAskUserRail`, `ConfirmInterruptRail`, filesystem/permission Rails; dynamic Rails/tools come from `modes.code.rails` / `modes.code.tools`. | Uses `CodingMemoryRail` and project memory files such as `JIUWENSWARM.md` / `CLAUDE.md`. || `code.team` | Code Adapter + Team sub-mode (`mode=code`, `sub_mode=team`) | Team collaboration launched from the Code profile. Useful when a coding project needs multiple members to split work while preserving code-workspace semantics. | The main agent stays on the Code profile; TeamManager starts team members and attempts to inherit the Code-side project directory, code tooling, and member skill toolkit. | Team members follow Team config; code/project context is influenced by both the Code profile and Team runtime. || `team` | Team runtime (`mode=team`) | Standard multi-agent collaboration. A leader decomposes, schedules, and summarizes work while role members execute subtasks. | Team members attach Rails such as `RuntimePromptRail`, `ResponsePromptRail`, `SysOperationRail`, `TaskPlanningRail`, `SecurityRail`, `HeartbeatRail`, and `AvatarPromptRail`; the leader additionally supports Team skill evolution/creation; tools come from the inheritable whitelist and team config. | Controlled by `modes.team.<name>.memory`, including shared `TEAM_MEMORY.md`, auto-extraction, and member memory prompt injection. |-| `team.plan` | Team Plan (canonicalized as `team.plan`, runtime uses the code/team path) | Planning-enhanced Team entry. Intended to give the Team stronger planning semantics, especially for leader coordination. | Sets `enable_team_plan`; the leader can keep the configured runtime language instead of being forced into the Code profile’s English runtime prompt; members still follow the Team / Code-Team inheritance path. | Same Team memory config; Team Plan changes coordination prompts rather than defining a separate memory block. |### Quick Mental Model- `agent.plan` and `agent.fast` use the same Deep Agent profile, but `agent.plan` keeps planning, subagent, and skill-evolution Rails while `agent.fast` removes those heavier orchestration pieces.-- `code.plan` and `code.normal` use the same Code Adapter. The difference is mostly mode semantics and command flow; both have the Code prompt, LSP, project memory, coding memory, and file/permission guardrails.- `code.team` and `team` both enter team collaboration, but from different entry points: `code.team` starts from the Code profile and is better for code-project delegation; `team` is the standard Team runtime.-- `team.plan` is a planning-enhanced Team entry. The current implementation starts it through the code/team path and enables `enable_team_plan` in TeamManager.---diff --git a/docs/en/SlashCommandArchitecture.md b/docs/en/SlashCommandArchitecture.mdindex 16e90f0bed..6b95433cd1 100644--- a/docs/en/SlashCommandArchitecture.md+++ b/docs/en/SlashCommandArchitecture.md@@ -39,7 +39,7 @@ Without clear layering and a single source of truth, the project risks: **semant**Definition**: User messages arriving at the Gateway that are identified by `MessageHandler` (or its unified entry point), potentially **only changing session/mode/routing without entering Agent conversation**.-**Typical commands**: `/new_session`, `/mode agent|code|team` and `/switch plan|fast|normal|team` on controlled channels, plus direct forms like `/mode agent.plan|agent.fast|code.plan|code.normal|code.team` (per current implementation). The TUI local command additionally supports `/mode plan`, `/mode team.normal`, and `/mode team.plan`; those forms are not part of the Gateway controlled-channel whitelist.+**Typical commands**: `/new_session`, `/mode agent|code|team` and `/switch plan|fast|normal|team` on controlled channels, plus direct forms like `/mode agent.plan|agent.fast|code.normal|code.team` (per current implementation). The TUI local command additionally supports `/mode plan` and `/mode team.normal`; those forms are not part of the Gateway controlled-channel whitelist.**Requirements**:diff --git a/docs/en/SlashCommands.md b/docs/en/SlashCommands.mdindex bb94bb01a9..f3f93ba393 100644--- a/docs/en/SlashCommands.md+++ b/docs/en/SlashCommands.md@@ -34,7 +34,7 @@ Executed locally in the terminal UI, not through Gateway control pipeline.| `/sandbox` | Set sandbox mode (see below) || `/auto-harness` | Auto-Harness task management (`run`/`schedule`, see below) |-> Note: `/mode` controlled switching logic is primarily on Gateway side, see "`/mode` and `/switch`" below. The TUI local command additionally supports `/mode plan`, `/mode team.normal`, and `/mode team.plan`; see the TUI guide for details.+> Note: `/mode` controlled switching logic is primarily on Gateway side, see "`/mode` and `/switch`" below. The TUI local command additionally supports `/mode plan` and `/mode team.normal`; see the TUI guide for details.### Gateway / Agent Parsing (Controlled Channel)@@ -108,14 +108,13 @@ Manages directories AI can access for file read, edit, and execute operations.- Direct syntax:- `/mode agent.plan` -> `agent.plan`- `/mode agent.fast` -> `agent.fast`- - `/mode code.plan` -> `code.plan`- `/mode code.normal` -> `code.normal`- `/mode code.team` -> `code.team`- Second-level switching:- agent family: `/switch plan` <-> `agent.plan`, `/switch fast` <-> `agent.fast`- - code family: `/switch plan` <-> `code.plan`, `/switch normal` <-> `code.normal`, `/switch team` <-> `code.team`+ - code family: `/switch normal` <-> `code.normal`, `/switch team` <-> `code.team`- Invalid combinations (e.g., `/switch fast` under `code.*`) return: `Invalid command`.-- Controlled channels do not accept `/mode plan`, `/mode team.normal`, or `/mode team.plan`.+- Controlled channels do not accept `/mode plan` or `/mode team.normal`.- Note: Standalone `/team` command removed, use `/mode team` instead.### `/resume`@@ -176,7 +175,7 @@ Manages directories AI can access for file read, edit, and execute operations.1. Select scope: `Team-shared` (JIUWENSWARM.md), `Personal` (JIUWENSWARM.local.md), or `Both`.2. Detect existing configs: Auto-detect `CLAUDE.md`, `.cursorrules`, `copilot-instructions.md` etc.3. Generate configs: Create project config files based on selection.-- Auto mode switch: If in `code.plan`, auto-switches to `code.normal` for write permission.+- Auto mode switch: Code initialization runs in `code.normal` for write permission.### `/mcp` (MCP Server Management)@@ -595,7 +594,7 @@ The command receives the following JSON data on each execution:| `session_id` | Current session ID || `session_name` | Session title (set via `/rename`) || `cwd` | Current working directory |-| `mode` | Current mode (`agent.plan` / `agent.fast` / `code.plan` / `code.normal` / `code.team` / `team` / `team.plan`) |+| `mode` | Current mode (`agent.plan` / `agent.fast` / `code.normal` / `code.team` / `team`) || `model` | Current model name || `provider` | Model provider || `version` | jiuwenswarm version |diff --git a/docs/zh/SLASH_COMMAND_ARCHITECTURE.md b/docs/zh/SLASH_COMMAND_ARCHITECTURE.mdindex 5b9538f2eb..eace09ac1a 100644--- a/docs/zh/SLASH_COMMAND_ARCHITECTURE.md+++ b/docs/zh/SLASH_COMMAND_ARCHITECTURE.md@@ -39,7 +39,7 @@**定义**:到达 Gateway 用户消息中,由 `MessageHandler`(或其后继统一入口)识别后,**可能只改会话/模式/路由,而不进入 Agent 对话**的指令。-**典型**:`/new_session`、受控通道上的 `/mode agent|code|team` 与 `/switch plan|fast|normal|team`,以及 `/mode agent.plan|agent.fast|code.plan|code.normal|code.team` 直达写法(以当前实现为准)。TUI 本地额外支持 `/mode plan`、`/mode team.normal`、`/mode team.plan`,这些不属于 Gateway 受控通道白名单。+**典型**:`/new_session`、受控通道上的 `/mode agent|code|team` 与 `/switch plan|fast|normal|team`,以及 `/mode agent.plan|agent.fast|code.normal|code.team` 直达写法(以当前实现为准)。TUI 本地额外支持 `/mode plan`、`/mode team.normal`,这些不属于 Gateway 受控通道白名单。**要求**:diff --git "a/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md" "b/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md"index aa97094e38..10f28162b8 100644--- "a/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md"+++ "b/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md"@@ -34,7 +34,7 @@| `/sandbox` | 设置沙箱模式(见下文) || `/auto-harness` | Auto-Harness 任务管理(`run`/`schedule`,见下文) |-> 说明:本页的 `/mode` 与 `/switch` 以 Gateway 受控通道行为为主。TUI 本地命令另支持 `/mode plan`、`/mode team.normal`、`/mode team.plan`,详见 [TUI 使用指南](TUI使用指南.md)。+> 说明:本页的 `/mode` 与 `/switch` 以 Gateway 受控通道行为为主。TUI 本地命令另支持 `/mode plan`、`/mode team.normal`,详见 [TUI 使用指南](TUI使用指南.md)。### Gateway / Agent 侧解析(受控通道)@@ -108,14 +108,13 @@- 直达写法:- `/mode agent.plan` -> `agent.plan`- `/mode agent.fast` -> `agent.fast`- - `/mode code.plan` -> `code.plan`- `/mode code.normal` -> `code.normal`- `/mode code.team` -> `code.team`- 二级切换:- agent 族:`/switch plan` <-> `agent.plan`,`/switch fast` <-> `agent.fast`- - code 族:`/switch plan` <-> `code.plan`,`/switch normal` <-> `code.normal`,`/switch team` <-> `code.team`+ - code 族:`/switch normal` <-> `code.normal`,`/switch team` <-> `code.team`- 非法组合(如在 `code.*` 下执行 `/switch fast`)返回:`非法指令`。-- 受控通道不接受 `/mode plan`、`/mode team.normal`、`/mode team.plan`。+- 受控通道不接受 `/mode plan`、`/mode team.normal`。- 备注:独立 `/team` 命令已移除,请统一使用 `/mode team`。### `/resume`@@ -176,7 +175,7 @@1. 选择范围:`团队共享`(JIUWENSWARM.md)、`个人私有`(JIUWENSWARM.local.md)或 `都要`。2. 检测已有配置:自动检测 `CLAUDE.md`、`.cursorrules`、`copilot-instructions.md` 等文件。3. 生成配置:根据选择生成项目配置文件。-- 自动模式切换:若当前处于 `code.plan` 模式,会自动切换到 `code.normal` 以便写入文件。+- 自动模式切换:Code 初始化会使用 `code.normal` 以便写入文件。### `/mcp`(MCP 服务管理)@@ -606,7 +605,7 @@| `session_id` | 当前会话 ID || `session_name` | 会话标题(通过 `/rename` 设置) || `cwd` | 当前工作目录 |-| `mode` | 当前模式(`agent.plan` / `agent.fast` / `code.plan` / `code.normal` / `code.team` / `team` / `team.plan`) |+| `mode` | 当前模式(`agent.plan` / `agent.fast` / `code.normal` / `code.team` / `team`) || `model` | 当前模型名称 || `provider` | 模型提供商 || `version` | jiuwenswarm 版本号 |diff --git "a/docs/zh/TUI\344\275\277\347\224\250\346\214\207\345\215\227.md" "b/docs/zh/TUI\344\275\277\347\224\250\346\214\207\345\215\227.md"index def45ecdb9..bd11be9c71 100644--- "a/docs/zh/TUI\344\275\277\347\224\250\346\214\207\345\215\227.md"+++ "b/docs/zh/TUI\344\275\277\347\224\250\346\214\207\345\215\227.md"@@ -72,9 +72,9 @@| `/evolve_simplify` | - | 整理、合并某技能的演进经验 | `/evolve_simplify myskill 合并重复经验` | `agent.plan` / `team` || `/init` | - | 在 **Code 模式** 下初始化 `JIUWENSWARM.md` / `JIUWENSWARM.local.md` | `/init` | **仅 `code.*`** || `/mcp` | - | 管理 MCP 服务 | `/mcp list`、`/mcp add ...` | 全部 |-| `/mode` | - | 切换或查看模式 | `/mode`、`/mode code`、`/mode team.plan` | 全部 |+| `/mode` | - | 切换或查看模式 | `/mode`、`/mode code`、`/mode team` | 全部 || `/permissions` | - | 设置 `permissions.tools` 中单工具的 allow/ask/deny | `/permissions ask write_file` | 全部 |-| `/plan` | - | 进入当前模式族的 plan 子模式,或发送规划请求 | `/plan`、`/plan open`、`/plan 迁移步骤` | 非 `team` |+| `/plan` | - | 进入 Agent 规划模式,或发送规划请求 | `/plan`、`/plan open`、`/plan 迁移步骤` | 非 `team` || `/rename` | - | 查看/重命名/清空当前会话标题 | `/rename`、`/rename 标题`、`/rename clear` | 全部 || `/resume` | `/continue` | 列出或恢复历史会话;无参 `/resume` 与 `/continue` 在 TUI 中可打开交互列表(见下) | `/resume list`、`/resume <id>` | 全部 || `/skills` | - | 技能与市场源管理 | `/skills`、`/skills install ...` | 全部 |@@ -101,12 +101,12 @@- **`/mode`**(`mode.ts`)- 无参数:显示当前模式。- - TUI 当前接受:`agent`、`plan`、`agent.plan`、`agent.fast`、`code`、`code.normal`、`code.plan`、`code.team`、`team`、`team.normal`、`team.plan`。+ - TUI 当前接受:`agent`、`plan`、`agent.plan`、`agent.fast`、`code`、`code.normal`、`code.team`、`team`、`team.normal`。- 实际映射:`agent` / `plan` → `agent.plan`;`code` → `code.normal`;`team.normal` → `team`;其它直达值保持不变。- 切换时会尝试调用 `mode.set` RPC,同时更新本地 UI 状态;如果后端不支持 `mode.set`,TUI 仍会在后续发送消息时通过当前模式传递。- - 从 `team` / `team.plan` / `code.team` 离开 Team 族且当前有 Team 任务运行时,TUI 会先弹出确认,确认后发送 `chat.interrupt` 再切换。-- **与 Gateway 受控通道的差异**:受控通道只接受 `/mode agent|code|team|agent.plan|agent.fast|code.plan|code.normal|code.team`;`/mode plan`、`/mode team.normal`、`/mode team.plan` 是 TUI 本地命令能力,不属于 Gateway slash 白名单。-- **同族子模式**:可用 **`/mode code.plan`**、**`/mode agent.fast`** 等直达;**`/switch plan|fast|normal|team`** 在 `switch.ts` 中实现,但 **默认 TUI 注册表未注册**,需要子模式时请用 `/mode` 直达或 **`/plan`**(见下)在 Agent/Code 族内进入 plan。+ - 从 `team` / `code.team` 离开 Team 族且当前有 Team 任务运行时,TUI 会先弹出确认,确认后发送 `chat.interrupt` 再切换。+- **与 Gateway 受控通道的差异**:受控通道只接受 `/mode agent|code|team|agent.plan|agent.fast|code.normal|code.team`;`/mode plan`、`/mode team.normal` 是 TUI 本地命令能力,不属于 Gateway slash 白名单。+- **同族子模式**:可用 **`/mode agent.fast`**、**`/mode code.normal`**、**`/mode code.team`** 等直达;**`/switch plan|fast|normal|team`** 在 `switch.ts` 中实现,但 **默认 TUI 注册表未注册**。#### `/workspace`(可信目录)@@ -118,7 +118,6 @@#### `/init`(仅 Code 模式)- 必须在 `code.*` 下执行;否则提示先 `/mode code`。-- 若当前为 `code.plan`,会自动切到 `code.normal` 以便写文件。- 需能解析工作目录:优先 `trustedDirs[0]`,否则 `process.cwd()`;无法解析时提示先 `/workspace set <path>`。- 交互选择范围:团队共享 `JIUWENSWARM.md`、个人 `JIUWENSWARM.local.md` 或两者;然后向后端发送编排提示(`logAsUser: false`)。- 详见 [Slash命令表.md](Slash命令表.md) 与源码 `init.ts`。@@ -193,7 +192,7 @@#### `/plan`- 在 `team` 模式下不可用。-- 无参数:进入当前族下的 plan(Agent → `agent.plan`,Code → `code.plan`)。+- 无参数:进入 `agent.plan`。- `open`:仅提示已进入规划模式。- 其它文本:在切换到 plan 后作为规划请求发送。@@ -354,7 +353,6 @@|------|------|------|| Agent(规划) | `agent.plan` | 全工具 + 主动记忆,偏规划 || Agent(快速) | `agent.fast` | 全工具 + 被动记忆,偏快 |-| Code(规划) | `code.plan` | 编码 + 编码记忆,偏规划;写文件能力受限场景更多 || Code(常规) | `code.normal` | 编码 + 编码记忆,偏执行 || Team | `team` | 多 Agent 协作 |@@ -372,11 +370,11 @@### 推荐工作流1. **进入 Code 模式**- ` /mode code` → 默认 `code.normal`;需要先看方案再动手时可 ` /mode code.plan`,或在已是 Code 族时用 **`/plan`** 进入 `code.plan`。+ ` /mode code` → 默认 `code.normal`。2. **划定可信目录**` /workspace add .` 或 ` /workspace set /path/to/repo`,确保 Agent 文件工具允许访问你的工程树。3. **(可选)项目级说明文件**- 在 `code.*` 下执行 ` /init`,按提示选择团队/个人/两者,生成 `JIUWENSWARM.md` 等;若从 `code.plan` 开始,命令会自动切到 `code.normal` 以便写入。+ 在 `code.*` 下执行 ` /init`,按提示选择团队/个人/两者,生成 `JIUWENSWARM.md` 等。4. **日常编码对话**直接描述需求;模型会通过白名单工具与编码记忆完成任务。5. **查看本轮改动**@@ -401,7 +399,7 @@| 现象 | 处理 ||------|------|| `/init` 提示需要 Code 模式 | 先执行 `/mode code` |-| 无法写文件或总被要求确认 | 确认处于 `code.normal`;`code.plan` 更偏规划;`/init` 会自动从 `code.plan` 切到 `code.normal` |+| 无法写文件或总被要求确认 | 确认处于 `code.normal` || 文件路径不在允许范围 | 使用 `/workspace add` 将仓库根或子目录加入可信列表 || 连接失败 | 检查 Gateway 是否监听、`--url` 是否正确、防火墙 || 未安装 `rg` | 安装 ripgrep 以改善搜索体验(欢迎屏提示) |diff --git "a/docs/zh/\345\221\275\344\273\244\350\241\214\346\214\207\344\273\244.md" "b/docs/zh/\345\221\275\344\273\244\350\241\214\346\214\207\344\273\244.md"index 7119038056..a547014830 100644--- "a/docs/zh/\345\221\275\344\273\244\350\241\214\346\214\207\344\273\244.md"+++ "b/docs/zh/\345\221\275\344\273\244\350\241\214\346\214\207\344\273\244.md"@@ -61,11 +61,10 @@ Gateway 会:|------|------|| `/mode agent.plan` | Agent 模式 + 规划风格(默认) || `/mode agent.fast` | Agent 模式 + 自动执行风格 |-| `/mode code.plan` | 代码模式 + 规划风格 || `/mode code.normal` | 代码模式 + 直接执行风格(默认) || `/mode code.team` | 代码模式 + 组队风格 |-> 说明:以上是 Gateway 受控通道白名单。TUI 本地 `/mode` 还支持 `/mode plan`(等价于 `agent.plan`)、`/mode team.normal`(等价于 `team`)和 `/mode team.plan`(直达 `team.plan`);这些写法不会被 Gateway 受控通道识别。+> 说明:以上是 Gateway 受控通道白名单。TUI 本地 `/mode` 还支持 `/mode plan`(等价于 `agent.plan`)、`/mode team.normal`(等价于 `team`);这些写法不会被 Gateway 受控通道识别。**使用方式:**@@ -76,14 +75,14 @@ Gateway 会:或```text-/mode code.plan+/mode code```Gateway 会:1. 拦截这条消息2. 取消当前 session 正在执行的任务(如果模式发生变化)3. 更新 `ChannelControlState.mode`-4. 回复系统提示,例如:`[收到 CLI 指令], mode 已变更为 code.plan`+4. 回复系统提示,例如:`[收到 CLI 指令], mode 已变更为 code.normal`---@@ -95,7 +94,7 @@ Gateway 会:| 命令 | 当前 agent 模式时 | 当前 code 模式时 ||------|------------------|------------------|-| `/switch plan` | → `agent.plan` | → `code.plan` |+| `/switch plan` | → `agent.plan` | 不支持 || `/switch fast` | → `agent.fast` | 不支持 || `/switch normal` | 不支持 | → `code.normal` || `/switch team` | 不支持 | → `code.team` |diff --git "a/docs/zh/\346\250\241\345\274\217\347\263\273\347\273\237.md" "b/docs/zh/\346\250\241\345\274\217\347\263\273\347\273\237.md"index 42892c9181..50c86001b8 100644--- "a/docs/zh/\346\250\241\345\274\217\347\263\273\347\273\237.md"+++ "b/docs/zh/\346\250\241\345\274\217\347\263\273\347\273\237.md"@@ -10,11 +10,9 @@ JiuwenSwarm 支持多种运行模式,不同模式对应不同的工具集、|------|------|------|| Agent(规划) | `agent.plan` | 默认模式。全工具 + 主动记忆,侧重推理与规划 || Agent(快速) | `agent.fast` | 全工具 + 被动记忆,侧重快速响应 |-| Code(规划) | `code.plan` | 编码模式 + 编码记忆,侧重代码生成的规划 || Code(常规) | `code.normal` | 编码模式 + 编码记忆,侧重代码执行 || Code(团队) | `code.team` | 以 Code 配置启动的团队协作模式 || Team | `team` | 多 Agent 协作模式,基于配置中的 `team` 定义 |-| Team(规划) | `team.plan` | 团队协作 + 规划型团队运行参数 |---@@ -29,14 +27,12 @@ JiuwenSwarm 支持多种运行模式,不同模式对应不同的工具集、/mode team # 切换到 Team 模式/mode agent.plan # 直达 Agent 规划子模式/mode agent.fast # 直达 Agent 快速子模式-/mode code.plan # 直达 Code 规划子模式/mode code.normal # 直达 Code 常规子模式/mode code.team # 直达 Code 团队子模式/mode team.normal # TUI 本地写法,等价于 team-/mode team.plan # TUI 本地写法,直达 Team 规划模式```-> 兼容性:`/mode plan`、`/mode team.normal`、`/mode team.plan` 是 TUI 本地命令能力;Gateway 受控通道只接受 `agent`、`code`、`team`、`agent.plan`、`agent.fast`、`code.plan`、`code.normal`、`code.team`。+> 兼容性:`/mode plan`、`/mode team.normal` 是 TUI 本地命令能力;Gateway 受控通道只接受 `agent`、`code`、`team`、`agent.plan`、`agent.fast`、`code.normal`、`code.team`。也可用 `/switch` 在同一大类内切换子模式:@@ -47,7 +43,7 @@ JiuwenSwarm 支持多种运行模式,不同模式对应不同的工具集、/switch team # Code 下切到 code.team```-> TUI 源码中有 `/switch` 实现,但当前默认 TUI 命令注册表未注册;TUI 用户请优先用 `/mode ...` 直达,或用 `/plan` 进入当前模式族的 plan 子模式。+> TUI 源码中有 `/switch` 实现,但当前默认 TUI 命令注册表未注册;TUI 用户请优先用 `/mode ...` 直达,或用 `/plan` 进入 Agent 规划模式。---@@ -142,18 +138,14 @@ channels:|------|----------------|------------------|------------------------|----------|| `agent.plan` | Deep Agent(`mode=agent`, `sub_mode=plan`) | 默认规划型对话。更适合复杂任务拆解、长期推理、技能演进与需要子代理协助的任务。 | 注册 `TaskPlanningRail`、`SubagentRail`;按配置启用 `SkillEvolutionRail` / `SkillCreateRail`;保留通用搜索、多模态、技能等普通 Agent 工具。 | 使用 `modes.agent.plan.memory`;默认主动记忆(`is_proactive: true`),会更积极地检索/沉淀上下文。 || `agent.fast` | Deep Agent(`mode=agent`, `sub_mode=fast`) | 快速响应型对话。更少规划编排,更偏直接回答或按需调用工具。 | 卸载 `TaskPlanningRail`、`SkillEvolutionRail`、`SkillCreateRail`、`SubagentRail`;仍保留通用运行时提示、安全、权限、搜索/多模态/技能工具。 | 使用 `modes.agent.fast.memory`;默认被动记忆(`is_proactive: false`),通常按需读写。 |-| `code.plan` | Code Adapter(`mode=code`, `sub_mode=plan`) | 编码任务的规划阶段。适合先读项目、拆解改动、制定实现步骤。 | 使用 Code 专用英文系统提示;固定挂载 `LspRail`、`ProjectMemoryRail`、`CodingMemoryRail`、`AgentModeRail`、`StructuredAskUserRail`、`ConfirmInterruptRail`、文件系统/权限 Rails;动态启用 `modes.code.rails` / `modes.code.tools` 中的能力。 | 不使用通用 `MemoryRail`;使用 `CodingMemoryRail` 与项目记忆(如 `JIUWENSWARM.md` / `CLAUDE.md`)。 |-| `code.normal` | Code Adapter(`mode=code`, `sub_mode=normal`) | 编码任务的执行阶段。适合改文件、跑命令、验证、交付结果。 | 与 `code.plan` 基本同一套 Code Rails/工具;区别主要是当前模式语义和前端/命令的执行意图,部分命令(如 `/init`)会从 `code.plan` 自动切到 `code.normal` 以便写入。 | 同 `code.plan`:编码记忆 + 项目记忆。 |+| `code.normal` | Code Adapter(`mode=code`, `sub_mode=normal`) | 编码任务的执行阶段。适合改文件、跑命令、验证、交付结果。 | 使用 Code 专用英文系统提示;固定挂载 `LspRail`、`ProjectMemoryRail`、`CodingMemoryRail`、`AgentModeRail`、`StructuredAskUserRail`、`ConfirmInterruptRail`、文件系统/权限 Rails;动态启用 `modes.code.rails` / `modes.code.tools` 中的能力。 | 编码记忆 + 项目记忆。 || `code.team` | Code Adapter + Team sub-mode(`mode=code`, `sub_mode=team`) | 以 Code profile 启动团队协作。适合代码项目中让团队成员分工,同时继承编码工作区与代码工具语义。 | 主 Agent 仍使用 Code profile;Team 成员会通过 TeamManager 启动,并尽量继承 Code 侧项目目录、代码工具和成员技能工具包。 | 团队成员使用 Team 配置;编码/项目上下文由 Code profile 和团队运行时共同影响。 || `team` | Team runtime(`mode=team`) | 标准多 Agent 协作。Leader 负责分解、调度、汇总,成员按角色并行处理。 | Team 成员挂载 `RuntimePromptRail`、`ResponsePromptRail`、`SysOperationRail`、`TaskPlanningRail`、`SecurityRail`、`HeartbeatRail`、`AvatarPromptRail` 等;Leader 额外支持 Team 技能演进/创建;工具来自可继承白名单和团队配置。 | 由 `modes.team.<name>.memory` 决定,可启用共享 `TEAM_MEMORY.md`、自动提取、成员记忆注入等。 |-| `team.plan` | Team Plan(规范化为 `team.plan`,运行时走 code/team 路径) | 团队规划增强模式。用于让 Team 以更强的规划语义启动,特别是 Leader 的规划/协调提示。 | 会设置 `enable_team_plan`;Leader 可保留配置语言的运行时提示,不强制使用 Code profile 的英文运行时提示;成员仍按团队/Code-Team 继承链配置。 | 同 Team 配置;Team Plan 主要改变团队运行提示和协调方式,不单独定义一套记忆配置。 |### 关键区别速记- `agent.plan` 与 `agent.fast` 使用同一个 Deep Agent profile,但前者挂载规划、子代理、技能演进等 Rails,后者会卸载这些偏“重编排”的能力。-- `code.plan` 与 `code.normal` 使用同一个 Code Adapter,差别主要是模式语义与命令流程;两者都拥有代码专属系统提示、LSP、项目记忆、编码记忆、文件/权限护栏。- `code.team` 与 `team` 都会进入团队协作,但入口不同:`code.team` 从 Code profile 进入,适合代码项目分工;`team` 是标准 Team runtime。-- `team.plan` 是 Team 的规划增强入口,当前实现会通过 code/team 路径启动,并在 TeamManager 中打开 `enable_team_plan`。---diff --git a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/mode.ts b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/mode.tsindex 0ce17cdc89..e09bd3167a 100644--- a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/mode.ts+++ b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/mode.ts@@ -12,11 +12,9 @@ export function buildModeAutocompleteItems(): AutocompleteItem[] {{ value: "agent.fast", label: " fast" },{ value: "code", label: "code" },{ value: "code.normal", label: " normal" },- { value: "code.plan", label: " plan" },{ value: "code.team", label: " team" },{ value: "team", label: "team" },{ value: "team.normal", label: " normal" },- { value: "team.plan", label: " plan" },];}@@ -26,12 +24,10 @@ export function createModeCommand(): SlashCommand {"code","agent.plan","agent.fast",- "code.plan","code.normal","code.team","team","team.normal",- "team.plan",] as const;/** 用户输入的简写 → 实际会话模式(/mode agent → agent.plan,/mode code → code.normal)。 */const modeAlias: Record<string, ClientMode> = {@@ -40,19 +36,17 @@ export function createModeCommand(): SlashCommand {code: "code.normal","agent.plan": "agent.plan","agent.fast": "agent.fast",- "code.plan": "code.plan","code.normal": "code.normal","code.team": "code.team",team: "team","team.normal": "team",- "team.plan": "team.plan",};return {name: "mode",description: "Switch chat mode",- usage: "/mode <agent|code|code.team|team|team.normal|team.plan>",- example: "/mode team.plan",+ usage: "/mode <agent|code|code.normal|code.team|team|team.normal>",+ example: "/mode code",kind: CommandKind.BUILT_IN,hidden: true,takesArgs: true,@@ -78,7 +72,7 @@ export function createModeCommand(): SlashCommand {makeItem(ctx.sessionId,"error",- "usage: /mode <agent|code|code.team|team|team.normal|team.plan>",+ "usage: /mode <agent|code|code.normal|code.team|team|team.normal>",),);return;diff --git a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/plan.ts b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/plan.tsindex 6ec45bc4b5..31cc261b3a 100644--- a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/plan.ts+++ b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/plan.ts@@ -1,17 +1,10 @@import { addInfo } from "../helpers.js";-import { CommandKind, type CommandContext, type SlashCommand } from "../types.js";--function planSubMode(ctx: CommandContext): "agent.plan" | "code.plan" {- if (ctx.mode === "code.plan" || ctx.mode === "code.normal" || ctx.mode === "code.team") {- return "code.plan";- }- return "agent.plan";-}+import { CommandKind, type SlashCommand } from "../types.js";export function createPlanCommand(): SlashCommand {return {name: "plan",- description: "Switch to plan sub-mode for the current mode family, or send a planning request",+ description: "Switch to agent plan mode, or send a planning request",usage: "/plan [open|<description>]",example: "/plan outline the migration steps",kind: CommandKind.BUILT_IN,@@ -29,7 +22,7 @@ export function createPlanCommand(): SlashCommand {}const value = args.trim();- const target = planSubMode(ctx);+ const target = "agent.plan";if (ctx.mode !== target) {ctx.setMode(target);}diff --git a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/switch.ts b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/switch.tsindex 1eebe57cb9..384d3af366 100644--- a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/switch.ts+++ b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/switch.ts@@ -6,12 +6,11 @@ import { CommandKind, type SlashCommand } from "../types.js";type SwitchArg = "plan" | "fast" | "normal" | "team";const AGENT_MODES = new Set<ClientMode>(["agent.plan", "agent.fast"]);-const CODE_MODES = new Set<ClientMode>(["code.plan", "code.normal", "code.team"]);+const CODE_MODES = new Set<ClientMode>(["code.normal", "code.team"]);function resolveRequestedMode(currentMode: ClientMode, switchArg: SwitchArg): ClientMode | null {if (switchArg === "plan") {if (AGENT_MODES.has(currentMode)) return "agent.plan";- if (CODE_MODES.has(currentMode)) return "code.plan";return null;}if (switchArg === "fast") {diff --git a/jiuwenswarm/channels/tui/frontend/src/core/event-handlers.ts b/jiuwenswarm/channels/tui/frontend/src/core/event-handlers.tsindex d4a7ca87ae..ab134f3126 100644--- a/jiuwenswarm/channels/tui/frontend/src/core/event-handlers.ts+++ b/jiuwenswarm/channels/tui/frontend/src/core/event-handlers.ts@@ -165,7 +165,7 @@ function _handleAgentModeToolResult(if (existingMode === "code.plan") {delegate.setMode("code.normal");} else if (existingMode === "team.plan") {- delegate.setMode("team.plan");+ delegate.setMode("team");} else if (existingMode === "agent.plan") {delegate.setMode("agent.fast");}@@ -206,7 +206,7 @@ function _handleAgentModeToolResult(const existingMode = delegate.getMode();let newMode: ClientMode | null = null;if (existingMode.startsWith("code.")) {- newMode = subMode === "plan" ? "code.plan" : subMode === "team" ? "code.team" : "code.normal";+ newMode = subMode === "team" ? "code.team" : "code.normal";} else if (existingMode.startsWith("agent.")) {newMode = subMode === "plan" ? "agent.plan" : "agent.fast";}@@ -224,6 +224,12 @@ function _getToolResultPayload(payload: Record<string, unknown>): Record<string,return payload;}+function normalizeVisibleMode(mode: ClientMode): ClientMode {+ if (mode === "code.plan") return "code.normal";+ if (mode === "team.plan") return "team";+ return mode;+}+function _extractPathFromToolResult(payload: Record<string, unknown>,pathKeys: string[],@@ -1194,7 +1200,7 @@ export function handleIncomingFrame(delegate: AppEventDelegate, frame: EventFramcase "session.updated": {const mode = typeof payload.mode === "string" ? payload.mode : "";if (isClientMode(mode)) {- delegate.setMode(mode);+ delegate.setMode(normalizeVisibleMode(mode));}if (typeof payload.title === "string") {delegate.setSessionTitle(payload.title);