Skip to content

What This Skill Does

mk:scale-routing is an internal sub-skill of Phase 0 (Orient) that replaces subjective orchestrator judgment with deterministic, auditable domain-based routing. It scans task descriptions against data/domain-complexity.csv and runs additional detection layers to classify task type, complexity level, workflow intensity, model tier, and suggested skill. A fintech auth change auto-classifies as COMPLEX without human intervention.

When to Use

Called automatically by the orchestrator at Phase 0. Not user-invocable directly. Runs on every task classification to determine routing before any agent is assigned.

Core Capabilities

Domain Classification (11 Built-in Domains)

DomainSignalsLevelWorkflowWeb Searches
e_commerceshopping, cart, checkout, payment, products, storemediumstandardecommerce architecture, payment processing
fintechbanking, payment, trading, finance, money, investmenthighenhancedPCI compliance, fraud detection
healthcaremedical, diagnostic, clinical, patient, hospitalhighenhancedHIPAA compliance, medical data security
socialsocial network, community, users, friends, postshighadvancedsocial graph, feed ranking, privacy
educationlearning, course, student, teacher, trainingmediumstandardLMS architecture, progress tracking
iotIoT, sensors, devices, embedded, smart, connectedhighadvanceddevice communication, edge computing
gaminggame, gaming, multiplayer, real-time, matchmakinghighadvancedmultiplayer architecture, game engine
governmentgovernment, civic, public, admin, regulationhighenhancedaccessibility, security clearance, audit trails
internal_toolsadmin, dashboard, internal, backoffice, cmslowstandardadmin panel patterns, RBAC, data tables
docsdocumentation, readme, changelog, wiki, guidelowone-shotdocumentation generators, static site builders
clicommand_line, cli, terminal, shell, scriptmediumstandardCLI frameworks, argument parsing

Extend by adding rows to data/domain-complexity.csv. Keep signals specific — low-signal keywords (e.g., "data", "app") create false positives.

4-Layer Detection System

LayerWhat It DoesWeight
0 — CSV Keyword MatchMatch task keywords against domain-complexity.csv (case-insensitive, first match wins for domain name)+40
1 — Task Content AnalysisClassify task type from action keywords (bug, feature, refactor, security, devops, docs, review, intake). Extract mentioned files and modules.+30
2 — Project Context AnalysisCheck project files (package.json, go.mod, etc.), directory structure (src/auth/, src/billing/), and recent git changes (HEAD~5)+20 +10
3 — Confidence ScoringSynthesize all evidence into final score. HIGH >=70, MEDIUM 40-69, LOW <40

Anti-pattern rule: NEVER classify a task based on repository type alone. Task content (Layer 1) takes precedence over project structure (Layer 2). "Fix the login button styles" in a backend-heavy repo routes to frontend patterns.

Task Type Classification (8 Types)

Task TypeSignal KeywordsSuggested SkillPriority
securityvulnerability, CVE, audit, penetration, secretsmk:cso1 (always wins)
bug_fixbug, error, broken, fails, regressionmk:fix or mk:investigate2
intakePRD, ticket, issue, analyze ticket, triagemk:intake3
featureadd, implement, build, create, newmk:cook4
refactorrefactor, clean up, extract, simplify, renamemk:cook --fast4
devopsdeploy, CI/CD, pipeline, docker, kubernetesmk:cook4
docsdocs, README, changelog, API docsmk:docs-init or mk:document-release4
reviewreview, PR, pull request, checkmk:review4

Security always wins and forces COMPLEX tier — no downgrade possible. suggested_skill is a recommendation the orchestrator may override.

Routing Logic

LevelModel TierGate 1Workflow
lowTRIVIAL (Haiku)Bypass eligible (one-shot)Minimal
mediumSTANDARD (Sonnet)RequiredStandard phases
highCOMPLEX (Opus)RequiredFull phases + security

One-shot bypass requires BOTH CSV match AND orchestrator zero-blast-radius confirmation.

