math-router

Deterministic router for math cognitive stack - maps user intent to exact CLI commands

⭐2.2kstars🔀157forks📁View on GitHub🕐Updated Jan 10, 2026⬇️1downloads

When & Why to Use This Skill

The Math Router is a high-performance, deterministic orchestration tool designed for the math cognitive stack. It efficiently maps natural language user intents to precise CLI commands across multiple specialized scripts, including SymPy, Z3, and Pint. By utilizing pattern-based routing instead of LLM inference, it ensures faster execution, eliminates command hallucination, and provides a reliable interface for complex mathematical operations like symbolic integration, theorem proving, and unit conversion.

Use Cases

  • Automated Symbolic Computation: Seamlessly routing calculus requests such as integration, derivatives, and limits to SymPy with exact argument extraction.
  • Formal Logic and Verification: Mapping logical propositions and optimization problems to Z3 solver commands for automated theorem proving and SAT solving.
  • Physical Unit Management: Converting complex physical quantities and checking dimensional consistency by routing natural language requests to the Pint library.
  • Geometric and Spatial Analysis: Executing spatial operations, measurements, and geometric predicates using the Shapely integration through intent-based mapping.
  • Educational Tutoring: Generating step-by-step math explanations and practice problems by orchestrating specialized tutor and scratchpad scripts.
namemath-router
descriptionDeterministic router for math cognitive stack - maps user intent to exact CLI commands
triggers["math", "calculate", "compute", "solve", "integrate", "derivative", "plot", "convert", "prove"]
priorityhigh
user-invocablefalse

Math Router

ALWAYS use this router first for math requests.

Instead of reading individual skill documentation, call the router to get the exact command:

Usage

# Route any math intent to get the CLI command
uv run python scripts/cc_math/math_router.py route "<user's math request>"

Example Workflow

  1. User says: "integrate sin(x) from 0 to pi"
  2. You run: uv run python scripts/cc_math/math_router.py route "integrate sin(x) from 0 to pi"
  3. Router returns:
    {
      "command": "uv run python scripts/cc_math/sympy_compute.py integrate \"sin(x)\" --var x --lower 0 --upper pi",
      "confidence": 0.95
    }
    
  4. You execute the returned command
  5. Return result to user

Why Use The Router

  • Faster: No need to read skill docs
  • Deterministic: Pattern-based, not LLM inference
  • Accurate: Extracts arguments correctly
  • Complete: Covers 32 routes across 7 scripts

Available Routes

Category Commands
sympy integrate, diff, solve, simplify, limit, det, eigenvalues, inv, expand, factor, series, laplace, fourier
pint convert, check
shapely create, measure, pred, op
z3 prove, sat, optimize
scratchpad verify, explain
tutor hint, steps, generate
plot plot2d, plot3d, latex

List All Commands

# List all available routes
uv run python scripts/cc_math/math_router.py list

# List routes by category
uv run python scripts/cc_math/math_router.py list --category sympy

Fallback

If the router returns {"command": null}, the intent wasn't recognized. Then:

  1. Ask user to clarify
  2. Or use individual skills: /sympy-compute, /z3-solve, /pint-compute, etc.