协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
skill-router-system【开发与工程】Implements and configures the AI agent skill routing system for auto-loading, trigger matching, confidence scoring, and skills-index generation across orchestration layers.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: skill-router-system description: Implements and configures the AI agent skill routing system for auto-loading, trigger matching, confidence scoring, and skills-index generation across orchestration layers. license: MIT compatibility: opencode metadata: version: "1.0.0" domain: agent triggers: skill router, auto-routing, trigger matching, skills-index, agent dispatch, adaptive routing, prompt injection, task routing archetypes:
Configures and maintains the AI agent skill routing infrastructure that automatically matches conversational triggers to specialized skill documents, manages the skills-index registry, and ensures reliable auto-loading of contextual expertise. This system enforces deterministic fallback chains, prevents routing drift, and aligns all dispatch logic with The 5 Laws of Elegant Defense (see code-philosophy).
Use this skill when:
skills-index.json registry and its regeneration pipelineAvoid this skill for:
/skill command execution by end users (this skill covers automated routing, not user CLI)parallel-skill-runner)Parse Incoming Intent — Extract keywords, technical terms, and conversational phrases from the user message. Identify domain intent (agent, cncf, coding, trading, etc.).
Checkpoint: Confirm at least one explicit or implicit trigger keyword exists. If none found, route to default-handler or ask for clarification.
Query Skills Index — Scan skills-index.json (or cache) for matching skills using substring and semantic similarity against metadata.triggers.
Checkpoint: Ensure index freshness (last_updated timestamp ≤ 1 hour old). Force reload via /reload endpoint if stale.
Score & Rank Matches — Apply confidence scoring: exact trigger match = 0.9+, conversational variant = 0.7–0.85, semantic overlap = 0.5–0.65. Sort descending. Checkpoint: If top score ≥ 0.75, proceed to auto-load. If 0.65–0.74, apply fallback routing. If < 0.65, trigger low-confidence fallback.
Inject Skill Context — Load the full SKILL.md content into the agent's active context window. Apply metadata constraints (role, scope, output-format).
Checkpoint: Verify file size ≥ 3,000 bytes and scan for placeholder/stub patterns. Reject and log if invalid.
Execute & Record — Process the request using loaded skill constraints. Log trigger hit, confidence score, latency, and outcome to access-log for continuous tuning. Checkpoint: Ensure routing history is persisted for threshold calibration. Update confidence weights for frequently matched triggers.
User Message
↓
Intent Extraction (NLP/regex keyword scan)
↓
Skills Index Lookup (substring + semantic cache)
↓
┌───────────────────────┐
│ Confidence ≥ 0.75? │ ─No──→ Fallback Handler / Clarification Request
│ │
└───────────────────────┘
Yes
↓
Load SKILL.md → Validate Stub Policy → Inject Context
↓
Execute with Skill Constraints
↓
Log to Access-Log → Update Trigger Weights
Every branching point in the routing pipeline must have an explicit fallback:
| Failure Mode | Fallback Action | Threshold |
|---|---|---|
| No matches found | Route to default-handler or ask clarifying question | 0.0 confidence |
| Multiple high-confidence ties (>0.85) | Load top 2, execute sequentially, merge outputs | Confidence tie |
Stale index (>1h) | Auto-trigger /reload, retry lookup after fetch completes | Cache expiry |
| Invalid SKILL.md (stub, <3KB, bad YAML) | Log error, skip skill, route to next match or fallback | Validation fail |
| Context window overflow during injection | Trim non-critical sections per code-philosophy Law 3, inject core constraints only | Token limit |
skills-index.json)The router relies on a flat JSON registry for O(1) lookups. Each entry contains:
{
"name": "skill-router-system",
"description": "Implements and configures the AI agent skill routing system...",
"path": "skills/agent/skill-router-system/SKILL.md",
"domain": "agent",
"role": "orchestration",
"triggers": ["skill router", "auto-routing", "trigger matching", "skills-index"],
"last_updated": "2026-05-19T10:30:00Z"
}
Regeneration is handled by python3 scripts/generate_readme.py and synced to the API server automatically.
code-philosophy (5 Laws of Elegant Defense) when designing routing flows or fallback chainsskills-index.json idempotent; regenerate only on actual skill additions/editscode, data, system, help) that cause cross-domain false positivesWhen configuring or auditing the skill router, produce:
| Skill | Purpose |
|---|---|
confidence-based-selector | Advanced scoring and adaptive threshold tuning for uncertain matches |
parallel-skill-runner | Concurrent execution of multi-skill routing for complex tasks |
dependency-graph-builder | Maps skill interdependencies to prevent circular auto-loading |
Authoritative documentation links for this domain. The model follows markdown links at load time to resolve external references and inline content.