Skip to main content

A simple Python CLI router for AI planning and coding agents.

Project description

CLI-Router

CLI-Router is a Python command-line orchestrator for AI coding tools. It routes planning and coding stages across external CLIs such as Claude Code, Codex, Hermes, and local model tools.

The router is intentionally programmatic and non-intelligent: it loads configured commands, renders prompt templates, captures stdout/stderr, extracts planner output, writes PLAN.md, and records run artifacts.

Install

pip install cli-router

For CLI usage, pipx is recommended:

pipx install cli-router

From a local checkout:

python -m pip install -e .

Commands

cli-router --help
cli-router plan "Add a health check endpoint"
cli-router run "Add a health check endpoint"
cli-router implement
cli-router check
cli-router config show
cli-router tools list
cli-router tools test claude-planner

plan runs the planner stage and writes PLAN.md. run runs planner then coder. implement runs the coder stage using the existing plan file.

Configuration

CLI-Router looks for config in this order:

  1. ./cli-router.yaml
  2. ./.cli-router.yaml
  3. ~/.config/cli-router/config.yaml
  4. Built-in defaults

Minimal example:

version: 1

defaults:
  plan_file: PLAN.md
  run_dir: .cli-router/runs
  stop_on_failure: true

tools:
  claude-planner:
    type: claude
    timeout_seconds: 60
    command:
      - claude
      - -p
      - --permission-mode
      - plan
      - --output-format
      - json
      - "{prompt}"
    output:
      format: json
      extract: result

  codex-coder:
    type: codex
    timeout_seconds: 120
    command:
      - codex
      - --ask-for-approval
      - never
      - exec
      - "{prompt}"
    output:
      format: text

workflows:
  default:
    stages:
      - id: planner
        tool: claude-planner
        fallback_tools:
          - codex-planner
        input_template: |
          You are the planning model for a coding-agent handoff.

          User request:
          {user_prompt}

          Inspect this repository and produce a concrete implementation plan.
          Do not edit files.
          Write the plan in Markdown.
        output_file: PLAN.md

      - id: coder
        tool: codex-coder
        input_template: |
          Please implement the plan in {plan_path}.

          Original user request:
          {user_prompt}

Command args and templates support {prompt}, {user_prompt}, and {plan_path} placeholders.

When a stage command fails, CLI-Router records stdout/stderr and classifies common failures. Usage-limit messages such as provider quota, rate-limit, or 429 errors are reported as usage-limit failures. Commands can set timeout_seconds; timed-out commands are recorded with exit code 124. A stage can define fallback_tools to try alternate configured tools in order after a failed primary tool.

Artifacts

Each run writes artifacts under .cli-router/runs/:

.cli-router/runs/2026-07-07T14-22-10/
  run.yaml
  planner.stdout
  planner.stderr
  planner.extracted.md
  coder.stdout
  coder.stderr

Development

python -m pip install -e .
python -m pytest

Build and check a release locally:

python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cli_router-0.1.0.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cli_router-0.1.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file cli_router-0.1.0.tar.gz.

File metadata

  • Download URL: cli_router-0.1.0.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cli_router-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bd0c757831952068a526123494a8aa17ad5f31ef6018fb3ff111d5fa335ce954
MD5 bce13732d512fc51751979cba1234f30
BLAKE2b-256 3ffc2bdcffde2d1df1f23dc71dee8fa0fac0e67d33c2bb8d2e6115a19282fb8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cli_router-0.1.0.tar.gz:

Publisher: publish.yml on coolrazor007/cli-router

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cli_router-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cli_router-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cli_router-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b9a11777177c17da2d742ac8bfa2676bfbe2d29d9c22fa9e24c384263e9e74b
MD5 99b39d6ada37358bfe3d1c1ad71dda31
BLAKE2b-256 99b7e9e2d63f072ec5fdf5279ab7943d74be74510bf3a7ef1b3f2bd4b00f966d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cli_router-0.1.0-py3-none-any.whl:

Publisher: publish.yml on coolrazor007/cli-router

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page