[Bug] Input field auto-prefills assistant text and submits it on Enter keystroke
Bug Description
Summary
The Claude Code TUI prefills the prompt input with text drawn from previous assistant messages. The prefilled text is rendered in the same input field as user typing, and pressing Enter submits it as if the user had typed it. This is not a UX preference — it is a correctness bug. The input field is mutating its value with content the user did not author, and a single Enter keystroke turns that content into a binding instruction to the agent.
Reproduction
- Have a conversation in which the assistant emits an imperative-style sentence (e.g. "commit this", "run the tests", "delete the branch").
- After the assistant's turn, type any character whose first letter matches the prefill (or in some cases, type nothing at all).
- Observe the previous assistant suggestion appear as ghosted text in the input.
- Press Enter.
- The ghosted text is submitted as the next user message and the agent acts on it.
Expected behavior
The input field reflects only what the user has typed. If a suggestion mechanism is desired, it must:
- be off by default, or at minimum
- require an explicit, distinct accept key (Tab) and never be committed by Enter, and
- be disable-able via
settings.jsonand an env var.
Actual behavior
- Suggestions are on by default.
- Enter — the universal "submit" key — accepts and submits the suggestion.
- There is no documented setting, env var, or CLI flag to disable it.
- Closing the suggestion is not obvious; users discover it only after it has fired.
Why this is a bug, not a feature request
- The input field is the primary trust boundary between the user and the agent. Mutating its value with non-user content violates that boundary.
- The accept key is overloaded with submit. Any "I'm just hitting Enter to clear / send my own message / dismiss" muscle-memory fires an unintended instruction.
- The instructions issued this way are not idle text — they cause the agent to take real, sometimes destructive, actions (commits, file edits, command execution).
- There is no opt-out. A correctness defect with no off switch is a bug by definition.
Impact
- Unintended commits, pushes, file deletions, branch operations, command executions.
- Erosion of trust in the tool: users stop typing freely because the input field is no longer theirs.
- Disproportionate impact on long sessions where many suggestions accumulate.
Severity
High. Loss of input integrity in an agent that executes shell commands and edits files is a safety issue, not a polish issue.
Existing related issues
#16032, #14003, #15427 — all currently filed as feature requests. This report asks for re-triage as a bug.
Suggested fix (in priority order)
- Default the suggestion behavior to off.
- Add
settings.jsonkey (e.g."input.autosuggest": false) and matching env var. - Decouple the accept key from Enter; require Tab (or similar) to accept, Esc to dismiss.
- Visually distinguish ghosted suggestion text from typed text far more strongly than current rendering.
Environment
- Claude Code version: 2.1.128
- OS: MacOS
- Terminal: terminal
- Shell: bash
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