Skip to content

feat(cli): agent callers get plain help with full descriptions #5450

Done

Description

@dan-petty

Problem or Motivation

Agents read devops help very often, and the Rich help boxes make each reply 2 to 4 times larger than the text in it.

Evidence:

  • Claude Code transcripts, 2026-10-16 to 2026-11-13: 6,169 help requests (-h, --help) from 1,881 of 3,911 agents in 131 sessions. They returned 15.0 M characters. The most-read pages: pr create --help 748, gh --help 698, openspec --help 446, ci --help 392, ci fail-to-pass --help 361.
  • 447 of 1,258 usage errors had a help request in the next 3 calls.
  • Measured on 2026-11-13, release 0.129.1, same words in both forms (leaf commands):
Command Rich bytes Plain bytes Words
pr create -h 3,915 1,796 290
roadmap intake -h 5,448 2,985 351
pr describe -h 2,856 946 137
ci fail-to-pass -h 1,793 706 106
  • A group page loses facts in plain Click form. Click cuts each command description to the first sentence and to the formatter width (80 columns), and adds .... devops roadmap -h shows 1,189 words in Rich form and 476 words in plain form, with 17 cut entries. devops ci -h has 18 cut entries. A wider max_content_width removes the ... cuts, but Click still keeps only the first sentence. With the full first paragraph kept, a group page is about 1.6 times smaller than the Rich page, not 6 times.
  • src/devops_cli/core/caller.py (is_agent_caller() and agent_tool()) already finds an agent caller. src/devops_cli/entry.py runs before Typer is imported, so it can set TYPER_USE_RICH.

Proposed Solution & Architectural Design

  • entry.py sets TYPER_USE_RICH=0 before the Typer import when is_agent_caller() finds an agent caller and the user did not set the variable. Help and usage-error text then come out as plain Click text. Person output does not change.
  • UsageTaggedGroup, the base class of each group in src/devops_cli/core/cli.py, writes the command list of a group with the full first paragraph of each command help, and with no width cut. So the plain page holds every word of the Rich page.
  • The root group class UsageRecordingGroup counts each help request in a new counter devops_cli_help_requests_total with the labels command_path (the closed command tree) and caller (the caller kinds of feat(telemetry): record each CLI usage error by name and kind #4839). Today help requests are counted only from local transcripts.
  • Find and fix each parser of the Rich usage-error box in the same pull request (tests, docs/generator.py).

Target Subsystem

SDLC, Git & PR Governance (the CLI root: entry.py, core/cli.py, core/caller.py).

Acceptance Criteria

  • A test (written first, fails on the base) runs devops roadmap -h with an agent marker and proves that the output holds no box character and that each command line holds the full first paragraph of its help, with no ... cut.
  • A test proves that a person caller (no agent marker) still gets the Rich help.
  • A test proves that TYPER_USE_RICH=1 set by the user wins over the agent default.
  • A test proves that a help request adds 1 to devops_cli_help_requests_total with its command path and caller.
  • uv run devops ci fail-to-pass --base origin/main shows that the new tests fail on the base.
  • Measure in telemetry, 7 days after the release: devops_cli_help_requests_total for agent callers, per 1,000 commands. The median help bytes of agent callers in the transcripts go down by 1.5 times or more.

Existing Tool Considered

Typer's TYPER_USE_RICH switch (Typer 0.28) and Click's plain help formatter. Click cuts group descriptions, so the project overrides one Click method (format_commands) in its existing group class. The detect_agent package that agent_tool() uses is already a dependency. Cost to build (estimate): 0.3 M model input and output, and 3 to 4 hours. Cost to keep: one override and one switch.

Related

#4833 (CLI usage tracker), #4860 (usage-error hints).

Alternatives check of 2026-11-29: in-use.
The repository already uses this tool.
Tool: fastapi/typer (https://github.com/fastapi/typer), MIT, last activity 2026-11-26, maintained.
Reason: Searches found no dedicated tool; Typer, which the CLI already uses, has the TYPER_USE_RICH switch that gives agent callers plain Click help, but it neither keeps full group command descriptions nor counts help requests.

Covers:

  • Plain Click help text for agent callers through TYPER_USE_RICH=0
  • User-set TYPER_USE_RICH value still wins over the agent default
  • Person callers keep the Rich help form unchanged
  • Switch applies before the Typer import, so it reaches every page

Lacks:

  • Group pages cut command help to the first sentence and 80 columns
  • No help-request counter with command path and caller labels
  • No caller detection; the project must supply its own agent check

Proposed design

Problem statement

Agents read devops help often, and the Rich help boxes make each reply 2 to 4 times larger than the text in it. Plain Click help cuts group descriptions to the first sentence and to 80 columns. The change gives agent callers plain help with the full first paragraph of each command and counts each help request.

Acceptance criteria

Requirement: Agent group help is plain and complete

An agent caller SHALL get plain help from a group command with the full first paragraph of each command description and no width cut.

Scenario: Roadmap group help for an agent

  • WHEN A test runs devops roadmap -h with an agent marker and no user-set TYPER_USE_RICH.
  • THEN The output holds no Rich box character and no command entry ends with ...; each command entry holds the full first paragraph of its help.

Requirement: Person help stays Rich

A person caller SHALL get the Rich help form.

Scenario: Roadmap group help for a person

  • WHEN A test runs devops roadmap -h with no agent marker and no user-set TYPER_USE_RICH.
  • THEN The output holds a Rich box character and matches the current Rich help form.

Requirement: User Rich setting wins

A user-set TYPER_USE_RICH value MUST override the agent default.

Scenario: Agent caller sets Rich on

  • WHEN A test runs devops roadmap -h with an agent marker and TYPER_USE_RICH=1.
  • THEN The output holds a Rich box character.

Requirement: Help requests are counted

A help request SHALL add one to devops_cli_help_requests_total with its command path and caller.

Scenario: Leaf help request from an agent

  • WHEN A test runs devops pr create -h with an agent marker and reads the metric.
  • THEN The counter increases by one with command path pr create and caller agent.

Requirement: Plain usage-error parsers accept plain text

Each parser of the Rich usage-error box SHALL accept the plain Click text and return the command path.

Scenario: Docs generator parses a plain usage error

  • WHEN A test gives docs/generator.py a plain Click usage error from an agent caller.
  • THEN The parser returns the command path and raises no exception.

Requirement: New tests fail on the base

The new help tests MUST fail on the base revision.

Scenario: Fail-to-pass check on the base

  • WHEN A developer runs uv run devops ci fail-to-pass --base origin/main.
  • THEN The command reports each new help test as failing on the base.

Existing Tool Considered

The alternatives check of 2026-11-17 in the issue body gives Typer the verdict in-use. The check lists what Typer covers and lacks. The proposal uses Typer's TYPER_USE_RICH=0 and adds the format_commands override and the help-request counter that the check says the tool lacks. The issue estimates 0.3 M tokens and 3 to 4 hours for the override and switch.

Key questions

  • How does an agent caller get plain help without changing person output?: Set TYPER_USE_RICH=0 at the start of entry.main() before any import of devops_cli.main when is_agent_caller() is true and the user did not set the variable. (best practice) [sources: src/devops_cli/entry.py, src/devops_cli/core/caller.py]
    • Chosen: Set TYPER_USE_RICH=0 in entry.py for agent callers. It runs before Typer import, leaves person output Rich, and keeps a user-set value.
    • Rejected: Force plain help for all callers. It changes person output.
    • Rejected: Render a custom plain formatter for each help page. It duplicates Typer's switch and adds code.
  • How does a group help page keep the full first paragraph of each command?: Override format_commands on UsageTaggedGroup to write the full first paragraph of each command help and to apply no width cut. (best practice) [sources: src/devops_cli/core/cli.py]
    • Chosen: Override format_commands on UsageTaggedGroup. The group class is shared by the command tree and can keep the full paragraph with no cut.
    • Rejected: Set only a wider max_content_width. Click still keeps only the first sentence.
    • Rejected: Use Rich help for group pages. It adds the box characters that the change removes.
  • Where should the help-request counter record each request?: Record devops_cli_help_requests_total in UsageRecordingGroup with the command_path and caller labels. (best practice) [sources: src/devops_cli/core/cli.py, src/devops_cli/telemetry/usage_errors.py, docs/TELEMETRY.md]
    • Chosen: Count in UsageRecordingGroup with the existing caller labels. The root group sees each help request, and the labels match the usage-error metric.
    • Rejected: Count from local transcripts. It is not live and misses MCP and cluster callers.
    • Rejected: Count in each command. It duplicates code and misses group help.
  • Which caller values does the help-request counter use?: The caller label uses person, agent, ci and mcp, as the usage-error metric does. [sources: docs/TELEMETRY.md, src/devops_cli/telemetry/usage_errors.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    scope/cli
    status/new
    value/high
    effort/medium
    on Nov 13, 2026
  2. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 13, 2026
  4. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The web searches returned only unrelated pages, so nothing new turned up; the issue itself names the existing tools: Typer's TYPER_USE_RICH switch and Click's plain help formatter, and Typer is already the CLI framework the project builds on. Typer covers the plain-text help/usage output for leaf commands (about half the bytes), but Click's plain group formatter still cuts each command description to its first sentence and to the formatter width, and no help-request counter exists, so it covers only part of the need.

    The repository already uses this tool.

    Tool: fastapi/typer (https://github.com/fastapi/typer)

    • License: MIT
    • Last activity: 2026-11-15
    • Maintained: yes

    Covers:

    • Switches help and usage-error output to plain Click text when TYPER_USE_RICH=0 is set before the Typer import
    • Leaves person output in Rich form, and a user-set TYPER_USE_RICH=1 can still win
    • Cuts leaf-command help size a lot (e.g. pr create -h 3,915 to 1,796 bytes) with the same words

    Lacks:

    • Click's plain group formatter keeps only the first sentence of each command description and cuts to the 80-column width with ... (17 cut entries in roadmap -h, 18 in ci -h)
    • No help-request metric with command_path and caller labels
    • Needs a project override of format_commands on the group class to keep the full first paragraph of every command

    Tools considered:

    Searches run:

    • Typer TYPER_USE_RICH environment variable plain help output, results: 5
    • Click help formatter group command descriptions truncated first sentence, results: 5
    • typer TYPER_USE_RICH rich help disable documentation, results: 5
    • click Group.format_commands help description truncate max_content_width, results: 5
    • Typer CLI library rich formatted help panels, results: 5

    Sources:

    Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.

  5. added
    status/ready
    and removed
    status/new
    on Nov 18, 2026
  6. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at b466159 (see proposed design in issue body).

    Moved to new items: #6233.

  7. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: in-use, tool https://github.com/fastapi/typer. A person decides what the new result means for the item.

    Searches (3)

    Tools considered:

    Searches run:

    • Typer TYPER_USE_RICH environment variable plain help output, results: 5
    • typer docs rich help disable environment variable, results: 5
    • click Group format_commands truncates command help first sentence, results: 5

    Sources:

  8. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: in-use, tool https://pypi.org/project/typer. A person decides what the new result means for the item.

    Searches (7)

    Tools considered:

    Searches run:

    • click group help command descriptions truncated first sentence ellipsis format_commands, results: 5
    • TYPER_USE_RICH environment variable plain help output typer, results: 5
    • typer TYPER_USE_RICH disable rich help, results: 5
    • typer github plain text help environment variable rich formatting, results: 5
    • fastapi typer, results: 5
    • typer.tiangolo.com, results: 5
    • click.palletsprojects.com help formatting, results: 5

    Sources:

  9. added
    status/in-progress
    and removed
    status/ready
    on Nov 29, 2026
  10. added
    status/in-review
    and removed
    status/in-progress
    on Nov 29, 2026
  11. removed
    status/in-review
    on Nov 29, 2026
  12. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 16:50 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/clisource/agenttype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions