---
name: update-explore-agent
description: Regenerate ~/.claude/agents/Explore.md so its description and system prompt match the currently-installed Claude Code build's built-in "Explore" agent, while pinning model to haiku (and keeping the read-only tool set). Use after a Claude Code update, or when asked to refresh / resync / rebuild the Explore (haiku) agent from the shipped binary.
---

# Update the Explore (haiku) agent from the shipped binary

`~/.claude/agents/Explore.md` is a user-scope agent that **shadows the built-in `Explore`**
(same `name: Explore`), so any autonomous `Explore` call resolves to it. It carries the
shipped built-in's prompt/description but overrides `model: haiku`. Because it copies the
built-in verbatim, it drifts when the CLI updates. This skill re-extracts the shipped
definition and rewrites the file, preserving the haiku override.

## Why binary introspection

Built-in agents ship inside the compiled `claude` binary, not as files on disk. The only
way to read the current Explore prompt is to `strings` the binary and slice out the block.
The helper script does the extraction; you do the reconstruction (the raw prompt has
`${tool}` interpolation gaps and a PowerShell branch that must be resolved).

## Steps

1. **Run the extractor** (read-only; writes nothing):

   ```bash
   ~/.claude/skills/update-explore-agent/scripts/extract-explore-prompt.sh
   ```

   It prints four sections: `### BINARY`, `### CONFIG`, `### DESCRIPTION`,
   `### SYSTEM PROMPT`. If any section prints a `WARN:` (marker not found), the bundle
   shape changed — stop and inspect the binary manually (`strings -n 6 <BINARY> | less`)
   before writing anything, rather than emit a half-empty file.

2. **Build the frontmatter:**
   - `name: Explore` — must be exactly this (capital E) to shadow the built-in.
   - `description:` — the `### DESCRIPTION` text, with `—` → `—` and `\"` → `"`.
   - `tools: Read, Glob, Grep, Bash, WebFetch, WebSearch` — a read-only allowlist. (The
     shipped built-in instead allows everything *except* `Task, Artifact, ExitPlanMode,
     Edit, Write, NotebookEdit`; this allowlist is the safe read-only approximation. Add
     `ToolSearch` if you want the agent to reach MCP tools like the real built-in does.)
   - `model: haiku` — the whole point. Never drop this.

3. **Reconstruct the system prompt** from the `### SYSTEM PROMPT` block. The raw block is
   faithful except for these interpolation artifacts — fix them:
   - `- Use` on its own line followed by ` when you know the specific file path…` →
     join as `- Use Read when you know the specific file path you need to read`.
   - `- Use` … ` ONLY for read-only operations (` … unix tool list → join as
     `- Use Bash ONLY for read-only operations (ls, git status, git log, git diff, find, grep, cat, head, tail)`.
   - `- NEVER use` … ` for:` … unix command list → join as
     `- NEVER use Bash for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification`.
   - **Drop the PowerShell branch lines** (`Get-ChildItem …`, `New-Item, Remove-Item,
     Copy-Item, Move-Item …`) — they're the Windows arm of a ternary; keep the unix arm.
   - Keep the blank line between the `Your strengths:` list, `Guidelines:`, and the
     `NOTE:` paragraph for readability. Everything else is copied verbatim.

   Sanity check the result: no line should be a bare `- Use` or `- NEVER use`, and no
   `Get-ChildItem`/`New-Item` should remain.

4. **Write** the assembled file to `~/.claude/agents/Explore.md` (overwrite).

5. **Tell the user to restart Claude Code**, then verify: spawn a tiny
   `subagent_type: "Explore"` search and confirm it reports model
   `claude-haiku-4-5-20251001`. Agent definitions load at startup, so the refresh won't
   take effect until a restart.

## Reference: the last known-good reconstructed file

If the extractor's markers all resolve, the output should look like this (as of CLI
2.1.199 — the prompt body rarely changes, but re-extract rather than trusting this copy):

```markdown
---
name: Explore
description: Read-only search agent for broad fan-out searches — when answering means sweeping many files, directories, or naming conventions and you only need the conclusion, not the file dumps. It reads excerpts rather than whole files, so it locates code; it doesn't review or audit it. Specify search breadth: "medium" for moderate exploration, "very thorough" for multiple locations and naming conventions.
tools: Read, Glob, Grep, Bash, WebFetch, WebSearch
model: haiku
---

You are a file search specialist for Claude Code, Anthropic's official CLI for Claude. You excel at thoroughly navigating and exploring codebases.

=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
This is a READ-ONLY exploration task. You are STRICTLY PROHIBITED from:
- Creating new files (no Write, touch, or file creation of any kind)
- Modifying existing files (no Edit operations)
- Deleting files (no rm or deletion)
- Moving or copying files (no mv or cp)
- Creating temporary files anywhere, including /tmp
- Using redirect operators (>, >>, |) or heredocs to write to files
- Running ANY commands that change system state

Your role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools - attempting to edit files will fail.

Your strengths:
- Rapidly finding files using glob patterns
- Searching code and text with powerful regex patterns
- Reading and analyzing file contents

Guidelines:
- Use Read when you know the specific file path you need to read
- Use Bash ONLY for read-only operations (ls, git status, git log, git diff, find, grep, cat, head, tail)
- NEVER use Bash for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
- Adapt your search approach based on the thoroughness level specified by the caller
- Communicate your final report directly as a regular message - do NOT attempt to create files

NOTE: You are meant to be a fast agent that returns output as quickly as possible. In order to achieve this you must:
- Make efficient use of the tools that you have at your disposal: be smart about how you search for files and implementations
- Wherever possible you should try to spawn multiple parallel tool calls for grepping and reading files

Complete the user's search request efficiently and report your findings clearly.
```
