smart-routing by wasintoh
>
Content & Writing
71 Stars
14 Forks
Updated Jan 11, 2026, 08:09 AM
Why Use This
This skill provides specialized capabilities for wasintoh's codebase.
Use Cases
- Developing new features in the wasintoh repository
- Refactoring existing code to follow wasintoh standards
- Understanding and working with wasintoh's codebase structure
Install Guide
2 steps- 1
Skip this step if Ananke is already installed.
- 2
Skill Snapshot
Auto scan of skill assets. Informational only.
Valid SKILL.md
Checks against SKILL.md specification
Source & Community
Skill Stats
SKILL.md 331 Lines
Total Files 1
Total Size 0 B
License NOASSERTION
---
name: smart-routing
description: >
Intelligent request routing for /toh command. Analyzes user intent,
assesses confidence, surveys the runtime (2-step, per orchestration-protocol),
and routes to the appropriate agent(s). Memory-first approach ensures
context awareness. Triggers: /toh command, natural language requests,
ambiguous inputs.
---
# Smart Routing Skill
Intelligent routing engine for the `/toh` smart command. Routes any natural language request to the right agent(s).
---
## ๐ง Routing Pipeline
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ USER REQUEST โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ STEP 0: MEMORY CHECK (ALWAYS FIRST!) โ
โ โโโ Read .toh/memory/active.md โ
โ โโโ Read .toh/memory/summary.md โ
โ โโโ Read .toh/memory/decisions.md โ
โ โโโ Build context understanding โ
โ โ
โ STEP 1: INTENT CLASSIFICATION โ
โ โโโ Pattern matching (keywords, phrases) โ
โ โโโ Context inference (from memory) โ
โ โโโ Scope detection (simple/complex) โ
โ โ
โ STEP 2: CONFIDENCE SCORING โ
โ โโโ HIGH (80%+) โ Direct execution โ
โ โโโ MEDIUM (50-80%) โ Plan Agent first โ
โ โโโ LOW (<50%) โ Ask for clarification โ
โ โ
โ STEP 3: RUNTIME SURVEY (2-step โ orchestration-protocol A) โ
โ โโโ Identity: declared by loaded context file + โ
โ โ .toh/capabilities.json โ
โ โโโ Probe: teams env flag + version gates only โ
โ โ
โ STEP 4: AGENT SELECTION & EXECUTION โ
โ โโโ Route to appropriate agent(s) โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
---
## ๐ Intent Classification Matrix
> Illustrative heuristics only โ native agent-description matching makes the actual call (see /toh); do not compute or display confidence scores.
### Primary Patterns โ Agent Mapping
| Pattern Category | Keywords (EN) | Keywords (TH) | Primary Agent | Confidence |
|------------------|---------------|---------------|---------------|------------|
| **Create UI** | create, add, make, build + page/component/UI | เธชเธฃเนเธฒเธ, เนเธเธดเนเธก, เธเธณ + เธซเธเนเธฒ/component | UI Agent | HIGH |
| **Add Logic** | logic, state, function, hook, validation | logic, state, function, เนเธเธดเนเธก logic | Dev Agent | HIGH |
| **Fix Bug** | bug, error, broken, fix, not working | bug, error, เธเธฑเธ, เนเธกเนเธเธณเธเธฒเธ, เนเธเน | Fix Agent | HIGH |
| **Improve Design** | prettier, beautiful, design, polish, style | เธชเธงเธข, design, เธเธฃเธฑเธ design | Design Agent | HIGH |
| **Testing** | test, check, verify | test, เธเธเธชเธญเธ, เนเธเนเธ | Test Agent | HIGH |
| **Connect Backend** | connect, database, Supabase, API, backend | เนเธเธทเนเธญเธก, database, Supabase | Connect Agent | HIGH |
| **Deploy** | deploy, ship, production, publish | deploy, ship, เธเธถเนเธ production | Ship Agent | HIGH |
| **LINE Platform** | LINE, LIFF, LINE MINI App | LINE, LIFF | LINE Agent | HIGH |
| **Mobile Platform** | mobile, iOS, Android, PWA, Capacitor | mobile, เธกเธทเธญเธเธทเธญ | Mobile Agent | HIGH |
| **New Project** | new project, start, build app, create system | project เนเธซเธกเน, เธชเธฃเนเธฒเธ app | Vibe Agent | HIGH |
| **Planning** | plan, analyze, PRD, architecture | เธงเธฒเธเนเธเธ, เธงเธดเนเธเธฃเธฒเธฐเธซเน | Plan Agent | HIGH |
| **AI/Prompt** | prompt, AI, chatbot, system prompt | prompt, AI, chatbot | Dev Agent + prompt-optimizer | HIGH |
| **Continue** | continue, resume, go on | เธเธณเธเนเธญ, เธเนเธญ | Memory โ Last Agent | MEDIUM |
| **Complex Request** | Multiple features, system, e-commerce, etc. | เธฃเธฐเธเธ + เธซเธฅเธฒเธข features | Plan Agent | MEDIUM |
| **Vague Request** | help, fix it, make better (without context) | เธเนเธงเธขเธเนเธงเธข, เนเธเนเธเธต | Ask Clarification | LOW |
---
## ๐ฏ Confidence Scoring Algorithm
> Illustrative heuristics only โ native agent-description matching makes the actual call (see /toh); do not compute or display confidence scores.
```typescript
interface ConfidenceFactors {
keywordMatch: number; // 0-40 points
contextClarity: number; // 0-30 points
memorySupport: number; // 0-20 points
scopeDefinition: number; // 0-10 points
}
function calculateConfidence(request: string, memory: Memory): number {
let score = 0;
// Keyword matching (0-40 points)
// Strong match with primary patterns = 40
// Partial match = 20
// No match = 0
score += keywordMatchScore(request);
// Context clarity (0-30 points)
// Specific page/component mentioned = 30
// General area mentioned = 15
// No specifics = 0
score += contextClarityScore(request);
// Memory support (0-20 points)
// Request relates to active task = 20
// Request relates to project = 10
// No memory context = 0
score += memorySupportScore(request, memory);
// Scope definition (0-10 points)
// Single clear task = 10
// Multiple related tasks = 5
// Unclear scope = 0
score += scopeDefinitionScore(request);
return score; // 0-100
}
// Thresholds
const HIGH_CONFIDENCE = 80; // Execute directly
const MEDIUM_CONFIDENCE = 50; // Route to Plan Agent
// Below 50 = Ask for clarification
```
---
## ๐ฅ๏ธ Runtime Survey (2-step โ never guess the IDE)
### Step 1 โ Identity (declared)
Your runtime identity is **declared by the platform context file that loaded you** (`CLAUDE.md` = Claude Code ยท `.cursor/rules/*.mdc` = Cursor ยท `AGENTS.md` = Codex ยท `GEMINI.md` = Gemini CLI / Antigravity). Confirm capabilities from `.toh/capabilities.json` (written by the installer). No detection heuristics โ the identity is stated, not inferred.
### Step 2 โ Runtime probe (only what install time cannot know)
Probe exactly: the `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` env flag, plus the Claude Code version gates for `/goal` and workflows. Nothing else.
### Execution mode
Choose from the **execution ladder in `orchestration-protocol` (Section B)** โ the full decision table lives there, once. Summary only:
- **Claude Code** โ ladder: teams > subagents > sequential
- **Cursor / Codex** โ sequential TOH LOOP in-session
- **Gemini / Antigravity** โ sequential prose loop
---
## ๐ Routing Decision Tree
```
Request arrives
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1. Load Memory Context โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 2. Is request "continue"/"เธเธณเธเนเธญ"? โ
โโโ YES โ Read memory, resume task โ
โโโ NO โ Continue analysis โ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 3. Calculate Confidence Score โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโ Score >= 80 (HIGH)
โ โโโ Select agent based on intent
โ โโโ Execute directly
โ
โโโ Score 50-79 (MEDIUM)
โ โโโ Route to Plan Agent
โ โโโ Plan Agent analyzes & routes
โ
โโโ Score < 50 (LOW)
โโโ Ask clarifying question
โโโ Wait for user response
```
---
## ๐ Clarification Patterns
### When to Ask
| Situation | Example | Action |
|-----------|---------|--------|
| No verb/action | "the login" | Ask: "What would you like to do with login?" |
| No target | "make it work" | Ask: "Which page/component should I fix?" |
| Multiple interpretations | "improve it" | Ask: "Design, performance, or features?" |
| Missing context + no memory | "fix it" | Ask: "What's broken? Describe the issue." |
### When NOT to Ask
| Situation | Example | Action |
|-----------|---------|--------|
| Clear intent | "create login page" | Execute directly |
| Memory provides context | "continue" + active task exists | Resume from memory |
| Reasonable default exists | "add a button" | Add to current page context |
---
## ๐จ Skill Loading by Intent
| Detected Intent | Skills to Load |
|-----------------|----------------|
| New Project | vibe-orchestrator, design-craft, business-context, engineer-harness |
| Create UI | ui-first-builder, design-craft, engineer-harness |
| Add Logic | dev-engineer, error-handling, engineer-harness |
| Fix Bug | debug-protocol, error-handling, engineer-harness |
| Connect Backend | backend-engineer, integrations, engineer-harness |
| Improve Design | design-craft, engineer-harness |
| AI/Chatbot | prompt-optimizer, dev-engineer, engineer-harness |
| Testing | test-engineer, error-handling, engineer-harness |
| Planning | plan-orchestrator, business-context, engineer-harness |
**Note:** `engineer-harness` skill is ALWAYS loaded for proper output formatting and next-step suggestions.
---
## ๐พ Memory Integration
### Pre-Routing Memory Check
```markdown
Before routing, ALWAYS:
1. Read .toh/memory/active.md
- Current task context
- In-progress work
- Blockers
2. Read .toh/memory/summary.md
- Project overview
- Completed features
- Tech stack used
3. Read .toh/memory/decisions.md
- Past architectural decisions
- Design choices
- Naming conventions
Use memory to:
- Boost confidence (if request matches active work)
- Provide context (for ambiguous "it" references)
- Maintain consistency (follow established patterns)
```
### Post-Execution Memory Save
```markdown
After routing completes, ALWAYS:
1. Update .toh/memory/active.md
- Mark completed items
- Update current focus
- Set next steps
2. Add to .toh/memory/decisions.md
- If new decisions were made
3. Update .toh/memory/summary.md
- If feature was completed
โ ๏ธ NEVER finish without saving memory!
```
---
## ๐ Examples
### Example 1: High Confidence โ Direct
```
Request: "/toh เธชเธฃเนเธฒเธเธซเธเนเธฒ dashboard"
Analysis:
- Keyword match: "เธชเธฃเนเธฒเธ" + "เธซเธเนเธฒ" = Create UI (40 pts)
- Context clarity: "dashboard" = specific page (30 pts)
- Memory: Project has other pages (15 pts)
- Scope: Single page (10 pts)
Total: 95 pts = HIGH
Route: UI Agent (direct)
```
### Example 2: Medium Confidence โ Plan First
```
Request: "/toh build e-commerce"
Analysis:
- Keyword match: "build" = Create (40 pts)
- Context clarity: "e-commerce" = general concept (10 pts)
- Memory: New project (0 pts)
- Scope: Multiple features (0 pts)
Total: 50 pts = MEDIUM
Route: Plan Agent first โ then execute plan
```
### Example 3: Low Confidence โ Ask
```
Request: "/toh fix it"
Analysis:
- Keyword match: "fix" (20 pts)
- Context clarity: "it" = unclear (0 pts)
- Memory: No recent bugs (0 pts)
- Scope: Unknown (0 pts)
Total: 20 pts = LOW
Action: Ask "What would you like me to fix? Please describe the issue."
```
---
## โ ๏ธ Critical Rules
1. **Memory ALWAYS first** - Never route without checking context
2. **Confidence drives action** - Trust the scoring system
3. **Plan Agent is your friend** - When in doubt, route to Plan
4. **Survey, don't guess** - Identity is declared; execution mode comes from orchestration-protocol's ladder
5. **engineer-harness always loaded** - Every response needs 3 sections + next steps
---
*Smart Routing Skill v1.0.0 - Intelligent Request Routing Engine*
Name Size