Model-Shunt v1.2.1
Universal Shunt Routing for AI Coding Agents

Stop burning frontier tokens on dumb file I/O

A universal, zero-dependency model-routing shunt. Delegates massive codebase reading and boilerplate generation to fast, economical worker models (Gemini Flash, Groq, Ollama) โ€” cutting token burn by up to 90% while preserving context.

โœ“ Zero external dependencies
โœ“ Bypasses Linux ARG_MAX
โœ“ Dynamic Model Discovery
โœ“ MCP + CLI + Hooks

The 20-Second Version

A token bill audit: what your agent was paying, and what it pays now.

The Shunt Architecture

Inspired by Spotify Engineering's internal routing pattern, redesigned as a universal open-source tool.

Without Model-Shunt Costly & Slow

The primary frontier agent reads raw files directly into its expensive context window.

// Frontier Agent Context
๐Ÿ“– File 1 (auth.ts): 1,200 lines (3,800 tokens)
๐Ÿ“– File 2 (session.ts): 850 lines (2,600 tokens)
๐Ÿ“– File 3 (user.ts): 2,400 lines (7,400 tokens)
Total: 13,800 tokens at $3.00/MTok
โš ๏ธ Context pollution: 95% of read tokens are irrelevant boilerplate that dilutes reasoning accuracy.
With Model-Shunt ๐Ÿ”€ 90% Less Tokens

Heavy files stream into a fast worker model. Only concise bullets with exact line numbers return.

// Shunt Worker Streams & Synthesizes
โšก Worker Model: Gemini 2.5 Flash / Groq ($0.075/MTok or $0)
// Frontier Agent Only Receives:
โ€ข auth.ts:42 | AuthTokenManager handles refresh
โ€ข session.ts:118 | Session cookie timeout set to 3600s
Total to Frontier: ~150 tokens (~98.9% saved!)
โœจ Frontier context stays razor sharp; exact line citations (N|) prevent hallucinations.

Interactive Savings Calculator

Estimate how much money and context tokens Model-Shunt saves for your daily coding workflow.

20,000 lines
2k lines 50k lines 100k lines
Estimated Monthly Cost Savings
$52.65
Saved ~94.8% of token costs
Without Shunt $55.80 / mo
With Model-Shunt $3.15 / mo

Real Files. Verified Citations.

These runs called the worker directly on real files. Factual claims (npm d3, Kubernetes OpenAPI) were checked against the source. On mypy, 6 of 13 citations name the symbol on that line.

mypy checker.py 10.8 s
446 KB
9,891 lines ยท ~111k tokens ยท via MCP
  • ! 6/13 citations name the symbol on that line
  • ! 5 more sit inside the named function
  • ! 2 name a different symbol
npm registry d3 8.3 s
733 KB ยท 1 line
~183k tokens ยท minified JSON torture test
  • โœ“ 100% ground-truth match
  • โœ“ 30/30 dependencies, exact set
  • โœ“ Version + license correct
K8s OpenAPI spec map-reduce
4.5 MB
~1.29M tokens ยท 9 chunks
  • โœ“ 4/4 claims verified 100%
  • โœ“ required fields at exact lines 4690/4691
  • โœ“ Citations survive across 9 chunks

Binary files (PDF, images, wheels) are rejected before any API call ยท Full methodology: docs/BENCHMARK.md

One-Click Agent Setup

Copy and paste the configuration into your preferred coding agent.

mcpServers configuration

Engineered for Autonomous Coding

Every detail designed to remove friction, prevent bugs, and safeguard your context window.

01

Zero Dependencies

Written in pure Python 3 standard library. No pip install, no virtualenv, and no npm. Works instantly anywhere Python 3.9+ is installed.

02

Linux ARG_MAX Guard

Bypasses the 128 KB CLI buffer limit in Linux by streaming file contents over stdin. Process hundreds of files in one pass without shell crashes.

03

Live Model Discovery

Exposes get_available_models to query your provider's active models in real time, auto-selecting the best model for reading vs writing.

04

Binary File Guard

Automatically scans initial byte blocks for null bytes (\x00) to reject images, PDFs, or compiled objects before sending them to the LLM.

05

Exact Line Indexing (N|)

Every file block has each line prefixed with its 1-based number. Worker models cite exact line ranges with zero guessing or hallucination.

06

Exponential Backoff

Automatic retry loops for HTTP 429 rate limits and 503 gateway timeouts, ensuring long-running agent workflows don't fail unexpectedly.