ClaudeMods
☰
EN
● 0 online · Views 0 times
SponsorsSubmit a project
GitHub repositories · by MohabYasser2

scout-router

Runs subagents that only explore, read or research on Sonnet; planning, audits and review stay on the main model.

MohabYasser2@MohabYasser2

MohabYasser2/claude-code-mods/tree/main/scout-router

Translated

About this mod

Scout Router is a Claude Code mod that reads a subagent's type and description when it starts. Explore agents, and general-purpose agents whose description is about exploring, reading, searching or researching, run on Sonnet. Anything about planning, auditing, reviewing or grading stays on the main model, and code-writing agents stay there too unless the plugin's builders option is set to sonnet. Haiku requests are left alone since Haiku is already cheaper. Each reroute is logged. It is part of a three-mod collection built on Claude Code's function hooks (early access, tested on 2.1.286 and 2.1.287), installed by copying the folder into ~/.claude/skills/ and running /reload-plugins. MIT licensed.

Installation

Check the author's README for the marketplace and plugin name first. Commands may change as the repository evolves.

claude plugin marketplace add MohabYasser2/claude-code-mods
claude plugin install scout-router
Original text / README

Claude Code mods

Three mods for Claude Code. I asked Claude to audit my last 30 Claude Code sessions and tell me where my time went. Each mod answers one thing it found.

| Mod | What it does | What the audit found | |---|---|---| | Cache Band | Shows how warm the prompt cache is, keeps it warm while you're away, and compacts long conversations at 400K tokens | My cache went cold 91 times | | Git Sync Band | Branch, ahead/behind and changed files above the prompt, with Pull, Files and Commit & push buttons | 1,660 git checks done by hand | | Scout Router | Runs subagents that only explore, read or research on Sonnet | 243 of 309 subagents ran on Opus |

They run on Claude Code's function hooks. Those are in early access, so the API can change between releases. I built and tested these on Claude Code 2.1.286 and 2.1.287.

Install

  1. Copy a mod's folder into ~/.claude/skills/, for example ~/.claude/skills/cache-band.
  2. New sessions load it. In a session that was already open, run /reload-plugins.

To check a mod before you load it, or to run its tests:

claude plugin validate ~/.claude/skills/cache-band
claude plugin test ~/.claude/skills/cache-band

When Claude Code loads a mod, it writes the claude-code type declarations into the mod's .claude-plugin/types folder, which tsconfig.json points at. That folder is git-ignored here.

Cache Band

Every message re-reads the whole conversation. The prompt cache keeps that cheap: a cache read costs about a tenth of the normal input price. On my plan a cache entry lives for an hour after it was last read. Once it goes cold, the next message writes the whole conversation into the cache again, and a one-hour cache write costs twice the input price. On a 400K conversation, that adds up.

The band sits above the prompt: a flame that cools into a snowflake as the hour runs out, the minutes left, two toggles and a Compact button.

Auto cache. Ten minutes before the cache would go cold, it pings it. The ping goes through $.model.fork, which sends the conversation's last request again from a background copy, with a one-line keep-alive at the end. The copy is word for word the same conversation, so the API serves it from the same cache, and that read keeps the cache for another hour. The reply is dropped and nothing is added to your chat. A "hi" typed into the chat would keep the cache warm too, but it stays in the conversation for good, and Claude might act on it.

It stops after 20 pings in a row. A ping reads the cache (0.1x) and a cold restart writes it (2x), so 20 pings cost about what the restart they prevent would, around 16 hours in. Your next message starts it again. If a ping finds the cache already gone, Auto cache pauses instead of paying full price every hour.

Auto compact. It compacts once the conversation passes 400K tokens, right after Claude's reply, while the cache is still warm, so reading the conversation for the summary is cheap. Why 400K:

  • Every message re-reads the whole conversation, so at 830K each message costs about twice what it does at 400K.
  • The longer the conversation, the more Claude misses (Chroma's context rot study).
  • Compacting too early summarizes a long task halfway through, and details get lost. Anthropic's API compaction defaults to 150K (docs). Claude Code's own auto-compact waits until about 83% of the window, around 830K on a 1M window.
  • 400K is twice the old 200K window, so a long task fits in one go, at under half the per-message cost of 830K.

Compact. The button runs /compact as if you typed it. The desktop app refuses a mod's direct compaction call, so this is the route that works there.

28 tests cover the gauge, the pings and Auto compact.

Git Sync Band

A band above the prompt with the branch, how far ahead or behind it is, the changed files and when you last pushed. It reads git status every minute and fetches every five, with no credential prompts and without taking git's index lock, so it never gets in the way of Claude's own git.

Before your prompt, it pulls with --ff-only when that can't lose anything, and tells Claude what came in, or why nothing did. Pull, Files and Commit & push run git straight from the band, without a turn in the chat. Commit & push writes the message with one small model call and shows it to you before anything runs. It won't commit files that look like secrets (.env files, keys, credentials).

5 tests cover the band's layouts and the commit flow.

Scout Router

When Claude starts a subagent, Scout Router reads its type and description. Explore agents, and general-purpose agents whose description is about exploring, reading, searching or researching, run on Sonnet. Anything about planning, auditing, reviewing or grading stays on the main model. Agents that write code stay there too, unless you set the plugin's builders option to sonnet. Haiku requests are left alone, since Haiku is already cheaper. Each reroute is logged.

License

MIT

Similar projects