Skip to content

AtomCode v5.0.9 新子系统深度分析 — Skills 注册表、目录钩子与精确命名契约 ​

基于 strings 工具自描述 + 系统提示 catalog 拼接 + 模块枚举的还原分析 2026-09-09 前置报告:05-version-diff-v4.25.5-to-v5.0.9.md 姊妹报告:45_SkillFirst_Subagent_Tiers_Dispatch.md(skill-first 注入策略)、26_插件/安装/Skills 深层覆盖(旧版 Skills 构成)、47_MCP_Trust(外部内容可信边界)


1. 全新源码模块(skills/ 目录) ​

crates/atomcode-capabilities/src/skills/
  ├── registry.rs          ← 技能注册表(目录构建)
  ├── catalog_hook.rs      ← 目录注入钩子(拼系统提示 catalog 段)
  ├── skill.rs             ← 技能模型
  └── use_skill.rs         ← use_skill 工具执行(参数替换)

→ 旧版只有 use_skill 工具本体;registry.rs + catalog_hook.rs 为 v5.0.9 全新, 把 Skills 从"单工具"升级为注册 → 目录 → 提示注入的完整基础设施。


2. 技能目录(AVAILABLE SKILLS) ​

2.1 注入位置(system prompt) ​

When any skills are installed, they are listed under the '=== AVAILABLE SKILLS ==='
  section of this system prompt; if that section is absent, none are installed

→ 目录是系统提示内嵌段;段是否存在即代表是否有技能安装(v5.0.9 让"空目录"不再出现)。

2.2 目录来源 ​

skill name from AVAILABLE SKILLS or list_skills; never invent a name
under '=== AVAILABLE SKILLS ===' in the system prompt or returned by list_skills

→ 合法技能名两个来源:系统提示 catalog 或 list_skills 返回值。

2.3 优先级截断(v5.0.9 动态目录) ​

list_skills shows any lower-priority skills omitted from the prompt catalog.
catalog shows ... & more lower-priority skills not shown.
If this catalog says skills were omitted, call `list_skills` before using an omitted
  or otherwise unlisted name, and use only an exact name it returns.

→ 目录按优先级截断:只展示最高优先级的技能;低优先级技能被省略,需 list_skills 补查;遗漏名必须先 list_skills 校验,再取精确名使用。


3. use_skill 工具契约(逐字还原) ​

3.1 工具自描述 ​

Invoke a named skill (a reusable prompt/workflow template) and return its content
  with your arguments substituted. The name must exactly match a skill listed under
  '=== AVAILABLE SKILLS ===' in the system prompt or returned by list_skills.

→ 精确名匹配:只能调 catalog/list_skills 列出的名字;参数替换返回扩充后内容。

3.2 校验与失败 ​

use_skill: invalid arguments:
use_skill: skill '<name>' is not installed / not found
use_skill: expansion task failed

→ 三态:参数错误 / 技能不存在 / 扩充任务失败(expansion 即模板+参数求值)。

3.3 UI 分类映射 ​

case `use_skill`: return `skill`

→ 与 list_symbols→file、find_references→search 同族:use_skill 被 UI 归类为 skill 类型(43 号报告的 UI 面映射延续)。


4. 精确命名契约(防猜名) ​

never invent or guess a skill name from memory
Only skill names you may pass directly to `use_skill`; never invent or guess a
  skill name from memory

→ 从记忆推断/猜名被明令禁止 —— 与 45 号报告 skill_first 的"never infer"呼应, 但本层是工具层校验(use_skill 参数侧)而非提示注入策略。


5. 与 Skill-First 注入的关系(catalog_hook.rs 位置) ​

catalog_hook.rs                ← 系统提示 catalog 段拼装处
If a task clearly matches a shown skill's description, you MUST load its exact
  listed name with `use_skill` and follow it BEFORE doing the work ...

→ catalog_hook.rs 在组装系统提示时拼接 AVAILABLE SKILLS 段; 45 号报告的 MUST 注入正是消费这个目录。注册表 → 目录 → hook 注入 → 强制调用 成完整链路。


6. 与既有系统的关系 ​

系统关系
DEEP_ANALYSIS_45 Skill-First消费 catalog 段做 MUST 调用注入 → 输出端
DEEP_ANALYSIS_26 插件/Skillsuse_skill/list_skills 工具本体旧版已有;新增注册表 + 目录钩子
DEEP_ANALYSIS_47 MCP 指令隔离同为"外部内容→提示注入";MCP 走 <mcp-server-instructions> 块,Skills 走 catalog 段,两者都带明确可信边界
DEEP_ANALYSIS_43 CodeIntel UI 面共享工具→UI 分类映射机制(case use_skill: return skill)

7. 逆向方法论备注 ​

  1. === AVAILABLE SKILLS === 段 + "if that section is absent, none are installed" 还原目录空性语义(段存在性 = 安装状态)
  2. list_skills shows any lower-priority skills omitted from the prompt catalog 暴露优先级截断目录机制(v5.0.9 新增)
  3. The name must exactly match a skill listed under ... or returned by list_skills 是 use_skill 精确名契约 的逐字工具自述
  4. use_skill: expansion task failed 暴露模板参数替换/扩充执行失败面
  5. case \use_skill`: return `skill`` 给出工具 UI 分类映射
  6. skills/registry.rs + catalog_hook.rs 模块路径 = 注册→目录→注入 完整链路证据

本报告由持续分析循环生成 — v5.0.9 Skills 注册表、目录钩子与精确命名契约深度分析

基于 VitePress 构建 · AtomCode v5.2.3 逆向工程分析文档