sleeplesshan/token-router

78 stars · Last commit 2026-06-18

Lossless local line routing for massive logs, source files, and agent-context references before they reach Claude Code or Codex.

README preview

# token-router

<!-- Badge placeholders -->
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
![Python](https://img.shields.io/badge/Python-3.10%2B-blue)
![Ollama](https://img.shields.io/badge/Ollama-local%20routing-black)
![Codex Skill](https://img.shields.io/badge/OpenAI%20Codex-skill-green)

**Lossless local line routing for massive logs, source files, and routeable agent-context references before they reach a cloud reasoning model.**

`token-router` is a Codex skill and standalone Python router that uses a local Ollama model to identify exact line ranges in oversized files, then returns the raw, unmodified slices to a high-reasoning cloud model such as GPT-5.5, o3, or another AI coding agent.

## Executive Summary

Large logs, legacy source files, and long agent instruction references are expensive context. Sending a 2,000+ line deployment log, monolithic source file, or routeable project-rules document directly to a cloud LLM can waste tokens, increase latency, and exhaust budgets before the model reaches the evidence that matters.

`token-router` solves this with a hybrid separation-of-concerns architecture:

- **Local model for search and triage:** Gemma 4 via Ollama runs on the user's machine and scans large files for relevant line coordinates.
- **Cloud model for reasoning:** GPT-5.5, o3, or another cloud model receives only raw high-density evidence slices and applies deep reasoning where it matters.

View full repository on GitHub →