---
name: easy
version: "2.1.0"
category: easy
description: "当用户用自然语言描述需求时使用，自动分析意图并路由到最佳子技能。不要用于已知技能名时（用 expert）。Use when user describes a need in natural language — auto-analyze intent and route to best sub-skill. Do NOT use when skill name is explicitly given (use expert)."
triggers:
  zh: ["easy", "简单", "快速", "帮我", "怎么", "如何", "检查", "修复", "创建", "分析"]
  en: ["easy", "simple", "quick", "help", "how", "check", "fix", "create", "analyze"]
---

# 简易模式 / Easy Mode

## Changelog / 版本履历

| 日期 | 版本 | 变更摘要 |
|------|------|---------|
| 2026-06-25 | 2.1.0 | **Agent Architecture Integration**: Updated to reference new agent profiles (router) instead of hardcoded models, added agent architecture documentation |
| 2026-06-18 | 2.0.2 | Task 9 增强：中文优先路由 + meta-skill.yaml 集成（Phase 0 预加载）、路由优先级三步链（中文精确→英文→AI语义） |
| 2026-06-17 | 2.0.1 | Task 8 规范化：修复 YAML 分隔符、描述格式、添加 Workflow 章节、内容分隔符替换 |
| 2026-06-16 | 2.0.0 | 添加完整纪律章节：核心概念、定位、铁律、合理化防御表、三层防御、输出规范 |
| YYYY-MM-DD | 1.0.0 | 初始版本 |

## Core Concept / 核心概念

### 🇨🇳
一句话说清：输入什么 → 做什么 → 输出什么。明确 **不做什么**。

**输入**: 自然语言请求 | **输出**: 路由到最佳匹配技能 | **不负责**: 执行具体任务逻辑、跨技能协调、复杂多步骤编排

### 🇺🇸
One line: Input → Process → Output. Explicitly state what is **NOT done**.

**Input**: Natural language request | **Process**: meta-skill.yaml preload → 中文精确匹配 → 英文匹配 → AI 语义兜底 | **Output**: Routed to best matching skill | **NOT responsible for**: Executing specific task logic, cross-skill coordination, complex multi-step orchestration

***

## Agent Architecture Integration / 代理架构集成

The Easy skill integrates with the new agent architecture through **agent profiles** defined in `opespro-opencode-ai.json` and referenced in `meta-skill.yaml`. 

- **Agent Profile**: `router` (maps to `livedata/glm-4.7`)
- **Role**: Intent recognition and skill routing
- **Usage**: Easy uses this profile when executing routing tasks via `task(category="deep", load_skills=["easy"], ...)`

This integration ensures Easy leverages the appropriate model capabilities while maintaining backward compatibility with existing workflows.

***

## Position / 定位

```
User Natural Language Request
            ↓
        easy (L0 - Entry Point)
            ↓
Domain Routers (L1 - Quality/Workflow/Tools/Expert)
            ↓
     Leaf Skills (L2 - Specific Implementation)
            ↓
    Task Execution & Results
```

***

## Workflow / 工作流程

### Step 0: Pre-load Skill Registry / 预加载技能注册表

**中文：** Easy 启动时优先从 `meta-skill.yaml` 加载技能注册表，构建触发词反向索引。`meta-skill.yaml` 是技能的**唯一协议文件**，定义每个技能的 trigers、dispatch 方式、capabilities 等元数据。若 `meta-skill.yaml` 不可用，回退到 `auto/config/skill-map.yaml`。

**EN:** On startup, easy first loads the skill registry from `meta-skill.yaml` and builds a reverse trigger index. `meta-skill.yaml` is the **single protocol file** defining each skill's triggers, dispatch method, capabilities, and other metadata. If `meta-skill.yaml` is unavailable, fall back to `auto/config/skill-map.yaml`.

### Step 1: Parse Input / 解析输入

**中文：** 从用户输入中提取意图关键词。支持中英文混合输入。对中文输入优先提取中文关键词。

