How the Routing Matrix in `skills/routing.md` Dispatches Tasks to the Correct Skill Module
The routing matrix in skills/routing.md uses a three‑dimensional lookup (Target Type → User Intent → Toolchain) to map incoming requests to skill paths, with fallback to primary keyword routing and support for multi‑skill pipeline execution.
The reverse-skill repository implements a hierarchical routing system to dispatch cybersecurity and reverse‑engineering tasks. At its core, skills/routing.md functions as a fallback decision table that bridges fast keyword matching with exhaustive scenario‑based skill selection.
Primary Routing vs. Matrix Fallback
The dispatch process operates in two layers to balance speed and coverage.
Layer 1: Keyword‑Based Primary Routing
The system first consults skills/MASTER-ROUTING.md via scripts/master-route.ps1. If a strong keyword match exists, it returns a PRIMARY route (e.g., R0) and executes immediately.
# Fast path: direct keyword match
.\skills\scripts\master-route.ps1 -Hint "Extract hidden strings from a PE file"
This avoids the overhead of parsing the full matrix for common tasks.
Layer 2: Three‑Dimensional Matrix Lookup
When primary routing fails, the engine falls back to skills/routing.md. The matrix is organized by three axes:
| Axis | Description | Example Values |
|---|---|---|
| Target Type | What object the task operates on | binary, network, memory |
| User Intent | What the user wants to accomplish | strings, exploit, analysis |
| Toolchain | Preferred or required execution environment | powershell, python, pwn-chain |
The algorithm walks rows until finding the first intersection match across all three columns.
Path Crossing: Multi‑Skill Pipeline Dispatch
Some requests require sequential execution across multiple skills. The "路径交叉" (Path Crossing) section in routing.md defines valid combinations.
For example, a CTF challenge might need:
pwn-chain→ initial exploitationreverse-engineer→ binary analysis
The dispatcher builds a pipeline and executes each skill's entry point in order.
# Build multi-skill pipeline from path crossing rules
$pipeline = @(
Get-SkillPath -Target 'binary' -Intent 'exploit' -Toolchain 'pwn-chain',
Get-SkillPath -Target 'binary' -Intent 'analysis' -Toolchain 'reverse-engineer'
)
foreach($skillPath in $pipeline){
& "$skillPath\scripts\run.ps1"
}
Path Resolution and Skill Loading
Selected rows contain relative paths like ../CTF-Sandbox-Orchestrator/.... The dispatcher resolves these against the skills/ directory, then loads the target module's SKILL.md and executes its scripts/run.ps1 or equivalent entry point.
# Programmatic three-axis lookup implementation
$matrix = Import-Csv -Path "$PSScriptRoot\..\skills\routing.md" -Delimiter '|'
function Get-SkillPath {
param($Target, $Intent, $Toolchain)
foreach($row in $matrix){
if($row.Target -match $Target -and `
$row.Intent -match $Intent -and `
$row.Toolchain -match $Toolchain){
return $row.Path.Trim()
}
}
throw "No matching skill found in routing.md"
}
Key Files in the Dispatch Chain
| File | Role |
|---|---|
skills/routing.md |
Three‑dimensional fallback matrix |
skills/MASTER-ROUTING.md |
Fast keyword‑based primary routing |
skills/SKILL.md |
Global entry that orchestrates layer 1 → layer 2 → sub‑skill |
skills/scripts/master-route.ps1 |
CLI helper implementing both routing layers |
docs/ARCHITECTURE.md |
System diagram including routing matrix placement |
CTF-Sandbox-Orchestrator/references/router-matrix.md |
Extended cross‑module routing for CTF pipelines |
Summary
- The routing matrix in
skills/routing.mdprovides exhaustive three‑axis matching when fast keyword routing fails - Primary routing via
MASTER-ROUTING.mdshortcuts common tasks for performance - Path crossing enables declarative multi‑skill pipelines for complex workflows
- Relative paths are resolved against
skills/to load module‑specificSKILL.mdfiles and execute their entry scripts - The
master-route.ps1script provides the unified interface for both routing layers
Frequently Asked Questions
How does the routing matrix handle ambiguous or overlapping matches?
The matrix processes rows sequentially and returns the first match where all three axes intersect. Design your most specific rules early in the file to ensure correct priority.
Can I add custom toolchains to the routing matrix?
Yes. Add new rows to skills/routing.md with your custom Toolchain value, then implement the corresponding skill module under skills/<toolchain>/ with a standard SKILL.md and scripts/ entry point.
What happens when no route matches at either layer?
When both MASTER-ROUTING.md and routing.md return no match, master-route.ps1 throws a terminating error with the task hint logged for diagnostics. The system does not provide a default fallback to prevent unintended execution.
Is the routing matrix used for real‑time task scheduling or only static dispatch?
The current implementation in reverse-skill performs static dispatch at invocation time. The matrix is loaded from disk and evaluated synchronously; there is no runtime task queue or scheduler in the open‑source core.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →