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
fix: add /memory /branch /branch command instructions documents
ldstyle8434a9b6f622f
diff --git a/docs/en/SlashCommands.md b/docs/en/SlashCommands.mdindex 56a6b5e167..369344d6b5 100644--- a/docs/en/SlashCommands.md+++ b/docs/en/SlashCommands.md@@ -45,6 +45,9 @@ Identified by Gateway and forwarded to AgentServer and other backend capabilitie| `/diff` | View session changes by turn (see below) || `/compact` | Compress current context (see below) || `/init` | Project initialization (see below) |+| `/branch` | Create a branch session from current conversation point (see below) |+| `/rewind` | Rewind conversation to before a specific turn (see below) |+| `/memory` | Memory management (see below) |---@@ -177,6 +180,79 @@ Manages directories AI can access for file read, edit, and execute operations.- Changes are written to `config.yaml` under `mcp.servers`;- After write, Agent config reload is triggered, and runtime MCP server bindings are synced accordingly.+### `/branch` (Branch Session)++- Usage: `/branch [name]`.+- Alias: `/fork`.+- Function: Create a branch session from the current conversation state, copying the current conversation history.+- Constraints:+ - Rejected when the session is busy (`session is busy`);+ - Rejected when the current session has no conversation records.+- Behavior:+ 1. Generate a new `session_id` and send `session.fork` RPC to the backend (carrying `source_session_id`, `target_session_id`, and optional title).+ 2. TUI automatically switches to the new branch session, clears the current transcript, and restores the branch history.+ 3. Prompts the user that they are now in the new branch, and informs them they can use `/resume <original_session_id>` to return to the original session.+- Examples:+ - `/branch` — Create an untitled branch+ - `/branch fix-login-bug` — Create a branch named `fix-login-bug`++### `/rewind` (Rewind Conversation)++- Usage: `/rewind [turn_number]`.+- Alias: `/checkpoint`.+- Function: Rewind the current session to before a specified turn, supporting conversation-only, code-only, or both.+- Constraints:+ - Rejected when the session is busy (`session is busy`);+ - Rejected when there are no conversation turns.+- Interactive flow:+ 1. Without parameters, displays a list of all conversation turns (with timestamps and file change statistics) for the user to select the target turn.+ 2. After selecting, displays restore options:+ - **Restore conversation and code** — Truncate conversation and restore files to their prior state;+ - **Restore conversation only** — Only truncate conversation, files remain unchanged;+ - **Restore code only** — Only restore files, conversation remains unchanged (shown only when the target turn has file changes);+ - **Cancel** — Abort the operation.+ 3. Calls the corresponding backend RPC based on selection:+ - `both` → `session.rewind_and_restore`+ - `conversation` → `session.rewind`+ - `code` → `session.restore_files`+- After rewind: TUI clears the transcript and reloads history; if the rewinded content contains user input, it is automatically filled into the input box.+- Limitation: Rewinding does not affect files edited manually or via bash commands.+- Examples:+ - `/rewind` — Interactive turn selection and restore mode confirmation+ - `/rewind 2` — Directly rewind to before turn 2++### `/memory` (Memory Management)++- Alias: `/mem`.+- Function: View and manage memory system status, memory files, toggle settings, and directory paths.+- Subcommands:++| Command | Description |+|---|---|+| `/memory` or `/memory edit` | Interactively select and edit a memory file (lists available files when no path is given) |+| `/memory list` | List all memory files (with size, line count, modification time) |+| `/memory edit <path>` | Open the specified memory file for editing (via `$EDITOR`) |+| `/memory status` | Show detailed memory system status |+| `/memory toggle [key]` | Toggle memory system switches (lists togglable items when no key is given) |+| `/memory open` | Show memory system directory paths |++- `status` display contents:+ - Current mode, storage engine, enabled status, proactive status, forbidden filter status;+ - Index status (FTS5, Vector, Cache), file count, chunk count;+ - Statistics for Project Memory, Coding Memory, Auto Memory, and External Memory.+- `toggle` available keys:+ - `memory_enabled` — Master memory switch;+ - `memory_proactive` — Proactive memory switch;+ - `memory_forbidden_enabled` — Forbidden filter switch.+ - After toggling, a prompt is shown if a session restart is required for the change to take effect.+- Examples:+ - `/memory` — Interactively edit a memory file+ - `/memory list` — List memory files+ - `/memory edit memory/MEMORY.md` — Edit a specific memory file+ - `/memory status` — View detailed status+ - `/memory toggle memory_enabled` — Toggle the master memory switch+ - `/memory open` — View memory directory paths+### `/skills` (Skills Management)Manage skills lifecycle: listing, installing, importing, uninstalling, and marketplace source management.@@ -362,4 +438,6 @@ If StatusView is unavailable, the command falls back to inline key-value display|---|---|| `/btw` | Ask question || `/context` | Context status view |-| `/memory` | Memory management |\ No newline at end of file+| `/memory` | Memory management |+| `/export` | Export related files |+| `/permissions` | Permission management |\ No newline at end of filediff --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 f48433059f..81a5e391d1 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"@@ -45,6 +45,9 @@| `/diff` | 查看当前会话按轮次改动(见下文) || `/compact` | 压缩当前上下文(见下文) || `/init` | 项目初始化(见下文) |+| `/branch` | 从当前对话点创建分支会话(见下文) |+| `/rewind` | 回退对话到指定轮次之前(见下文) |+| `/memory` | 记忆管理(见下文) |---@@ -199,6 +202,79 @@- `delete` 走 TeamSkills Hub 原生删除接口 `DELETE /api/v1/plugins/{skill_id}/versions/{version}`;- `--token` 与 `--system-token` 互斥,且必须二选一。+### `/branch`(分支会话)++- 用法:`/branch [name]`。+- 别名:`/fork`。+- 功能:以当前会话的当前状态为起点,创建一个分支会话,复制当前对话历史。+- 约束:+ - 当前会话正在处理中(`session is busy`)时拒绝执行;+ - 当前会话无对话记录时拒绝执行。+- 行为:+ 1. 生成新 `session_id`,向后端发送 `session.fork` RPC(携带 `source_session_id`、`target_session_id` 与可选标题)。+ 2. TUI 自动切换到新分支会话,清空当前 transcript 并恢复分支的历史记录。+ 3. 提示用户已在新分支,并告知可用 `/resume <原会话ID>` 返回原会话。+- 示例:+ - `/branch` — 创建无标题分支+ - `/branch fix-login-bug` — 创建名为 `fix-login-bug` 的分支++### `/rewind`(回退对话)++- 用法:`/rewind [turn_number]`。+- 别名:`/checkpoint`。+- 功能:将当前会话回退到指定轮次之前,支持仅回退对话、仅恢复文件、或两者同时恢复。+- 约束:+ - 当前会话正在处理中(`session is busy`)时拒绝执行;+ - 无对话轮次时拒绝执行。+- 交互流程:+ 1. 无参数时,先展示当前会话所有轮次列表(含时间、文件变更统计),供用户选择目标轮次。+ 2. 选择轮次后,展示恢复选项:+ - **Restore conversation and code** — 截断对话并恢复文件到该轮次之前的状态;+ - **Restore conversation only** — 仅截断对话,文件保持不变;+ - **Restore code only** — 仅恢复文件,对话保持不变(仅当目标轮次有文件变更时显示);+ - **Cancel** — 取消操作。+ 3. 根据选择调用对应后端 RPC:+ - `both` → `session.rewind_and_restore`+ - `conversation` → `session.rewind`+ - `code` → `session.restore_files`+- 回退后:TUI 清空 transcript 并重新加载历史;若回退内容包含用户输入,会自动填入输入框。+- 局限:回退不影响通过 bash 命令或手动编辑的文件。+- 示例:+ - `/rewind` — 交互式选择轮次并确认恢复方式+ - `/rewind 2` — 直接回退到第 2 轮之前++### `/memory`(记忆管理)++- 别名:`/mem`。+- 功能:查看与管理记忆系统状态、记忆文件、开关配置及目录路径。+- 子命令:++| 命令 | 说明 |+|---|---|+| `/memory` 或 `/memory edit` | 交互式选择并编辑记忆文件(无参数时列出可选文件) |+| `/memory list` | 列出所有记忆文件(含大小、行数、修改时间) |+| `/memory edit <path>` | 打开指定记忆文件进行编辑(通过 `$EDITOR`) |+| `/memory status` | 显示记忆系统详细状态 |+| `/memory toggle [key]` | 切换记忆系统开关(无参数时列出可切换项) |+| `/memory open` | 显示记忆系统各目录路径 |++- `status` 展示内容:+ - 当前模式、存储引擎、启用状态、Proactive 状态、Forbidden Filter 状态;+ - 索引状态(FTS5、Vector、Cache)、文件数、分块数;+ - Project Memory、Coding Memory、Auto Memory、External Memory 的统计。+- `toggle` 可切换项:+ - `memory_enabled` — 记忆总开关;+ - `memory_proactive` — 主动记忆开关;+ - `memory_forbidden_enabled` — Forbidden Filter 开关。+ - 切换后若需要重启会话生效,会给出提示。+- 示例:+ - `/memory` — 交互式编辑记忆文件+ - `/memory list` — 列出记忆文件+ - `/memory edit memory/MEMORY.md` — 编辑指定记忆文件+ - `/memory status` — 查看详细状态+ - `/memory toggle memory_enabled` — 切换记忆总开关+ - `/memory open` — 查看记忆目录路径+### `/skills`(技能管理)管理技能的完整生命周期:列表查看、安装、导入、卸载以及市场源管理。@@ -373,6 +449,7 @@|----------------|---------|| `/btw` | 提问 || `/context` | 上下文状态查看 |-| `/memory` | 记忆管理 |+| `/export` | 导出相关文件 |+| `/permissions` | 权限管理 |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 69366094d9..c549580061 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"@@ -83,6 +83,9 @@| `/workspace` | `/workspace_dir`, `/workspace-dir` | 管理文件操作可信目录 | `/workspace add .` | 全部 || `/export` | - | 导出当前会话到文件或剪贴板 | `/export`、`/export my-chat` | 全部 || `/status` | - | 查看运行状态概览、用量、配置 | `/status`、`/status usage` | 全部 |+| `/branch` | `/fork` | 从当前对话点创建分支会话 | `/branch fix-login-bug` | 全部 |+| `/rewind` | `/checkpoint` | 回退对话到指定轮次之前 | `/rewind 2` | 全部 |+| `/memory` | `/mem` | 记忆管理(状态、文件、开关、目录) | `/memory status` | 全部 |#### `/resume` 与 `/continue` 在 TUI 中的特殊行为@@ -173,6 +176,40 @@- 若 TUI 提供 StatusView,会打开带标签页的交互界面;否则回退为内联键值展示。- 详见 [Slash命令表.md](Slash命令表.md) 的 `/status` 小节。+#### `/branch`(分支会话)++- 别名:`/fork`。+- 约束:当前会话忙时或无对话记录时拒绝执行。+- 行为:生成新 `session_id` 并调用 `session.fork`;TUI 自动切换到新分支会话,清空 transcript 并恢复分支历史。提示用户可用 `/resume <原会话ID>` 返回原会话。+- 示例:`/branch`、`/branch fix-login-bug`。++#### `/rewind`(回退对话)++- 别名:`/checkpoint`。+- 约束:当前会话忙时或无对话轮次时拒绝执行。+- 交互流程:+ 1. 无参数时先展示轮次列表(含时间、文件变更统计),供用户选择目标轮次。+ 2. 选择后展示恢复选项:+ - **Restore conversation and code** — 截断对话并恢复文件;+ - **Restore conversation only** — 仅截断对话;+ - **Restore code only** — 仅恢复文件(仅当目标轮次有文件变更时显示);+ - **Cancel** — 取消。+ 3. 对应调用 `session.rewind_and_restore`、`session.rewind` 或 `session.restore_files`。+- 回退后:TUI 清空 transcript 并重新加载历史;若回退内容包含用户输入,会自动填入输入框。+- 局限:回退不影响通过 bash 命令或手动编辑的文件。+- 示例:`/rewind`(交互式)、`/rewind 2`(直接回退到第 2 轮前)。++#### `/memory`(记忆管理)++- 别名:`/mem`。+- 子命令:+ - `list` — 列出所有记忆文件(大小、行数、修改时间)。+ - `edit [path]` — 编辑记忆文件;无参数时交互式选择。+ - `status` — 显示记忆系统详细状态(引擎、索引、Project/Coding/Auto/External Memory 统计)。+ - `toggle [key]` — 切换记忆开关;无参数时列出可切换项(`memory_enabled`、`memory_proactive`、`memory_forbidden_enabled`)。+ - `open` — 显示记忆系统各目录路径。+- 示例:`/memory status`、`/memory toggle memory_enabled`、`/memory edit memory/MEMORY.md`。+#### `/clear` 与忙状态- 若 `session is busy`(正在处理),`/clear` 会拒绝执行,需先中断任务(**`Ctrl+C`** 第一次中断;默认构建无 `/cancel` 命令)。