Skip to content

feat(skills): 增加自定义 Skill 管理与按 Bot 优先披露#211

Open
xiongz-c wants to merge 4 commits into
masterfrom
codex/skill-management-spec
Open

feat(skills): 增加自定义 Skill 管理与按 Bot 优先披露#211
xiongz-c wants to merge 4 commits into
masterfrom
codex/skill-management-spec

Conversation

@xiongz-c

@xiongz-c xiongz-c commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

背景 / 动机

botmux 的 bot 已经承载了“某个入口 + 某个 CLI/模型/工作区/人设”的配置语义。对应地,团队或项目自定义 Skill 也需要成为可复用、CLI 无关、按 bot 选择的资产,而不是只能依赖某个 CLI 的全局 skill 目录。

本 PR 的边界是:botmux 管理一组 Skill 资产,并在会话启动时按全局注入策略和 bot 优先列表做 scoped delivery / priority disclosure;不把 botmux 扩展成通用 Agent 平台,也不接管底层 CLI 自己的全局 skill 发现机制。

Review Map

  • Skill 资产与 registrysrc/core/skills/*src/services/skill-registry-store.tstest/skill-*.test.ts。覆盖 Skill 包解析、registry、local/Git/GitHub 安装、更新、删除、doctor 和资源读取。
  • 会话注入链路src/core/skills/session-runtime.tssrc/core/skills/session-resolver.tssrc/core/worker-pool.tssrc/adapters/cli/*。覆盖 manifest、prompt catalog、Claude scoped plugin、sandbox readonly roots。
  • 配置与命令入口src/services/bot-config-store.tssrc/core/command-handler.tssrc/core/skills/cli-admin-command.tssrc/core/skills/im-command.ts。bot 只维护 direct priority skill 列表;delivery 与工作区 Skill 注入方式是全局默认。
  • Dashboard 管理面src/dashboard.tssrc/core/dashboard-ipc-server.tssrc/dashboard/skill-install-request.tssrc/dashboard/web/skills.tssrc/dashboard/web/style.css。覆盖安装/更新/删除、后台 job、全局注入配置、bot 横向配置卡和分页列表。
  • 文档与兼容性docs/setup/skills.mdREADME.md。说明默认行为、安装来源、delivery、Dashboard、sandbox 和排障。

改动

  • 增加 botmux 自定义 Skill Registry,支持本机目录、Git URL、GitHub 页面 URL / 简写来源安装,支持 update/remove/doctor。
  • 增加 bot 级 priority skill policy:bot 配置只保存 skill:<name> 优先披露列表。
  • 增加全局 Skill 注入配置:trustProjectSkills 控制是否读取工作区 .agents/skills / .botmux/skillsdelivery 控制 auto | prompt | native
  • 增加会话级 Skill manifest、prompt catalog,以及会话内 botmux skill show/read/resources 读取命令。
  • 增加 Claude scoped native delivery;Codex 等通用 CLI 走 prompt delivery fallback。
  • 增加 Dashboard Skills 页面,用于 registry 安装/更新/删除、全局注入配置、按 bot 配置优先披露列表。
  • 增加强边界:拒绝带凭证的 HTTPS Git URL、Git path 限制在 checkout 内、Git 操作文件锁串行化、缺少 git 时返回 git_not_found、删除 in-use skill 前提示/阻止、resource 枚举防 symlink 越界。

默认值 / 兼容性依据

  • 未配置 BotConfig.skills 时,不生成 manifest、不注入 prompt、不创建 runtime plugin,也不改变 CLI args;底层 Codex / Claude 等 CLI 保持原有默认行为。
  • 配置 priority skill 后,语义是“优先披露”:botmux 只把选中的 Skill 放进会话 manifest/catalog,底层 CLI 原生 skill 目录仍由 CLI 自己处理。
  • 工作区 Skill 默认不读取;开启全局“读取工作区 Skill”后,才把当前工作区 .agents/skills.botmux/skills 纳入候选。
  • trusted 作为旧配置兼容别名读取为 all,但不再暴露成独立安全语义。
  • delivery:auto 优先使用 adapter 支持的 native/scoped delivery,不支持时走 prompt;delivery:native 在目标 CLI 不支持时阻止新会话并给用户可见诊断。
  • botmux registry 写入 ~/.botmux/skills;不会写入 ~/.codex/skills~/.claude/skills 等宿主 CLI 全局目录。本机 CLI skill 库目录会作为 local-link 引用,不复制。
  • Git/GitHub 安装依赖系统 git。缺少 git 会给出明确错误;私有仓库认证应走系统 Git 凭证、SSH agent 或 gh auth,不接受带 token 的 URL。

测试覆盖

  • Skill source 解析、包解析、frontmatter、registry local/Git/GitHub 安装、更新、remove 清理 store 副本和 doctor。
  • Git URL 凭证拒绝、Git/GitHub repo-relative path 校验、symlink 越界拒绝、跨进程 file lock 和同一 Git source 并发串行化。
  • bot/global 配置解析、/botconfig set skills JSON 文本路径、priority include diagnostics。
  • session manifest 写入、prompt catalog 注入、botmux skill show/read/resources 资源越界保护。
  • Claude scoped plugin、native delivery 不支持时的用户可见 fatal 诊断、sandbox runtime roots 只读绑定。
  • Dashboard install request 前置校验、后台 job、删除 in-use skill 检查、invalid policy 400、全局注入配置局部刷新。

验证

本次验证:

  • pnpm vitest run test/skill-*.test.ts test/dashboard-skill-install-request.test.ts test/session-skill*.test.ts test/session-lifecycle-start.test.ts test/command-handler.test.ts test/dashboard-ipc.test.ts test/dashboard-auth.test.ts test/global-config.test.ts test/bot-config-store.test.ts test/file-lock.test.ts(25 files,318 passed)。
  • pnpm vitest run test/sandbox.test.ts -t "binds selected skill runtime roots"(1 passed,38 skipped)。
  • pnpm build
  • git diff --check

补充:本次也跑过包含完整 test/sandbox.test.ts 的同一套 focused 命令,仍有 1 个既有 sandbox opaque-dir landing 用例失败:a BRAND-NEW opaque dir is mkdir-only。该失败不在本 PR 的 Skill 注入路径上;Skill 相关 sandbox readonly roots 用例已单独通过。

影响范围

未配置 skills 的 bot 不受影响。已配置 skills 的 bot 只影响新会话;运行中的历史会话不会 retroactively 注入。Dashboard 新增管理入口仍在 token-gated 管理面内。安装/更新 Git/GitHub Skill 会调用系统 git;没有 git 的环境会得到明确错误而不是静默失败。删除已被 bot 引用的 Skill 需要确认/force,避免无提示制造 dangling policy。

@xiongz-c xiongz-c force-pushed the codex/skill-management-spec branch from cea6b05 to e31ef2a Compare June 15, 2026 09:49
@xiongz-c xiongz-c changed the title feat(skills): 增加 bot 级自定义 skill 管理 feat(skills): 增加自定义 Skill 管理与按 Bot 优先披露 Jun 15, 2026
@xiongz-c xiongz-c marked this pull request as ready for review June 15, 2026 09:50
@xiongz-c xiongz-c requested a review from deepcoldy as a code owner June 15, 2026 09:50
@xiongz-c xiongz-c force-pushed the codex/skill-management-spec branch 2 times, most recently from bd2b006 to 67de15d Compare June 16, 2026 02:29
@deepcoldy

Copy link
Copy Markdown
Owner

🐂🍺 我可能需要多花些时间review哈

@deepcoldy deepcoldy force-pushed the codex/skill-management-spec branch from 67de15d to 7234695 Compare June 17, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants