---
title: "Task-Described CLI Command Discovery for Coding Agents"
term: "Task-Described CLI Command Discovery"
description: "Pair a CLI plain-language help search subcommand with inline help, JSON output, and a thin routing skill on large CLIs where preloading docs bloats context."
aliases:
  - CLI help search for coding agents
  - natural-language CLI command discovery
  - task-based CLI discovery
tags:
  - context-engineering
  - cost-performance
  - tool-engineering
  - skills
  - tool-agnostic
last_reviewed: 2026-11-28
maturity: emerging
---

# Task-Described CLI Command Discovery for Coding Agents

> On large CLIs, a plain-language help search subcommand and thin skill let coding agents discover commands on demand without preloading help trees.

Task-described CLI command discovery adds a plain-language search subcommand to a CLI binary and pairs it with a thin skill that directs coding agents to search first. This applies [progressive disclosure](../patterns/agent-design/progressive-disclosure-agents.md) to command-line interfaces. Anthropic recommends tool search when tool libraries grow over time ([Anthropic Tool Search Tool docs](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool)). Direct evidence for the CLI form comes from one vendor release: Vercel CLI's `vercel help search`, announced November 19, 2026 by Software Engineer Melkey Moksyakov ([Vercel Changelog](https://vercel.com/changelog/agents-can-now-find-vercel-cli-commands-by-describing-the-task)). That announcement reports no accuracy, latency, or token benchmarks, so the quantitative bounds below come from adjacent tool-search work.

## When this pattern applies

Three conditions decide whether task-described CLI search earns its extra shell call:

- The CLI exposes a large or changing command and API surface. In Anthropic's tool-search guidance, Claude's tool-selection accuracy degrades once exposed tools exceed 30 to 50 ([Anthropic Tool Search Tool docs](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool)).
- The matcher ranks the right command first on natural-language phrasing, because single-call inline help expansion returns documentation for the first result only ([Vercel Changelog](https://vercel.com/changelog/agents-can-now-find-vercel-cli-commands-by-describing-the-task)).
- Target agents have shell access and receive a thin skill instructing them to call the search subcommand before guessing flags.

## How the discovery interface works

The pattern splits responsibility across two sides: a thin skill on the agent side routes command lookups to the CLI, and a search subcommand inside the CLI binary resolves task wording into current syntax. Vercel CLI ships this interface with five elements ([Vercel Changelog](https://vercel.com/changelog/agents-can-now-find-vercel-cli-commands-by-describing-the-task)):

- Plain-language task queries: the agent describes the goal, such as `vercel help search "roll back production"`, and receives a list of matching commands. Vercel states that search handles wording variations like "show" instead of "list" and "handles minor spelling mistakes", and that "Vercel doesn't log your search text."
- Single-call inline help (`--with-help`): adding `--with-help` includes the help page for the first result in the same call. For the rollback query, it returns options and examples for `vercel rollback`.
- Structured output (`--json`): adding `--json` returns search results as JSON. Combining `--json` with `--with-help` includes usage instructions, options, and examples for the first result.
- API endpoint placeholders: when a Vercel API endpoint matches the task, search returns a `vercel api` command with the request path and placeholders for every required input. The agent fills in values without guessing the path.
- Companion routing skill: the CLI bundles a skill telling coding agents to start with `vercel help search` when looking for a command.

Keeping only that routing instruction in the skill instead of embedding the full command reference follows [Discoverable vs Non-Discoverable Context](discoverable-vs-nondiscoverable-context.md).

## Why it works

Upfront tool definitions compete with task context before work begins, and large catalogs cause wrong tool selection and incorrect parameters ([Anthropic Engineering](https://www.anthropic.com/engineering/advanced-tool-use)). Lazy discovery avoids that standing cost: OpenDev maintains a set of discovered tools whose initial context contains zero external tool schemas and adds schemas only for tools explicitly searched for or previously invoked ([Bui, 2026 §2.4.7](https://arxiv.org/abs/2603.05344v3)).

Relying on pretraining without discovery breaks once a CLI or API changes after the model's cutoff. Microsoft Principal Developer Advocate Waldek Mastykarz notes that when an agent skips tools or skills, it falls back to pretraining and uses whichever version it learned before cutoff ([Mastykarz, Microsoft](https://developer.microsoft.com/blog/how-ai-coding-agents-actually-use-your-technology)). In Vercel CLI, `vercel help search` finds matching commands from a plain-language task description, `--with-help` includes the first result's help page in the same call, and API endpoint matches return a `vercel api` command with the request path and placeholders for every required input ([Vercel Changelog](https://vercel.com/changelog/agents-can-now-find-vercel-cli-commands-by-describing-the-task)).

## When this backfires

- Small or repeatedly used CLIs: search adds an extra step and latency before execution. Anthropic advises that direct tool calling fits better for fewer than 10 tools, when every tool runs on every request, or when definitions total less than 100 tokens ([Anthropic Engineering](https://www.anthropic.com/engineering/advanced-tool-use); [Anthropic Tool Search Tool docs](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool)).
- Rank-1 misses under `--with-help`: because `--with-help` expands only the first match ([Vercel Changelog](https://vercel.com/changelog/agents-can-now-find-vercel-cli-commands-by-describing-the-task)), a lexical mismatch injects the wrong help page and still forces a second lookup. Repantis et al. report that BM25 reaches 33% found@1 on MetaTool where tool names share little lexical overlap with queries, and 60.0% found@1 on BFCL across 370 tools against 73.2% for MiniLM-L6-v2 embeddings ([Repantis et al., 2026 §4.1–4.2](https://arxiv.org/abs/2605.24660v2)).
- Pretraining overconfidence and harness truncation: a routing skill is advisory. Mastykarz observes that even when a description matches intent, a model may still skip the tool if the task looks simple or it feels confident it already knows the answer, including when its training data is outdated ("high confidence, stale information"), and harnesses loaded with many extensions may summarize or drop tool descriptions before the model sees them ([Mastykarz, Microsoft](https://developer.microsoft.com/blog/how-ai-coding-agents-actually-use-your-technology)).
- Competing direct tools and oversized help text: In Mastykarz's example of two competing MCP tools, if one returns direct information on the first turn while another returns routing instructions for a subtool, the model may decide it knows enough and never invoke the subtool, failing the routing. He also warns that returning "3,000 tokens of documentation when 200 would do" pushes relevant context out of the window ([Mastykarz, Microsoft](https://developer.microsoft.com/blog/how-ai-coding-agents-actually-use-your-technology)). Verbose `--with-help` output creates the same drag.
- Unmeasured CLI payoff: Vercel's changelog reports no measured accuracy, token, or latency gains for `vercel help search` ([Vercel Changelog](https://vercel.com/changelog/agents-can-now-find-vercel-cli-commands-by-describing-the-task)). Measure invocation rate and rank-1 hit rate on real tasks before building a search subcommand for an internal CLI.

## Example

Vercel CLI demonstrates task-described lookup with inline help and structured output ([Vercel Changelog](https://vercel.com/changelog/agents-can-now-find-vercel-cli-commands-by-describing-the-task)):

```bash
# Find commands by plain-language task and include the first match's help
# Returns options and examples for `vercel rollback`
vercel help search "roll back production" --with-help

# Return JSON search results with usage instructions, options, and examples
# for the first result
vercel help search "roll back production" --with-help --json
```

When a task matches a Vercel API endpoint rather than a CLI subcommand, search returns a `vercel api` command with the request path and placeholders for every required input so the agent fills in values without guessing the path ([Vercel Changelog](https://vercel.com/changelog/agents-can-now-find-vercel-cli-commands-by-describing-the-task)).

## Key Takeaways

- Reserve task-described CLI search for large or changing CLIs; adjacent tool-search guidance favors direct exposure below 10 tools or under 100 total tokens of definitions ([Anthropic Tool Search Tool docs](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool)).
- Pair task search with `--with-help`, `--json`, and required-input placeholders so agents retrieve command identity and usage in one shell call ([Vercel Changelog](https://vercel.com/changelog/agents-can-now-find-vercel-cli-commands-by-describing-the-task)).
- Measure rank-1 hit rate on real task phrasing, because `--with-help` expands only the first result and lexical matchers drop sharply when vocabulary diverges from descriptions ([Repantis et al., 2026](https://arxiv.org/abs/2605.24660v2)).
- Treat a companion routing skill as soft guidance and check transcripts for pretraining-driven skips before assuming discovery runs ([Mastykarz, Microsoft](https://developer.microsoft.com/blog/how-ai-coding-agents-actually-use-your-technology)).
- Keep inline help output compact so `--with-help` does not push task context out of the window ([Mastykarz, Microsoft](https://developer.microsoft.com/blog/how-ai-coding-agents-actually-use-your-technology)).

## Related

- [Unix CLI as the Native Tool Interface for AI Agents](../tool-engineering/unix-cli-native-tool-interface.md) — baseline `--help` and `--json` CLI pattern that task-described search extends
- [Discoverable vs Non-Discoverable Context](discoverable-vs-nondiscoverable-context.md) — why a thin routing skill replaces an embedded command reference
- [Context Hub: On-Demand Versioned API Docs for Coding Agents](context-hub.md) — external registry counterpart for pulling live API documentation into context on demand
- [Advanced Tool Use: Scaling Agent Tool Libraries](../tool-engineering/advanced-tool-use.md) — API-level deferred tool search solving the same scaling problem for MCP catalogs
- [Chance-Corrected Shortlist Depth Sizing](../tool-engineering/chance-corrected-shortlist-depth-sizing.md) — scorer-quality and shortlist-depth limits behind retrieval-based tool discovery
