Hydra
Enables Codex to delegate bounded engineering jobs to Claude Code CLI in isolated Git worktrees with strict security and allowance pacing.
README
Hydra
Run bounded Claude Code jobs from Codex without handing over your repository or your release process.
Hydra is a local Codex plugin that sends a specific engineering task to the Claude Code CLI already signed in on your Mac. Jobs run in the background. Write access stays inside isolated Git worktrees. Codex remains responsible for checking the result and deciding what reaches your branch.
Hydra uses your Claude.ai Pro or Max subscription. It rejects API credentials, provider gateways, and automatic model fallback.
Why Hydra exists
A fresh agent pays for context again. Three broad mid-tier sessions can consume more input and cache tokens than one focused Opus session that settles the question.
Hydra makes that cost visible and starts with one lead by default. It opens another session only for a separate scope, an unresolved question, or an independent judgment that the plan names in advance. Each session receives a bounded evidence capsule and a small role-specific delta instead of the host conversation.
What it provides
| Concern | Hydra's rule |
|---|---|
| Authentication | Use the installed Claude Code CLI and an existing Claude.ai Pro or Max login. |
| Model choice | Request Sonnet, Opus, Fable, or a full Claude model ID explicitly. Never fall back. |
| Fan-out | Start with one lead. Permit at most three fresh sessions and one Fable session per plan. |
| Writes | Run test and execute jobs in dedicated detached Git worktrees. |
| Network | Use a strict empty allowlist for sandboxed write jobs. |
| Persistence | Keep bounded, sanitized events and immutable terminal results on disk. |
| Cancellation | Signal only identity-matching process groups, then escalate from SIGTERM to SIGKILL. |
| Allowance | Pace manual usage snapshots; preserve quality floors and reject paid overflow. |
Install
Hydra 1.0 supports macOS on Apple silicon. You need Node.js 20.9 or newer, Git, Codex, and Claude Code 2.1.228 or newer.
git clone https://github.com/azixxxxx/Hydra.git
cd Hydra
npm ci
npm run check
codex plugin marketplace add "$PWD"
codex plugin add hydra@hydra-local
Open a new Codex task after installation so it discovers the MCP server and bundled skills.
First run
Start with preflight. It checks the local CLI version, Claude.ai authentication, provider routing, and the capabilities Hydra relies on.
Run Hydra preflight for this repository.
Then ask for a bounded job:
Ask Opus for an independent architecture review of the persistence layer. Limit the evidence capsule to the relevant files and return repository references for every finding.
Hydra exposes nine MCP tools for preflight, routing, starting jobs, status, paginated results, continuation, cancellation, outcome recording, and allowance snapshots. See the plugin reference for request shapes and operating details.
How it fits together
flowchart LR
Codex["Codex"] -->|"MCP request"| Server["Hydra server"]
Server --> Store["Durable job store"]
Store --> Worker["Detached worker"]
Worker -->|"explicit model and effort"| Claude["Claude Code CLI"]
Worker --> Worktree["Isolated Git worktree"]
Claude --> Worker
Worker --> Store
Server -->|"status and bounded results"| Codex
The server returns immediately after it creates a durable job and launches its worker. The worker survives an MCP restart, records sanitized evidence, and preserves useful worktrees for inspection. Hydra never commits, pushes, merges, deploys, or applies a patch to your main checkout.
Allowance pacing
Hydra records manual snapshots from Claude Settings as integer basis points. It does not scrape the account page, call private usage endpoints, or pretend that local token counts equal a weekly quota percentage.
During most of the week, Hydra conserves optional work. Inside the final 24 hours, it can spend verified surplus more aggressively, but only when it has enough matching observations, the snapshot is fresh, the job is useful, and every applicable bucket still fits its reserve. Required model and effort never decrease to save allowance.
The account-level usage-credit switch remains a manual check. Keep usage credits disabled if paid overflow must be impossible. If Claude asks for credits, Hydra stops with USAGE_CREDITS_REQUIRED rather than switching models or billing paths.
Security boundary
Hydra removes external setting sources, hooks, project MCP servers, automatic memory, WebFetch, and WebSearch from delegated jobs. Read permissions are scoped to the repository or worktree. Git setup disables hooks, filters, text conversion, and fsmonitor execution.
Sanitization is a backstop, not a reason to place secrets in prompts or repository output. Do not include credentials in tasks, roles, schemas, notes, fixtures, or issues. Report a credential leak, sandbox escape, routing bypass, or cancellation defect through a private security advisory.
Support
| Platform | Status |
|---|---|
| macOS arm64 | Maintained and release-tested |
| Linux | Code paths exist; community-owned and unverified |
| macOS x64 | Unverified |
| Windows | Unsupported |
Linux support can graduate when it has a maintainer and CI evidence for process identity, descendant cancellation, settings discovery, sandbox behavior, filesystem isolation, and subscription-only routing.
Documentation
- Plugin reference
- Hydra 1.0 boundary
- Architecture decisions
- Hydra 1.0 verification report
- Contributing
- Security policy
- Changelog
Development
npm ci
npm test
npm run check
The default suite uses a mock Claude CLI and consumes no subscription allowance. Real Claude and isolation probes are opt-in and must stay disabled in public CI.
License
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.