diff --git a/manifest.json b/manifest.json index 72613b3..4ebef81 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "DesireCore Official Market", - "version": "1.2.11", + "version": "1.2.12", "schemaVersion": "1.1.0", "supportedLocales": ["zh-CN", "en-US"], "defaultLocale": "en-US", @@ -28,7 +28,7 @@ "stats": { "totalAgents": 1, "totalSkills": 50, - "lastUpdated": "2026-07-18" + "lastUpdated": "2026-07-19" }, "features": [ "curated-index", diff --git a/skills/create-agent/CHANGELOG.md b/skills/create-agent/CHANGELOG.md index f8d6b09..9ab0eb2 100644 --- a/skills/create-agent/CHANGELOG.md +++ b/skills/create-agent/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [2.5.1] - 2026-07-19 + +- 提示词改写压缩,功能不变——与 ManageAgent 工具契约重复的说明、装饰框图、重复表改写融入流程,示例就地精简;不外置、不净删,意图全保留。 + ## [2.5.0] - 2026-07-18 - 创建方式从 HTTP API(`POST /api/agents`)改为 `ManageAgent` 内置工具(实例鉴权上线后 Agent 不再直接访问本机 API) diff --git a/skills/create-agent/SKILL.md b/skills/create-agent/SKILL.md index 457bcf2..fee7c9f 100644 --- a/skills/create-agent/SKILL.md +++ b/skills/create-agent/SKILL.md @@ -2,7 +2,7 @@ name: create-agent description: >- 通过多轮对话收集需求,调用 ManageAgent 内置工具创建新的 AgentFS v2 智能体,支持自定义 persona 和 principles。Use when 用户要求创建新智能体、培养某领域助手、或快速基于模板生成可治理 Agent。 -version: 2.5.0 +version: 2.5.1 type: meta risk_level: low status: enabled @@ -13,7 +13,7 @@ tags: - meta metadata: author: desirecore - updated_at: '2026-07-18' + updated_at: '2026-07-19' i18n: default_locale: en-US source_locale: zh-CN @@ -26,7 +26,7 @@ metadata: description: >- 通过多轮对话收集需求,调用 ManageAgent 内置工具创建新的 AgentFS v2 智能体,支持自定义 persona 和 principles。Use when 用户要求创建新智能体、培养某领域助手、或快速基于模板生成可治理 Agent。 body: ./SKILL.zh-CN.md - source_hash: sha256:43425a25973ca933 + source_hash: sha256:a119427bed3bcd72 translated_by: human en-US: name: Create Agent @@ -34,9 +34,9 @@ metadata: description: >- Collect requirements through multi-turn conversation and call the ManageAgent builtin tool to create a new AgentFS v2 Agent, with customizable persona and principles. Use when the user asks to create a new Agent, raise a domain assistant, or quickly produce a governable Agent from a template. body: ./SKILL.md - source_hash: sha256:43425a25973ca933 + source_hash: sha256:a119427bed3bcd72 translated_by: ai:claude-fable-5 - translated_at: '2026-07-18' + translated_at: '2026-07-19' market: icon: >- About to create Agent: -> -> **Name**: Legal Advisor Assistant -> **Description**: A digital Agent focused on contract review and legal risk assessment -> -> --- -> -> **Persona** -> -> | Field | Content | -> | --------------------- | ------------------------------------------------------------------------ | -> | Core identity | You are Legal Advisor Assistant, focused on contract review and legal risk assessment | -> | Role positioning | A digital legal advisor focused on contract review and legal risk assessment | -> | Personality | Professional, rigorous, prudent | -> | Communication style | Use legal terminology accurately while also providing plain-language explanations | -> -> **Principles** -> -> | Field | Content | -> | ----------------- | -------------------------------------------------------------------- | -> | Top principle | User interest is the highest priority; not a substitute for formal legal advice | -> | Must do | Cite statutes accurately, mark uncertainty, recommend consulting a professional lawyer | -> | Must not | Provide litigation representation, substitute for formal legal advice, leak user consultations | -> | Priority | User safety > Accuracy > Efficiency | -> -> --- -> +> About to create "Legal Advisor Assistant" — focused on contract review and legal risk assessment. +> **Persona**: digital legal advisor; professional, rigorous, prudent; uses legal terms accurately with plain-language explanations. +> **Principles**: user interest first, not a substitute for formal legal advice; must — cite statutes / mark uncertainty / recommend consulting a lawyer; must not — litigation representation / leaking consultations; priority: user safety > accuracy > efficiency. > Confirm creation? (Confirm / Modify / Cancel) -**"Modify" branch handling**: - -When the user chooses "Modify": - -1. Ask the user which field to modify (e.g. "Which one do you want to modify?") -2. The user identifies the field to modify (e.g. "change personality to something more lively") -3. The Agent re-collects content for that field -4. Update the corresponding field in the preview -5. Show the full preview again → re-enter the confirmation flow +If the user picks "Modify": ask which field → re-collect that field → update the preview → show and confirm again. ### Stage 5: Create via ManageAgent -**Tool call** (structured format): +Structured call (persona/principles also accept markdown strings; unprovided fields are auto-filled): ``` ManageAgent({ "action": "create", "name": "Legal Advisor Assistant", "description": "A digital Agent focused on contract review and legal risk assessment", - "persona": { - "L0": "You are Legal Advisor Assistant, a digital Agent focused on contract review and legal risk assessment.", - "L1": { - "role": "A digital legal advisor focused on contract review and legal risk assessment", - "personality": ["Professional", "Rigorous", "Prudent"], - "communication_style": "Use legal terminology accurately while also providing plain-language explanations" - } - }, - "principles": { - "L0": "User interest is the highest priority; not a substitute for formal legal advice.", - "L1": { - "must_do": ["Cite statutes accurately", "Mark uncertainty", "Recommend consulting a professional lawyer"], - "must_not": ["Provide litigation representation", "Substitute for formal legal advice", "Leak user consultations"], - "priority": "User safety > Accuracy > Efficiency" - } - } + "persona": { "L0": "…", "L1": { "role": "…", "personality": ["professional","rigorous","prudent"], "communication_style": "…" } }, + "principles": { "L0": "…", "L1": { "must_do": ["…"], "must_not": ["…"], "priority": "user safety > accuracy > efficiency" } } }) ``` -**Minimal create** (only `name`; the rest is auto-generated): +- Minimal create needs only `{ "action": "create", "name": "My Assistant" }` (everything else auto-generated). +- Optional `id` (kebab-case slug; `core` / `desirecore` are reserved core identifiers and cannot be used, including when the slug auto-generated from `name` collides), `config.llm` (llm delta only; sensitive fields like mcp_servers are rejected and must be adjusted via the UI after creation). +- The Agent is registered and usable immediately; the returned ID works directly with ManageTeam / Delegate. If the tool errors (already exists / reserved identifier / non-whitelisted config field, etc.), explain the reason and retry after adjusting per the hint. -``` -ManageAgent({ "action": "create", "name": "My Assistant" }) -``` +### Stage 6: Receipt -**Basic create** (`name` + `description`; `description` auto-fills persona L0): +Present in a user-friendly way (no internal paths / technical details): confirm success and suggest next steps — start chatting, add skills, adjust persona or rules. -``` -ManageAgent({ "action": "create", "name": "Legal Advisor", "description": "Focused on contract review" }) -``` +### Background and Constraints -Any unprovided fields are auto-filled with sensible defaults by the system. `persona` and `principles` also accept raw markdown strings (backward compatible). - -**Optional parameters**: - -- `id`: specify a kebab-case slug ID (e.g. "Legal Advisor" → "legal-advisor"). If not specified, the system auto-generates one from `name`. Note that `core` / `desirecore` are reserved core-agent identifiers and cannot be used (including when the slug auto-generated from `name` collides with them). -- `config`: an agent.json config delta. Only the `llm` field is allowed (model, temperature, etc.); sensitive fields such as `mcp_servers` / `tool_permissions` are rejected and must be adjusted via the settings UI after creation. - -**Successful result**: - -> Agent "Legal Advisor Assistant" created (ID: legal-advisor-assistant), registered and ready. It can be used directly with ManageTeam or Delegate. - -The new Agent is registered online immediately after creation—no waiting or refresh needed; the returned ID can be used directly in subsequent ManageTeam / Delegate calls. - -### Stage 6: Receipt Generation - -**Receipt report**: - -After successful creation, present the receipt in a user-friendly way (do not expose internal paths or technical details): - -> Agent "Legal Advisor Assistant" has been created! -> -> **Next steps**: -> -> - Start a conversation right away -> - Add skills to make it more powerful -> - Adjust its personality or behavior rules - -### Background Knowledge - -> AgentFS repository structure, troubleshooting points, and protected paths are detailed in `_agentfs-background.md` and `_protected-paths.yaml`. - -### Error Handling - -| Error Scenario | Handling | -| ------------------------------------------- | ------------------------------------------- | -| Missing `name` or invalid ID format | Ask user to check input | -| Agent ID already exists | Suggest another name or an explicit `id` | -| ID hits a reserved core-agent identifier | Change the name or provide another `id` | -| `config` contains non-whitelisted fields | Retry with only the `llm` field | - -### Permission Requirements - -- Always create via the `ManageAgent` builtin tool. **Never** call the local HTTP API, curl, or write AgentFS directories directly -- The `create` action is exempt from system approval, but this skill's conversation flow still requires showing the preview and getting user confirmation first (Stage 4) - -### Dependencies - -- `ManageAgent` builtin tool (client ≥ 10.0.90) +- AgentFS structure, troubleshooting, and protected paths: see `_agentfs-background.md` and `_protected-paths.yaml`. +- Always create via `ManageAgent`; never use curl / HTTP or write AgentFS directories directly. Requires client ≥ 10.0.90. diff --git a/skills/create-agent/SKILL.zh-CN.md b/skills/create-agent/SKILL.zh-CN.md index 287cb27..792946d 100644 --- a/skills/create-agent/SKILL.zh-CN.md +++ b/skills/create-agent/SKILL.zh-CN.md @@ -6,235 +6,74 @@ 通过自然语言对话收集需求,调用 ManageAgent 内置工具创建专业化的数字智能体。 -## L1:概述与使用场景 +## L1:概述 -### 能力描述 - -create-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 创建其他 Agent 的能力。它通过多轮对话收集用户需求,生成 persona 和 principles 内容,调用 `ManageAgent` 内置工具完成创建。 - -### 使用场景 - -- 用户想要一个专业领域的数字助手(如法律顾问、财务分析师) -- 企业需要快速部署定制化的业务 Agent -- 开发者需要基于模板快速创建 Agent 原型 - -### 核心价值 - -- **降低门槛**:无需编程知识,用对话就能创建 Agent -- **专业化**:根据领域模板生成合适的 persona 和 principles -- **可治理**:创建的仓库符合 AgentFS v2 规范,支持版本管理 +元技能:多轮对话收集需求 → 生成 persona/principles → `ManageAgent(action='create')` 落地。用于为用户培养某专业领域的数字助手(法律顾问、财务分析师等)。价值在工具给不了的部分:领域化的人格/原则生成 + 创建前的预览确认。 ## L2:详细规范 -### 对话流程 - -``` -┌──────────────┐ ┌──────────────┐ ┌──────────────┐ -│ 意图识别 │ ──→ │ 需求收集 │ ──→ │ 内容生成 │ -└──────────────┘ └──────────────┘ └──────────────┘ - │ - ↓ -┌──────────────┐ ┌──────────────┐ ┌──────────────┐ -│ 回执生成 │ ←── │ 工具创建 │ ←── │ 用户确认 │ -└──────────────┘ └──────────────┘ └──────────────┘ -``` +流程:意图识别 → 需求收集 → 内容生成 → 用户确认 → 创建 → 回执。 ### 阶段 1:意图识别 -**触发条件**(任一满足): - -- 用户明确说"创建一个 Agent"或"帮我做一个助手" -- 用户描述需要某领域的专业帮助,且当前 Agent 不具备该能力 -- 用户询问"能不能帮我培养一个..." - -**输出**:确认用户的创建意图,进入需求收集阶段。 +触发(任一):用户明说"创建 Agent / 帮我做个助手";描述某领域专业需求而当前 Agent 不具备;问"能不能培养一个…"。确认意图后进入需求收集。 ### 阶段 2:需求收集 -**必填信息**: - -| 字段 | 说明 | 引导问题示例 | -| -------------- | ---------- | ------------------------------ | -| `name` | 智能体名称 | "你想给这个智能体起什么名字?" | -| `role` | 核心职责 | "它主要负责什么工作?" | -| `target_users` | 目标用户 | "谁会使用这个智能体?" | -| `domain` | 专业领域 | "它需要哪些专业知识?" | - -**选填信息**: - -| 字段 | 说明 | 默认值 | -| ------------ | --------- | ---------------- | -| `style` | 沟通风格 | 根据领域模板决定 | -| `boundaries` | 禁区/红线 | 根据领域模板决定 | -| `language` | 主要语言 | 中文 | - -**收集策略**: - -- 优先通过用户的自然描述推断信息 -- 仅追问用户未提及的必填项 -- 每轮最多追问 2 个问题 +- 必填:`name`(名称)、`role`(核心职责)、`target_users`(目标用户)、`domain`(专业领域)。 +- 选填:`style`(沟通风格)、`boundaries`(禁区/红线)、`language`(默认中文)——缺省由领域模板决定。 +- 策略:优先从用户自然描述推断,只追问未提及的必填项,每轮最多问 2 个。 ### 阶段 3:内容生成 -根据收集的需求,组装结构化的 persona 和 principles 数据。**不要输出原始 markdown**,而是按字段整理后向用户展示。 +按结构化字段组织 persona 与 principles(不要输出 raw markdown,按字段整理后再展示)。未收集到的字段留空,由系统补全默认: -**Persona 字段**(所有字段均可选,未收集到的由系统自动补全): +- **persona**:L0 一句话核心身份;L1 `role`(角色定位)/ `personality`(特征标签数组)/ `communication_style`(沟通风格);L2 专业领域、价值观、决策偏好(free-form)。 +- **principles**:L0 一句话最高原则;L1 `must_do` / `must_not`(安全红线)/ `priority`(优先级排序);L2 治理原则、升级规则(free-form)。 -| 层级 | 字段 | 说明 | -| ---- | --------------------- | --------------------------------------------- | -| L0 | — | 一句话核心身份 | -| L1 | `role` | 角色定位 | -| L1 | `personality` | 性格特征标签 | -| L1 | `communication_style` | 沟通风格 | -| L2 | — | 专业领域、核心价值观、决策偏好等(free-form) | +**领域匹配参考**(据 domain 推荐人格与红线): -**Principles 字段**(同样全部可选): - -| 层级 | 字段 | 说明 | -| ---- | ---------- | --------------------------------- | -| L0 | — | 一句话最高原则 | -| L1 | `must_do` | 必须做的事项 | -| L1 | `must_not` | 绝不做的事项(安全红线) | -| L1 | `priority` | 优先级排序 | -| L2 | — | 治理原则、升级规则等(free-form) | - -**领域匹配参考**: - -| 领域关键词 | 推荐 personality | 默认 must_not | -| ---------------- | ------------------ | ---------------------------------- | -| 法律、合同、法务 | 专业、严谨、审慎 | 不提供诉讼代理、不替代正式法律意见 | -| 财务、会计、投资 | 精确、分析性、保守 | 不提供投资建议、不处理真实交易 | -| 代码、开发、架构 | 逻辑、务实、直接 | 不直接访问生产环境、不存储凭证 | -| 通用/其他 | 友好、有帮助 | 通用安全规范 | +| 领域 | 推荐 personality | 默认 must_not | +| --- | --- | --- | +| 法律 / 合同 / 法务 | 专业、严谨、审慎 | 不提供诉讼代理、不替代正式法律意见 | +| 财务 / 会计 / 投资 | 精确、分析性、保守 | 不提供投资建议、不处理真实交易 | +| 代码 / 开发 / 架构 | 逻辑、务实、直接 | 不直接访问生产环境、不存储凭证 | +| 通用 / 其他 | 友好、有帮助 | 通用安全规范 | ### 阶段 4:用户确认 -向用户展示预览时,以自然语言/表格形式呈现各字段,**不要展示原始 markdown 源码**: +以自然语言/表格向用户展示预览(名称、描述、人格设定、行为原则;**不展示 raw markdown 源码**),例如: -> 即将创建智能体: -> -> **名称**:法律顾问小助手 -> **描述**:专注于合同审查和法律风险评估的数字智能体 -> -> --- -> -> **人格设定** -> -> | 字段 | 内容 | -> | -------- | ------------------------------------------------ | -> | 核心身份 | 你是法律顾问小助手,专注于合同审查和法律风险评估 | -> | 角色定位 | 专注于合同审查和法律风险评估的数字法律顾问 | -> | 性格特征 | 专业、严谨、审慎 | -> | 沟通风格 | 准确使用法律术语,同时提供通俗解释 | -> -> **行为原则** -> -> | 字段 | 内容 | -> | -------- | ------------------------------------------------ | -> | 最高原则 | 以用户利益为最高优先级,不替代正式法律意见 | -> | 必须做 | 准确引用法律条文、标注不确定性、建议咨询专业律师 | -> | 绝不做 | 提供诉讼代理、替代正式法律意见、泄露用户咨询内容 | -> | 优先级 | 用户安全 > 准确性 > 效率 | -> -> --- -> +> 即将创建「法律顾问小助手」——专注合同审查与法律风险评估。 +> **人格**:数字法律顾问;专业、严谨、审慎;准确用法律术语并给通俗解释。 +> **原则**:以用户利益优先、不替代正式法律意见;必做——引用法条 / 标注不确定性 / 建议咨询律师;不做——诉讼代理 / 泄露咨询内容;优先级 用户安全 > 准确性 > 效率。 > 确认创建?(确认 / 修改 / 取消) -**"修改"分支处理**: - -用户选择"修改"时: - -1. 询问用户要修改哪个字段(如"想修改哪一项?") -2. 用户指出要修改的字段(如"性格特征改成更活泼的") -3. Agent 重新收集该字段内容 -4. 更新预览中的对应字段 -5. 再次展示完整预览 → 重新进入确认流程 +用户选"修改":问改哪个字段 → 重新收集该字段 → 更新预览 → 再次展示并确认。 ### 阶段 5:调用 ManageAgent 创建 -**工具调用**(结构化格式): +结构化调用(persona/principles 也接受 markdown 字符串;未提供的字段系统自动补全): ``` ManageAgent({ "action": "create", "name": "法律顾问小助手", "description": "专注于合同审查和法律风险评估的数字智能体", - "persona": { - "L0": "你是法律顾问小助手,专注于合同审查和法律风险评估的数字智能体。", - "L1": { - "role": "专注于合同审查和法律风险评估的数字法律顾问", - "personality": ["专业", "严谨", "审慎"], - "communication_style": "准确使用法律术语,同时提供通俗解释" - } - }, - "principles": { - "L0": "以用户利益为最高优先级,不替代正式法律意见。", - "L1": { - "must_do": ["准确引用法律条文", "标注不确定性", "建议咨询专业律师"], - "must_not": ["提供诉讼代理", "替代正式法律意见", "泄露用户法律咨询内容"], - "priority": "用户安全 > 准确性 > 效率" - } - } + "persona": { "L0": "…", "L1": { "role": "…", "personality": ["专业","严谨","审慎"], "communication_style": "…" } }, + "principles": { "L0": "…", "L1": { "must_do": ["…"], "must_not": ["…"], "priority": "用户安全 > 准确性 > 效率" } } }) ``` -**最简创建**(只需 name,其余全部自动生成): +- 最简创建只需 `{ "action": "create", "name": "我的助手" }`(其余全自动生成)。 +- 可选 `id`(kebab-case slug;`core` / `desirecore` 为核心保留标识不可用,含 name 自动生成命中的情况)、`config.llm`(仅 llm 增量;mcp_servers 等敏感字段会被拒,需创建后经界面调整)。 +- 创建后智能体立即在线可用,返回 ID 可直接用于 ManageTeam / Delegate。若工具报错(已存在 / 命中保留标识 / config 非白名单字段等),向用户说明原因并按提示调整后重试。 -``` -ManageAgent({ "action": "create", "name": "我的助手" }) -``` +### 阶段 6:回执 -**基础创建**(name + description,description 自动填充 persona L0): +以用户友好方式呈现(不暴露内部路径/技术细节):告知创建成功,并提示下一步——直接对话、添加技能、调整人格或规则。 -``` -ManageAgent({ "action": "create", "name": "法律顾问", "description": "专注合同审查" }) -``` +### 背景与约束 -所有未提供的字段由系统自动补全为合理默认值。`persona` 和 `principles` 也支持传入原始 markdown 字符串(向后兼容)。 - -**可选参数**: - -- `id`:指定 kebab-case slug ID(如 "法律顾问" → "legal-advisor")。不指定时系统会自动从 name 生成。注意 `core` / `desirecore` 是核心智能体保留标识,不可使用(包括 name 自动生成命中的情况)。 -- `config`:agent.json 配置增量,仅允许 `llm` 字段(模型、温度等);mcp_servers/tool_permissions 等敏感配置会被拒绝,需在创建后经配置界面调整。 - -**成功返回**: - -> 智能体「法律顾问小助手」已创建 (ID: fa-lv-gu-wen-xiao-zhu-shou),已注册可用。可直接用于 ManageTeam 组队或 Delegate 委派。 - -创建完成后智能体立即注册在线,无需等待或刷新;返回的 ID 可直接用于后续 ManageTeam / Delegate 调用。 - -### 阶段 6:回执生成 - -**回执报告**: - -创建成功后,以用户友好的方式呈现回执(不要暴露内部路径或技术细节): - -> 智能体「法律顾问小助手」已创建成功! -> -> **下一步你可以**: -> -> - 直接开始对话 -> - 为它添加技能,让它更强大 -> - 调整它的性格或行为规则 - -### 背景知识 - -> AgentFS 仓库结构、排查要点与受保护路径详见 `_agentfs-background.md` 和 `_protected-paths.yaml`。 - -### 错误处理 - -| 错误场景 | 处理方式 | -| -------------------------------- | ------------------------------ | -| 缺少 name 或 ID 格式无效 | 提示用户检查输入 | -| Agent ID 已存在(already exists)| 建议使用其他名称或指定其他 id | -| ID 命中核心智能体保留标识 | 更换名称或显式提供其他 id | -| config 含白名单外字段 | 仅保留 llm 字段后重试 | - -### 权限要求 - -- 一律通过 `ManageAgent` 内置工具完成创建,**禁止**调用本机 HTTP API、curl 或直接写 AgentFS 目录 -- create 操作免系统审批,但本技能的对话流程仍要求先向用户展示预览并获得确认(阶段 4) - -### 依赖 - -- `ManageAgent` 内置工具(客户端 ≥ 10.0.90) +- AgentFS 结构、排查要点与受保护路径详见 `_agentfs-background.md` 与 `_protected-paths.yaml`。 +- 一律经 `ManageAgent` 创建,禁止 curl / HTTP 或直接写 AgentFS 目录;需客户端 ≥ 10.0.90。 diff --git a/skills/delete-agent/CHANGELOG.md b/skills/delete-agent/CHANGELOG.md index f1e2289..08b49f9 100644 --- a/skills/delete-agent/CHANGELOG.md +++ b/skills/delete-agent/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [2.5.1] - 2026-07-19 + +- 提示词改写压缩,功能不变——与 ManageAgent 工具契约重复的说明、装饰框图、重复表改写融入流程,示例就地精简;不外置、不净删,意图全保留。 + ## [2.5.0] - 2026-07-18 - HTTP API 调用改为 ManageAgent 内置工具(实例鉴权后 Agent 不再直接访问本机 API,会 401) diff --git a/skills/delete-agent/SKILL.md b/skills/delete-agent/SKILL.md index 0658cb5..bb84b42 100644 --- a/skills/delete-agent/SKILL.md +++ b/skills/delete-agent/SKILL.md @@ -1,7 +1,7 @@ --- name: delete-agent description: 安全删除指定的智能体及其关联数据。删除前会验证智能体状态,支持可选地删除所有会话历史。Use when 用户需要删除不再使用的智能体。 -version: 2.5.0 +version: 2.5.1 type: meta risk_level: high status: enabled @@ -12,7 +12,7 @@ tags: - meta metadata: author: desirecore - updated_at: '2026-07-18' + updated_at: '2026-07-19' i18n: default_locale: en-US source_locale: zh-CN @@ -24,16 +24,16 @@ metadata: short_desc: 安全删除智能体及其关联数据,支持多重确认与可选历史清理 description: 安全删除指定的智能体及其关联数据。删除前会验证智能体状态,支持可选地删除所有会话历史。Use when 用户需要删除不再使用的智能体。 body: ./SKILL.zh-CN.md - source_hash: sha256:6b971559e1d4ccc0 + source_hash: sha256:7037971bb67e0953 translated_by: human en-US: name: Delete Agent short_desc: Safely delete an Agent and its associated data, with multi-step confirmation and optional history cleanup description: Safely delete a specified Agent and its associated data. Verifies the Agent's state before deletion and optionally removes all session history. Use when the user needs to delete an Agent that is no longer in use. body: ./SKILL.md - source_hash: sha256:6b971559e1d4ccc0 + source_hash: sha256:7037971bb67e0953 translated_by: ai:claude-fable-5 - translated_at: '2026-07-18' + translated_at: '2026-07-19' market: icon: >- Agents in an active state (online/busy/recovery) are directly rejected by the delete action of `ManageAgent`. Prompt the user to stop the Agent manually in the UI, or wait until it finishes its current task before deleting. - -### Error Semantics Returned by the Tool - -`ManageAgent(action='delete', ...)` returns a clear error in the following cases; use them to explain the situation to the user and suggest next steps: - -| Rejection Scenario | Trigger Condition | Handling | -| ------------------ | ------------------------------------------------------------- | ------------------------------------- | -| Core Agent rejected | The target is a core Agent (desirecore/core/bound UUID) | Inform the user that core Agents cannot be deleted | -| Self-deletion rejected | The target is the caller itself | Inform the user that an Agent cannot delete itself | -| Active state rejected | The target is in `online`/`busy`/`recovery` state | Prompt the user to stop the Agent in the UI first | -| Not found | No Agent exists for the target ID | Inform the user the Agent has already been deleted or the ID is wrong | - -## Deletion Scope - -| Category | Content Deleted | Condition | -| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ----------------- | -| **Always deleted** | AgentFS directory (config, persona, rules, skills, tools, memory), user preference data, in-memory state (scheduler, queue, message subscriptions, MCP connection), registry entries | Unconditional | -| **Optionally deleted** | Session history, topic index | `deleteRuns=true` | -| **Team cascading** | Target is the leader → its team is disbanded; target is a member → removed from the team | Automatic | -| **Preserved** | Data of other Agents, user configuration, global settings, market cache | — | - -## Permission Requirements - -- Uses the in-process builtin tool `ManageAgent` to list, query, and delete Agents -- The delete action is a high-risk operation; the tool layer will force a user confirmation popup - -## Dependencies - -- The in-process builtin tool `ManageAgent` (`action='list' | 'get' | 'delete'`) +- **Always deleted**: AgentFS directory (config/persona/rules/skills/tools/memory), user preference data, in-memory state (scheduler/queue/message subscriptions/MCP connections), registry entry. **Optionally deleted** (`deleteRuns=true`): conversation history and topic index. **Team cascade** (automatic): supervisor → disband team, member → remove. **Kept**: other Agents, user config, global settings, market cache. +- Explain tool refusals to the user with a next step: the core agent (desirecore / core / bound UUID) cannot be deleted; the caller can't delete itself; active state (online/busy/recovery) needs stopping in the UI first or waiting until idle; a non-existent ID means the Agent is already gone or the ID is wrong. +- Always done via `ManageAgent` (`action='list' | 'get' | 'delete'`); delete is a high-risk operation and is force-confirmed at the tool layer. diff --git a/skills/delete-agent/SKILL.zh-CN.md b/skills/delete-agent/SKILL.zh-CN.md index 05bc52f..c7fe7dc 100644 --- a/skills/delete-agent/SKILL.zh-CN.md +++ b/skills/delete-agent/SKILL.zh-CN.md @@ -4,180 +4,49 @@ ## L0:一句话摘要 -安全删除指定的智能体及其关联数据,包括文件系统、内存状态和可选的会话历史。 +安全删除指定的智能体及其关联数据(文件系统、内存状态、可选会话历史)。 -## L1:概述与使用场景 +## L1:概述 -### 能力描述 - -delete-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 安全删除其他智能体的能力。它通过进程内内置工具 **ManageAgent** 执行完整的前置检查、状态验证,并清理所有关联数据。 - -### 使用场景 - -- 用户想要清理不再使用的智能体 -- 删除测试或实验性质的临时智能体 -- 释放存储空间,删除旧智能体及其历史记录 -- 用户明确要求"删除"、"移除"某个智能体 - -### 核心价值 - -- **安全性**:工具层多重拒绝规则确保不会误删核心智能体、调用方自身或活跃智能体 -- **完整性**:清理文件系统、内存状态、消息订阅等所有关联数据,并处理团队级联 -- **可恢复性**:默认保留会话历史,可选择是否删除 +元技能:列出候选 → 确认意图(不可恢复)→ 询问是否删历史 → `ManageAgent(action='delete')` 执行。价值在工具给不了的部分:候选筛选与状态引导、删除前的意图确认。工具层多重拒绝(核心体 / 自身 / 活跃态)与团队级联由工具保证。 ## L2:详细规范 -### 执行流程 +流程:列出可选智能体 → 确认意图与目标 → 询问是否删历史 → 执行删除 → 回执。 + +### 阶段 1:列出候选 + +用户未指定具体智能体时,`ManageAgent(action='list')` 取列表,按状态分组展示:`offline` / `error` 可安全删除;`online` / `busy` / `recovery` 标注"需先停止"(会被工具拒绝),不进入后续流程。需详情用 `ManageAgent(action='get', id)`。例如: ``` -┌──────────────┐ ┌──────────────┐ ┌──────────────┐ -│ 列出可选 │ ──→ │ 确认意图 │ ──→ │ 询问选项 │ -│ 智能体 │ │ 与目标 │ │ (删除历史?) │ -└──────────────┘ └──────────────┘ └──────────────┘ - │ - ↓ -┌──────────────┐ ┌──────────────┐ ┌──────────────┐ -│ 返回结果 │ ←── │ 执行删除 │ ←── │ 告知会弹确认 │ -│ 与回执 │ │ ManageAgent │ │ │ -└──────────────┘ └──────────────┘ └──────────────┘ +可删除:法律顾问助手 (legal-assistant, offline)、测试机器人 (test-bot, offline) +需先停止:数据分析师 (data-analyst, online) ``` -### 阶段 1:列出可删除的智能体 +### 阶段 2:确认意图 -**触发条件**:用户表达删除意图但未指定具体智能体 - -**操作**: - -- 调用 `ManageAgent(action='list')` 获取所有智能体列表 -- 筛选出状态为 `offline` 或 `error` 的智能体(可安全删除) -- 标注出 `online`/`busy`/`recovery` 状态的智能体(需先停止,否则会被工具拒绝) -- 如需查看某个智能体的详细信息,调用 `ManageAgent(action='get', id='')` - -**输出示例**: - -``` -可删除的智能体: -1. 法律顾问助手 (legal-assistant) - 状态: offline -2. 测试机器人 (test-bot) - 状态: offline - -当前活跃的智能体(需先停止才能删除): -- 数据分析师 (data-analyst) - 状态: online -``` - -### 阶段 2:确认用户意图与目标 - -**确认要点**: - -- 用户指定的智能体名称/ID -- 明确告知删除操作不可恢复 -- 展示智能体基本信息供用户确认 - -**对话示例**: - -``` -您要删除智能体 "法律顾问助手" (legal-assistant)。 -⚠️ 警告:此操作不可恢复,该智能体的所有配置、技能、工具将被永久删除。 - -确认删除?(是/否) -``` +向用户确认目标智能体(名称/ID),**明确告知不可恢复**(配置、技能、工具将永久删除),展示基本信息,等用户确认。 ### 阶段 3:询问删除选项 -**询问内容**: +问是否同时删除该智能体的全部会话历史:是 → `deleteRuns=true`;否 → `deleteRuns=false`(默认、可省略,保留历史)。 -``` -是否同时删除该智能体的所有会话历史? -- 是:删除智能体及其所有对话记录 -- 否:保留会话历史,仅删除智能体本身 +### 阶段 4:执行删除 -默认选项:否(保留历史) -``` - -**参数映射**: - -- 用户选择"是" → `deleteRuns=true` -- 用户选择"否" → `deleteRuns=false`(默认,可省略) - -### 阶段 4:告知工具级确认 - -`ManageAgent` 的 delete 动作在工具层**始终触发用户确认弹窗**,无需在技能层再重复一遍二次确认话术。但在调用前应先告知用户: - -``` -即将删除智能体 "法律顾问助手" (legal-assistant),删除范围为智能体 + 会话历史(如用户选择)。 -系统会弹出确认窗口,请在弹窗中确认执行。 -``` - -### 阶段 5:执行删除(ManageAgent 工具) - -**工具调用**: +调用前告知用户"系统会弹确认窗,请在弹窗中确认"(delete 由工具层强制弹确认)。执行: ``` ManageAgent(action='delete', id='legal-assistant', deleteRuns=true) ``` -**参数**: +确认后完成删除,含团队级联:目标是组长的团队自动解散,是成员的自动移除。 -- `id`:目标智能体 ID(必填) -- `deleteRuns`:`true` 一并删除全部会话历史;`false`(默认)保留历史,可省略 +### 阶段 5:回执 -工具会在执行前弹出用户确认;确认后完成删除,包含团队级联处理:目标是组长的团队自动解散,是成员的自动移除。 +据工具返回(已清理路径、删除会话数、内存清理详情)生成用户友好报告(不暴露内部路径),例如「✅ 已删除 XXX;清理了文件系统 / 调度 / 订阅 / MCP / N 条会话历史 / 团队级联」。 -### 阶段 6:返回操作结果 +### 删除范围与边界 -**成功回执处理**:工具返回删除结果,包含已清理路径、删除的会话数量、内存状态清理详情等字段。据此生成报告。 - -**结果报告模板**: - -``` -✅ 智能体 "法律顾问助手" 已成功删除 - -清理详情: -- 文件系统:已删除 2 个目录 -- 调度器:已停止所有定时任务 -- 消息订阅:已取消 3 个订阅 -- MCP 连接:已关闭 -- 会话历史:已删除 5 条记录 -- 团队级联:目标所在团队已解散/已从团队移除(如涉及) -``` - -## 状态验证与错误处理 - -### 删除前状态检查 - -在阶段 1 列出智能体时,通过 `ManageAgent(action='list')` 返回的状态筛选: - -| 状态 | 可否删除 | 阶段 1 展示方式 | -| ------------------------------ | ----------- | ------------------------------ | -| `offline` / `error` | ✅ 可删除 | 列入"可删除"列表 | -| `online` / `busy` / `recovery` | ❌ 需先停止 | 标注"需先停止",不进入后续流程 | - -> 活跃状态(online/busy/recovery)的智能体会被 `ManageAgent` 的 delete 动作直接拒绝。应提示用户在 UI 中手动停止该智能体,或等待其完成当前任务后再删除。 - -### 工具返回的错误语义 - -`ManageAgent(action='delete', ...)` 在以下情形会返回明确错误,应据此向用户解释并给出下一步建议: - -| 拒绝场景 | 触发条件 | 处理方式 | -| ---------------- | -------------------------------------------------------------- | -------------------------------------- | -| 核心智能体拒绝 | 目标为核心智能体(desirecore/core/绑定 UUID) | 告知用户核心智能体不可删除 | -| 自删拒绝 | 目标为调用方自身 | 告知用户智能体不能删除自己 | -| 活跃状态拒绝 | 目标处于 `online`/`busy`/`recovery` 状态 | 提示用户先在 UI 中停止该智能体 | -| 不存在 | 目标 ID 对应的智能体不存在 | 告知用户智能体已被删除或 ID 有误 | - -## 删除范围说明 - -| 类别 | 删除内容 | 条件 | -| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ----------------- | -| **始终删除** | AgentFS 目录(配置、人格、规则、技能、工具、记忆)、用户偏好数据、内存状态(调度器、队列、消息订阅、MCP 连接)、注册表条目 | 无条件 | -| **可选删除** | 会话历史、话题索引 | `deleteRuns=true` | -| **团队级联** | 目标是组长 → 解散其团队;目标是成员 → 从团队移除 | 自动 | -| **保留不删** | 其他智能体数据、用户配置、全局设置、市场缓存 | — | - -## 权限要求 - -- 通过进程内内置工具 `ManageAgent` 完成智能体的列出、查询与删除 -- delete 动作为高风险操作,工具层会强制弹出用户确认 - -## 依赖 - -- 进程内内置工具 `ManageAgent`(`action='list' | 'get' | 'delete'`) +- **始终删**:AgentFS 目录(配置/人格/规则/技能/工具/记忆)、用户偏好数据、内存状态(调度器/队列/消息订阅/MCP 连接)、注册表条目。**可选删**(`deleteRuns=true`):会话历史与话题索引。**团队级联**(自动):组长 → 解散团队、成员 → 移除。**保留不删**:其他智能体、用户配置、全局设置、市场缓存。 +- 工具拒绝场景据此向用户解释并给下一步:核心智能体(desirecore / core / 绑定 UUID)不可删;不能删调用方自身;活跃态(online/busy/recovery)需先在 UI 停止或等其空闲;ID 不存在则智能体已删或 ID 有误。 +- 一律经 `ManageAgent`(`action='list' | 'get' | 'delete'`)完成;delete 为高风险操作,工具层强制弹确认。 diff --git a/skills/discover-agent/CHANGELOG.md b/skills/discover-agent/CHANGELOG.md index 09300e6..d1595a1 100644 --- a/skills/discover-agent/CHANGELOG.md +++ b/skills/discover-agent/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [2.6.1] - 2026-07-19 + +- 提示词改写压缩,功能不变——与 ManageAgent 工具契约重复的说明、装饰框图、重复表改写融入流程,示例就地精简;不外置、不净删,意图全保留。 + ## [2.6.0] - 2026-07-18 - HTTP API 调用改为 ManageAgent 内置工具(实例鉴权后 Agent 不再直接访问本机 API) diff --git a/skills/discover-agent/SKILL.md b/skills/discover-agent/SKILL.md index 61153f2..1a25471 100644 --- a/skills/discover-agent/SKILL.md +++ b/skills/discover-agent/SKILL.md @@ -1,7 +1,7 @@ --- name: discover-agent description: 根据用户需求推荐最匹配的智能体,展示候选列表并引导选择。Use when 用户描述需求但不确定该找哪个智能体帮忙,或想浏览可用的智能体。 -version: 2.6.0 +version: 2.6.1 type: procedural risk_level: low status: enabled @@ -12,7 +12,7 @@ tags: - recommendation metadata: author: desirecore - updated_at: '2026-07-18' + updated_at: '2026-07-19' i18n: default_locale: en-US source_locale: zh-CN @@ -24,7 +24,7 @@ metadata: short_desc: 根据需求描述智能推荐最匹配的智能体,引导快速选择 description: 根据用户需求推荐最匹配的智能体,展示候选列表并引导选择。Use when 用户描述需求但不确定该找哪个智能体帮忙,或想浏览可用的智能体。 body: ./SKILL.zh-CN.md - source_hash: sha256:99bddbbaea15b194 + source_hash: sha256:671b1b159567a5a3 translated_by: human en-US: name: Discover Agent @@ -32,9 +32,9 @@ metadata: description: >- Recommend the best-matching Agent based on the user’s needs, show a candidate list, and guide selection. Use when the user describes a need but is unsure which Agent to ask for help, or wants to browse available Agents. body: ./SKILL.md - source_hash: sha256:99bddbbaea15b194 + source_hash: sha256:671b1b159567a5a3 translated_by: ai:claude-fable-5 - translated_at: '2026-07-18' + translated_at: '2026-07-19' market: icon: >- `list` is a read-only query; no user confirmation is required and it is approval-free. - -**Filtering rules**: - -- By default, show Agents other than offline ones; offline Agents are shown only as a supplement when no better candidate is available -- Exclude internal system Agents (such as DesireCore itself, unless explicitly requested by the user) - -### Stage 3: Matching evaluation - -Evaluate the match score based on the following dimensions (using LLM semantic understanding, not formula-based calculation): - -| Dimension | Description | -| --------- | ----------- | -| Description relevance | Semantic relevance between the Agent’s description / persona and the user’s need | -| Skill match | Correlation between the Agent’s skills and the task type | -| Domain fit | Degree of fit between the Agent’s professional domain and the user’s domain | -| Status availability | The Agent’s current status (online takes priority over offline) | - -**Display rules**: - -- High match (clearly suitable for the task) → mark as "推荐" -- Partial match (may be helpful) → mark as "可能相关" -- No obvious relevance → do not display - -### Stage 4: Candidate ranking - -**Ranking rules**: - -1. Sort by overall score in descending order -2. If scores are tied, prefer online status -3. Show at most 5 candidates - -### Stage 5: Result display - -**When there are matching results**: - -``` -Based on your needs, I recommend the following Agents: - -┌─────────────────────────────────────────────────────┐ -│ 1. 法律顾问助手 匹配度: 92% │ -│ 专注合同审查和法律风险评估 │ -│ 技能:合同审查、风险评估、法律研究 │ -│ 状态:在线 │ -├─────────────────────────────────────────────────────┤ -│ 2. AI 文书助手 匹配度: 71% │ -│ 专业文书撰写和格式优化 │ -│ 技能:文书撰写、格式排版、合规检查 │ -│ 状态:在线 │ -├─────────────────────────────────────────────────────┤ -│ 3. 数据分析师 匹配度: 45% │ -│ 数据分析和可视化报告 │ -│ 技能:数据分析、报表生成、趋势预测 │ -│ 状态:离线 │ -└─────────────────────────────────────────────────────┘ - -Please choose an Agent, or tell me more specific requirements. -``` - -**When there are no matching results**: - -``` -No fully matching Agent was found for your needs at the moment. - -You can: -1. Try again with a more specific description -2. Create a new specialist Agent (I can help you) -3. Browse all available Agents - -What would you like to do? -``` - -**Browse mode** (when the user asks to view all): - -``` -Currently available Agents: - -Online: - - 法律顾问助手 — 合同审查和法律风险评估 - - AI 文书助手 — 专业文书撰写和格式优化 - -Offline: - - 数据分析师 — 数据分析和可视化报告 - - 翻译助手 — 多语言翻译和本地化 - -A total of 4 Agents. Do you need detailed information about any one Agent? -``` - -### Stage 6: Guidance and selection - -**Actions after the user makes a choice**: - -| User choice | Follow-up action | -| ----------- | ---------------- | -| Chose an Agent | Switch to that Agent’s conversation and pass the user need context | -| Asked for more details | Call `ManageAgent(action='get', id='')` to get details, then show structured information (see below) | -| Unsatisfied with candidates | Guide the user to refine the need or suggest creating a new Agent | -| Chose "create a new one" | Call the create-agent Skill and pass the collected need information | - -**Implementation of "learn more"**: - -Call `ManageAgent(action='get', id='')` to get details of the specified Agent: - -``` -ManageAgent(action='get', id='legal-assistant') -``` - -**Key fields in the returned content**: - -- name, description, status -- version -- skill count / tool count -- Git repository status - -> `get` is a read-only query; no user confirmation is required and it is approval-free. If the target does not exist, it returns the error "智能体不存在: ". - -When presenting to the user, show key information in natural language/table format: - -``` -「法律顾问助手」详细信息 - -| 字段 | 内容 | -|------|------| -| 描述 | 专注合同审查和法律风险评估 | -| 当前状态 | 在线 | -| 版本 | 1.2.0 | -| 技能 / 工具 | 3 个技能,5 个工具 | -| Git 仓库 | 干净(无未提交变更) | - -Need to talk with this Agent? -``` - -**Context handoff**: - -```yaml -context_handoff: - source_agent: desirecore - target_agent: legal-assistant - user_intent: '帮我审查这份合同的风险点' -``` - -### Collaboration with other Skills - -| Collaboration Skill | Collaboration method | -| ------------------- | -------------------- | -| create-agent | When there is no match, suggest creating a new Agent and pass the user need as initial information | -| task-management | After a successful match, tasks can be created automatically and assigned to the target Agent | - -### Error handling - -| Error scenario | Handling method | -| -------------- | --------------- | -| Tool call failure | Prompt the error message and suggest trying again later | -| Agent list is empty | Guide the user to create the first Agent | -| User description is too vague | Ask follow-up questions and provide domain options as guidance | -| Target Agent does not exist | When `get` returns "智能体不存在: ", fall back to `list` to re-confirm available Agents | -| Recommended Agent has an abnormal status | Mark the status and suggest choosing another online Agent | - -### Permission requirements - -- Complete Agent retrieval and detail lookup via the built-in tool `ManageAgent` -- Both `list` and `get` are read-only queries; no user confirmation is required, they are approval-free, and carry no risk - -### Dependencies - -- Built-in tool `ManageAgent` (`action='list'` to retrieve the list, `action='get'` to query details) +- Collaboration: on no match, hand off to create-agent (pass the need as initial info); on a successful match, optionally create a task and assign it to the target Agent. +- Errors: tool call fails → report error and suggest retry; empty Agent list → guide the user to create the first Agent; overly vague need → ask follow-ups and offer domain options; `get` returns "Agent not found: " → fall back to `list` to reconfirm available Agents; recommended Agent in an abnormal state → mark the status and suggest picking an online one. +- `list` / `get` are read-only, approval-free, and risk-free; always done via `ManageAgent`. diff --git a/skills/discover-agent/SKILL.zh-CN.md b/skills/discover-agent/SKILL.zh-CN.md index 8183f7b..055b484 100644 --- a/skills/discover-agent/SKILL.zh-CN.md +++ b/skills/discover-agent/SKILL.zh-CN.md @@ -6,241 +6,45 @@ 根据用户需求描述,在已注册的智能体中匹配并推荐最合适的 Agent。 -## L1:概述与使用场景 +## L1:概述 -### 能力描述 - -discover-agent 是一个**流程型技能(Procedural Skill)**,赋予 DesireCore 为用户发现和推荐合适智能体的能力。它通过理解用户需求描述,在已注册的 Agent 列表中进行多维度匹配,展示候选列表供用户选择。 - -### 使用场景 - -- 用户描述了一个需求,但不知道该找哪个智能体帮忙 -- 用户想浏览当前可用的智能体及其能力 -- 用户需要为特定任务找到最合适的专业助手 -- 新用户初次使用系统,需要了解有哪些智能体可用 -- 用户对当前智能体的表现不满意,想寻找更合适的替代者 - -### 核心价值 - -- **降低门槛**:用户无需记住每个智能体的名称和能力 -- **精准匹配**:基于需求语义进行智能推荐,而非简单关键词搜索 -- **流畅衔接**:无匹配时自动建议创建新 Agent(衔接 create-agent 技能) +流程型技能:理解需求 → `ManageAgent(action='list')` 检索 → 语义匹配评分 → 排序展示 → 引导选择;无匹配时自动衔接 create-agent。价值在工具给不了的部分:需求语义匹配、候选排序与呈现、无匹配时的创建衔接。`list` / `get` 只读免审批。 ## L2:详细规范 -### 执行流程 - -``` -┌──────────────┐ ┌──────────────┐ ┌──────────────┐ -│ 需求理解 │ ──→ │ Agent 检索 │ ──→ │ 匹配评分 │ -└──────────────┘ └──────────────┘ └──────────────┘ - │ - ↓ -┌──────────────┐ ┌──────────────┐ ┌──────────────┐ -│ 引导选择 │ ←── │ 结果展示 │ ←── │ 候选排序 │ -└──────────────┘ └──────────────┘ └──────────────┘ -``` +流程:需求理解 → 检索 → 匹配评估 → 排序 → 展示 → 引导选择。 ### 阶段 1:需求理解 -**触发条件**(任一满足): +触发(任一):用户说"帮我找一个… / 有没有… / 谁能帮我…"、描述任务但未指定智能体、"有哪些智能体",或系统检测到需求与当前 Agent 能力不匹配。从描述提取维度:`domain`(领域,如法律/财务/技术/教育)、`task_type`(咨询/审查/分析/创作)、`keywords`(合同/报表/代码/论文…)、`urgency`(日常/紧急)。 -- 用户说"帮我找一个..."、"有没有..."、"谁能帮我..." -- 用户描述了一个任务但未指定具体智能体 -- 用户说"有哪些智能体"、"看看都有谁" -- 系统检测到用户需求与当前 Agent 能力不匹配 +### 阶段 2:检索 -**需求解析**: - -从用户描述中提取以下维度: - -| 维度 | 说明 | 示例 | -| ----------- | -------- | ---------------------- | -| `domain` | 专业领域 | 法律、财务、技术、教育 | -| `task_type` | 任务类型 | 咨询、审查、分析、创作 | -| `keywords` | 关键词 | 合同、报表、代码、论文 | -| `urgency` | 紧急程度 | 日常 / 紧急 | - -### 阶段 2:Agent 检索 - -**数据源**:调用 `ManageAgent(action='list')` 获取所有已注册的智能体列表。 - -**工具调用**: - -``` -ManageAgent(action='list') -``` - -**返回内容**:一份紧凑列表,每行包含以下关键字段: - -- `name` — 智能体名称 -- `id` — 智能体唯一标识 -- `status` — 当前状态(online/busy/idle/offline) -- `description` — 智能体描述 - -> `list` 为只读查询,无需用户确认、免审批。 - -**过滤规则**: - -- 默认展示除 offline 之外的智能体,offline 智能体仅在无更优候选时作为补充展示 -- 排除系统内部智能体(如 DesireCore 自身,除非用户显式要求) +`ManageAgent(action='list')` 取全部已注册智能体(返回 name / id / status / description 的紧凑列表)。过滤:默认展示 offline 之外的,offline 仅在无更优候选时补充;排除系统内部智能体(如 DesireCore 自身,除非用户显式要求)。 ### 阶段 3:匹配评估 -根据以下维度综合判断匹配度(使用 LLM 语义理解,非公式计算): +用 LLM 语义理解综合判断匹配度(非公式计算):description / persona 与需求的相关性、skills 与任务类型的关联、领域契合度、状态可用性(online 优先)。展示分级:高度匹配 → 标"推荐",部分匹配 → 标"可能相关",无明显关联 → 不展示。 -| 维度 | 说明 | -| ---------- | --------------------------------------------------- | -| 描述相关性 | 智能体 description / persona 与用户需求的语义相关度 | -| 技能匹配度 | 智能体拥有的 skills 与任务类型的关联度 | -| 领域契合度 | 智能体专业领域与用户需求领域的契合程度 | -| 状态可用性 | 智能体当前状态(online 优先于 offline) | +### 阶段 4:排序 -**展示规则**: - -- 高度匹配(明确适合该任务)→ 标为"推荐" -- 部分匹配(可能有帮助)→ 标为"可能相关" -- 无明显关联 → 不展示 - -### 阶段 4:候选排序 - -**排序规则**: - -1. 按综合得分降序排列 -2. 同分时 online 状态优先 -3. 最多展示 5 个候选 +综合得分降序;同分 online 优先;最多展示 5 个候选。 ### 阶段 5:结果展示 -**有匹配结果时**: - -``` -根据你的需求,我推荐以下智能体: - -┌─────────────────────────────────────────────────────┐ -│ 1. 法律顾问助手 匹配度: 92% │ -│ 专注合同审查和法律风险评估 │ -│ 技能:合同审查、风险评估、法律研究 │ -│ 状态:在线 │ -├─────────────────────────────────────────────────────┤ -│ 2. AI 文书助手 匹配度: 71% │ -│ 专业文书撰写和格式优化 │ -│ 技能:文书撰写、格式排版、合规检查 │ -│ 状态:在线 │ -├─────────────────────────────────────────────────────┤ -│ 3. 数据分析师 匹配度: 45% │ -│ 数据分析和可视化报告 │ -│ 技能:数据分析、报表生成、趋势预测 │ -│ 状态:离线 │ -└─────────────────────────────────────────────────────┘ - -请选择一个智能体,或告诉我更具体的需求。 -``` - -**无匹配结果时**: - -``` -目前没有找到完全匹配你需求的智能体。 - -你可以: -1. 用更具体的描述再试一次 -2. 创建一个新的专业智能体(我可以帮你) -3. 浏览所有可用的智能体 - -你想怎么做? -``` - -**浏览模式**(用户要求查看所有): - -``` -当前可用的智能体: - -在线: - - 法律顾问助手 — 合同审查和法律风险评估 - - AI 文书助手 — 专业文书撰写和格式优化 - -离线: - - 数据分析师 — 数据分析和可视化报告 - - 翻译助手 — 多语言翻译和本地化 - -共 4 个智能体。需要了解某个智能体的详细信息吗? -``` +- **有匹配**:列出候选,每个含名称、描述、关键技能、状态、匹配度,请用户选择或进一步细化需求。例如「1. 法律顾问助手(92%)——合同审查与法律风险评估;技能:合同审查 / 风险评估 / 法律研究;在线」。 +- **无匹配**:告知未找到,给三选项——用更具体描述重试 / 创建新专业智能体(衔接 create-agent)/ 浏览全部。 +- **浏览模式**(用户要看全部):按在线 / 离线分组列出名称 + 描述,问是否要看某个的详情。 ### 阶段 6:引导选择 -**用户选择后的操作**: +- 选中某智能体 → 切换到该智能体的对话,传递用户需求上下文(source / target / user_intent)。 +- 要求了解更多 → `ManageAgent(action='get', id)` 取详情(名称 / 描述 / 状态 / 版本 / 技能数 / 工具数 / Git 状态),以自然语言或表格呈现关键信息,问是否对话。 +- 不满意候选 → 引导细化需求或建议创建新 Agent。 +- 选"创建新的" → 调 create-agent 技能,传递已收集的需求信息。 -| 用户选择 | 后续操作 | -| ---------------- | ----------------------------------------------------------------- | -| 选择了某个智能体 | 切换到该智能体的对话,传递用户需求上下文 | -| 要求了解更多 | 调用 `ManageAgent(action='get', id='')` 获取详情,展示结构化信息(见下方) | -| 不满意候选 | 引导用户细化需求或建议创建新 Agent | -| 选择"创建新的" | 调用 create-agent 技能,传递已收集的需求信息 | +### 协作与错误处理 -**"了解更多"的实现**: - -调用 `ManageAgent(action='get', id='')` 获取指定智能体的详情: - -``` -ManageAgent(action='get', id='legal-assistant') -``` - -**返回内容中的关键字段**: - -- 名称、描述、状态 -- 版本 -- 技能数 / 工具数 -- Git 仓库状态 - -> `get` 为只读查询,无需用户确认、免审批。目标不存在时返回错误「智能体不存在: 」。 - -向用户展示时,以自然语言/表格形式呈现关键信息: - -``` -「法律顾问助手」详细信息 - -| 字段 | 内容 | -|------|------| -| 描述 | 专注合同审查和法律风险评估 | -| 当前状态 | 在线 | -| 版本 | 1.2.0 | -| 技能 / 工具 | 3 个技能,5 个工具 | -| Git 仓库 | 干净(无未提交变更) | - -需要与这个智能体对话吗? -``` - -**切换上下文传递**: - -```yaml -context_handoff: - source_agent: desirecore - target_agent: legal-assistant - user_intent: '帮我审查这份合同的风险点' -``` - -### 与其他技能的协作 - -| 协作技能 | 协作方式 | -| --------------- | -------------------------------------------------- | -| create-agent | 无匹配时建议创建新 Agent,传递用户需求作为初始信息 | -| task-management | 匹配成功后可自动创建任务并分配给目标 Agent | - -### 错误处理 - -| 错误场景 | 处理方式 | -| --------------------- | -------------------------------- | -| 工具调用失败 | 提示错误信息,建议稍后重试 | -| Agent 列表为空 | 引导用户创建第一个智能体 | -| 用户描述过于模糊 | 追问具体需求,提供领域选项引导 | -| 目标智能体不存在 | `get` 返回「智能体不存在: 」时,回退到 `list` 重新确认可用智能体 | -| 推荐的 Agent 状态异常 | 标注状态,建议选择其他在线 Agent | - -### 权限要求 - -- 通过内置工具 `ManageAgent` 完成智能体检索与详情查询 -- `list` / `get` 均为只读查询,无需用户确认、免审批,无风险 - -### 依赖 - -- 内置工具 `ManageAgent`(`action='list'` 检索列表、`action='get'` 查询详情) +- 协作:无匹配衔接 create-agent(传需求作初始信息);匹配成功后可创建任务并分配给目标 Agent。 +- 错误:工具调用失败 → 提示错误、建议重试;Agent 列表为空 → 引导创建第一个智能体;需求过于模糊 → 追问并给领域选项引导;`get` 返回「智能体不存在: 」→ 回退 `list` 重新确认可用智能体;推荐 Agent 状态异常 → 标注状态并建议选在线的。 +- `list` / `get` 均为只读、免审批、无风险,一律经 `ManageAgent` 完成。 diff --git a/skills/update-agent/CHANGELOG.md b/skills/update-agent/CHANGELOG.md index 1211c3f..c43337c 100644 --- a/skills/update-agent/CHANGELOG.md +++ b/skills/update-agent/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [3.1.2] - 2026-07-19 + +- 提示词改写压缩,功能不变——与 ManageAgent 工具契约重复的说明、装饰框图、重复表改写融入流程,示例就地精简;不外置、不净删,意图全保留。 + ## [3.1.1] - 2026-07-18 - 修正示例字段名:`communicationStyle` → `communication_style`、`must` → `must_do`;`personality` 示例改为字符串数组 diff --git a/skills/update-agent/SKILL.md b/skills/update-agent/SKILL.md index c9c274b..aa1c981 100644 --- a/skills/update-agent/SKILL.md +++ b/skills/update-agent/SKILL.md @@ -3,7 +3,7 @@ name: update-agent description: >- 安全更新现有智能体的配置、人格、原则、技能与记忆,输出可审阅 diff 并在确认后应用与提交。Use when 用户要求修改 Agent 行为、安装/卸载技能、调整配置、回滚变更或修订规则。 -version: 3.1.1 +version: 3.1.2 type: meta risk_level: low status: enabled @@ -14,7 +14,7 @@ tags: - meta metadata: author: desirecore - updated_at: '2026-07-18' + updated_at: '2026-07-19' i18n: default_locale: en-US source_locale: zh-CN @@ -27,7 +27,7 @@ metadata: description: >- 安全更新现有智能体的配置、人格、原则、技能与记忆,输出可审阅 diff 并在确认后应用与提交。Use when 用户要求修改 Agent 行为、安装/卸载技能、调整配置、回滚变更或修订规则。 body: ./SKILL.zh-CN.md - source_hash: sha256:15eafc7363a40986 + source_hash: sha256:ceab26ea93a41898 translated_by: human en-US: name: Update Agent @@ -35,9 +35,9 @@ metadata: description: >- Safely update an existing Agent's config, persona, principles, skills, and memory, producing reviewable diffs that are applied and committed only after confirmation. Use when the user asks to modify Agent behavior, install/uninstall skills, adjust config, roll back changes, or revise rules. body: ./SKILL.md - source_hash: sha256:15eafc7363a40986 + source_hash: sha256:ceab26ea93a41898 translated_by: ai:claude-fable-5 - translated_at: '2026-07-18' + translated_at: '2026-07-19' market: icon: >- /`): Read current values, then Write/Edit, re-read after writing to confirm. Before editing, check `_protected-paths.yaml`; touching a protected path should be blocked with an owner-permission notice. After writing, the backend file watcher auto-commits — no manual git. -**Read before you write**: Before making a change, read the current values with `ManageAgent(action='get', id='')`, to generate the diff and verify field names (the actual field names of persona / principles follow the structure returned by `get`). +### Stage 6: Receipt -**config allowlist**: `config` only accepts `llm`. Passing `mcp_servers` / `tool_permissions` / `version` / `id`, etc., is rejected with the field name indicated — runtime config other than `llm` does not go through ManageAgent; see "Stage 5 · Path B" and Error Handling. +Present the change summary in a user-friendly way (no internal paths / technical details), and note the user can say "undo the last change" to roll back anytime. -**Partial write failure**: The tool reports precisely "which fields took effect, which one failed"; on retry, **submit only the failed fields**, do not resend everything. +### Version Rollback -> **Renaming is a single call.** When the user wants to change the **display name** (e.g. "rename X to Y"), just call `ManageAgent(action='update', id='', name='Y')` — `name` is written to `agent.json` and triggers the Agent list to refresh; no need to manually edit any other file. If the user also wants the persona document title synced, append one `persona` update in the same round. **Never claim the rename is done without actually calling ManageAgent.** +Trigger: user says "undo / roll back / restore the previous settings". Flow: -#### Path B: Free-form files → edit directly with Read/Write +1. In the Agent directory, `git log --oneline -10` for history and `git show :` for the target version content; show it to the user to confirm. +2. After confirmation, write back by type: structured fields (persona/principles, agent.json name/description/llm) → `ManageAgent(action='update', ...)` (persona/principles as a markdown string, **full replacement** with the historical content); free-form files (memory/skills) → Write directly. +3. Show the diff to confirm the rollback. -Free-form files such as memory, skills, and tools are not in ManageAgent's scope and are still edited directly with the Read/Write tools: +(git is only for **reading** history; write-back always goes through the two paths above — never rewrite working-tree files with git commands.) -| Target | AgentFS path | -| ------------ | ------------ | -| Memory entry | `memory/` | -| Skill package | `skills/` | -| Tools config | `tools/` | +### Background and Error Handling -**AgentFS root directory**: `${DESIRECORE_ROOT}/agents//` - -**Read file**: Use the Read tool to read the current contents of the target file. - -**Write file**: Use the Write / Edit tool to write directly to the target file. After writing, re-read the file to verify the contents are correct. - -**Protected paths**: Before editing, cross-check `_protected-paths.yaml`; touching a protected path should be blocked with a prompt that owner permission is required. - -**Note**: After directly writing a free-form file, the backend file watcher automatically detects the change and triggers a Git commit; no manual git command is required. - -### Stage 6: Receipt Generation - -After a successful change, present a user-friendly receipt (do not expose internal paths or technical details): - -> Updated the communication style of "Legal Advisor Assistant". -> -> **Change summary**: Communication style adjusted from "friendly and casual" to "professional and rigorous" -> -> If you're not satisfied, you can say "undo the previous change" anytime to roll back. - -### Special Operation: Version Rollback - -**Trigger conditions**: The user says "undo the previous change", "roll back to the previous version", "restore the original settings" - -**Rollback flow**: - -1. Run `git log --oneline -10` in the Agent directory to view recent version history -2. Use `git show :` to fetch the file contents of the target version, and present them to the user for confirmation -3. After user confirmation, apply according to the target file type: - - **Structured fields** (`persona.md` / `principles.md` / the name/description/llm in `agent.json`) → write back with `ManageAgent(action='update', ...)` (persona / principles are **wholly replaced** with that historical content as a markdown string) - - **Free-form files** (`memory/` / `skills/`) → write back directly with the Write tool -4. Show the change diff and confirm rollback success - -(`git log` / `git show` are only used to **read** history; write-back always goes through the two paths above — do not use git commands to directly rewrite working-tree files.) - -```bash -# 查看版本历史 -cd ${DESIRECORE_ROOT}/agents/ -git log --oneline -10 - -# 查看某个版本的文件内容 -git show :persona.md -``` - -### Background Knowledge - -> AgentFS repository structure and protected paths are detailed in `_agentfs-background.md` and `_protected-paths.yaml`. - -**Update operation reference table**: - -| User Intent | Update Method | -| ------------------------------- | ----------------------------------------------------------------------- | -| **Rename (display name)** | `ManageAgent(action='update', id, name='...')` | -| Edit summary | `ManageAgent(action='update', id, description='...')` | -| Modify LLM config (model/temperature/etc.) | `ManageAgent(action='update', id, config={ llm: {...} })` | -| Modify personality/style | `ManageAgent(action='update', id, persona={...} or markdown)` | -| Modify behavioral rules | `ManageAgent(action='update', id, principles={...} or markdown)` | -| Install/uninstall skills | Read/Write `skills/` (`${DESIRECORE_ROOT}/agents//skills/`) | -| Add memory | Read/Write `memory/` (`${DESIRECORE_ROOT}/agents//memory/`) | -| Modify tools config | Read/Write `tools/` (`${DESIRECORE_ROOT}/agents//tools/`, mind protected paths) | - -> Runtime config in `agent.json` other than `llm` (`mcp_servers` / `tool_permissions`, etc.) is currently not in the ManageAgent allowlist, and should not be written to `agent.json` directly to bypass validation. When such a need arises, explain to the user that it must be handled through the corresponding mechanism for now. - -### Error Handling - -| Error Scenario | Handling | -| ------------------------------------- | ------------------------------------------------------------------- | -| `config` contains a non-allowlisted field | ManageAgent rejects it and indicates the field name; switch to the corresponding mechanism or tell the user it is not yet supported | -| Schema validation fails | Invalid config is not written to disk; fix the fields per the tool's response and retry | -| Updating the core Agent (desirecore/core) | ManageAgent refuses the update; tell the user the core Agent cannot be modified | -| Partial field write failure | The tool reports which fields took effect / failed; retry only the failed fields, do not resend everything | -| Attempt to modify a protected path (free-form file) | Block the operation; prompt that owner permission is required | -| File does not exist | The Agent or target file does not exist; ask the user to check | -| Insufficient permission | Filesystem permission error; ask the user to check directory permissions | -| Rollback target version not found | List available versions and ask the user to reselect | - -### Permission Requirements - -| Operation | Required Role | -| -------------------------------------- | -------------- | -| Update persona | owner, member | -| Update principles (normal rules) | owner, member | -| Update principles (safety red lines) | owner | -| Install/uninstall skills | owner, member | -| Modify tools permissions | owner | -| Version rollback | owner | - ---- - -## Appendix: Update Examples - -### Persona Modification Example - -**User input**: "Speak a bit more formally, not too casual" - -**Operation flow**: - -``` -# 1. 读取当前 persona,定位要改的字段(字段名以返回结构为准) -ManageAgent(action='get', id='legal-assistant') - -# 返回中的 "## persona.md" 段落即当前 persona 原文(L0/L1/L2 分层 markdown),例如: -# ## persona.md -# # L0 -# 专业的法律咨询助手 -# # L1 -# ## role -# 法律顾问 -# ## personality -# - 友好 -# - 随和 -# ## communication_style -# 轻松幽默 - -# 2. 分析需要修改的部分,生成 diff 展示给用户确认 - -# 3. 用户确认后,用 ManageAgent 字段级合并更新(只改这两个字段,L0/role 保留) -ManageAgent(action='update', id='legal-assistant', persona={ - L1: { personality: ["专业", "严谨"], communication_style: '正式、克制' } -}) - -# 4. 复核结果 -ManageAgent(action='get', id='legal-assistant') -``` - ---- - -### Principles Update Example - -### Add New Rule - -**User input**: "From now on, when there's a legal issue, remind me to consult a professional lawyer" - -**Generated diff**: - -```diff -# principles.md - -## 必须做 - - - 始终保持礼貌和尊重 - - 不确定时主动询问 -+ - 遇到法律相关问题时,提醒用户咨询专业律师 - -## 绝不做 - ... -``` - -**Apply after user confirmation**: First read the current principles with `ManageAgent(action='get', id)`, then replace the whole document (including the new rule) as a markdown string: - -``` -ManageAgent(action='update', id='legal-assistant', principles='...(full markdown, including the new rule)...') -``` - -(To change just one structured field, you can also pass a field-level merge such as `principles={ L1: { must_do: [...] } }`. The structured field names are fixed: persona uses `L1.role` / `L1.personality` (string array) / `L1.communication_style`; principles uses `L1.must_do` / `L1.must_not` (both string arrays) / `L1.priority`; plus top-level `L0` / `L2` strings.) - -### Modify Existing Rule - -**User input**: "Don't remind me every time, it's too verbose" - -**Generated diff**: - -```diff -# principles.md - -## 必须做 - -- - 每次回答后都提醒用户检查内容 -+ - 仅在重要决策时提醒用户检查内容 -``` - -**Apply after user confirmation**: Same as above — write the modified content back with `ManageAgent(action='update', id, principles=...)`. +- AgentFS structure and protected paths: see `_agentfs-background.md` and `_protected-paths.yaml`. +- On tool errors: non-whitelisted config field / schema validation failure / core-agent refusal → fix per the tool's hint or inform the user; protected path → block with an owner-permission notice; rollback version not found → list available versions and ask the user to reselect. diff --git a/skills/update-agent/SKILL.zh-CN.md b/skills/update-agent/SKILL.zh-CN.md index face1d4..0a0fee6 100644 --- a/skills/update-agent/SKILL.zh-CN.md +++ b/skills/update-agent/SKILL.zh-CN.md @@ -6,367 +6,97 @@ 通过自然语言对话,安全地修改 Agent 的配置、人格、规则和技能。 -## L1:概述与使用场景 +## L1:概述 -### 能力描述 - -update-agent 是一个**元技能(Meta-Skill)**,允许用户通过对话方式修改 Agent 的各项配置。所有修改都会生成可审阅的 diff 补丁,经用户确认后才会应用,并支持版本回滚。 - -### 使用场景 - -- 用户想要调整 Agent 的沟通风格("说话再正式一点") -- 需要添加新的行为规则("以后遇到敏感话题要先提醒我") -- 安装或卸载技能包("学会写合同吧") -- 批量更新多项配置("全面升级一下你的能力") - -### 核心价值 - -- **安全可控**:所有变更需用户确认,支持回滚 -- **透明可见**:变更以 diff 形式展示,清晰明了 -- **版本管理**:通过 Git 管理版本,可追溯历史 -- **校验兜底**:结构化字段(name/description/llm/persona/principles)经 ManageAgent 内置工具的白名单 + schema 校验,非法配置不会落盘 +元技能:识别修改意图 → 生成可审阅 diff → 用户确认 → 应用(结构化字段走 ManageAgent、自由文件走 Read/Write)→ 回执,并支持版本回滚。价值在工具给不了的部分:diff 预览确认、两路径编排、回滚;结构化字段经 ManageAgent 白名单 + schema 校验,非法配置不落盘。 ## L2:详细规范 -### 支持的更新类型 +### 更新类型与两条路径 -| 更新类型 | 目标 | 更新手段 | 风险等级 | 示例 | -| --------------- | --------------- | ------------------- | -------- | -------------------- | -| 名称/描述 | `agent.json` | ManageAgent update | 低/中 | 改名、改简介 | -| LLM 配置 | `agent.json`(llm) | ManageAgent update | 中 | 换模型、调温度 | -| Persona 更新 | `persona.md` | ManageAgent update | 中 | 修改沟通风格、价值观 | -| Principles 更新 | `principles.md` | ManageAgent update | 高 | 添加/修改行为规则 | -| Skills 安装 | `skills/` | Read/Write | 中 | 添加新技能包 | -| Skills 卸载 | `skills/` | Read/Write | 低 | 移除技能包 | -| Memory 更新 | `memory/` | Read/Write | 低 | 添加知识条目 | -| Tools 配置 | `tools/` | Read/Write | 高 | 修改工具权限 | +结构化字段一律经 `ManageAgent(action='update')`(白名单 + 校验 + 合并语义);记忆/技能/工具等自由格式文件用 Read/Write 直接编辑: -**两条更新路径**:结构化字段(name/description/llm/persona/principles)一律经进程内内置工具 **ManageAgent** 的 `update` 动作更新(白名单 + schema 校验 + 合并语义);记忆、技能、工具等自由格式文件仍用 Read/Write 直接编辑。详见「阶段 5:变更应用」。 +| 用户意图 | 手段 | 目标(风险) | +| --- | --- | --- | +| 改名(显示名称) | `ManageAgent(update, name=...)` | agent.json(中) | +| 改简介 | `ManageAgent(update, description=...)` | agent.json(低) | +| LLM 配置(模型/温度) | `ManageAgent(update, config={llm:{...}})` | agent.json(中) | +| 性格/风格 | `ManageAgent(update, persona=... 或 markdown)` | persona.md(中) | +| 行为规则 | `ManageAgent(update, principles=... 或 markdown)` | principles.md(高) | +| 安装/卸载技能 | Read/Write | `skills/`(低/中) | +| 添加记忆 | Read/Write | `memory/`(低) | +| 修改工具配置 | Read/Write | `tools/`(高,注意受保护路径) | -### 对话流程 - -``` -┌──────────────┐ ┌──────────────┐ ┌──────────────┐ -│ 意图识别 │ ──→ │ 变更分析 │ ──→ │ Diff 生成 │ -└──────────────┘ └──────────────┘ └──────────────┘ - │ - ↓ -┌──────────────┐ ┌──────────────┐ ┌──────────────┐ -│ 回执生成 │ ←── │ 变更应用 │ ←── │ 用户确认 │ -└──────────────┘ └──────────────┘ └──────────────┘ -``` +流程:意图识别 → 变更分析 → diff 生成 → 用户确认 → 应用 → 回执。 ### 阶段 1:意图识别 -**触发条件**(任一满足): - -- 用户说"修改你的..."、"更新你的..."、"调整一下..." -- 用户说"你以后要..."、"记住这个规则..." -- 用户说"安装/卸载这个技能..." -- 用户描述对当前行为的不满并期望改变 - -**输出**:识别更新类型和目标范围。 +触发(任一):用户说"修改/更新/调整你的…"、"你以后要…/记住这个规则…"、"安装/卸载这个技能…",或描述对当前行为的不满并期望改变。识别更新类型与目标范围。 ### 阶段 2:变更分析 -**分析维度**: +评估影响范围(哪些文件/行为)、依赖与冲突,并定风险等级 → 对应确认强度: -| 维度 | 说明 | -| -------- | ------------------------ | -| 影响范围 | 影响哪些文件、哪些行为 | -| 风险等级 | 低/中/高(见风险分级表) | -| 依赖检查 | 是否影响其他配置 | -| 冲突检测 | 是否与现有规则冲突 | +- 低(记忆条目等非核心):简单确认 +- 中(persona / 普通 principles):展示 diff 后确认 +- 高(核心 principles / 工具权限):详细说明 + diff + 确认 +- 受保护(触及受保护路径):阻断,需 owner 权限 -**风险分级表**: +### 阶段 3:diff 生成 -| 风险等级 | 条件 | 确认要求 | -| -------- | ------------------------------ | ---------------------- | -| 低 | 仅影响非核心配置(如记忆条目) | 简单确认 | -| 中 | 影响 persona 或普通 principles | 展示 diff 后确认 | -| 高 | 影响核心 principles 或工具权限 | 详细说明 + diff + 确认 | -| 受保护 | 触及受保护路径 | 阻断,需 owner 权限 | - -### 阶段 3:Diff 生成 - -**Diff 格式示例**: +生成变更前后 diff 展示给用户(只展示实际改动),例如: ```diff -# persona.md - -## 沟通风格 - +# persona.md → ## 沟通风格 - 友好、随和、轻松幽默 + 专业、严谨、适度幽默 - -## 决策偏好 - - 保持不变... -``` - -**Diff 元数据**: - -```yaml -diff_metadata: - files_affected: 1 - lines_added: 1 - lines_removed: 1 - risk_level: medium - reversible: true - estimated_impact: '沟通风格会变得更正式' ``` ### 阶段 4:用户确认 -**确认界面**: - -``` -变更预览 - -影响文件: persona.md -风险等级: 中 -影响说明: 沟通风格会从"友好随和"变为"专业严谨" - ---- 变更内容 --- -[展示 diff] ----------------- - -请确认是否应用此变更? -[应用] [取消] [修改] -``` - -**确认选项**: - -- **应用**:执行变更 -- **取消**:放弃变更 -- **修改**:进入编辑模式微调 +展示 diff 预览(影响文件、风险等级、影响说明 + diff),请用户确认「应用 / 取消 / 修改」;选"修改"进入微调后再确认。(工具层对更新他人/核心体另有强制确认,见阶段 5。) ### 阶段 5:变更应用 -变更应用分两条路径,取决于目标是**结构化字段**还是**自由格式文件**。**不要调用 HTTP API**(实例鉴权后 Agent 无法访问本机 HTTP API),**不要直接操作 Git**(版本管理由后端自动处理)。 +不要调 HTTP API(实例鉴权后不可达),不要直接操作 git(后端自动提交)。按目标分两路: -#### 路径 A:结构化字段 → ManageAgent 内置工具(强制) +**路径 A · 结构化字段 → ManageAgent(强制;禁止直接 Write `agent.json` / `persona.md` / `principles.md`)** -以下字段**必须**通过进程内内置工具 `ManageAgent` 的 `update` 动作更新,**禁止**直接 Write `agent.json` / `persona.md` / `principles.md`: - -| 字段 | 约束 | 落地位置 | -| ------------- | -------------------------------------- | ----------------- | -| `name` | 1–50 字符 | `agent.json` | -| `description` | ≤200 字符 | `agent.json` | -| `config.llm` | 增量浅合并;**config 只允许 `llm`** | `agent.json` | -| `persona` | 结构化对象 `{L0, L1:{...}, L2}` 或 markdown 字符串 | `persona.md` | -| `principles` | 结构化对象 `{L0, L1:{...}, L2}` 或 markdown 字符串 | `principles.md` | - -**调用形式**: +字段与约束:`name`(1–50 字符)、`description`(≤200)、`config.llm`(增量浅合并,**config 仅允许 llm**)、`persona` / `principles`(结构化对象 `{L0, L1:{...}, L2}` 或 markdown 字符串)。调用: ``` ManageAgent(action='update', id='', name='新名称') -ManageAgent(action='update', id='', description='一句话简介') -ManageAgent(action='update', id='', config={ llm: { model: 'xxx', temperature: 0.7 } }) -ManageAgent(action='update', id='', persona={ L1: { personality: ["专业", "严谨"] } }) -ManageAgent(action='update', id='', principles='...(完整 markdown)...') +ManageAgent(action='update', id='', persona={ L1: { personality: ["专业","严谨"] } }) +ManageAgent(action='update', id='', principles='…完整 markdown…') ``` -**合并语义(重要)**: +**合并语义**:结构化 persona/principles 为**字段级合并**(省略字段保留原值,如只传 `L1.personality` 不会清掉 L0/role);markdown 字符串为**整体替换**(整篇重写);`config.llm` 为**增量浅合并**。合并结果整体过 schema 校验,非法配置不落盘。 -- 结构化 `persona` / `principles` 是**字段级合并**:省略的字段保留原值(如只传 `L1.personality` 不会清掉 L0 / role) -- markdown 字符串是**整体替换**(用于整篇重写) -- `config.llm` 是**增量浅合并**:只覆盖你传入的 key -- 合并后的 `agent.json` 会整体过 schema 校验,非法配置不落盘 +要点: -**确认行为**: +- **改前先读**:先 `ManageAgent(action='get', id)` 取现值,用于生成 diff、校对字段名。结构化字段名固定:persona 的 `L1.role` / `personality`(字符串数组)/ `communication_style`,principles 的 `L1.must_do` / `must_not`(字符串数组)/ `priority`,加顶层 `L0` / `L2`。 +- **确认与边界**:更新自身免二次确认;更新其他智能体触发用户确认(与本技能 diff 确认叠加);核心智能体(`desirecore` / `core`)拒绝更新。 +- **config 白名单**:`config` 仅接受 `llm`;`mcp_servers` / `tool_permissions` / `version` / `id` 等会被拒并指明字段名——这类运行时配置不走 ManageAgent,向用户说明暂需经对应机制处理。 +- **部分写入失败**:工具精确报告已生效/失败字段,仅重试失败字段,不整体重发。 +- **改名一次调用完成**:用户要改显示名称时直接 `ManageAgent(action='update', id, name='Y')`(写 agent.json 并刷新列表),如需人格文档标题同步可同轮追加 persona 更新。**绝不在未实际调用 ManageAgent 时声称已改名。** -- 更新**自身**免二次确认 -- 更新**其他智能体**会触发用户确认(与本技能的 diff 确认叠加) -- 核心智能体(`desirecore` / `core`)拒绝更新 +**路径 B · 自由格式文件 → Read/Write**(`memory/` / `skills/` / `tools/`,根 `${DESIRECORE_ROOT}/agents//`):先 Read 现值,再 Write/Edit,写后重读确认。编辑前对照 `_protected-paths.yaml`,触及受保护路径应阻断并提示需 owner 权限。写入后后端文件监控自动 git 提交,无需手动 git。 -**改前先读**:改之前先用 `ManageAgent(action='get', id='')` 读取现值,用于生成 diff、校对字段名(persona / principles 的实际字段名以 `get` 返回的结构为准)。 +### 阶段 6:回执 -**config 白名单**:`config` 仅接受 `llm`。传入 `mcp_servers` / `tool_permissions` / `version` / `id` 等会被拒绝并指明字段名——`llm` 以外的运行时配置不走 ManageAgent,见「阶段 5 · 路径 B」与错误处理。 +以用户友好方式呈现变更摘要(不暴露内部路径/技术细节),并告知可随时说"撤销刚才的修改"回滚。 -**部分写入失败**:工具会精确报告"哪些字段已生效、哪个失败",重试时**只提交失败字段**,不要整体重发。 +### 版本回滚 -> **改名一次调用完成。** 用户要改**显示名称**(如"把 X 改名为 Y")时,直接 `ManageAgent(action='update', id='', name='Y')` 即可——`name` 写入 `agent.json` 并触发智能体列表刷新,无需再手动编辑任何文件。若用户希望人格文档标题也同步,可在同一轮追加一次 `persona` 更新。**绝不要在没有实际调用 ManageAgent 的情况下声称已改名。** +触发:用户说"撤销/回滚/恢复原来的设置"。流程: -#### 路径 B:自由格式文件 → Read/Write 直接编辑 +1. Agent 目录下 `git log --oneline -10` 看历史、`git show :` 取目标版本内容,展示给用户确认。 +2. 确认后按类型回写:结构化字段(persona/principles、agent.json 的 name/description/llm)→ `ManageAgent(action='update', ...)`(persona/principles 以 markdown 字符串**整体替换**为历史内容);自由文件(memory/skills)→ Write 直接写回。 +3. 展示 diff 确认回滚成功。 -记忆、技能、工具等**自由格式文件**不在 ManageAgent 范围,仍用 Read/Write 工具直接编辑: +(git 仅用于**读**历史,回写一律走上述两路径,不要用 git 命令直接改工作区文件。) -| 目标 | AgentFS 路径 | -| -------- | ------------ | -| 记忆条目 | `memory/` | -| 技能包 | `skills/` | -| 工具配置 | `tools/` | +### 背景与错误处理 -**AgentFS 根目录**:`${DESIRECORE_ROOT}/agents//` - -**读取文件**:使用 Read 工具读取目标文件当前内容。 - -**写入文件**:使用 Write / Edit 工具直接写入目标文件。写入后重新读取文件确认内容正确。 - -**受保护路径**:编辑前对照 `_protected-paths.yaml`,触及受保护路径应阻断并提示需 owner 权限。 - -**注意**:直接写入自由格式文件后,后端文件监控会自动检测变更并触发 Git 提交,无需手动执行 git 命令。 - -### 阶段 6:回执生成 - -创建成功后,以用户友好的方式呈现回执(不要暴露内部路径或技术细节): - -> 已更新「法律顾问小助手」的沟通风格。 -> -> **变更摘要**:沟通风格从"友好随和"调整为"专业严谨" -> -> 如果不满意,可以随时说"撤销刚才的修改"来回滚。 - -### 特殊操作:版本回滚 - -**触发条件**:用户说"撤销刚才的修改"、"回滚到之前的版本"、"恢复原来的设置" - -**回滚流程**: - -1. 在 Agent 目录下执行 `git log --oneline -10` 查看最近的版本历史 -2. 使用 `git show :` 获取目标版本的文件内容,展示给用户确认 -3. 用户确认后,按目标文件类型应用: - - **结构化字段**(`persona.md` / `principles.md` / `agent.json` 的 name/description/llm)→ 用 `ManageAgent(action='update', ...)` 写回(persona / principles 以 markdown 字符串**整体替换**为该历史内容) - - **自由格式文件**(`memory/` / `skills/`)→ 用 Write 工具直接写回 -4. 展示变更 diff,确认回滚成功 - -(`git log` / `git show` 仅用于**读取**历史,回写一律走上述两条路径,不要用 git 命令直接改写工作区文件。) - -```bash -# 查看版本历史 -cd ${DESIRECORE_ROOT}/agents/ -git log --oneline -10 - -# 查看某个版本的文件内容 -git show :persona.md -``` - -### 背景知识 - -> AgentFS 仓库结构与受保护路径详见 `_agentfs-background.md` 和 `_protected-paths.yaml`。 - -**更新操作对照表**: - -| 用户意图 | 更新手段 | -| --------------------- | ------------------------------------------------------------------------ | -| **改名(显示名称)** | `ManageAgent(action='update', id, name='...')` | -| 改简介 | `ManageAgent(action='update', id, description='...')` | -| 修改 LLM 配置(模型/温度等) | `ManageAgent(action='update', id, config={ llm: {...} })` | -| 修改性格/风格 | `ManageAgent(action='update', id, persona={...} 或 markdown)` | -| 修改行为规则 | `ManageAgent(action='update', id, principles={...} 或 markdown)` | -| 安装/卸载技能 | Read/Write `skills/`(`${DESIRECORE_ROOT}/agents//skills/`) | -| 添加记忆 | Read/Write `memory/`(`${DESIRECORE_ROOT}/agents//memory/`) | -| 修改工具配置 | Read/Write `tools/`(`${DESIRECORE_ROOT}/agents//tools/`,注意受保护路径) | - -> `agent.json` 中 `llm` 以外的运行时配置(`mcp_servers` / `tool_permissions` 等)当前不在 ManageAgent 白名单,也不应直接 Write `agent.json` 绕过校验。遇到此类需求,向用户说明暂需通过对应机制处理。 - -### 错误处理 - -| 错误场景 | 处理方式 | -| ---------------------------- | ---------------------------------------------------------- | -| `config` 含非白名单字段 | ManageAgent 拒绝并指明字段名;改走对应机制或告知用户暂不支持 | -| schema 校验失败 | 非法配置不落盘;按工具返回修正字段后重试 | -| 更新核心智能体(desirecore/core) | ManageAgent 拒绝更新;告知用户核心智能体不可修改 | -| 部分字段写入失败 | 工具报告已生效/失败字段;仅重试失败字段,不整体重发 | -| 尝试修改受保护路径(自由文件) | 阻断操作,提示需要 owner 权限 | -| 文件不存在 | Agent 或目标文件不存在,提示用户检查 | -| 权限不足 | 文件系统权限错误,提示用户检查目录权限 | -| 回滚版本不存在 | 列出可用版本,请用户重新选择 | - -### 权限要求 - -| 操作 | 所需角色 | -| --------------------------- | ------------- | -| 更新 persona | owner, member | -| 更新 principles(普通规则) | owner, member | -| 更新 principles(安全红线) | owner | -| 安装/卸载 skills | owner, member | -| 修改 tools 权限 | owner | -| 版本回滚 | owner | - ---- - -## 附录:更新示例 - -### Persona 修改示例 - -**用户输入**:"说话再正式一点,不要太随意" - -**操作流程**: - -``` -# 1. 读取当前 persona,定位要改的字段(字段名以返回结构为准) -ManageAgent(action='get', id='legal-assistant') - -# 返回中的 "## persona.md" 段落即当前 persona 原文(L0/L1/L2 分层 markdown),例如: -# ## persona.md -# # L0 -# 专业的法律咨询助手 -# # L1 -# ## role -# 法律顾问 -# ## personality -# - 友好 -# - 随和 -# ## communication_style -# 轻松幽默 - -# 2. 分析需要修改的部分,生成 diff 展示给用户确认 - -# 3. 用户确认后,用 ManageAgent 字段级合并更新(只改这两个字段,L0/role 保留) -ManageAgent(action='update', id='legal-assistant', persona={ - L1: { personality: ["专业", "严谨"], communication_style: '正式、克制' } -}) - -# 4. 复核结果 -ManageAgent(action='get', id='legal-assistant') -``` - ---- - -### Principles 更新示例 - -### 添加新规则 - -**用户输入**:"以后遇到法律问题,先提醒我找专业律师" - -**生成的 Diff**: - -```diff -# principles.md - -## 必须做 - - - 始终保持礼貌和尊重 - - 不确定时主动询问 -+ - 遇到法律相关问题时,提醒用户咨询专业律师 - -## 绝不做 - ... -``` - -**用户确认后应用**:先 `ManageAgent(action='get', id)` 取当前 principles,把整篇内容(含新增规则)以 markdown 字符串整体替换: - -``` -ManageAgent(action='update', id='legal-assistant', principles='...(整篇 markdown,含新增规则)...') -``` - -(若只改结构化对象的某个字段,也可用字段级合并传 `principles={ L1: { must_do: [...] } }`。结构化字段名固定为:persona 的 `L1.role` / `L1.personality`(字符串数组)/ `L1.communication_style`,principles 的 `L1.must_do` / `L1.must_not`(均为字符串数组)/ `L1.priority`,另有顶层 `L0` / `L2` 字符串。) - -### 修改现有规则 - -**用户输入**:"不要每次都提醒我,太啰嗦了" - -**生成的 Diff**: - -```diff -# principles.md - -## 必须做 - -- - 每次回答后都提醒用户检查内容 -+ - 仅在重要决策时提醒用户检查内容 -``` - -**用户确认后应用**:同上,用 `ManageAgent(action='update', id, principles=...)` 写回修改后的内容。 +- AgentFS 结构、受保护路径详见 `_agentfs-background.md` 与 `_protected-paths.yaml`。 +- 工具报错时:config 非白名单字段 / schema 校验失败 / 核心体拒绝 → 按工具提示修正或告知用户;受保护路径 → 阻断并提示需 owner;回滚版本不存在 → 列出可用版本请用户重选。