Repository navigation
feat(skills): 内置技能改可选注入模式(global|prompt|off,默认 prompt),根治 codex 等全局 CLI 泄漏 - #389
Merged
Merged
Conversation
…LI 泄漏 问题:codex 等无 --plugin-dir 动态注入能力的 CLI,botmux 把 10 个内置桥接技能装进 其全局 skills 目录(如 ~/.codex/skills)。CODEX_HOME 仅在读隔离时重定向,常规下 botmux 与用户手动跑的独立 codex 共用同一目录,导致独立 codex 误触发 botmux 技能。 方案:新增「内置技能注入模式」,per-bot(bots.json skillInjection) → 机器级 (config.json skills.builtinInjection) → 默认 prompt 三级解析: - prompt(默认):不落全局盘,把精简技能目录注入会话 prompt,全文按需 `botmux skill show` - global:装进 CLI 全局目录(原生体验,但独立 CLI 也会看到),给只用 botmux 的用户 - off:只留路由提示 + `botmux --help` 引导 影响面:作用于全部 10 个「仅全局 skillsDir、不支持动态注入」的 CLI (codex/gemini/opencode/cursor/coco/traex/pi/oh-my-pi/mtr/genius);claude 家族 (--plugin-dir) 与无 skillsDir 的 CLI 不受影响。共享目录(coco/traex 同用 ~/.trae/skills)按「该目录上任一 bot 选 global 就装」取并集,跨 daemon 一致不打架。 关键:prompt/off 的全局盘清理放在 forkWorker→ensureCliEnv、once-cache 之前,每个 新会话拉起 CLI 前都执行,确保切离 global、旧残留在 CLI 启动前被扫掉;只动 botmux- 命名空间不碰用户技能。genius(injectsSessionContext) 的 catalog 走 --append-system-prompt。`botmux skill show` 现可服务内置技能全文(无 manifest 也行)。 配置入口: - 机器级:`botmux skills injection [global|prompt|off]`(写 config.json) - per-bot:`/config skillInjection` + dashboard「Bot Defaults → CLI / 模型」板块新增 下拉(GET /api/bot-default-oncall 回传 + PUT /api/bots/:appId/skill-injection → applyConfigField,与 p2pMode 同路径),留空=回机器级默认 help 补齐 ask/skill/workflow/report/dispatch + 子命令 --help 提示。 测试:新增 24 条内置技能单测 + bot-config-store/dashboard-ipc/bot-payload 等既有套件 全绿;pnpm build(含 dashboard bundle) 通过。
…llInjectionSupport dashboard 的「内置技能注入方式」按 CLI 能力分类(dynamic/global/none)。relay/seed 是 Claude Code fork(走 createClaudeFamilyAdapter,设 pluginDir),本就被容量判定正确归为 dynamic——但为防回归、并回应 relay 归类的疑问,把内联判定抽成 injection-mode.ts 的 resolveSkillInjectionSupport(cliId) 单一实现,dashboard serializer 复用,并加全 CLI 矩阵测试:claude-code/seed/relay→dynamic、codex/gemini/…/genius→global、 antigravity/aiden/hermes/mir/mira/codex-app→none。纯重构+测试,无行为变化。
deepcoldy
force-pushed
the
wt/premium-claude-codex-skill-skill
branch
from
July 6, 2026 17:47
8b58943 to
608bae6
Compare
deepcoldy
added a commit
to xu4wang/botmux
that referenced
this pull request
Jul 9, 2026
Resolve the session-manager.ts import conflict: keep both the new assertSafeAppId import (this PR) and the skills/injection-mode imports (deepcoldy#389).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么
新增「botmux skills 注入方式」配置(
global|prompt|off,默认prompt),控制 botmux 内置桥接技能如何送进「只有全局 skills 目录、不支持--plugin-dir动态注入」的 CLI(codex/gemini/opencode/cursor/coco/traex/pi/oh-my-pi/mtr/genius)。为什么
codex 等 CLI 没有 Claude 的
--plugin-dir动态注入,botmux 把 10 个内置技能装进全局~/.codex/skills。CODEX_HOME仅在读隔离时重定向,常规下 botmux 与用户手动跑的独立 codex 共用同一目录 → 独立 codex 会看到并误触发 botmux 技能。默认改成 prompt 注入后根治泄漏。三种模式
prompt(默认):不落全局盘,把「额外能力」技能目录注入会话 prompt(仅开场一次),全文按需botmux skill show;独立 CLI 看不到global:装进 CLI 全局目录(原生体验,但独立 CLI 也会看到),给只用 botmux 的用户off:只留路由提示 +botmux --help引导关键实现
bots.jsonskillInjection) → 机器级(config.jsonskills.builtinInjection) → 默认 prompt;共享目录(coco/traex 同用~/.trae/skills)按「该目录上任一 bot 选 global 就装」取并集,跨 daemon 一致forkWorker → ensureCliEnv、once-cache 之前,每个新会话拉起 CLI 前都执行——切离 global、旧版本/外部残留都在 CLI 启动前被扫掉;只动botmux-命名空间,不碰用户自定义 skill<botmux_routing>管通信原语(send/history/quoted/bots + @门),<botmux_builtin_skills>只列额外能力(schedule/handoff/workflow/workflow-create/orchestrate/goal-ask/ask),catalog 开头显式指向 routing;off提示也 XML 包裹buildNewTopicPrompt),follow-up 走buildFollowUpContent、resume/refork 走buildReforkPrompt均不重注(CLI 自身 session 文件已保存开场那轮)injectsSessionContext+ 全局 skillsDir) 的 catalog 走--append-system-promptbotmux skill show/list现可服务内置技能全文(无 user manifest 也可)配置入口
botmux skills injection [global|prompt|off](写~/.botmux/config.json)/config skillInjection+ dashboard「Bot Defaults → CLI / 模型」下拉,按 CLI 类型渲染(后端回传skillInjectionSupport):--plugin-dir动态)→ 控件禁用,固定显示「动态注入」prompt/global/off可选,「动态注入」作为禁用选项提示不支持botmux --help补齐 ask/skill/workflow/report/dispatch + 「子命令支持 --help」提示dashboard 控件示意(codex 类)
影响面
--plugin-dir)与无 skillsDir 的 CLI 不受影响worker-pool.ensureCliSkills/session-manager.buildNewTopicPrompt/global-config/bot-registry/dashboard-ipc-server+dashboard.ts代理 /bot-config-store/ 新增skills/injection-mode.ts测试
test/skill-injection-mode.test.ts(25 条:模式解析 / 共享目录并集 / catalog 排除通信技能 / off XML 包裹 / skill show 内置兜底 / CLI setter 增删查)dashboard-ipc/dashboard-bot-payload/bot-config-store/session-skill-injection/builtin-skills等既有套件全绿pnpm build(含 dashboard bundle)通过pnpm test(unit):7264 passed / 13 failed,13 条均为本机既有 baseline(terminal-url×7 / tunnel-client×2 / recall-frozen×1 / dashboard-create-session×3 的 role-resolver mock 漂移),与本改动无关——已核对这 4 个失败文件/子系统本 PR 均未触及,且在origin/master上同样失败