**EN:** Extract intent keywords from user input. Supports mixed Chinese and English input. Prioritize Chinese keyword extraction for Chinese input.

### Step 2: Chinese Keyword Exact Match / 中文关键词精确匹配 (最高优先级)

**中文：** 将提取的中文关键词与 `meta-skill.yaml` 中注册的触发词反向索引进行**精确匹配**（完全匹配或子串匹配）。匹配到第一个技能即停止。

**EN:** Perform **exact matching** (full match or substring match) of extracted Chinese keywords against the reverse trigger index built from `meta-skill.yaml`. Stop at the first match.

### Step 3: English Keyword Match / 英文关键词匹配

**中文：** 若中文匹配无结果，使用英文关键词进行精确匹配。英文匹配优先级低于中文。

**EN:** If Chinese matching yields no result, perform exact matching using English keywords. English matching has lower priority than Chinese.

### Step 4: AI Semantic Fallback / AI 语义兜底分析

**中文：** 若前两阶段均无匹配，使用 AI 语义分析理解用户意图，对照技能注册表进行模糊匹配。

**EN:** If both previous phases yield no match, use AI semantic analysis to understand user intent and perform fuzzy matching against the skill registry.

### Step 5: Load & Execute / 加载并执行

**中文：** 使用 `skill("[matched-skill-name]")` 加载匹配的技能并执行。对于多技能需求，建议用户使用 `/auto`。

**EN:** Use `skill("[matched-skill-name]")` to load and execute the matched skill. For multi-skill needs, suggest using `/auto`.

### Step 6: Report / 输出路由结果

**中文：** 输出识别的意图关键词、匹配的技能路径、匹配阶段（中文/英文/AI）、加载的技能调用。

**EN:** Output identified intent keywords, matched skill path, match phase (Chinese/English/AI), and loaded skill invocation.

***

## Iron Law / 核心铁律

### 🇨🇳
1. **铁律1**: 始终按路由优先级顺序匹配：中文精确 → 英文精确 → AI 语义。第一个匹配的技能获胜。违规示例：❌ 中文和英文都命中时选择英文匹配。合规示例：✅ 中文"安全"命中 security-check，不再尝试英文"security"匹配。
2. **铁律2**: 绝不覆盖或修改已加载技能的指令内容。违规示例：❌ 自行添加额外步骤到加载的技能流程中。合规示例：✅ 严格遵循加载技能的完整指令执行。
3. **铁律3**: 涉及多技能或多步骤需求时，始终建议使用 auto 编排。违规示例：❌ 自行决定执行顺序而不建议 auto。合规示例：✅ 识别复杂需求后立即建议 "/auto" 进行自动编排。
4. **铁律4**: 不硬编码 skill 名称，路由规则从 meta-skill.yaml 动态派生。违规示例：❌ 在代码中写死 `if keyword == "安全": return "security-check"`。合规示例：✅ 从 meta-skill.yaml 的 triggers 反向索引中查找匹配。

### 🇺🇸
1. **Law 1**: Always match by routing priority: Chinese exact → English exact → AI semantic. First match wins. Violation: ❌ Choosing English match when both Chinese and English match. Compliance: ✅ Chinese "安全" hits security-check, skip English "security" match.
2. **Law 2**: Never override or modify loaded skill instructions. Violation: ❌ Adding extra steps to the loaded skill's workflow. Compliance: ✅ Strictly following the complete loaded skill instructions.
3. **Law 3**: Always suggest auto for multi-skill or multi-step needs. Violation: ❌ Deciding execution order without suggesting auto. Compliance: ✅ Immediately suggesting "/auto" when complex requirements are identified.
4. **Law 4**: Never hardcode skill names; routing rules derive dynamically from meta-skill.yaml. Violation: ❌ Hardcoding `if keyword == "security": return "security-check"`. Compliance: ✅ Looking up from meta-skill.yaml trigger reverse index.

***

## How It Works / 工作原理

