tui: prompt ribbon titlecases custom agent ids instead of showing agent.name · Issue #57722 · anomalyco/opencode · GitHub
Skip to content

tui: prompt ribbon titlecases custom agent ids instead of showing agent.name #57722

Open

Description

@Addin

Description

Custom agents are identified in lowercase (work-item, pr-writer, adversarial-review), and the agent record already carries that string as name. The prompt ribbon still titlecases the id for display, so the label does not match the identifier users configure and reference:

  • work-item → Work-Item
  • pr-writer → Pr-Writer

Source: packages/tui/src/component/prompt/index.tsx:1558

agentLabel: agent ? Locale.titlecase(agent.id) : undefined,

Locale.titlecase uppercases every word start (packages/tui/src/util/locale.ts):

export function titlecase(str: string) {
  return str.replace(/\b\w/g, (c) => c.toUpperCase())
}

There is no CLI setting to turn this off — the full settings reference has no agent-label or casing option — and renaming the agent file does not help, since the transform is applied to the id itself.

Proposed fix

Use agent.name instead of Locale.titlecase(agent.id). The API already returns the lowercase id as name for custom agents ("id": "work-item", "name": "work-item"), while built-ins keep their display names (General, Explore), so the one-line change fixes custom agents without affecting built-ins.

Related: #30372 fixed the same class of bug (CSS capitalize on custom agent identifiers) in the legacy app prompt selector.

Plugins

None.

OpenCode version

2.1.2

Steps to reproduce

  1. Create ~/.config/opencode/agents/work-item.md with mode: primary.
  2. Start the TUI and select the work-item agent (shift+tab).
  3. The prompt ribbon reads Work-Item.

Expected behavior

The ribbon shows the agent identifier as defined: work-item.

Actual behavior

The ribbon shows Work-Item.

Operating System

Linux 7.2.6-76070206-generic (x86_64)

Terminal

Ghostty (TERM=xterm-ghostty, COLORTERM=truecolor)

Activity

  1. opencode-agent commented on Oct 21, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed write-up! You're asking for the TUI prompt ribbon to show custom agent ids exactly as you defined them (work-item) instead of titlecasing them (Work-Item), for example by showing the agent's name.

    The titlecasing is deliberate for now. The TUI applies Locale.titlecase to agent ids in many places, not only the ribbon: session messages, "Switched agent" lines, subagent titles and so on. So changing it is a display design choice rather than a bug fix. You're right that it's inconsistent, though: the agent picker shows the raw id while the ribbon titlecases it. I've passed this on to the maintainers to consider.

    Related:

  2. lab1207 commented on Oct 21, 2026

    @lab1207

    Claiming this one — opened #57730: #57730

    The prompt ribbon now uses agent.name instead of Locale.titlecase(agent.id). The API already returns the lowercase id as the name for custom agents and the display name for the built-ins, so the one-line change fixes custom agents and leaves the built-ins alone.

    No bun in this environment, so I could not run the TUI suite; the PR body says so.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions