/discovery:explore [--output change-prep|explain] [scope]from discovery
Explores local codebase, traces dependencies, and checks tests before making changes. Persists findings to EXPLORE.md. Use for understanding existing code, dependencies, and test coverage.
Ships in discovery. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Arguments. [--output change-prep|explain] [scope]. --output sets the reply shape for this run (Reply shape) and is not part of the scope. e.g., /discovery:explore payments module dependencies, /discovery:explore tests, /discovery:explore git, /discovery:explore config
Run each command below as its own Bash call, all sent together in one message (worktree isolation).
Keep any bound in the command's own pipe (output limits).
Unless this section says otherwise, treat a failure (not a repository, git unavailable) as an unknown value and carry on. Keep these as body calls, never ## Pre-computed context lines (gather-block convention).
git branch --show-currentgit status --porcelain | head -20git rev-parse --show-toplevelThese values orient this session only. Resolve files against the project root, an absolute machine path, but never echo it into EXPLORE.md; the handoff artifact records relative paths (outcome gate below).
explore_outputResolve explore_output before routing; it decides only the final reply. EXPLORE.md and its
sidecars are written the same way under every value. Lowest layer first, a later one winning
(key contract: ${CLAUDE_PLUGIN_ROOT}/reference/config.md):
auto;userConfig value, ${user_config.explore_output} (a literal unexpanded token means unset;
auto here is reported as the default, since the two cannot be told apart);explore_output in docs/conventions/discovery.yaml at the project root;--output change-prep or --output explain argument on this invocation.Read the file with the Read tool; a missing file or key leaves that layer unset, and the file does
not apply when the project root is unknown. No ~/.claude file, .claude/ file or personal override
sets this key. A value other than auto, change-prep or
explain in any layer (or an --output value other than the two) is named in the reply, with the
file or userConfig that held it, the key, and the value, and that layer is dropped. A valid
higher layer (such as --output) still wins; with none, the run continues on the default, auto,
reported as the default level with the invalid value named. It never falls through to a lower
layer's value.
Under auto, pick the concrete shape:
explain only when a person asked, in their own message, how something works ("how does the
retry scheduler work", "walk me through the login flow").change-prep for everything else: a request made before a change, and every invocation from
another skill (a skill body told you to run /discovery:explore, or you are a subagent another
skill dispatched), however its scope is worded. A calling skill that wants a walkthrough passes
--output explain.State one line in the reply: the concrete shape and the layer that supplied the value, e.g.
explore_output: explain (auto from the default; how-does-it-work request) or
explore_output: change-prep (docs/conventions/discovery.yaml).
The two shapes:
change-prep: the handoff summary: what exists, the constraints and patterns a change must
respect, the open questions with recommended defaults, and the next stage
(/discovery:research or /planning:plan (if enabled)).explain: a walkthrough of how the scope works, in the order a request or call moves
through it, each step citing the path:line it rests on, from files the run Read. Open
questions are still surfaced. No next-stage recommendation unless the person asked for one.From the main conversation, this skill dispatches the discovery:explorer subagent. Exploration reads many files; keeping that out of the orchestrator's context window is the point. The agent loads the project's path-scoped rules, runs the six dimensions, writes the artifact set, and returns a bounded summary plus a file pointer, not the reads. The parent resolves the pre-dispatch envelope first, six fields (scope, reason, memory-slice path, memory root, budget, capability flags), written into the dispatch prompt as the labeled template in ${CLAUDE_PLUGIN_ROOT}/reference/parent-contract.md, not as prose the agent has to parse, and owns the post-dispatch boundary after: re-surfacing open_questions to the user, dispatching the sibling verifier, and writing its verdict back into EXPLORE.md (which agent, its prompt, the literal verification: line, and what to write when no verifier can run: ${CLAUDE_PLUGIN_ROOT}/reference/parent-contract.md, "The sibling verifier, stated once"), the explorer always returns verification: pending because it may not grade its own work, so an artifact left saying pending after the parent verified it cannot be told apart from one whose verifier never ran, and this artifact is the whole handoff a fresh session resumes from.
The spawn's model follows the parent contract's "The worker's model is the parent's call":
pass one only when a multi-agent config layer moves the explorer's role off its pin.
The dispatch prompt also carries Output: change-prep or Output: explain, the concrete shape
resolved under Reply shape above, never auto: the explorer cannot see the request or who made it.
After the acceptance gate passes, the reply to the person (or the calling skill) is the explorer's
prose in that shape plus the explore_output: line.
Run inline instead when any of these holds. Inline runs the identical workflow, and the escape hatch relaxes nothing:
When selecting the dispatched route: probe check-dispatch-artifact.sh --help before dispatching; a denied or errored probe halts. An un-runnable post-dispatch gate is not a reason to take the inline escape hatch to dodge the gate. A legitimate inline run (tight iteration, cost, already-a-subagent) does not owe that script, it has no script verdict to self-grade, so do not apply this precondition to the inline path. Invocation forms: ${CLAUDE_PLUGIN_ROOT}/reference/parent-contract.md.
Which agent, decided by four tests. The named alternative is the built-in Explore subagent, and these four decide between it and discovery:explorer. Any one YES routes to discovery:explorer, and all four NO means this skill is the wrong entry point altogether, dispatch built-in Explore and do not invoke this skill:
.claude/rules/, a nested AGENTS.md, declared layer rules)? Built-in Explore never sees them.verified: grep, never verified: read.Each NO above is a harness denial, not a preference, and the four are recorded once with their basis in ${CLAUDE_PLUGIN_ROOT}/reference/parent-contract.md, "The built-in Explore agent cannot hold this plugin's contract". Read it before arguing with a test; do not restate the denials anywhere else.
Built-in Explore is therefore a scout under a worker, never the worker. Where it earns its place: the locate-tier legwork inside a larger exploration, per the fan-out rules below. When dispatching one, pass a thoroughness level (the values are subagents: built-in subagents's to state) and restate any convention that bounds the search, because it arrives convention-blind.
Preload-liveness sentinel. A dispatched agent receives this body through its skills: preload, and we never count on the harness to tell the agent when that preload does not load. The record for that harness behavior is ${CLAUDE_PLUGIN_ROOT}/reference/parent-contract.md, "Harness facts the dispatch design rests on". A dispatched run therefore echoes this token verbatim as preload_token in its return payload. The disk fallback Reads this same file, so a matching preload_token is file-identity, not proof that preload fired:
discovery-explore-preload-8e2b7d
A missing or mismatched token is a hard failure: the parent discards the run, never downgrades or accepts the artifact. Without it, a preload miss produces an undisciplined run that still writes an artifact. Indistinguishable from success at every other seam. Provenance is preload: fired | fallback; fallback is the accepted recovery, not a discard. Rationale and the parent-side contract: ${CLAUDE_PLUGIN_ROOT}/skills/explore/reference/dispatch.md, "Discipline liveness".
Post-dispatch acceptance gate. Parent-side, before the payload is believed. status: complete is the agent's claim about its own run, and a claim is not evidence. Grade the run off disk, against the memory-slice path from the parent's own pre-dispatch envelope, carry that path across the dispatch, because it is this gate's input, and never a path read out of the payload, because the failure this gate exists to catch is a payload that comes back carrying no pointer at all. In order:
Pre-dispatch: create the memory slice and touch <that slice>/.explore-dispatch as the gate's freshness baseline, then hand that file to the gate as --newer-than. Without it a slice that already holds an earlier run's artifact set passes every on-disk check even when this dispatch wrote nothing at all. Both shell forms of that one command are in ${CLAUDE_PLUGIN_ROOT}/reference/parent-contract.md ("The pre-dispatch baseline"). Copy the one matching this session's shell, because the POSIX form's touch is not a command in PowerShell and its directory flag is a parameter error there. Same file carries the envelope template this dispatch also owes. The memory root's self-ignoring .gitignore guard is a separate obligation this gate does not grade. Same file, "What this gate does not grade".
The payload is well-formed. preload_token matches the sentinel verbatim, preload: is fired or fallback, and an artifact: pointer is present. Missing token or artifact is a failed dispatch whatever the status field says; a missing token is a discard, per the rule above. A missing or unrecognized preload: field is an out-of-date agent definition, not a pass. A matching token does not prove preload fired; preload: fallback is not a discard.
And scope_as_received matches the scope the parent actually sent. Compared against the envelope the parent wrote, not against what it meant. It is the only check here that fires on an input that is present and wrong. A mismatch is a failed dispatch: re-dispatch with the scope restated in a form that survives the trip (see the caveat under Scope); do not accept the artifact and mentally translate it. A well-formed payload carrying no scope_as_received is an out-of-date agent definition, not a pass.
The artifact set is actually on disk, and this run put it there:
"${CLAUDE_PLUGIN_ROOT}/scripts/check-dispatch-artifact.sh" <the retained memory-slice path> \
--index-name EXPLORE.md \
--newer-than <that slice>/.explore-dispatch --expect-index <the payload's artifact: value>
--index-name is required, not defaulted, the same gate grades /discovery:research runs, the two artifact families differ only in that name, and a gate that fails closed everywhere else must not guess which family it is looking at.
The gate grades exactly the slice path it is given and never scans the slice for an index elsewhere, so on a collision the envelope's slice path is already the sub-slice the parent assigned pre-dispatch, and that same assigned path is the one handed here.
Cite the exit status, 0 usable, 1 no usable artifact set, 2 ungradeable, not a reading of the directory, because the context most motivated to call the dispatch finished is the one that would be doing the reading. Only the slice path and --index-name are required, and that bare form is still a real gate: every optional check reports unchecked rather than passing quietly. Append --expect-sidecars <n> when the payload reported a sidecars: count, and drop any flag whose value the payload did not supply.
The index= path in that output is authoritative downstream: the verifier's target and the handoff pointer both come from it, not from artifact:. pointer=mismatch means the payload named a file this gate never graded, a defect in the payload, not a naming preference to reconcile.
Before the sibling verifier, run bash "${CLAUDE_PLUGIN_ROOT}/lib/read-verification.sh" --plugin discovery --skill explore --file docs/conventions/discovery.yaml and report its line: light and off skip that verifier and write verification: skipped (<level>), as the parent contract "The sibling verifier, stated once" says.
Any non-zero exit halts the workflow, and a gate that could not run at all is a FAIL, never a skip. An invocation above that is denied, prompts and is declined, or errors out halts exactly as a non-zero exit does; do not fall back to reading the directory. Do not proceed to research, planning, or an edit on the strength of an exploration that did not happen. Proceeding is the damage a silently-empty return actually causes; the missing artifact is only how it starts. Recovery ladder, and why a resume beats a re-dispatch: ${CLAUDE_PLUGIN_ROOT}/skills/explore/reference/dispatch.md.
One named exception, and it is an exception to the halt, not to the gate. Exit 1 with persistence: by-value in the payload means the agent finished and its environment refused every write, the one failure where a re-dispatch pays full price to reproduce the same refusal. There the parent writes the slice itself from the artifact bodies the payload carries verbatim, into the memory-slice path it resolved before dispatch (on that path the payload's artifact: value is a destination the agent names, never the anchor), and then re-runs the identical gate command above. The workflow proceeds only on a subsequent exit 0. If the second run is non-zero, the halt stands and the ladder resumes at the rung it was on. The freshness check needs nothing special: the parent writes after its own pre-dispatch touch, so the index is strictly newer than the baseline.
Read the by-value rung before performing that write: ${CLAUDE_PLUGIN_ROOT}/skills/explore/reference/dispatch.md. It carries the two conditions that bind the write (filename checking and the collision rule) and why a by-value payload of findings rather than artifact bodies is a failed dispatch rather than a fallback.
Coverage discipline when fanning out: (1) write a numbered gap-list before any deepen pass; (2) fan out by disjoint area, never split the six dimensions across agents; (3) whoever holds the workflow writes EXPLORE.md. discovery:explorer writes its own, while built-in Explore agents cannot write one at all, so their caller does.
When to fan out, and to what. Fan-out is the worker's, not the parent's: the parent dispatches one discovery:explorer, which scales inside its own run. Two triggers, either one: the scope names two or more disjoint areas, or the numbered gap-list after the first pass carries four or more entries in areas that share no files. Below that, go sequential; a scout costs a spawn and returns a pointer, which a single-area scope does not need. The worker type is the built-in Explore scout described above, one per disjoint area, each told what it owns and what it must not wander into. Spawn at most a dozen scouts at once. That is this plugin's own ceiling, not the session's, which subagents: concurrent subagent limit governs, so a wave of twelve is not guaranteed to fit. Treat a refused spawn as an area deferred, not dropped: hold it and re-spawn it in the next wave, and let the gap-list rather than the first wave decide when coverage is done. The scout is locate-tier: its hits are pointers, and the worker Reads the file itself before any sidecar records verified: read.
One EXPLORE.md, one worker. Do not fan the six dimensions across parent-side explorers, the shape the /discovery:research deep tier uses for N independent topics: codebase areas share a dependency graph, and a parent-side split severs dimension 3. Revisit only when an ask arrives as N genuinely separable modules with no cross-area dependency; then the sub-slice machinery this plugin already has applies unchanged.
Load reference/workflow.md when you are the worker (inline, or the dispatched discovery:explorer), before the first dimension. It holds purpose, the six dimensions, exploration modes, and the output format. The parent does not load it to dispatch. The outcome gate below still applies. The worker also reads reference/ecosystem-discovery.md before dimension 1: it resolves the import token, test locations and build files the dimensions grep.
Before writing EXPLORE.md (or returning the summary), check the artifact against binary criteria read off it, not a "did I explore enough?" recap. Any FAIL → return to the named dimension and fix before handoff:
verified: ran with its command: and observed result:; a test that was only opened supports no such claim.repos: carries each explored repository's sha and dirty flag, its ## Code references section opens with coverage: exhaustive or coverage: key-files followed by the staleness-check line, and every abstract states a finding rather than naming what was covered.open_questions for the parent to surface under dispatch. Each with a recommended default.When dispatched work returns after you presented open questions and before the user answers, never re-send them: a return that changes one re-sends that question alone, in full, marked changed, and after the user's reply each question it left unanswered is restated in full: docs/contracts/async-round-presentation/README.md in the marketplace.
Explore the following: $ARGUMENTS
A leading --output <value> in that line is the reply shape, not part of the scope.
A dispatched run does not read that line. The scope does not reach a preloaded body by argument substitution, and a non-fork subagent has no view of the conversation to fall back on, so do not rely on seeing an unfilled slot: for a dispatched run the scope arrives in the dispatch prompt, and its absence is a parent-envelope failure the agent reports rather than repairs, whatever the line above renders as. There is no unscoped orientation mode under dispatch: a general repository sweep would hand back a plausible artifact answering a question nobody asked. What is documented about that path, and what is not, in either direction, is recorded once in ${CLAUDE_PLUGIN_ROOT}/reference/parent-contract.md. Running inline with no scope supplied above, infer it from the current conversation context. Identify what area of the codebase is relevant to the task at hand and explore that.
Caveat, a ${CLAUDE_…}-shaped token in a scope may not arrive as you typed it, which is a different question from the paragraph above and not evidence for or against it. What was observed, what is documented, what is not, and the practical rule: ${CLAUDE_PLUGIN_ROOT}/reference/parent-contract.md ("A different question"). The scope_as_received echo-back in the acceptance gate is what catches it whichever way the substitution actually runs.
Write the exploration output to <memory_dir>/<slug>/EXPLORE.md, a memory-tier artifact, never committed. Destination and slug resolve per the lifecycle artifact protocol (${CLAUDE_PLUGIN_ROOT}/reference/artifact-protocol.md).
This file is the authoritative stage summary, a fresh session must be able to resume external research or planning reading only this artifact.
EXPLORE.md is always an index, at every size, not only past an overflow threshold. It carries a task restatement, a one-line abstract per sidecar copied verbatim from that sidecar's header, a section → file + anchor table, a ## Code references listing with its coverage: and staleness-check lines, and the closing Next-stage-handoff naming what external research (/discovery:research) or planning needs. The 7-point Output format's content lives in sibling EXPLORE-<section>.md sidecars in the same directory, each opening with a machine-readable YAML header so a consumer can grep headers and read exactly one file. Schema, the repos: commit pin, and the two load-bearing placement rules. Sidecars stay inside <memory_dir>/<slug>/, and EXPLORE.md stays the entry point: ${CLAUDE_PLUGIN_ROOT}/skills/research/context/artifact-shape.md.
Sidecar bodies match their length to what the section needs: cover the substance, with no filler sections, redundant summaries, or boilerplate. The index's one-line abstracts and the outcome gate's specifics are the floor.
Sidecar filenames are keyed on the section, not the scope, a run has one scope and many sections, so a scope-keyed name gives every sidecar the same filename and later sections overwrite earlier ones. Use the same stable id the header's section field and the index anchor carry.
Sidecar headers use the EXPLORE schema, not the research one. Local evidence is a repository path and whether the file was actually Read. verified: read | ran | grep | inferred, not a URL, a source tier, and a publishing pool. Handed the research header, a run either fabricates fields it has no values for or improvises a shape no consumer can parse; never borrow a research field, because filling one launders a grep hit into the field a fetched primary would occupy. Schema and why verified is load-bearing: the artifact-shape spoke's "EXPLORE.md sidecar header" section.
If an unrelated EXPLORE.md already exists in that slice, do not clobber it, and do not rename the index to dodge it, since EXPLORE-*.md is the sidecar pattern and a renamed index collides with its own sidecars. Occupancy is the parent's to resolve, before any write: stat the slice root pre-dispatch, and when it is occupied assign a sub-slice <memory_dir>/<slug>/<scope-slug>/ as the envelope's slice path, so the whole artifact set is written there under its normal names. A worker never picks a sub-slice itself, and on an inline run this session is the parent and applies the same check before writing. A prior exploration lost to a filename collision is silent and unrecoverable.
Explore agentBoth answer "what is in this codebase", so a request to explore can route to either.
Explore (built-in subagent): a one-shot locator that returns excerpts to its caller and
skips CLAUDE.md. It mutates nothing: it cannot write files. It is reached through the Agent
tool's subagent_type. Record: ${CLAUDE_PLUGIN_ROOT}/reference/parent-contract.md,
"Harness facts the dispatch design rests on".EXPLORE.md a cleared session resumes from.Routing. When the built-in Explore agent resolves in this session, dispatch it directly for a
bare locate ("where is X", "what calls Y"); use this skill when the four tests under Routing above
send the run to discovery:explorer. Inside this skill's run, Explore is the locate-tier scout,
never the worker.
Mutation gate. Explore writes nothing. This skill writes the artifact set in the memory slice
only.
The four-part records live in reference/native-explore.md.
/discovery:research <topic>./planning:interview./planning:design.git status and git log probe in reference/workflow.md dimension 2. A staged or committed delete is intentional: note it in the output and skip it. Investigate an unexplained one, and ask only when the probe does not settle which it is./discovery:research. This skill reads local code, git, and file system onlyevals/evals.json (opens in a new tab)evals/fixtures/discovery-output-change-prep.yaml (opens in a new tab)evals/fixtures/discovery-output-explain.yaml (opens in a new tab)evals/fixtures/discovery-output-invalid.yaml (opens in a new tab)reference/dispatch.md (opens in a new tab)reference/ecosystem-discovery.md (opens in a new tab)reference/native-explore.md (opens in a new tab)reference/workflow.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub melodic-software/claude-code-plugins --plugin discovery7 skills in this plugin
/blindspotSurface the user's unknown-unknowns before unfamiliar work in a new area or domain and coach a sharper prompt (read-only; writes no EXPLORE.md). Use when: 'what am I missing', 'find my blindspots', 'sharpen this prompt'. Not for codebase handoffs: /discovery:explore. Not for external research: /discovery:research./read-docsRead docsRead an upstream vendor docs page via shared lookup/cache, marking silences and separating inference (raw-byte verify; when claude-code-docs resolves in this session, prefer it for Claude Code Q&A). Use when: 'read the docs page for X', 'what does the official page say', or WebFetch truncated a page. Not for multi-source: /discovery:research./Other plugins' skills for the same job