How to Implement Custom Analysis Decision Frameworks Beyond the Default Precedence Logic
Extend the reverse-skill routing system by registering new routes in routing.json, creating skill definitions, and appending decision rules to analysis-decision-framework.md to override or augment the default R0-R51 precedence logic.
The reverse-skill repository provides a structured approach to analysis routing through a single source of truth defined in skills/config/routing.json. By default, the system relies on a precedence array that processes routes R0 through R51 in order, applying decision rules from skills/ops/analysis-decision-framework.md. When you need specialized handling for unique analysis scenarios, you must implement a custom analysis decision framework that extends both the routing layer and the rule-evaluation engine.
Understanding the Default Precedence Architecture
The reverse-skill framework routes analysis requests through three coordinated components:
skills/config/routing.json– Contains theroutesobject defining route IDs (R0-R51), their associated skills, keyword triggers, and thepriorityarray that determines evaluation order.skills/MASTER-ROUTING.md– Maps priority entries to concrete skill directories and provides human-readable documentation of the routing logic.skills/ops/analysis-decision-framework.md– Catalogs decision rules R1-R51 that agents apply after a skill is selected, including trigger conditions, actions, and evidence requirements.
The priority array in routing.json dictates the sequential evaluation order. When master-route.ps1 processes an analysis request, it iterates through this array until finding a route whose keywords match the input context.
Step 1: Register a Custom Route
To introduce your custom framework, you must first declare it in the routing configuration.
- Open
skills/config/routing.jsonand add a new entry under the"routes"object using the next available route ID (e.g., R50):
"R50": {
"label": "Custom-Framework",
"skill": "custom-framework/SKILL.md",
"keywords": [
{ "must": "my-custom-framework|custom-analysis|my-framework" }
]
}
- Insert the route identifier into the
"priority"array, positioning it above fallback routes you intend to outrank:
"priority": [
"R50", "R4", "R1", "R0"
]
- Validate routing coherence by executing the verification script:
powershell -NoProfile -ExecutionPolicy Bypass -File skills/scripts/verify-routing-coherence.ps1
This script ensures that MASTER-ROUTING.md remains synchronized with routing.json and that no orphaned routes exist.
Step 2: Create the Skill Skeleton
Establish the physical directory structure and documentation for your custom framework.
- Create the directory
skills/custom-framework/. - Add a
SKILL.mdfile describing the framework's purpose, inputs, and outputs. Copy the template fromskills/SKILL.mdto ensure proper formatting. - Optionally add a
references/subdirectory for supporting documentation.
The SKILL.md serves as the contract between the routing system and the analysis agent, specifying what data the framework expects and what decisions it produces.
Step 3: Extend the Decision-Rule Set
The core intelligence of your framework resides in skills/ops/analysis-decision-framework.md. To add custom evaluation logic:
- Append a new rule block following the existing R1-R51 pattern, starting with R52 (reserved IDs end at R51):
### R52 — Custom-Risk Scoring
| | |
|---|---|
| **Trigger** | Presence of `my-custom-framework` tag in findings |
| **Action** | Compute a risk score (0-100) based on configurable weights |
| **Evidence** | `E-custom-score` |
- Define the new evidence type in the "Evidence IDs" table near the top of the file.
- Update downstream checklists (such as the "Synthesis checklist") to reference R52 where applicable.
Maintain monotonic numbering without gaps to ensure the decision engine parses rules correctly.
Step 4: Wire Rules into the Framework
Connect your custom rules to the skill definition so they execute automatically.
In skills/custom-framework/SKILL.md, reference the rule ID in the Actions section:
## Actions
- When a finding matches the *my-custom-framework* tag → invoke **R52** for risk scoring.
Ensure that automation scripts driving the analysis (such as skills/scripts/master-route.ps1) invoke the generic decision engine, which will now recognize and process rule R52 when the custom framework is activated.
Step 5: Verify the End-to-End Flow
Validate that routing and decision logic function correctly through integrated testing.
- Run the comprehensive smoke test:
powershell -NoProfile -ExecutionPolicy Bypass -File skills/scripts/smoke.ps1
- Inspect
work/<case>/route-scope.mdgenerated bymaster-route.ps1to confirm the router selected R50 when keywords matched your custom framework. - Verify that evidence output
E-custom-scoreappears in the case timeline, confirming that rule R52 fired during analysis.
Step 6: Document the Custom Framework
Update skills/INDEX.md to enable discovery through the repository interface. Include:
- A concise description of the framework's analytical approach.
- A relative link to
skills/custom-framework/SKILL.md. - A list of new rule IDs introduced (R52).
Summary
Implementing a custom analysis decision framework in reverse-skill requires coordination between routing configuration and decision-rule definitions:
- Register routes in
skills/config/routing.jsonand position them in thepriorityarray to override default precedence. - Validate changes using
verify-routing-coherence.ps1to maintain consistency withMASTER-ROUTING.md. - Create skill definitions in dedicated subdirectories following the established
SKILL.mdtemplate. - Extend decision rules starting at R52 in
skills/ops/analysis-decision-framework.md, defining triggers, actions, and evidence IDs. - Test implementations using
smoke.ps1to verify routing selection and evidence generation.
Frequently Asked Questions
Where does the default precedence logic live in the reverse-skill repository?
The default precedence logic resides in skills/config/routing.json within the priority array, which lists route IDs from highest to lowest precedence. The master-route.ps1 script processes this array sequentially, matching against the keywords defined for each route in the routes object. Routes R0-R51 are reserved in the base implementation, with R0 typically serving as the fallback generic analyzer.
Can I modify existing decision rules R1-R51 instead of creating new ones?
You should not modify rules R1-R51 directly, as these are reserved by the repository's base framework and may be overwritten during updates. Instead, create new rules starting at R52 in skills/ops/analysis-decision-framework.md and override routing precedence through the priority array in routing.json to ensure your custom rules evaluate before or alongside default logic.
How do I ensure my custom framework takes precedence over the generic R0 fallback?
Insert your custom route ID (e.g., R50) into the priority array in skills/config/routing.json before the R0 entry. The routing engine evaluates the array sequentially from index 0, so entries appearing earlier receive higher precedence. Run verify-routing-coherence.ps1 after modification to confirm the configuration remains valid.
What is the purpose of the evidence IDs like E-custom-score?
Evidence IDs serve as standardized references in the decision framework, linking rule actions to concrete output artifacts. When you define E-custom-score in analysis-decision-framework.md and reference it in rule R52, you create a contract that automation scripts can detect and extract from case outputs. This enables downstream tools to programmatically consume your custom analysis results.
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 →