[PR #8788] feat: use agent description as prompt placeholder #12870

Open
opened 2026-02-16 18:17:45 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8788

State: open
Merged: No


Summary

Implements dynamic placeholder hints that display the current agent's description instead of static randomized hints, except in build mode.

Closes #8804

https://github.com/user-attachments/assets/a5bac30f-bcdc-4517-986e-b5cea81c2bc6

Changes

  • Agent descriptions as placeholders: When a custom agent has a description, it's now shown in the placeholder text
  • Fallback to randomized hints: Build agent and agents without descriptions continue using the existing randomized hint rotation. The rationale for the build agent retaining the cool generated placeholder texts is that it is the default mode and it should look good for newcomers who aren't into customization yet.

Implementation Details

CLI/TUI (packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx)

  • Added placeholderText memo that reactively returns agent description or randomized hint
  • Updates when switching between agents

Web App (packages/app/src/components/prompt-input.tsx)

  • Added placeholderText memo with same logic as CLI
  • Added shouldRotatePlaceholder memo to control hint rotation
  • Rotation stops when showing agent descriptions, resumes for build/no-description agents

Known Issues & Workarounds

Text Rendering Ghosting Bug

When switching between agents, ghost characters from the previous placeholder could remain visible due to browser/terminal text layout caching.

Workaround: Added .padEnd(70, " ") to force full-width text rendering which overwrites stale cached text.

TODO: This is a temporary fix. Investigate why OpenTUI textarea / browser doesn't invalidate text rendering cache, it should properly flush the input.

Testing

  • Tested switching between agents with descriptions
  • Tested build agent shows randomized hints
  • Tested agents without descriptions fall back to hints
  • Verified no visual ghosting with padding fix
  • Confirmed rotation behavior (stops for descriptions, continues for hints)
  • Test web version

Files Changed

  • packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx (+14, -1)
  • packages/app/src/components/prompt-input.tsx (+23, -4)
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8788 **State:** open **Merged:** No --- ## Summary Implements dynamic placeholder hints that display the current agent's description instead of static randomized hints, except in build mode. Closes #8804 https://github.com/user-attachments/assets/a5bac30f-bcdc-4517-986e-b5cea81c2bc6 ## Changes - **Agent descriptions as placeholders**: When a custom agent has a description, it's now shown in the placeholder text - **Fallback to randomized hints**: Build agent and agents without descriptions continue using the existing randomized hint rotation. The rationale for the build agent retaining the cool generated placeholder texts is that it is the default mode and it should look good for newcomers who aren't into customization yet. ## Implementation Details ### CLI/TUI (`packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx`) - Added `placeholderText` memo that reactively returns agent description or randomized hint - Updates when switching between agents ### Web App (`packages/app/src/components/prompt-input.tsx`) - Added `placeholderText` memo with same logic as CLI - Added `shouldRotatePlaceholder` memo to control hint rotation - Rotation stops when showing agent descriptions, resumes for build/no-description agents ## Known Issues & Workarounds ### Text Rendering Ghosting Bug When switching between agents, ghost characters from the previous placeholder could remain visible due to browser/terminal text layout caching. **Workaround**: Added `.padEnd(70, " ")` to force full-width text rendering which overwrites stale cached text. **TODO**: This is a temporary fix. Investigate why OpenTUI textarea / browser doesn't invalidate text rendering cache, it should properly flush the input. ## Testing - [x] Tested switching between agents with descriptions - [x] Tested build agent shows randomized hints - [x] Tested agents without descriptions fall back to hints - [x] Verified no visual ghosting with padding fix - [x] Confirmed rotation behavior (stops for descriptions, continues for hints) - [ ] Test web version ## Files Changed - `packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx` (+14, -1) - `packages/app/src/components/prompt-input.tsx` (+23, -4)
yindo added the pull-request label 2026-02-16 18:17:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12870