# How the Master Routing System Prioritizes Reverse Engineering Tasks

> Learn how the master routing system prioritizes reverse engineering tasks. Discover its deterministic cascade for selecting optimal skill modules based on target type, intent, and toolchain.

- Repository: [ZhaoXu/reverse-skill](https://github.com/zhaoxuya520/reverse-skill)
- Tags: deep-dive
- Published: 2026-08-08

---

**The master routing system employs a deterministic cascade that first matches requests against a ranked primary shortcut table (R1–R40) in [`MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/MASTER-ROUTING.md), then falls back to a comprehensive three-axis matrix in [`routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.md) to select the optimal skill module based on target type, user intent, and toolchain.**

The `reverse-skill` repository by zhaoxuya520 automates the selection of reverse-engineering workflows through a hierarchical decision engine. By evaluating every request across three orthogonal dimensions, the master routing system guarantees that the most specific skill module—whether for Android APK analysis or Windows binary decompilation—handles the task without manual intervention.

## Three Dimensions of Prioritization

The routing engine evaluates every incoming task against three distinct axes defined in the source documentation:

- **Target Type** – The file format or platform (e.g., APK, ELF, .NET binary, iOS IPA)
- **User Intent** – The analytical goal (e.g., "decompile," "unpack," "remove anti-debug," "dynamic instrumentation")
- **Toolchain** – The preferred or required toolset (e.g., IDA Pro, radare2, Frida, Ghidra)

These dimensions are encoded in two core configuration files. The primary priority list resides in [[`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md)](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md), which contains a ranked table (R1 → R40) that assigns immediate skills to obvious signals. For example, an APK extension triggers `apk-reverse/`, while a .NET binary triggers `dotnet-reverse/`. If the primary shortcut fails to match, the system consults [[`skills/routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/routing.md)](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/routing.md), which enumerates every target type against user intent and optional toolchain to locate the exact skill path.

## Step-by-Step Prioritization Flow

The routing algorithm follows a strict five-phase cascade implemented in [`skills/scripts/master-route.ps1`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/scripts/master-route.ps1):

1. **Extract Signals** – The parser scans the user’s hint for keywords including file extensions, binary signatures, and action phrases like "decompile," "Frida," or "OLLVM."

2. **Primary Shortcut Evaluation** – The engine scans the priority table in [`MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/MASTER-ROUTING.md) (section "优先级（高 → 低）"). The first row whose condition matches the hint determines the **PRIMARY** skill. For instance, the hint "APK / Android" immediately routes to `apk-reverse/`.

3. **Fallback Matrix Lookup** – If no primary rule matches, the system loads [`routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.md) and performs a three-axis lookup:
   - Selects the **target type** row (e.g., *Binary exe/dll/so/elf*)
   - Selects the **user intent** column (e.g., "decompile / IDA analyze")
   - Optionally narrows by **toolchain** (e.g., IDA vs. radare2)

4. **Tool Availability Verification** – The system checks [[`skills/tool-index.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/tool-index.md)](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/tool-index.md) to verify required tools are installed. Missing tools trigger the bootstrap flow (`bootstrap-reverse.ps1` or [`bootstrap-reverse.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/bootstrap-reverse.sh)) before execution proceeds.

5. **Skill Execution** – The selected skill’s [`SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/SKILL.md) is opened and its workflow runs, automatically creating a case workspace at `work/<case>/scope.md`.

## Architecture Overview

The system architecture visualized in [[`docs/ARCHITECTURE.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/docs/ARCHITECTURE.md)](https://github.com/zhaoxuya520/reverse-skill/blob/main/docs/ARCHITECTURE.md) illustrates this deterministic routing layer:

```mermaid
flowchart LR
    SKILL[SKILL.md] --> Routing[routing.md]
    Routing --> Primary[Primary shortcut table]
    Routing --> Matrix[Full three‑axis matrix]
    Primary -->|match| SkillModule[Selected skill]
    Matrix -->|match| SkillModule
    SkillModule --> ToolCheck[tool-index.md]
    ToolCheck -->|missing| Bootstrap[bootstrap‑reverse]
    ToolCheck -->|available| Execute[Run skill workflow]

```

**SKILL.md** serves as the entry point that loads routing rules. The **Primary shortcut** provides a fast path for common tasks, while the **Full matrix** guarantees coverage for edge cases. The **bootstrap** subsystem ensures cross-platform execution regardless of whether the host runs Windows or Kali Linux.

## Practical Usage Examples

Analysts interact with the routing engine through PowerShell commands. The engine handles the prioritization logic automatically:

```powershell

# Primary shortcut match for Android analysis

powershell -File skills\scripts\master-route.ps1 -Hint "apk unpack and decompile"

# Expected output:

# PRIMARY: apk-reverse/

# Reason: R1 condition "APK / Android app" matched the hint.

# → Opening apk-reverse/SKILL.md …

```

When hints are ambiguous, the system falls back to the matrix:

```powershell

# Fallback matrix lookup for anti-debug removal

powershell -File skills\scripts\master-route.ps1 -Hint "remove anti-debug checks in a Linux ELF"

# Expected output:

# PRIMARY: reverse-engineering/

# Reason: No primary shortcut matched; matrix lookup:

#   Target Type = Binary exe/dll/so/elf

#   User Intent = "remove anti-debug / anti-detection"

#   → routed to reverse-engineering/anti-analysis.md

```

The following Python-style pseudocode mirrors the deterministic logic implemented in `master-route.ps1`:

```python
def route_task(hint: str) -> str:
    # Phase 1: Primary shortcut lookup

    for rank, cond, skill in PRIMARY_TABLE:
        if matches(cond, hint):
            return skill

    # Phase 2: Full matrix lookup

    target = infer_target_type(hint)
    intent = infer_user_intent(hint)
    return MATRIX[target][intent] or "reverse-engineering/"

def ensure_tools(skill: str):
    needed = read_tool_requirements(skill)
    missing = [t for t in needed if not tool_available(t)]
    if missing:
        bootstrap(missing)
    refresh_tool_index()

```

## Summary

- The **master routing system** prioritizes tasks using a ranked primary table (R1–R40) in [`MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/MASTER-ROUTING.md) before falling back to a three-axis matrix in [`routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.md).
- **Three dimensions** determine routing: target type, user intent, and toolchain.
- **Tool verification** occurs via [`tool-index.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/tool-index.md), with automatic bootstrapping for missing dependencies.
- The **deterministic cascade** guarantees the most specific skill handles the request, ensuring APKs route to `apk-reverse/` while ambiguous binary tasks consult the full matrix.

## Frequently Asked Questions

### What happens if no primary rule matches the task?

If no primary shortcut matches, the routing engine loads [`routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.md) and performs a comprehensive matrix lookup across target type and user intent dimensions. This fallback mechanism ensures coverage for specialized or edge-case scenarios that lack dedicated R1–R40 shortcuts.

### How does the system handle missing tools or dependencies?

After selecting a skill, the engine consults [`tool-index.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/tool-index.md) to verify required tools are installed. If tools are missing, the system executes `bootstrap-reverse.ps1` (Windows) or [`bootstrap-reverse.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/bootstrap-reverse.sh) (Linux) to install dependencies, refreshes the tool index, and then proceeds with skill execution.

### What is the difference between MASTER-ROUTING.md and routing.md?

[`MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/MASTER-ROUTING.md) contains the **primary priority list**—a fast-path table of 40 ranked rules for common signals like APK or .NET binaries. [`routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.md) contains the **full routing matrix**, an exhaustive three-dimensional lookup table that covers every combination of target type, user intent, and toolchain for cases not handled by the primary shortcuts.

### Can analysts override the automatic routing decision?

While the system is designed to operate deterministically, analysts can influence routing by crafting specific hints that trigger higher-ranked primary rules or by manually specifying target types and intents that map to precise matrix coordinates in [`routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.md).