tool-routing

tool-routing is a cursor rule for Cursor from hmj1026/dhpk. It costs 4 tokens per session (1,210 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.

Good fit Use it to trace code relationships, inspect large files, find references, plan refactors, and choose between repository tools and basic file search.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/hmj1026/dhpk/tool-routing
View source ↗ hmj1026/dhpk
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.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tool-routing

Your own site · 80×15
<a href="https://agentmods.dev/rules/hmj1026/dhpk/tool-routing"><img src="https://agentmods.dev/badge/rules/hmj1026/dhpk/tool-routing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4 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,210 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00004 $0.01210
Opus 5.5 $0.00002 $0.00484
Sonnet 5.5 $0.00001 $0.00242
Haiku 4.5 $0.00000 $0.00121

Measured yesterday against content hash 60257acb1470, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 yesterday.

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 · 81 lines

How it starts

The opening of the file, as written. The whole thing — 81 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. 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

  • Path-first: before reading code detail, locate the entry point, trace the call chain (A→B→C), and map data flow (input→transform→output). Analysing logic without its execution context produces local-reasoning misdiagnosis. (codebase-exploration, root-cause-investigation, gitnexus-exploring)
  • Single vs dual perspective: default to single-perspective (cx / gitnexus_query / codebase-exploration) for clear errors with a stack trace. Escalate to the codebase-exploration --dual mode, issue-analyze + Codex, or gitnexus_context only when findings are uncertain, contradictory, or intermittent, or the decision spans multiple modules. (codebase-exploration, issue-analyze, gitnexus-debugging)
  • Parallel exploration: when independent directions materially affect the conclusion (e.g. frontend + backend + data, or several module boundaries), assess whether dispatching up to 3 Explore agents in one turn will reduce uncertainty. Give each explicit non-overlapping scope and the cx tool-priority block; consolidate before the next round. Do not dispatch for a single-file patch or symbol lookup. (harness-fill, flow-guide)

Read the full file on GitHub · 81 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. yesterday Changed · -4 lines · -14 tokens per session 60257acb1470
  2. 28d ago Changed · +6 lines b29b23564c42
  3. 1mo ago Changed d08b4cd074f9
  4. 1mo ago 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 yesterday), licensed MIT. It adds 4 tokens to every session and 1,210 once invoked, about $0.0000 per session on Opus 5.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.