qwen_agent/.features/skill/decisions/001-architecture.md
朱潮 63d17d355b feat(skill): add feature memory with changelog and decisions
添加 skill 功能的完整记忆文档:

Changelog:
- 2025-Q4: 初始实现 (GRPC 层 + 内置 skills)
- 2026-Q1: API 完善 (REST API + Hook 系统)

Design Decisions:
- 001: Skill 架构设计 (目录结构、Hook 系统)
- 002: 上传安全措施 (ZipSlip、路径遍历防护)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 12:30:56 +08:00

47 lines
1.3 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.

# 001: Skill 架构设计
## 状态
已采纳 (Accepted)
## 上下文
需要为 QWEN_AGENT 模式的机器人提供可扩展的技能(插件/工具)支持,允许动态加载自定义功能。
## 决策
### 目录结构设计
```
skill-name/
├── SKILL.md # 核心指令文档(必需)
├── skill.yaml # 元数据配置(可选)
├── .claude-plugin/
│ └── plugin.json # Hook 和 MCP 配置(可选)
└── scripts/ # 可执行脚本(可选)
```
### Hook 系统
| Hook 类型 | 执行时机 | 用途 |
|-----------|---------|------|
| `PrePrompt` | system_prompt 加载时 | 动态注入用户上下文 |
| `PostAgent` | agent 执行后 | 处理响应结果 |
| `PreSave` | 保存消息前 | 内容过滤/修改 |
### 技能来源
1. **官方 skills**: `./skills/` 目录
2. **用户 skills**: `projects/uploads/{bot_id}/skills/`
## 结果
### 正面影响
- 渐进式加载,按需读取
- 支持多种元数据格式(优先级: plugin.json > SKILL.md
- 完整的 Hook 扩展机制
- MCP 服<><E69C8D><EFBFBD>器配置支持
### 负面影响
- 需要管理文件系统权限
- 技能包格式验证复杂度增加
## 替代方案
1. 使用数据库存储(拒绝:文件更灵活)
2. 仅支持单一格式(拒绝:用户多样性需求)