math-router
npx machina-cli add skill parcadei/Continuous-Claude-v3/math-router --openclawMath 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
- User says: "integrate sin(x) from 0 to pi"
- You run:
uv run python scripts/cc_math/math_router.py route "integrate sin(x) from 0 to pi" - Router returns:
{ "command": "uv run python scripts/cc_math/sympy_compute.py integrate \"sin(x)\" --var x --lower 0 --upper pi", "confidence": 0.95 } - You execute the returned command
- 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:
- Ask user to clarify
- Or use individual skills: /sympy-compute, /z3-solve, /pint-compute, etc.
Source
git clone https://github.com/parcadei/Continuous-Claude-v3/blob/main/.claude/skills/math-router/SKILL.mdView on GitHub Overview
math-router is the primary route for math requests, routing user intent to exact CLI commands. It deterministically maps intents like integrate, plot, or prove to specific scripts, providing precise arguments and a confidence score. Always run this first to streamline math workflows.
How This Skill Works
Feed the user's math request into the router script: uv run python scripts/cc_math/math_router.py route "<user's math request>". The router returns a JSON object with command and confidence. If command is null, ask the user for clarification or fall back to the dedicated math skills.
When to Use It
- When the user asks for a math operation (e.g., integrate, derivative, solve) and needs an exact CLI command.
- When a deterministic pattern-based mapping is preferred over LLM inference to ensure correct arguments.
- When the request involves unit conversions or quantity checks routed to Pint or similar scripts.
- When plotting 2D/3D functions or producing LaTeX output (plot2d, plot3d, etc.).
- When you want to guarantee routing first before consulting individual math skills (ALWAYS use the router first).
Quick Start
- Step 1: Route the math request with: uv run python scripts/cc_math/math_router.py route "<user's math request>"
- Step 2: Run the command returned in the router's response (the value of command).
- Step 3: Return the results to the user.
Best Practices
- Always route math intents through math-router first.
- Provide explicit operation and operands to minimize ambiguity.
- Rely on category-specific commands (sympy, pint, shapely, z3, etc.).
- Check router output; if command is null, ask for clarification or fall back to individual skills.
- Validate the syntax and parameters of the returned command before execution.
Example Use Cases
- uv run python scripts/cc_math/sympy_compute.py integrate \"sin(x)\" --var x --lower 0 --upper pi
- uv run python scripts/cc_math/sympy_compute.py diff \"x**2\" --var x
- uv run python scripts/cc_math/plot.py plot2d --expr 'y = x^2'
- uv run python scripts/cc_math/pint_compute.py convert '3.5 inch' 'cm'
- uv run python scripts/cc_math/z3_solve.py prove 'sqrt(2) is irrational'