tool-routing

tool-routing is a cursor rule for Cursor from hmj1026/dhpk. It costs 18 tokens per session (1,265 once invoked), scanned A, original, MIT.

A set of rules for choosing tools when exploring a codebase, such as finding definitions, callers, dependencies, or the likely impact of an edit. It names preferred tools and fallbacks when those tools are unavailable.

In plain words
What is it for?
Use it to trace code relationships, inspect large files, find references, plan refactors, and choose between repository tools and basic file search.
Why use it?
It reduces wasted searches and helps prevent unsafe blind edits, especially during renames and refactors.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: mentions CLAUDE.md; mentions subagents; mentions Codex.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/hmj1026/dhpk/tool-routing
Clone the repo
git clone --depth 1 https://github.com/hmj1026/dhpk

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tool-routing

README.md
[![agentmods](https://agentmods.dev/badge/rules/hmj1026/dhpk/tool-routing.svg)](https://agentmods.dev/rules/hmj1026/dhpk/tool-routing)
Your own site
<a href="https://agentmods.dev/rules/hmj1026/dhpk/tool-routing"><img src="https://agentmods.dev/badge/rules/hmj1026/dhpk/tool-routing.svg" alt="Measured on agentmods" height="20"></a>
Per session 18 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,265 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00018 $0.01265
Opus 5 $0.00009 $0.00633
Sonnet 5 $0.00004 $0.00253
Haiku 4.5 $0.00002 $0.00127

Measured today against content hash 30f6c01a0c19, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

tool-routing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

cursor/rules/tool-routing.mdc · 79 lines

How it starts

The opening of the file, as written. The whole thing — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Tool Routing — gitnexus / cx / claude-mem / Read / Grep

SSOT for code exploration in dhpk-using projects. Cross-references the existing dhpk:tool-routing skill (richer prose, examples, sub-agent prompt boilerplate); this file is the compact reference card consumable directly from a project's CLAUDE.md.

Tools mentioned (cx, gitnexus, claude-mem) are external — each project decides whether to install them. dhpk does not bundle them. The decision tree below degrades gracefully (fall back to Grep / Read if the primary tool is not installed).

Decision tree

Intent Primary Fallback
What breaks if I edit X? gitnexus_impact({target, direction:"upstream"}) cx references
Where is X defined? cx definition --name X gitnexus_query
File overview (>200 lines) cx overview <file> cx definition for selected functions
File <100 lines, full read needed Read (after cx overview confirms)
Find callers cx references --name X gitnexus_impact upstream
Global rename / refactor gitnexus_rename cx references → scoped Edit (never blind find-and-replace)
Pre-commit scope check gitnexus_detect_changes() git diff --stat
Explore unfamiliar module cx overview <dir> gitnexus_query
Past decisions (cross-session) claude-mem smart_search / search get_observations([IDs])
Plain text / comments / docs Grep

Tie-breakers

  1. cx > gitnexus when both apply (cheaper, local, no MCP round-trip)
  2. gitnexus is the hard rule for impact / detect_changes / rename (when installed)
  3. claude-mem skips current session (already in scrollback); only for past-session decisions
  4. Read is the floor — only when nothing else fits
  5. Multi-repo GitNexus index: always pass the repo parameter to gitnexus_impact / gitnexus_query calls — omitting it errors with "Multiple repositories indexed" and costs a retry cycle

Investigation order & perspective depth

Read the full file on GitHub · 79 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 79 lines · 18 tokens per session scan A 30f6c01a0c19

Subscribe to this mod's changes

tool-routing is a cursor rule published in the GitHub repository hmj1026/dhpk (2 stars, last pushed today), licensed MIT. It adds 18 tokens to every session and 1,265 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.