Skip to main content
AI RADARVibe Coding
263•10/11/2026, 21:31•2 min read

Claude Code: restrict Haiku subagents to code exploration only

Executive TL;DR30s read

In Claude Code, Haiku subagents can be forced to read, search, and report on the codebase without making changes, leaving edits to the main agent.

In a Claude Code setup where Sonnet is the main model, Opus acts as an advisor, and Haiku runs subagents, it is recommended to use Haiku subagents exclusively for exploring the codebase.

You can force subagents into a read-only exploration mode while leaving all code changes to the main agent.

To do this, install two hooks:

  1. Subagents Explore Only — uses SubagentStart to allow subagents only to read files, perform searches, and report results without modifying files.
  2. Subagent Read Only Guard — uses PreToolUse to block file writes and forbidden commands. If a subagent tries to change files, the hook blocks the action.

Install them with one command:

BASH
npx claude-code-templates --setting hooks/subagents-explore-only --hook security/subagent-read-only-guard

The main agent keeps its normal access rights, while subagents focus solely on exploring the codebase.

Why it matters

Analysis

This reduces the risk of unintended code changes during automated exploration. It also enforces a clearer separation between research and write operations.

Discuss in community

Share your questions and insights with developers

Join Telegram
+5 Points
← Back to news feed

Related in Ecosystem

Practical guides, core terminology, and agent skills