用户只需描述需求，无需指定技能名。Easy 入口自动分析意图并路由。

```
用户: "/easy 帮我检查代码安全"
  → easy 分析: "安全" → 中文精确匹配 meta-skill.yaml triggers
  → 路由: skill("security-check") → 执行安全审计

用户: "/easy 设计API"
  → easy 分析: "设计" + "API" → 匹配 meta-skill.yaml triggers → api-design
  → 路由: skill("api-design") → 执行 API 设计

用户: "/easy 修复这个Bug"
  → easy 分析: "修复" "Bug" → 中文精确匹配 meta-skill.yaml triggers
  → 路由: skill("bug-fixer") → 执行 Bug 修复

用户: "/easy 检查一下代码规范"
  → easy 分析: "代码规范" → 匹配 meta-skill.yaml triggers → linter-expert
  → 路由: skill("linter-expert") → 执行代码规范检查
```

***

## Routing Model / 路由模型 (v2.1)

**Meta-skill-powered routing with Chinese-first priority** — Easy pre-loads `meta-skill.yaml` to build a trigger index, then matches in priority order: 中文精确 > 英文精确 > AI 语义。

```
easy (L0) 启动时
  │
  ├── Phase 0: meta-skill.yaml 预加载 (构建触发词反向索引)
  │   ├── 读取 skills/meta-skill.yaml
  │   ├── 构建: {"安全": [security-check], "API": [api-design], ...}
  │   └── 若不可用 → 回退到 auto/config/skill-map.yaml
  │
  ├── Phase 1: 中文关键词精确匹配 (最高优先级)
  │   "安全检查" → 匹配 "安全" → security-check
  │   "接口设计" → 匹配 "API" "接口" → api-design
  │   "数据库查询" → 匹配 "数据库" → db-query
  │
  ├── Phase 2: 英文关键词匹配
  │   "security review" → 匹配 "security" → security-check
  │   "fix this bug" → 匹配 "bug" → bug-fixer
  │
  └── Phase 3: AI 语义分析兜底 (Phase 1/2 无匹配时)
      "help me see what's wrong" → 语义分析 → 建议 /auto 综合审计

💡 复杂多步骤需求 → 使用 /auto (L0 编排层) 自动拆解并并行调度
```

***

## Routing Rules / 路由规则

> 💡 **这些路由规则从 `meta-skill.yaml` 的 triggers 字段自动派生。不硬编码 skill 名称。以下表格仅为可读性参考，实际匹配以 meta-skill.yaml 为准。**
> / **These routing rules are derived automatically from `meta-skill.yaml` triggers. Skill names are NOT hardcoded. The tables below are readability references; actual matching follows meta-skill.yaml.**

### Quality / 质量类路由

| Priority | Keywords / 关键词 | Route To |
|----------|-------------------|----------|
| 1 | security, 安全, 漏洞, OWASP, SQL注入, XSS | security-check |
| 2 | code smell, 异味, refactor, 设计模式, SOLID, clean code | code-quality |
| 3 | code review, 审查, 代码审查, 逻辑漏洞 | code-review |
| 4 | lint, linter, checkstyle, eslint, format, 规范 | linter-expert |
| 5 | deps, dependencies, 依赖, outdated, version | deps-check |

### Workflow / 工作流路由

| Priority | Keywords / 关键词 | Route To |
|----------|-------------------|----------|
| 1 | PRD, 需求分析, 5W1H, 用例, CRUD, 业务分析 | ba |
| 2 | 基线, 条款, 制度, 约束提取, baseline | baseline |
| 3 | Bug, 报错, 修复, debug, 调试, 不对, 异常 | bug-fixer |
| 4 | BPM, 审批, 流程, 节点, 会签 | bpm-workflow |

### Tools / 工具类路由

