$npx -y skills add nexus-research-lab/nexus --skill nexus-manager管理 Nexus 的 Agent、Room、Workspace 与 Skill 系统操作。当用户提到创建 agent、创建 room、邀请成员、查看 room、读写工作区文件、安装或卸载 skill、删除成员或房间、查询系统协作结构时,使用此 skill,即使没有明确说“管理”二字。
| 1 | # nexus-manager |
| 2 | |
| 3 | 管理 Nexus 平台的 Agent、Room、Workspace 与 Skill。通过 CLI 工具执行系统操作。 |
| 4 | |
| 5 | CLI 工具:优先使用环境变量 `NEXUSCTL_COMMAND_PATH` 指向的命令;示例里的 `nexusctl` 只是简写。 |
| 6 | 不要搜索 `cmd/nexusctl`,也不要手写 `go run ./cmd/nexusctl`,运行时入口已经注入。 |
| 7 | |
| 8 | ## CLI 输出约定 |
| 9 | |
| 10 | - Agent 正常调用统一加 `--json`,让 stdout 始终返回单行 JSON,便于直接提字段。 |
| 11 | - `stdout` 只读数据,`stderr` 只读诊断;失败时不要从 stdout 猜错误。 |
| 12 | - 参数用法错误返回 `64`,执行错误返回 `1`。遇到 `64` 先修参数,遇到 `1` 再判断是否重试或换方案。 |
| 13 | - 默认不要加 `--verbose`,只有在排查异常、确认 skill 部署过程或追踪系统初始化问题时才显式打开。 |
| 14 | - 子命令按领域拆分:`agent`、`room`、`conversation`、`workspace`、`skill`、`launcher`。 |
| 15 | - 失败时优先读 stderr 里的 JSON 错误,不要假设命令名仍旧是旧 Python 风格。 |
| 16 | - 多用户部署下不要把 `user_id` 写进命令模板;运行时会自动注入当前用户作用域。只有手工在终端直跑 `nexusctl` 时,才需要显式传 `--scope-user-id` 或设置 `NEXUSCTL_USER_ID`。 |
| 17 | |
| 18 | ```bash |
| 19 | # Agent 正常调用 |
| 20 | nexusctl --json agent list |
| 21 | |
| 22 | # 排查问题时再打开诊断 |
| 23 | nexusctl --json --verbose agent list |
| 24 | |
| 25 | # 人工查看时使用格式化输出 |
| 26 | nexusctl --pretty agent list |
| 27 | ``` |
| 28 | |
| 29 | ## 核心概念 |
| 30 | |
| 31 | - **Agent(成员)**:具有独立工作空间的智能体,可被邀请加入 Room 协作。 |
| 32 | - **Room(群组空间)**:多个 Agent 共处的对话空间,支持创建后追加成员。 |
| 33 | - **Workspace(工作区)**:每个 Agent 独立拥有的文件空间,可读写业务文件与运行资料。 |
| 34 | - **Skill(技能)**:平台内置 Skill 由全局平台库提供,Agent 只记录启用的 ID;外部或 workspace-local Skill 才可能以文件形式部署到 Agent 工作区。 |
| 35 | - **主智能体**:系统内置的保留 Agent,不能作为 Room 成员,所有 Room 操作由它发起。 |
| 36 | - 每个成员创建后自动获得独立工作空间(workspace),用于存放工具配置、记忆和业务文件;不要把平台内置 Skill 当作 workspace 文件维护。 |
| 37 | |
| 38 | ## 命令参考 |
| 39 | |
| 40 | ### Agent 管理 |
| 41 | |
| 42 | #### 列出成员 |
| 43 | |
| 44 | ```bash |
| 45 | nexusctl agent list |
| 46 | ``` |
| 47 | |
| 48 | #### 创建成员 |
| 49 | |
| 50 | ```bash |
| 51 | nexusctl agent create --name "Research" |
| 52 | ``` |
| 53 | |
| 54 | #### 读取成员详情 |
| 55 | |
| 56 | ```bash |
| 57 | nexusctl agent get research |
| 58 | ``` |
| 59 | |
| 60 | #### 读取成员会话 |
| 61 | |
| 62 | ```bash |
| 63 | nexusctl session list --agent-id research |
| 64 | ``` |
| 65 | |
| 66 | ### Room 管理 |
| 67 | |
| 68 | #### 查看 Room 列表 |
| 69 | |
| 70 | ```bash |
| 71 | nexusctl room list |
| 72 | ``` |
| 73 | |
| 74 | #### 读取 Room |
| 75 | |
| 76 | ```bash |
| 77 | nexusctl room get abc123 |
| 78 | ``` |
| 79 | |
| 80 | #### 读取 Room 上下文 |
| 81 | |
| 82 | ```bash |
| 83 | nexusctl room contexts abc123 |
| 84 | ``` |
| 85 | |
| 86 | #### 创建 Room |
| 87 | |
| 88 | ```bash |
| 89 | nexusctl room create --agent-id research --agent-id writer --name "内容团队" --title "Kickoff" --description "内容生产协作空间" |
| 90 | ``` |
| 91 | |
| 92 | #### 更新 Room |
| 93 | |
| 94 | ```bash |
| 95 | nexusctl room update abc123 --name "内容团队" --title "本周计划" |
| 96 | ``` |
| 97 | |
| 98 | #### 向 Room 追加成员 |
| 99 | |
| 100 | ```bash |
| 101 | nexusctl room add-member abc123 --agent-id translator |
| 102 | ``` |
| 103 | |
| 104 | - `--room_id` 和 `--agent_id` 均必填。 |
| 105 | - 仅支持群组类型 Room(`room`),不支持私聊(`dm`)。 |
| 106 | - 返回字段:`room_id`、`room_name`、`conversation_id`、`member_agent_ids` |
| 107 | |
| 108 | #### 移除 Room 成员 |
| 109 | |
| 110 | ```bash |
| 111 | nexusctl room remove-member abc123 --agent-id translator |
| 112 | ``` |
| 113 | |
| 114 | #### 创建 Room directed message |
| 115 | |
| 116 | Room runtime 内会自动注入当前 `room_id`、`conversation_id` 和 `source_agent_id`;Agent 正常调用时不要额外传这些字段。`recipients` 填 Room 成员的 `agent_id`,不是成员名。 |
| 117 | |
| 118 | ```json |
| 119 | {"tool":"nexus_room.send_directed_message","arguments":{"recipients":["0ed5434a8c13"],"wake_policy":"none","reply_route":{"mode":"none"},"content":"私下提醒"}} |
| 120 | {"tool":"nexus_room.send_directed_message","arguments":{"recipients":["0ed5434a8c13"],"wake_policy":"immediate","reply_route":{"mode":"private","recipients":["<host-agent-id>"],"wake_policy":"immediate"},"content":"请处理后私下回给主持人"}} |
| 121 | {"tool":"nexus_room.send_directed_message","arguments":{"recipients":["0ed5434a8c13"],"wake_policy":"immediate","reply_route":{"mode":"private","recipients":["<host-agent-id>"],"wake_policy":"immediate","next_reply_route":{"mode":"public"}},"content":"请私下回答主持人,主持人随后公开推进"}} |
| 122 | {"tool":"nexus_room.send_directed_message","arguments":{"recipients":["<self-agent-id>"],"wake_policy":"none","reply_route":{"mode":"none"},"content":"只写给自己的上下文"}} |
| 123 | ``` |
| 124 | |
| 125 | #### 删除 Room |
| 126 | |
| 127 | ```bash |
| 128 | nexusctl room delete abc123 |
| 129 | ``` |
| 130 | |
| 131 | ### Workspace 操作 |
| 132 | |
| 133 | #### 列出工作区文件 |
| 134 | |
| 135 | ```bash |
| 136 | nexusctl workspace list --agent-id research |
| 137 | ``` |
| 138 | |
| 139 | #### 读取工作区文件 |
| 140 | |
| 141 | ```bash |
| 142 | nexusctl workspace get --agent-id research --path "RUNBOOK.md" |
| 143 | ``` |
| 144 | |
| 145 | #### 更新工作区文件 |
| 146 | |
| 147 | ```bash |
| 148 | nexusctl workspace update --agent-id research --path "RUNBOOK.md" --content "# 新计划" |
| 149 | ``` |
| 150 | |
| 151 | #### 创建工作区条目 |
| 152 | |
| 153 | ```bash |
| 154 | nexusctl workspace create --agent-id research --path "notes/todo.md" --type file --content "- kickoff" |
| 155 | nexusctl workspace create --agent-id research --path "notes" --type directory |
| 156 | ``` |
| 157 | |
| 158 | #### 重命名工作区条目 |
| 159 | |
| 160 | ```bash |
| 161 | nexusctl workspace rename --agent-id research --path "notes/todo.md" --new-path "notes/plan.md" |
| 162 | ``` |
| 163 | |
| 164 | #### 删除工作区条目 |
| 165 | |
| 166 | ```bash |
| 167 | nexusctl workspace delete --agent-id research --path "notes/plan.md" |
| 168 | ``` |
| 169 | |
| 170 | ### Skill 管理 |
| 171 | |
| 172 | #### 列出 Skill |
| 173 | |
| 174 | ```bash |
| 175 | nexusctl skill list |
| 176 | ``` |
| 177 | |
| 178 | #### 读取成员 Skill 状态 |
| 179 | |
| 180 | ```bash |
| 181 | nexusctl skill agent-list --agent-id research |
| 182 | ``` |
| 183 | |
| 184 | #### 安装 Skill |
| 185 | |
| 186 | ```bash |
| 187 | nexusctl skill install --agent-id research --skill-name planner |
| 188 | ``` |
| 189 | |
| 190 | #### 搜索社区 Skill |
| 191 | |
| 192 | ```bash |
| 193 | nexusctl skill search-external "pdf" |
| 194 | ``` |
| 195 | |
| 196 | #### 从 Git 导入 Skill |
| 197 | |
| 198 | ```bash |
| 199 | nexusctl skill import-git --url https://github.com/example/skills --path skills/demo |
| 200 | ``` |
| 201 | |
| 202 | #### 导入并安装外部 Skill |
| 203 | |
| 204 | ```bash |
| 205 | nexusctl skill install-external --agent-id research --item-file search-result.json |
| 206 | nexusctl skill install-external --agent-id research --import-mode skills_sh --package-spec owner/repo/skill --skill-slug skill |
| 207 | ``` |
| 208 | |
| 209 | #### 更新导入 Skill |
| 210 | |
| 211 | ```bash |
| 212 | nexusctl skill update demo-skill |
| 213 | nexusctl skill update --all |
| 214 | ``` |
| 215 | |
| 216 | #### 卸载 Skill |
| 217 | |
| 218 | ```bash |
| 219 | nexusctl skill uninstall --agent-id research --skill-name planner |
| 220 | ``` |
| 221 | |
| 222 | ## Wor |