# Understanding the PRIMARY Fast Path in reverse-skill: Routing and Execution Architecture

> Discover the PRIMARY fast path in reverse-skill. Learn how this deterministic routing mechanism efficiently maps task keywords to specific skill folders, ensuring the right reverse-engineering workflow is chosen automatically.

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

---

**The PRIMARY fast path is a deterministic routing mechanism that maps task keywords to specific skill folders, defined in [`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md) and executed via `skills/scripts/master-route.ps1` to ensure the correct reverse-engineering workflow is selected before any analysis begins.**

The `zhaoxuya520/reverse-skill` repository implements a structured governance framework for reverse-engineering tasks. At its foundation lies the PRIMARY fast path, a rule-based priority system that eliminates manual decision-making by automatically routing tasks to specialized skill directories based on detected technology keywords.

## What Is the PRIMARY Fast Path?

The PRIMARY fast path is the central routing contract that determines which skill folder receives priority processing for a given task. According to [`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md) (lines 5-16), this contract mandates three critical behaviors:

- **Route before acting**: The system must identify the PRIMARY path before executing any analysis.
- **Output rationale**: The chosen PRIMARY identifier and reasoning must be recorded.
- **Immediate execution**: The corresponding [`SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/SKILL.md) must open for immediate action.

This mechanism ensures that tasks involving specific technologies—such as APK files or iOS binaries—route to dedicated folders like `apk-reverse/` or `mobile-reverse/` rather than generic handlers, reducing context-switching errors.

## How the Priority Table Maps Tasks to PRIMARY Routes

The routing logic relies on a deterministic priority table located in [`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md) (lines 50-94). This table evaluates high-level task keywords against predefined conditions, selecting the first matching rule. If no conditions match, the system falls back to **R0** for generic reverse-engineering.

### PRIMARY Route Identifiers

The following table illustrates the keyword-to-folder mapping implemented in the fast path:

| ID | Condition (keywords) | PRIMARY Skill Folder |
|----|----------------------|----------------------|
| **R1** | APK / smali / jadx / apktool | `apk-reverse/` |
| **R2** | IPA / iOS / Objection / MobSF / mobile | `mobile-reverse/` |
| **R3** | JS signing / front‑end crypto / jshook / CDP | `js-reverse/` |
| **R4** | DSL VM / fireye / custom‑opcode VM | `reverse-engineering/dsl‑vm‑reverse/` |
| **R0** | Any other binary / unknown format | `reverse-engineering/` |

When `master-route.ps1` parses a task hint, it scans for these keywords in priority order. Detecting "jadx" and "apk" immediately triggers **R1**, directing the workflow to the Android-specific skill folder.

## The Execution Flow and Routing Contract

The PRIMARY fast path enforces a strict reading order that ensures proper authorization and tool selection before execution. According to the source code in [`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md), the flow follows this exact sequence:

[`RULES.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/RULES.md) → [`MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/MASTER-ROUTING.md) → `PRIMARY SKILL.md` → `(optional) routing.md` → [`tool-index.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/tool-index.md) → `bootstrap` → `ACT`

This chain guarantees that:

1. Policy constraints from [`RULES.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/RULES.md) are validated first
2. Routing logic selects the correct PRIMARY identifier
3. Specific skill instructions load from the chosen [`SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/SKILL.md)
4. Tool initialization occurs via [`tool-index.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/tool-index.md)
5. Execution proceeds only after bootstrap authorization

## PowerShell Implementation of PRIMARY Routing

The `skills/scripts/master-route.ps1` script implements the routing contract by parsing task hints and generating the PRIMARY route.

### Running the Router

```powershell

# Route a task mentioning APK analysis with jadx

powershell -File skills\scripts\master-route.ps1 -Hint "Analyze malicious APK with jadx"

# Expected output:

# PRIMARY=R1  →  apk-reverse/

# Reason: Detected keywords "apk", "jadx"

```

### Route Scope Generation

Upon execution, `master-route.ps1` creates a timestamped directory at `work/master-route-<timestamp>/` containing [`route-scope.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/route-scope.md). This file captures the PRIMARY decision, selected folder, and detection rationale.

The `skills/scripts/case-init.ps1` script subsequently consumes this scope file to initialize the case workspace with proper authorization, ensuring the bootstrap phase executes only after routing confirmation.

## Role Mapping and Access Control

The repository maintains a role mapping file at [`ops/role-map.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/ops/role-map.md) that associates each PRIMARY identifier (`R1`, `R2`, etc.) with specific specialist roles. This mapping ensures that when the fast path selects **R1** for APK analysis, the system identifies the responsible reverse-engineering specialist and applies appropriate access controls before the bootstrap phase begins.

## Summary

- The PRIMARY fast path is defined in [`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md) (lines 5-16) as a mandatory "route before acting" contract that processes task keywords before any analysis begins.
- Priority identifiers **R1** through **R0** map specific technologies (APK, IPA, JavaScript) to dedicated skill folders, with **R0** serving as the generic fallback for unknown formats.
- The `master-route.ps1` PowerShell script implements this logic by parsing hints against the priority table and creating auditable [`route-scope.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/route-scope.md) files in `work/master-route-<timestamp>/`.
- Execution follows a strict chain: [`RULES.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/RULES.md) → [`MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/MASTER-ROUTING.md) → [`SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/SKILL.md) → [`tool-index.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/tool-index.md) → `bootstrap` → `ACT`, ensuring compliance and traceability.

## Frequently Asked Questions

### What triggers the PRIMARY fast path to select R1 instead of R0?

The router scans the task hint for keywords defined in the priority table. If the hint contains "APK," "smali," "jadx," or "apktool," it matches the **R1** rule in [`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md) and routes to `apk-reverse/`. Only if no specific keywords match does the system fall back to **R0** (`reverse-engineering/`).

### How does master-route.ps1 create the route scope file?

The script generates a timestamped directory at `work/master-route-<timestamp>/` and writes a [`route-scope.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/route-scope.md) file containing the PRIMARY identifier, selected skill folder path, and detection rationale. `case-init.ps1` reads this file during case setup to authorize the correct workflow and initialize the workspace.

### Where is the PRIMARY fast path documentation maintained?

The routing contract, priority table, and execution flow are documented in [`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md). Lines 5-16 define the execution contract requiring route-then-act behavior, while lines 50-94 contain the deterministic keyword-to-folder mapping that drives the fast path selection.

### Can the PRIMARY fast path handle tasks with multiple technologies?

Yes. The router evaluates the priority table in sequential order, selecting the first matching rule it encounters. For a task involving both "APK" and "JS signing," the system selects whichever rule appears first in the table (typically **R1** or **R3**), though the specific ordering in [`MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/MASTER-ROUTING.md) determines final precedence.