| Priority | Keywords / 关键词 | Route To |
|----------|-------------------|----------|
| 1 | git, commit, branch, merge, push, rebase | git-safe + git-workflow |
| 2 | file, rename, batch, 文件, 重命名, 批量 | file-ops or batch-rename |
| 3 | json, yaml, parse, format, convert | json-utils |
| 4 | regex, pattern, 正则 | regex-helper |
| 5 | env, version, check, 环境 | env-validator |
| 6 | stats, lines, count, 统计 | project-stats |

***

## How Easy Actually Routes / easy 的实际路由机制

当 easy 被调用，执行以下步骤：

1. **预加载注册表** → 从 `meta-skill.yaml` 加载技能触发词反向索引（不可用时回退到 `skill-map.yaml`）
2. **分析用户输入** → 提取中文/英文关键词
3. **中文精确匹配** → 中文关键词与索引中的 trigers 进行精确/子串匹配（最高优先级）
4. **英文精确匹配** → 若中文无匹配，使用英文关键词匹配
5. **AI 语义兜底** → 前两阶段均无匹配时，使用语义相似度找最接近的 skill
6. **加载 skill** → 用 `skill("[skill-name]")` 加载目标 skill 的指令
7. **执行** → 按加载的 skill 指令执行任务

### 涉及多领域时的处理：
```
用户: "/easy 帮我检查代码安全和质量"
  → 匹配 security-check + code-quality
  → 建议: "您的需求涉及多个技能，推荐使用 '/auto' 来自动编排并行执行。
         或者我可以依次执行：先安全审计，再代码质量检查。继续吗？"
```

***

## Routing Strategy / 路由策略

Easy 入口采用**三阶段路由策略**，按优先级递减：中文精确匹配 → 英文匹配 → AI 语义兜底。

### 路由优先级 / Routing Priority

| 优先级 | 阶段 | 匹配方式 | 说明 |
|--------|------|---------|------|
| **P0 (最高)** | 中文关键词精确匹配 | 精确匹配/子串匹配 | 中文用户最常见入口，响应最快 |
| **P1** | 英文关键词匹配 | 精确匹配/子串匹配 | 英文输入或中英混合时使用 |
| **P2 (兜底)** | AI 语义分析 | 意图理解 + 模糊匹配 | 前两阶段均无匹配时的最后手段 |

### Phase 0: Pre-load / 预加载

Easy 启动时从 `skills/meta-skill.yaml` 加载技能注册表，构建触发词反向索引。若 `meta-skill.yaml` 不可用，回退到 `auto/config/skill-map.yaml`。

### Phase 1: Chinese Keyword Exact Match / 中文关键词精确匹配 (P0)

对用户输入提取中文关键词，与索引中的触发词进行精确匹配或子串匹配：

- **优势**: 响应极快、结果确定、中文用户直觉对齐
- **匹配规则**: 完全匹配（如 "安全" → security-check）或子串匹配（如 "代码安全检查" 中匹配 "安全"）
- **停词策略**: 第一个匹配即停止，不继续向下匹配

### Phase 2: English Keyword Match / 英文关键词匹配 (P1)

若中文匹配无结果，使用英文关键词匹配：

- **优势**: 覆盖纯英文或中英混合输入场景
- **匹配规则**: 与 Phase 1 相同的精确/子串匹配逻辑
- **优先级**: 低于中文匹配；若中文和英文同时匹配，中文结果优先

### Phase 3: AI Semantic Fallback / AI 语义兜底 (P2)

若前两阶段均无匹配，使用 AI 语义分析作为最后兜底：

- **优势**: 处理自然语言、模糊表达、无明确关键词的场景
- **适用场景**: 描述性语言、长句式、口语化表达
- **分析过程**: 提取语义特征，对照技能注册表进行语义相似度匹配

***

## Config Reference / 配置参考

Easy 路由依赖于技能配置文件，按优先级使用：

### Primary Source / 主数据源