Product Area Configuration (Optional)

Add .claude/product-areas.yaml to your project root for team-specific routing:

yaml
areas:
  - name: Authentication
    paths:
      - "src/auth/**"
      - "src/middleware/auth*"
    keywords:
      - "login"
      - "session"
      - "token"
      - "OAuth"
    pic:                    # optional
      - "alice"
      - "bob"

When the YAML exists, output includes product_area and pic fields. When absent, CSV-only mode — no degradation.

Harness Density (v2.1)

Level (Model)Model ID containsDensity
low (TRIVIAL/Haiku)anyMINIMAL
medium (STANDARD/Sonnet)anyFULL
high (COMPLEX/Opus)opus-4-6, opus-4.6, opus-4-7LEAN
high (COMPLEX/Opus)other (opus-4-5, claude-opus-4)FULL

Override: MEOWKIT_AUTOBUILD_MODE=MINIMAL|FULL|LEAN env var.

Output Schema

Full output includes:

FieldValuesVersion
domainsnake_case string or "unknown"v1.0
levellow, medium, highv1.0
workflowone-shot, standard, enhanced, advancedv1.0
model_tier_overrideTRIVIAL, STANDARD, COMPLEXv1.0
task_typebug_fix, feature, refactor, security, devops, docs, review, intakev2.0
suggested_skillmk:fix, mk:cook, mk:cso, mk:review, mk:intake, etc.v2.0
confidenceHIGH, MEDIUM, LOWv2.0
product_areastring (omitted if no YAML)v2.0
picstring[] (omitted if no YAML or no PIC)v2.0
autobuild_densityMINIMAL, FULL, LEANv2.1

Workflow

  1. Layer 0 — Match keywords from data/domain-complexity.csv against task description. Case-insensitive, first domain match wins. Multiple matches use HIGHEST complexity.
  2. Layer 1 — Analyze task content. Classify task type. Extract mentioned files/modules.
  3. Layer 2 — Check project context: files present, directory structure, recent git changes (HEAD~5).
  4. Layer 3 — Score confidence per domain using weighted evidence. HIGH >=70, MEDIUM 40-69, LOW <40.
  5. Classify task type — Map signals to one of 8 task types. Security always wins.
  6. Optional — Check .claude/product-areas.yaml. If exists, merge area keywords and paths.
  7. Output — Structured result with all fields. Fallback: no match returns unknown, defer to manual classification.

Example Prompt

Task: "Add OAuth2 support to the login page"

Layer 0: "OAuth" → fintech domain match
Layer 1: "add" → feature task type, "login" → auth module
Layer 2: package.json present, src/auth/ directory exists
Layer 3: CSV match +40, task content +30, project files +20 = 90 → HIGH confidence

Output:
{
  "domain": "fintech",
  "level": "high",
  "workflow": "enhanced",
  "model_tier_override": "COMPLEX",
  "task_type": "feature",
  "suggested_skill": "mk:cook",
  "confidence": "HIGH",
  "autobuild_density": "FULL"
}

Common Use Cases

  • Every Phase 0 task classification — invoked automatically by orchestrator
  • Domain-specific routing — fintech, healthcare, gaming tasks get appropriate complexity and model tier
  • Team-specific customization — add .claude/product-areas.yaml for path-based routing with PIC suggestions
  • Harness integration — autobuild_density field feeds mk:autobuild for scaffolding decisions

Pro Tips

  • Multiple domains can match a single task — the HIGHEST complexity match wins.
  • One-shot workflow bypass requires BOTH CSV match AND orchestrator zero-blast-radius confirmation. CSV alone is not sufficient.
  • Adding too many low-signal keywords ("data", "app") creates false positives. Keep signals specific to the domain.
  • The harness density script at .claude/skills/autobuild/scripts/density-select.sh is load-bearing infrastructure — do not remove or rename it.

Released under the MIT License.