Files
market/skills/delete-agent/SKILL.md
Yige 1f7c8b9673 feat: skills i18n 改造(schemaVersion 1.1,零向后兼容) (#1)
* feat: skills i18n 改造 — schemaVersion 1.1,零向后兼容

把 21 个 skills + 1 个 agent + manifest/categories 全量迁移到 schemaVersion 1.1
的 i18n 结构,配套 CI AI 翻译流水线(GitHub Models)与本地工具链。

## 关键变更

### 数据结构(破坏性,schemaVersion 1.0 → 1.1)
- SKILL.md: 顶层 name 改为 ASCII slug(== 目录名,符合 agentskills.io 规范);
  中文显示名/short_desc/description 全部迁入 metadata.i18n.<locale>
- agents/<id>/agent.json: shortDesc/fullDesc/tags/persona.{role,traits} 迁入
  i18n.<locale>;changelog[].changes 改为 { <locale>: string[] } 对象
- categories.json: 每个分类的 label/description 迁入 i18n.<locale>,顶层只剩
  color/icon
- manifest.json: 加 supportedLocales / defaultLocale;顶层 description 迁入
  i18n.<locale>

### Body 文件结构
- 根 SKILL.md = frontmatter + default_locale (en-US) body
- SKILL.<locale>.md = 各 locale 的 markdown body(首行 <!-- locale: xx --> 自校验)

### 工具链(scripts/i18n/)
- glossary.json: zh→en 术语表 + do_not_translate 白名单
- schema/skill-frontmatter.schema.json: i18n frontmatter JSON Schema
- validate-i18n.py: 8 条校验规则(name 合规 / locale 完整性 / hash 一致性等)
- translate.py: GitHub Models / Anthropic 双 backend,sha256 增量翻译
- migrate.py: 一次性迁移脚本(旧格式 → i18n 结构)

### CI(.github/workflows/)
- i18n-validate.yml: PR 触发跑 validate + translate --check
- i18n-translate.yml: PR 触发用 GitHub Models(默认 openai/gpt-5-mini)翻译缺失
  locale,自动追加 commit;可切到 ANTHROPIC_API_KEY 走 Claude

### 文档
- docs/I18N.md: 作者贡献指南(schema 说明 / 提交流程 / 常见问题)
- README.md: 加多语言段落

## 验证

- uv run scripts/i18n/validate-i18n.py: OK,49 文件 0 错误
- uv run scripts/i18n/translate.py --check: 0 stale locale
- 21 skills 标题数 zh-CN == en-US 严格对齐(最大 66=66)
- skills-ref 规范校验:全部通过(顶层 name ASCII slug + description 单字段)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(i18n): 修复 PR #1 review 反馈的 6 项问题

- schema: translated_by 正则放宽为 ^(human|ai:[A-Za-z0-9._:/-]+)$,接受
  'ai:github:openai/gpt-5-mini' 这类 backend:model 形式(CI 翻译输出格式)
- README + docs/I18N.md: 修正"CI 用 Claude API"误导描述,正确说明默认是
  GitHub Models(openai/gpt-5-mini)+ GITHUB_TOKEN,可选切到 Anthropic
- skills/minimax-tts/SKILL.md & SKILL.zh-CN.md: 删除多余的 ``` 闭合,避免
  Markdown 后续渲染错乱
- skills/docx/SKILL.md: 翻译时丢失的 • Unicode escape 示例已恢复,
  与 zh-CN 版本对齐

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 00:26:33 +08:00

10 KiB
Raw Blame History

name, description, version, type, risk_level, status, disable-model-invocation, tags, metadata, market
name description version type risk_level status disable-model-invocation tags metadata market
delete-agent 安全删除指定的智能体及其关联数据。删除前会验证智能体状态支持可选地删除所有会话历史。Use when 用户需要删除不再使用的智能体。 2.4.2 meta high enabled true
agent
deletion
meta
author updated_at i18n
desirecore 2026-02-28
default_locale source_locale locales zh-CN en-US
en-US zh-CN
zh-CN
en-US
name short_desc description body source_hash translated_by
删除智能体 安全删除智能体及其关联数据,支持多重确认与可选历史清理 安全删除指定的智能体及其关联数据。删除前会验证智能体状态支持可选地删除所有会话历史。Use when 用户需要删除不再使用的智能体。 ./SKILL.zh-CN.md sha256:148cd72a6808741e human
name short_desc description body source_hash translated_by translated_at
Delete Agent Safely delete an Agent and its associated data, with multi-step confirmation and optional history cleanup 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. ./SKILL.md sha256:148cd72a6808741e ai:claude-opus-4-7 2026-05-03
icon category maintainer compatible_agents channel
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><defs><linearGradient id="da2-a" x1="2" y1="7" x2="16" y2="21" gradientUnits="userSpaceOnUse"><stop stop-color="#FF9500"/><stop offset="1" stop-color="#FF3B30"/></linearGradient></defs><circle cx="9" cy="7" r="4" fill="url(#da2-a)" fill-opacity="0.15" stroke="url(#da2-a)" stroke-width="1.5"/><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" fill="url(#da2-a)" fill-opacity="0.1" stroke="url(#da2-a)" stroke-width="1.5"/><circle cx="19" cy="11" r="4" fill="#FF3B30" fill-opacity="0.12"/><line x1="16.5" y1="11" x2="21.5" y2="11" stroke="#FF3B30" stroke-width="2" stroke-linecap="round"/></svg> productivity
name verified
DesireCore Official true
latest

delete-agent Skill

L0: One-line Summary

Safely delete a specified Agent and its associated data, including filesystem, in-memory state, and optionally session history.

L1: Overview and Use Cases

Capability Description

delete-agent is a Meta-Skill that empowers DesireCore to safely delete other Agents. It performs full pre-flight checks and state validation, and cleans up all associated data.

Use Cases

  • The user wants to clean up Agents that are no longer in use
  • Delete temporary Agents created for testing or experimentation
  • Free up storage space by deleting old Agents and their history
  • The user explicitly asks to "delete" or "remove" a particular Agent

Core Value

  • Safety: multiple checks ensure that active Agents are not accidentally deleted
  • Completeness: cleans up filesystem, in-memory state, message subscriptions, and all associated data
  • Recoverability: session history is preserved by default, with the option to delete it

L2: Detailed Specification

Execution Flow

┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│  List target │ ──→ │   Confirm    │ ──→ │   Ask about  │
│    Agents    │     │ intent/target│     │   options    │
└──────────────┘     └──────────────┘     │ (delete runs?)│
                                          └──────────────┘
                                                  │
                                                  ↓
┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│ Return result│ ←── │ Execute the  │ ←── │     Final    │
│  and receipt │     │  delete API  │     │ confirmation │
└──────────────┘     └──────────────┘     └──────────────┘

Phase 1: List Deletable Agents

Trigger condition: the user expresses intent to delete but does not specify a particular Agent

Operation:

  • Call GET /api/agents to fetch the list of all Agents
  • Filter Agents whose status is offline or error (safe to delete)
  • Annotate Agents whose status is online/busy/recovery (must be stopped first)

Output example:

Deletable Agents:
1. Legal Advisor Assistant (legal-assistant) - status: offline
2. Test Bot (test-bot) - status: offline

Currently active Agents (must be stopped before deletion):
- Data Analyst (data-analyst) - status: online

Phase 2: Confirm User Intent and Target

Confirmation points:

  • The Agent name/ID specified by the user
  • Explicitly inform that deletion is irreversible
  • Display the Agent's basic info for the user to confirm

Dialog example:

You are about to delete the Agent "Legal Advisor Assistant" (legal-assistant).
⚠️ Warning: this operation is irreversible. All configuration, skills, and tools of this Agent will be permanently deleted.

Confirm deletion? (yes/no)

Phase 3: Ask About Deletion Options

Question content:

Do you also want to delete all session history of this Agent?
- Yes: delete the Agent and all of its conversation records
- No: keep session history; delete only the Agent itself

Default option: No (keep history)

Parameter mapping:

  • User chooses "Yes" → deleteRuns=true
  • User chooses "No" → deleteRuns=false (default)

Phase 4: Final Confirmation

Confirmation summary:

Please confirm the deletion:
- Target Agent: Legal Advisor Assistant (legal-assistant)
- Scope: Agent + session history (if chosen by the user)
- Risk level: High (irreversible)

Confirm and execute deletion? (yes/no)

Phase 5: Execute the Delete API Call

API endpoint: DELETE /api/agents/{agentId}

Query parameters:

  • deleteRuns: 'true' or 'false'

Request example:

curl -X DELETE "{agentServiceUrl}/api/agents/legal-assistant?deleteRuns=true"

{agentServiceUrl} is taken from the Agent Service address in the "Local API" section of the system prompt.

Phase 6: Return the Operation Result

Successful response handling:

{
  "deleted": true,
  "cleanedPaths": [
    "/Users/xxx/.desirecore/agents/legal-assistant",
    "/Users/xxx/.desirecore/users/xxx/agents/legal-assistant"
  ],
  "deletedRunsCount": 5,
  "memoryCleaned": {
    "scheduler": true,
    "queue": 0,
    "messaging": 3,
    "mcp": true
  }
}

Result report template:

✅ Agent "Legal Advisor Assistant" successfully deleted

Cleanup details:
- Filesystem: 2 directories deleted
- Scheduler: all scheduled tasks stopped
- Message subscriptions: 3 subscriptions canceled
- MCP connection: closed
- Session history: 5 records deleted

State Validation and Error Handling

Pre-deletion State Check

When listing Agents in Phase 1, filter status via GET /api/agents:

Status Deletable? Phase 1 Display
offline / error Yes Listed under "Deletable"
online / busy / recovery Stop first Annotated "must be stopped"; not entered into the subsequent flow

How to stop an active Agent: send the agent:shutdown event via Socket.IO:

event: agent:shutdown
data: { 'agentId': '<agent_id>' }
effect: abort all active sessions → stop scheduled tasks → status becomes offline

The Agent cannot directly send Socket.IO events. If the target Agent is active, prompt the user to stop it manually in the UI, or wait until it finishes its current task before deleting.

API Error Codes

Code Scenario Handling
400 Invalid Agent ID format Ask the user to check the Agent name
404 Agent does not exist Inform the user the Agent has already been deleted or the ID is wrong
409 Agent is currently active (API returns Cannot delete agent "xxx": currently online) Ask the user to stop the Agent in the UI first
500 Internal server error Ask the user to try again later

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
Preserved Data of other Agents, user configuration, global settings, market cache

Permission Requirements

  • Prefer using the Bash tool to call curl against the Agent Service HTTP API to perform the operation
  • The API base address is injected into the "Local API" section of the system prompt; reference it directly
  • The delete operation requires explicit user confirmation (high-risk operation)

Dependencies

  • Agent Service HTTP API (DELETE /api/agents/{agentId})
  • The Local API address declaration in the system prompt