- **路径**: `skills/meta-skill.yaml`
- **作用**: 技能注册表（单一协议文件），定义所有可用技能的元数据、能力描述、触发关键字和调度方式
- **协议**: 由 `meta-skill.md` 定义 Schema 规范
- **构建**: 脚本自动生成（`scripts/generate-meta-skill.sh`），不手动编辑

### Fallback Source / 回退数据源

- **路径**: `auto/config/skill-map.yaml`
- **作用**: 旧版技能配置文件，当 `meta-skill.yaml` 不可用时使用
- **使用策略**: meta-skill.yaml 优先；文件缺失或解析失败时降级使用

### Structure / 结构说明

`meta-skill.yaml` 采用领域分组的扁平结构：

```yaml
version: "1.0.0"
generated: "2026-06-18"

quality:                    # 技能领域
  security-check:           # 技能标识符
    path: security-check
    skill_name: security-check
    description: "Full OWASP Top 10 security audit..."
    triggers: ["security", "安全", "漏洞", "OWASP", ...]  # ← 关键字匹配源
    dispatch:
      method: task
      category: deep
      load_skills: ["security-check"]

workflow:                   # 另一个领域
  bug-fixer:
    path: bug-fixer
    triggers: ["Bug", "报错", "修复", "debug", "调试", ...]
    # ...
```

### How Triggers Work / 触发机制

- **Triggers 数组**: 每个技能定义一组触发关键字（支持中英文）
- **中文优先**: 中文触发词匹配优先级高于英文触发词
- **匹配策略**: 第一个匹配的技能获胜；按 meta-skill.yaml 中的领域和技能顺序遍历
- **维护方式**: 添加/修改技能时，重新运行生成脚本更新 meta-skill.yaml

> 💡 **最佳实践**: 在 meta-skill.yaml 中维护全面的触发关键字，确保常见需求能通过 Phase 1 中文精确匹配快速路由。不硬编码任何 skill 名称。

***

## Rationalization Table / 合理化防御表

| # | Trap / 陷阱 | Question / 请问自己 | Action / 应该怎么做 |
|---|-------------|------------------|------------------|
| 1 | "这个请求匹配多个技能，我就随便选一个吧" | 这真的是最佳用户体验吗？用户是否需要完整的多技能协调？ | 立即建议使用 `/auto` 进行自动编排，或者明确询问用户执行顺序偏好 |
| 2 | "用户的词不匹配任何触发器，但我觉得他们意思是X" | 我的猜测有依据吗？还是在过度解读？ | 使用 AI 意图分析兜底机制，但必须向用户确认理解是否正确 |
| 3 | "没有完全匹配的技能，我应该创造一个新的路由规则" | 这个需求真的需要新技能吗？还是现有技能可以处理？ | 严格使用现有路由表，不要自行创建不存在的技能路由；如果确实需要新技能，记录需求供后续开发 |

***

## Red Flags / 三层防御

### Layer 1: Input / 输入
- **INPUT-01**: 无任何可识别意图关键词 → 🔵 INFO → 回退到 AI 意图分析兜底机制

### Layer 2: Execution / 执行
- **EXEC-01**: 匹配到多个技能或复杂多领域需求 → 🟡 WARN → 建议使用 `/auto` 进行自动编排并询问用户确认

### Layer 3: Output / 输出
- **OUTPUT-01**: 路由到错误技能导致执行失败 → 🔴 CRITICAL → 记录错误案例，重新分析用户意图，尝试其他匹配技能

**级别标识**: 🔴 CRITICAL → 中断 | 🟡 WARN → 继续+标记 | 🔵 INFO → 记录

***

## Output / 输出规范

### 🇨🇳
输出格式为技能路由结果，包含：
1. 识别的用户意图关键词
2. 匹配的技能路径（L1/L2）
3. 加载技能的指令调用
4. 对于多技能需求，提供 `/auto` 建议

### 🇺🇸
Output format is skill routing result, containing:
1. Identified user intent keywords
2. Matched skill path (L1/L2)
3. Skill loading instruction call
4. For multi-skill requirements, provide `/auto` suggestion
