refactor: 四个全局技能复盘优化(v2.4.0)

P0 结构性修复:
- update-agent 阶段 5 统一为 HTTP API,移除所有 Git 操作示例
- create-agent 响应格式与实际 API 对齐
- delete-agent 合并"前置检查"与"错误处理"

P1 一致性修复:
- 统一 frontmatter 字段顺序、tags 英文化
- 提取 AgentFS 背景知识到共享 _agentfs-background.md
- 受保护路径统一引用 _protected-paths.yaml

P2 缺失补充:
- discover-agent 补充"了解更多"API 实现
- update-agent 新增 Persona 修改示例
- create-agent 补充"修改"分支交互流程
- delete-agent 补充停止 Agent 方式

P3 精简优化:
- 精简版本回滚、删除范围、匹配算法描述

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 22:47:09 +08:00
parent 41afa07fbe
commit 0e013567d3
9 changed files with 206 additions and 204 deletions

View File

@@ -0,0 +1,37 @@
# AgentFS 背景知识(共享)
> 此文件由 create-agent、update-agent 等元技能共享引用。
> 以下信息仅供 Agent 内部理解,**不要向用户展示**。
## AgentFS v2 仓库结构
每个 Agent 的仓库遵循 AgentFS v2 扁平结构:
```
<agent_id>/
├── agent.json # 元数据与运行时配置
├── persona.md # 人格定义L0/L1/L2
├── principles.md # 行为原则L0/L1/L2
├── memory/ # 记忆目录
├── skills/ # 技能目录
├── tools/ # 工具目录
└── heartbeat/ # 心跳配置
```
## 关键文件说明
| 文件 | 验证 API | 常见问题 |
|------|---------|---------|
| `agent.json` | `GET /api/agents/:id` 返回完整配置 | engine 字段缺失导致无法启动 |
| `persona.md` | `GET /api/agents/:id/persona` 返回结构化数据 | L0 为空则 Agent 无身份摘要 |
| `principles.md` | `GET /api/agents/:id/principles` 返回结构化数据 | must_not 为空则无安全红线 |
| `memory/` | 目录存在即可 | `_policy.json` 缺失会使用默认策略 |
## 受保护路径
详见 `_protected-paths.yaml`。核心规则:
- `persona.md` L0 section — **block**(核心身份,不可自动修改)
- `principles.md` "绝不做" section — **block**(安全红线,需人类显式修改)
- `agent.json` access_control / privacy — **owner_only**(需 owner 确认)
- `tools/` permissions / credentials — **owner_only / block**(敏感操作)