Hydra Logo HYDRA
GitHub
Multi-Model Hierarchical AI

Route Every Dev Task to the
Right AI Model Automatically

Hydra automatically routes every developer task to the right AI model — using Claude when it matters, Ollama when it's free. Ten tiers, automatic fallbacks, zero Python required.

10
Routing Tiers
<200ms
Typical Route Overhead
~80%
API Cost Savings vs Claude-Only
100%
Always-On Local Fallback

System Architecture

One brain, nine heads. Claude Code classifies and orchestrates — every other tier executes. Click a layer to explore its role.

Tier 1 — The Brain
Claude Code
Routing & Decider Layer
route.sh & decide.sh
Execution Heads (Tiers 2-10)
Antigravity & Ollama
Expert T2-T3
Review T4
Standard T5-T8
Grunt T9-T10

Tier 1 — The Brain

Claude Code resides at the top of the hierarchy. It classifies incoming developer intents, breaks them down using workspace maps, and manages the execution flow. It writes the files, reviews execution logs, and coordinates parallel tasks.

Primary Executor Claude Code CLI
Cost Priority Highest (Conserved)

Interactive Command Builder

Pick the complexity tier that matches your task, type what you need, and copy the exact dispatch command to run.

Select Complexity Tier
bash — hydra CLI
Generated Command:
hydra do SIMPLE "write a DTO for user settings"
1. Policy Selection: decide.sh reviews parameters and flags formatting structures.
2. Workspace Guard: scope.sh checks directories to ensure write safety.
3. Execution & Rollback: edit.sh writes code atomically and executes validation.

Workspace Directory Explorer

Every file has a specific job. Click any entry to see exactly what it does and how it fits into the routing pipeline.

Root Components
hydra-ui TUI Bash
AGENTS.md Spec
CLAUDE.md Spec
install.sh Shell
hydra.rb Ruby
dispatch/
hydra.sh Bash
route.sh Bash
agy.sh Bash
ollama.sh Bash
scope.sh Bash
decide.sh Bash
edit.sh Bash
review.sh Bash
parallel.sh Bash
company.sh Bash
repo-map.sh Bash
cost.sh Bash
registry/
routing.yaml YAML
models.yaml YAML
domains.yaml YAML
workspace.yaml YAML
policy.yaml YAML
playbooks.yaml YAML
pricing.yaml YAML
workforce.yaml YAML
ui/src/
App.tsx TSX
state.ts TS
StatusPanel.tsx TSX
hydra-ui
/hydra-ui
TUI Shell script

Executes the compiled Bun application of the React TUI. Run this locally to launch the interactive terminal dashboard to monitor all active token allocations, model executions, and costs.

Runs TUI in an isolated terminal node.
Invokes the bundle index.tsx using the Bun runtime.
#!/usr/bin/env bash
# Launch Hydra TUI — run this directly in your terminal
exec bun "$(dirname "$0")/ui/src/index.tsx"
          

Interactive TUI Simulator

Experience the React/Ink console dashboard interface directly. Cycle model tiers and submit queries to run a simulated dispatch.

🐍 HYDRA multi-model orchestrator NORMAL │ Claude: 52% │ Tab: Cycle Tier
SYSTEM Claude context
█████░░░░░ 52%
[COMPACT]
TOKEN POOLS
• Claude (agy) ✓ ok
• Gemini Pro ✓ ok
• Flash ✓ ok
• Gemini Flash Thinking ✓ ok
• Qwen (local) ✓ ok
TIERS
T1 Claude Core
T2 Opus Think
T3 Sonnet Think
T5 Pro High
T7 Flash High
T10 Qwen (local)
o__o__o o__o__o o__o__o \ / \ / \ / \ / \ / \ / o---------o---------o \ / \ / \ / \ / o---o-----o---o \ \ / / \ \ / / o---o---o \ | / \ | / o
HYDRA AI — MULTI-MODEL ORCHESTRATION
🐍 System: Hydra multi-model TUI initialized.
🐍 System: Press Tab to cycle tiers. Try typing a query or /help.
STANDARD ❯

Model Routing Hierarchy

Each tier is purpose-built — from a free local Qwen model for boilerplate to Claude Opus for architecture decisions. Route.sh picks the right one automatically.

