Files
nexus/wiki/concepts/ToolWrapper.md

48 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: tool-wrapper
title: "ToolWrapper"
type: concept
tags: [Agent, Skill, 设计模式]
sources: []
last_updated: 2026-03-19
---
# ToolWrapper
将某个库或框架的规范文档打包成skill的包装模式。Agent只有在真正用到该技术时才会动态加载相关文档references/目录而非将所有规则塞入system prompt。
## 定义
ToolWrapper是一种Skill设计模式核心机制是**按需加载**——将领域知识、编码规范、最佳实践封装为可触发的文档模块仅在Agent检测到相关关键词时激活对应知识。
## 机制
- references/目录存放具体技术文档如conventions.md
- SKILL.md监听特定关键词或事件
- 当用户开始使用某技术时,动态加载对应规范
- 规范被Agent当作"绝对真理"执行
## 适用场景
- 团队内部编码规范分发
- 特定框架最佳实践封装
- 减少system prompt信息过载
- 需要精确控制规范版本和加载时机
## 优点
- 按需加载不浪费上下文token
- 规范独立,便于单独更新维护
- Agent只在需要时才加载避免干扰
## 缺点
- 需要预先识别和封装所有相关知识
- 关键词触发机制可能遗漏边界情况
- 多skill并发时可能有加载冲突
## 关系
- 上位概念:[[AgentSkill设计模式]]
- 并列模式:[[Generator]]、[[Reviewer]]、[[Inversion]]、[[Pipeline]]