# Priority Order of Routing Rules in reverse-skill: Complete Technical Guide

> Master reverse-skill routing rules. Understand the priority order from R4 to R0, ensuring efficient and accurate request handling. Get the complete technical guide.

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

---

**The routing rules in reverse-shelf follow a strict priority hierarchy defined in [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json), where the `"priority"` array dictates sequential evaluation from R4 (DSL VM reverse) as the highest precedence down to R0 (General reverse-engineering) as the fallback, with the engine selecting the first matching candidate.**

The **zhaoxuya520/reverse-skill** repository implements a sophisticated routing system that directs reverse engineering tasks to specialized skill modules based on contextual hints. Understanding the **priority order of routing rules in reverse-skill** is essential for predicting which module handles a given task, as the system evaluates candidates in a specific sequence defined by the configuration file [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json).

## How the Routing Priority System Works

The routing engine treats the `"priority"` field in [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json) as its single source of truth. Located at lines 324-329, this array contains 43 route identifiers arranged by precedence, where **lower indices indicate higher priority**. When processing a task hint, the engine iterates through this array sequentially, comparing the hint against each route's regex patterns until it finds the first match. That route becomes the **PRIMARY** route assigned to the task.

Tie-breaking follows the array position explicitly—if two routes match with equal scores, the one appearing earlier in the priority list wins. This deterministic approach ensures consistent behavior across Linux, macOS, and Windows environments.

## Complete Priority Hierarchy of Routing Rules

The current priority list as implemented in the `main` branch evaluates routes in the following strict order:

1. **R4** – DSL VM reverse
2. **R1** – APK reverse  
3. **R2** – Mobile reverse (Android + iOS)
4. **R3** – JS / frontend reverse
5. **R30** – Browser extension reverse
6. **R31** – macOS / Mach-O reverse
7. **R33** – Go / Rust reverse
8. **R5** – .NET reverse
9. **R9** – Malware analysis
10. **R21** – Protocol reverse
11. **R22** – Ghidra reverse
12. **R6** – IDA reverse
13. **R7** – radare2
14. **R8** – Firmware pentest
15. **R34** – Hardware / debug interfaces
16. **R28** – OT / ICS
17. **R17** – Pwn chain
18. **R16** – Patch-diff / N-day
19. **R18** – EDR bypass RE
20. **R24** – Windows / AD
21. **R37** – Identity federation (SAML/OIDC)
22. **R23** – Cloud / K8s
23. **R35** – Database security
24. **R25** – Digital forensics
25. **R44** – Threat intelligence / OSINT
26. **R36** – Email / phishing analysis
27. **R29** – Wi-Fi / wireless
28. **R38** – RF / SDR research
29. **R32** – Thick client security
30. **R26** – Code audit / SAST
31. **R27** – Threat hunting
32. **R10** – Attack chain
33. **R11** – Pentest tools
34. **R12** – API security
35. **R13** – Supply chain security
36. **R14** – LLM / Agent security
37. **R15** – Binary diff / symbol migrate
38. **R19** – Browser / desktop automation
39. **R40** – Case evidence review
40. **R20** – Docs generator
41. **R39** – Diagram generation
42. **R41** – CTF sandbox orchestrator
43. **R0** – General reverse-engineering (fallback)

## Key Configuration Files and Scripts

### skills/config/routing.json

This file serves as the central registry for all route definitions, keyword regexes, and the definitive **priority** order. The JSON structure maps each route ID to its execution parameters and matching patterns, while the priority array at lines 324-329 establishes the evaluation sequence.

### skills/scripts/master-route.sh and master-route.ps1

These cross-platform entry points handle the actual routing logic. They parse the task hint, load [`routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.json), and iterate through the priority array to identify the primary route.

### skills/scripts/verify-routing-coherence.ps1

This PowerShell script performs automated validation to ensure the priority list order matches the sequence of route definitions in [`routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.json). It exits with status 0 if the configuration is coherent, preventing drift between the defined routes and their evaluation order.

### skills/scripts/test-routing.sh and test-routing.ps1

The CI test harnesses verify that route selection behaves according to the priority hierarchy across different platforms and edge cases.

## Practical Route Selection Examples

Query the routing system to see which rule gets selected for specific tasks:

```bash
skills/scripts/master-route.sh --hint "extract APK symbols"

```

This returns route **R1** (APK reverse) because the hint matches the APK-related regex patterns, and R1 holds higher priority than other mobile or binary analysis routes.

To explicitly target the radare2 module:

```bash
skills/scripts/master-route.sh --hint "run radare2 analysis"

```

The engine returns **R7** (radare2) as the primary route, assuming no higher-priority route claims the input.

When no specific patterns match, the system defaults to the fallback:

```bash
skills/scripts/master-route.sh --hint "random unrelated phrase"

```

This selects **R0** (General reverse-engineering) as defined at position 43 in the priority array.

Validate your routing configuration integrity using:

```powershell
-NoProfile -ExecutionPolicy Bypass -File skills/scripts/verify-routing-coherence.ps1

```

This cross-checks that the priority indices align with the route definition order in [`routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.json).

## Summary

- The **priority order of routing rules in reverse-skill** is strictly defined by the `"priority"` array in [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json).
- **R4 (DSL VM reverse)** holds the highest precedence, while **R0 (General reverse-engineering)** serves as the universal fallback.
- The engine evaluates routes sequentially; the first match wins, making array position critical for resolution logic.
- **master-route.sh** and **master-route.ps1** implement this logic across platforms, while **verify-routing-coherence.ps1** ensures configuration validity.
- All 43 routes are documented in [`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md) for reference.

## Frequently Asked Questions

### What file determines the priority order of routing rules in reverse-skill?

The file **[`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json)** contains the definitive priority array at lines 324-329. This JSON field lists route IDs in descending order of precedence, serving as the single source of truth for the routing engine across all platforms.

### How does the routing engine handle multiple matching rules?

The engine processes the priority array sequentially from index 0 to 42. The first route whose regex patterns match the input hint becomes the primary route. If multiple routes match, the one appearing earlier in the priority array wins automatically, ensuring deterministic behavior without ambiguity.

### What happens if my task hint does not match any specific routing rule?

When no defined patterns match the input hint, the system selects **R0 (General reverse-engineering)**, which occupies the final position (index 42) in the priority array. This fallback route handles generic reverse engineering tasks that do not fit specialized categories like APK analysis, malware reversing, or cloud security.

### How can I verify that the routing priority configuration is correct?

Run the **`skills/scripts/verify-routing-coherence.ps1`** script to validate that the priority list order matches the sequence of route definitions in [`routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.json). This PowerShell script exits with status 0 if the configuration is coherent, helping maintain consistency during repository updates or custom modifications.