Open-source local hook automatically switches Claude models to cut AI costs

✍️ OpenClawRadar📅 Published: March 7, 2026🔗 Source
Open-source local hook automatically switches Claude models to cut AI costs
Ad

A developer has open-sourced a local hook that automatically selects the most cost-effective Claude AI model based on the type of coding task, potentially reducing AI costs by 50-70% without quality loss.

How it works

The tool runs as a local hook in Cursor and Claude Code (both use the same hook system) before each prompt is sent. It sits next to Opus/plan and acts as an efficient front-end filter that prevents obviously bad model matches before they hit expensive models.

Key functionality

  • Reads the prompt and current model selection
  • Uses simple keyword rules to classify tasks (git operations, feature work, architecture/deep analysis)
  • Blocks if you're overpaying (e.g., Opus for git commit) and suggests Haiku or Sonnet
  • Blocks if you're underpowered (Sonnet/Haiku for architecture) and suggests Opus
  • Lets everything else through unchanged
  • ! prefix bypasses the filter completely if you disagree with its suggestion
Ad

Technical details

  • 3 files: bash + python3 + JSON
  • No proxy, no API calls, no external services
  • Fail-open design: if it hangs, Claude Code proceeds normally
  • Open-sourced at: https://github.com/coyvalyss1/model-matchmaker

Performance and testing

The developer analyzed several weeks of their own prompts and found:

  • 60-70% were standard feature work Sonnet could handle
  • 5-20% were debugging/troubleshooting
  • A significant portion were pure git/rename/formatting tasks that Haiku handles identically at 90% less cost

Retroactive analysis showed the tool would have cut 50-70% of AI spend with no quality drop. After tuning, it correctly handled 12/12 real test prompts.

Problem it solves

The issue isn't knowledge—developers know they should switch models—but friction. When in flow state, developers don't want to think about dropdown menus. This tool automates the decision-making process.

📖 Read the full source: r/ClaudeAI

Ad

👀 See Also

Multi-Agent Trading Council System Using GPT-5.1 and Claude 4.6
Tools

Multi-Agent Trading Council System Using GPT-5.1 and Claude 4.6

A developer built a multi-agent trading system using ZagiHQ for orchestration with three parallel data-gathering agents and three LLMs (GPT-5.1, Claude 4.6 Opus, Claude 4.6 Sonnet) that must agree on trades. The system filters out setups through disagreement and requires manual approval.

OpenClawRadar
Canopy: Terminal Dashboard for Managing Multiple Claude Code Agents
Tools

Canopy: Terminal Dashboard for Managing Multiple Claude Code Agents

Canopy is an open source terminal UI that provides a single dashboard view for tracking multiple AI coding agents running across git worktrees. It shows agent states (running, idle, waiting for input, done, errored) and lets you jump into sessions or send input without fully switching.

OpenClawRadar
ClawTalk iOS App Enables Voice Chat with Self-Hosted OpenClaw AI Agents
Tools

ClawTalk iOS App Enables Voice Chat with Self-Hosted OpenClaw AI Agents

ClawTalk is a native iOS app that provides push-to-talk voice chat for OpenClaw self-hosted LLM setups. It features on-device speech-to-text using WhisperKit, real-time streaming responses with markdown rendering, and supports multiple TTS options including ElevenLabs, OpenAI, and Apple's built-in voices.

OpenClawRadar
Cortex v1.2 adds LLM enrichment, Q&A with citations, and conflict resolution
Tools

Cortex v1.2 adds LLM enrichment, Q&A with citations, and conflict resolution

Cortex, a local memory layer for OpenClaw agents, has released v1.2 with LLM-augmented enrichment by default, a question-answering command with citations, and improved deduplication and conflict resolution. The tool now includes unified configuration management and intent-based search pre-filtering.

OpenClawRadar