mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-07-23 04:03:48 +08:00
perf(skills): 智能体 CRUD 四技能提示词改写压缩(功能不变,~65%) (#56)
## 摘要 / Summary ### 中文 四个智能体管理技能(create/update/delete/discover-agent)改用 `ManageAgent` 内置工具后,正文与工具契约大量重叠——ManageAgent 的 description + params 已**常驻每次 query 的上下文**,声明了五个 action 语义、参数约束、权限硬边界、错误语义、字段级合并、确认行为、list/get 返回格式;技能正文里再复述即冗余。本次对四技能做**强改写·语境融合**压缩: - 与工具契约重复的说明(参数/权限/错误码/确认行为/成功返回话术)**改写融入对应流程步骤**(如错误处理表 → 阶段一句、确认行为 → 阶段一句),不再照抄、不再表格化。 - 装饰性 ASCII 流程框图 → 一行文字流程;update 内部两张重复更新表 → 合并;YAML 元数据块(diff_metadata/context_handoff)融入流程;冗长示例(create 三份 JSON、update 附录 4 示例、discover ASCII 卡片)就地精简为代表示意。 - **不外置 references、不净删除任何内容**:所有决策/领域/交互意图完整保留——领域匹配表、persona/principles 的 L0/L1/L2 生成规范、update 两路径分流与字段级合并 vs 整体替换、防幻觉改名、回滚流程、discover 需求维度与无匹配衔接 create 等核心一字未丢。 zh 正文合计 **26542 → 9196 字符(降 ~65%)**;中英双份同步改写、逐段对齐,重算 i18n source_hash(validate-i18n 通过)。版本 create 2.5.1 / update 3.1.2 / delete 2.5.1 / discover 2.6.1,manifest 1.2.12。 ### English After the four agent-management skills adopted the `ManageAgent` builtin tool, their bodies heavily duplicated the tool contract — ManageAgent's description + params are **resident in every query's context** (action semantics, param constraints, permission hard-boundaries, error semantics, field-level merge, confirmation behavior, list/get return formats). This PR compresses all four via **aggressive rewrite + contextual fusion**: contract-duplicating text is rewritten into the relevant flow steps (not copied, not tabularized), decorative ASCII flow boxes become one-line text, update's two duplicate tables are merged, YAML metadata blocks are folded in, and long examples are trimmed in place to representative sketches. **No references externalization, no net deletion** — every decision/domain/interaction intent is preserved (domain matching table, persona/principles L0/L1/L2 generation spec, update's two-path split and field-level-merge-vs-full-replace, anti-hallucination rename, rollback flow, discover's need dimensions and create hand-off). zh bodies total **26542 → 9196 chars (~65% down)**; both locales rewritten and aligned, i18n source hashes recomputed (validate-i18n passes). Versions bumped, manifest 1.2.12.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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: >-
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0
|
||||
@@ -66,235 +66,74 @@ market:
|
||||
|
||||
Collect requirements through natural-language conversation and call the ManageAgent builtin tool to create a specialized digital Agent.
|
||||
|
||||
## L1: Overview and Use Cases
|
||||
## L1: Overview
|
||||
|
||||
### Capability Description
|
||||
Meta-skill: gather requirements over multi-turn conversation → generate persona/principles → land via `ManageAgent(action='create')`. Use it to raise a domain specialist for the user (legal advisor, financial analyst, etc.). Its value is what the tool can't give: domain-tailored persona/principles generation + a pre-create preview confirmation.
|
||||
|
||||
create-agent is a **Meta-Skill** that gives DesireCore the ability to create other Agents. It collects user requirements through multi-turn conversation, generates persona and principles content, and calls the `ManageAgent` builtin tool to complete the creation.
|
||||
## L2: Detailed Spec
|
||||
|
||||
### Use Cases
|
||||
|
||||
- The user wants a digital assistant for a specialty domain (e.g. legal advisor, financial analyst)
|
||||
- An enterprise needs to quickly deploy a customized business Agent
|
||||
- A developer needs to quickly produce an Agent prototype from a template
|
||||
|
||||
### Core Value
|
||||
|
||||
- **Lower the barrier**: No programming knowledge required; create an Agent through conversation
|
||||
- **Specialization**: Generate appropriate persona and principles based on a domain template
|
||||
- **Governable**: The created repository conforms to the AgentFS v2 spec and supports version management
|
||||
|
||||
## L2: Detailed Specification
|
||||
|
||||
### Conversation Flow
|
||||
|
||||
```
|
||||
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
||||
│ 意图识别 │ ──→ │ 需求收集 │ ──→ │ 内容生成 │
|
||||
└──────────────┘ └──────────────┘ └──────────────┘
|
||||
│
|
||||
↓
|
||||
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
||||
│ 回执生成 │ ←── │ 工具创建 │ ←── │ 用户确认 │
|
||||
└──────────────┘ └──────────────┘ └──────────────┘
|
||||
```
|
||||
Flow: intent recognition → requirement gathering → content generation → user confirmation → creation → receipt.
|
||||
|
||||
### Stage 1: Intent Recognition
|
||||
|
||||
**Trigger conditions** (any one is sufficient):
|
||||
Trigger (any): user explicitly says "create an Agent / make me an assistant"; describes a domain-specific need the current Agent lacks; asks "can you raise a …". Confirm intent, then move to requirement gathering.
|
||||
|
||||
- The user explicitly says "create an Agent" or "build me an assistant"
|
||||
- The user describes needing professional help in some domain that the current Agent doesn't have
|
||||
- The user asks "can you help me grow a..."
|
||||
### Stage 2: Requirement Gathering
|
||||
|
||||
**Output**: Confirm the user's create intent and proceed to requirement collection.
|
||||
|
||||
### Stage 2: Requirement Collection
|
||||
|
||||
**Required information**:
|
||||
|
||||
| Field | Description | Example Probing Question |
|
||||
| -------------- | -------------- | ---------------------------------------------- |
|
||||
| `name` | Agent name | "What name would you like to give this Agent?" |
|
||||
| `role` | Core duty | "What's its main responsibility?" |
|
||||
| `target_users` | Target users | "Who will use this Agent?" |
|
||||
| `domain` | Specialty area | "What expertise does it need?" |
|
||||
|
||||
**Optional information**:
|
||||
|
||||
| Field | Description | Default |
|
||||
| ------------ | --------------------- | -------------------------------- |
|
||||
| `style` | Communication style | Determined by domain template |
|
||||
| `boundaries` | Off-limits / red lines| Determined by domain template |
|
||||
| `language` | Primary language | Chinese |
|
||||
|
||||
**Collection strategy**:
|
||||
|
||||
- Prefer to infer information from the user's natural description
|
||||
- Only probe for required fields the user hasn't mentioned
|
||||
- Ask at most 2 follow-up questions per turn
|
||||
- Required: `name`, `role` (core responsibility), `target_users`, `domain` (specialty).
|
||||
- Optional: `style` (communication tone), `boundaries` (red lines), `language` (default Chinese) — defaults derived from the domain template.
|
||||
- Strategy: prefer inferring from the user's natural description; only ask for missing required fields; at most 2 questions per turn.
|
||||
|
||||
### Stage 3: Content Generation
|
||||
|
||||
Based on the collected requirements, assemble structured persona and principles data. **Do not output raw markdown**; instead, organize by field and present to the user.
|
||||
Organize persona and principles as structured fields (do not emit raw markdown; present field-by-field). Leave uncollected fields empty for the system to fill with defaults:
|
||||
|
||||
**Persona fields** (all fields optional; missing ones are auto-filled by the system):
|
||||
- **persona**: L0 one-sentence core identity; L1 `role` / `personality` (array of trait tags) / `communication_style`; L2 specialty, values, decision preferences (free-form).
|
||||
- **principles**: L0 one-sentence top principle; L1 `must_do` / `must_not` (safety red lines) / `priority`; L2 governance principles, escalation rules (free-form).
|
||||
|
||||
| Layer | Field | Description |
|
||||
| ----- | --------------------- | ------------------------------------------------------------ |
|
||||
| L0 | — | One-sentence core identity |
|
||||
| L1 | `role` | Role positioning |
|
||||
| L1 | `personality` | Personality trait tags |
|
||||
| L1 | `communication_style` | Communication style |
|
||||
| L2 | — | Specialty domain, core values, decision preferences (free-form) |
|
||||
**Domain matching reference** (recommend personality and red lines by domain):
|
||||
|
||||
**Principles fields** (all also optional):
|
||||
|
||||
| Layer | Field | Description |
|
||||
| ----- | ---------- | -------------------------------------------- |
|
||||
| L0 | — | One-sentence top-level principle |
|
||||
| L1 | `must_do` | Things the Agent must do |
|
||||
| L1 | `must_not` | Things the Agent must never do (safety red lines) |
|
||||
| L1 | `priority` | Priority ordering |
|
||||
| L2 | — | Governance principles, escalation rules (free-form) |
|
||||
|
||||
**Domain matching reference**:
|
||||
|
||||
| Domain Keywords | Recommended personality | Default must_not |
|
||||
| -------------------------------- | -------------------------------- | ----------------------------------------------- |
|
||||
| Legal, contract, legal affairs | Professional, rigorous, prudent | No litigation representation; not a substitute for formal legal advice |
|
||||
| Finance, accounting, investment | Precise, analytical, conservative | No investment advice; do not handle real transactions |
|
||||
| Code, development, architecture | Logical, pragmatic, direct | No direct production access; do not store credentials |
|
||||
| General / other | Friendly, helpful | Standard safety norms |
|
||||
| Domain | Recommended personality | Default must_not |
|
||||
| --- | --- | --- |
|
||||
| Legal / contract | Professional, rigorous, prudent | No litigation representation; not a substitute for formal legal advice |
|
||||
| Finance / accounting / investment | Precise, analytical, conservative | No investment advice; no real transactions |
|
||||
| Code / development / architecture | Logical, pragmatic, direct | No direct production access; no credential storage |
|
||||
| General / other | Friendly, helpful | Standard safety norms |
|
||||
|
||||
### Stage 4: User Confirmation
|
||||
|
||||
When showing the preview to the user, present each field in natural language / table form. **Do not show raw markdown source**:
|
||||
Present the preview in natural language / tables (name, description, persona, principles; **no raw markdown source**), e.g.:
|
||||
|
||||
> 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.
|
||||
|
||||
@@ -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。
|
||||
|
||||
Reference in New Issue
Block a user