Tier Complexity Enum Target Model Executor Accuracy Rating Cost Weight
1 CORE Claude Code Direct Shell
$$$$$
2 EXPERT Claude 4.6 Opus (Thinking) Antigravity
$$$$
3 VERY_HARD Claude 4.6 Sonnet (Thinking) Antigravity
$$$
4 HARD Gemini 2.0 Flash Thinking Antigravity
$$
5 COMPLEX Gemini 3.1 Pro (High) Antigravity
$$
6 MODERATE Gemini 3.1 Pro (Low) Antigravity
$
7 STANDARD Gemini 3.5 Flash (High) Antigravity
$
8 SIMPLE Gemini 3.5 Flash (Medium) Antigravity
$
9 TRIVIAL Gemini 3.5 Flash (Low) Antigravity
$
10 GRUNT Qwen 2.5 Coder 7B Local Ollama
Free

Getting Started

Three steps to get Hydra running. Install dependencies, clone the repo, and launch the TUI — you'll be routing tasks in under five minutes.

A Option A: Homebrew Tap (Recommended)

Install locally from the cloned repository:
brew install --HEAD Formula/hydra.rb

Or tap and install the published package:

brew tap ankit373/hydra && brew install hydra
B Option B: Standalone Installer

Copies all modules to ~/.hydra, installs Bun dependencies, seeds the local state.json, writes the launch script, and automatically registers them in your shell configuration profile (~/.zshrc / ~/.bashrc).

./install.sh
C Option C: Manual Development Install

Clone the source code manually and install dependencies. Excellent for hacking on the TUI dashboard or customizing router scripts.

git clone https://github.com/ankit373/hydra.git && cd hydra/ui && bun install
Path & Data Isolation

Hydra isolates core read-only scripts from mutable runtime state:
HYDRA_HOME: Resolves env var -> local auto-detection (repo mode) -> falls back to ~/.hydra.
HYDRA_DATA: All mutable logs and state (like state.json, cost.jsonl) are stored here (defaults to ~/.hydra). Override by setting export HYDRA_DATA="/your/path".

1 Monitor Status

Display active Antigravity allocations, Claude token percentages, and pool status.

hydra status
2 Dispatch a Task

Send instructions directly to a specific model tier by its complexity enum key.

hydra do SIMPLE "write a User DTO class in TypeScript"
3 Rubber Duck Code Review

Execute a peer evaluation on a code snippet using a different model family to avoid shared biases.

hydra duck "$(cat src/auth.ts)"
1 Boot the Interface

Launch the React TUI directly in your console (make sure to run outside of standard IDE shells).

hydra-ui
2 Cycle Model Tiers

Press Tab inside the input console to cycle the complexity key (e.g., standard to simple).

3 Check Token & Cost

Review real-time cost accumulations and active model metrics on the top status panel.

1 Slash Command Integration

Type /hydra inside a running Claude Code CLI interactive session.

2 Execute Delegation Tasks

Specify complexity tiers and prompts right in your chat window without leaving the session.

/hydra do SIMPLE "write a User DTO class in TypeScript"
3 Context Interception

Claude Code intercepts the command, coordinates with route.sh, and applies the outputs directly back to your workspace.

Open Source Community

Hydra is MIT licensed and built in the open. Ask questions, report bugs, request features, or send a pull request — all from here.

💬
Discussions
Ask questions, share ideas, show off what you built with Hydra, or start a conversation with the community.
Open Discussions →
🐛
Report a Bug
Found something broken? Open a bug report with steps to reproduce and we'll get it fixed.
File a Bug Report →
Request a Feature
Have an idea for a new model tier, routing behaviour, or TUI improvement? We want to hear it.
Submit Feature Request →
🤝
Contributing Guide
Read the dev setup, commit style, shell script standards, and PR process before sending your first contribution.
Read Contributing Guide →
🔒
Security Policy
Found a security vulnerability? Please do not open a public issue — follow our responsible disclosure process.
View Security Policy →
📋
Changelog
See what's changed across every release — new features, bug fixes, and breaking changes all documented.
View Changelog →

Contributors

Loading contributors…
⭐ Star on GitHub