[BUG] promptSuggestion silently disabled when outputStyle is set, due to strict equality mismatch on querySource

Resolved 💬 2 comments Opened May 10, 2026 by heeseon87 Closed May 12, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The "prompt suggestions" feature (gray ghost text in the input box, accepted with Tab/Right arrow) never appears when outputStyle is set to anything other than the default in ~/.claude/settings.json for example "outputStyle": "Explanatory".

The feature is silently disabled with no telemetry: even with CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 set as an environment variable, no tengu_prompt_suggestion_init or any related telemetry event is emitted, and no error is logged in --debug mode.

This affects users who customize outputStyle (a documented and supported setting), making the feature effectively unreachable for them. In my case, I have used Claude Code with outputStyle: "Explanatory" for ~1 year and have never once seen the prompt suggestion ghost text on macOS, while the same Claude Code
version (2.1.138) shows it correctly on Windows where I had the default outputStyle.

What Should Happen?

With CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 and at least 2 assistant turns of conversation, the gray ghost text suggestion should appear in the input box regardless of the user's outputStyle setting. outputStyle configures response presentation, not whether speculation/suggestion features run.

Error Messages/Logs

No error messages or logs are produced — the feature fails silently.

Running with claude -d "*" --debug-file /tmp/claude-debug.log over multiple turns produces zero entries matching prompt_suggestion, suggestion_suppressed, speculation, or tengu_prompt_suggestion_init. The function returns before reaching any logging path.

The only relevant trace in debug logs is the API request source field, which shows the querySource has been extended:

source=repl_main_thread:outputStyle:Explanatory

Steps to Reproduce

  1. Set outputStyle in ~/.claude/settings.json:
   {
     "outputStyle": "Explanatory"
   }
   (Any non-default value reproduces — Explanatory, custom styles, etc.)
  1. Launch Claude Code with the env override that the code documents as "overrides everything":

CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 claude

  1. Have at least 2 turns of conversation (to clear the early_conversation suppress reason).
  2. Observe the input box on the 3rd+ prompt no gray ghost text appears, ever, in any subsequent turn.
  3. Confirm the workaround works by overriding outputStyle for one session:

CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 claude --settings '{"outputStyle":"default"}'

  1. With the same conversation, ghost text appears as expected from turn 3 onward.

Root Cause Analysis (verified against open-source fork)

There is a strict-equality vs prefix-match inconsistency between the call site and the function body for executePromptSuggestion:

Call site — src/query/stopHooks.ts:111 (uses prefix match):

querySource.startsWith('repl_main_thread')

Function body — src/services/PromptSuggestion/promptSuggestion.ts:187 (uses strict equality):
export async function executePromptSuggestion(context: REPLHookContext) {
  if (context.querySource !== 'repl_main_thread') return
  ...
}

When outputStyle is set, the querySource string is extended to "repl_main_thread:outputStyle:Explanatory" (verified in debug logs). The startsWith check at the call site passes, but the strict !== check inside the function body fails, causing it to return immediately before any telemetry, before any of the documented suppress reasons (growthbook, non_interactive, swarm_teammate, setting, etc.) are evaluated.

This is why no tengu_prompt_suggestion_init event is ever logged the function exits at line 1 before the logging paths.

Suggested Fix

Change promptSuggestion.ts:187 to match the call-site semantics:

if (!context.querySource.startsWith('repl_main_thread')) return

Alternatively, strip the suffix before comparison, or normalize querySource at a single source of truth. The current asymmetry between the two sites is the bug.

Claude Model

claude-opus-4-7 (and reproduces with claude-sonnet-4-6)

Is this a regression?

No — this has never worked on this machine for ~1 year of usage with outputStyle="Explanatory". It is not a recent regression; it is a long-standing silent failure tied specifically to having outputStyle set.

Last Working Version

N/A (never worked on macOS with non-default outputStyle)

Claude Code Version

2.1.138 (Claude Code)

Platform

Anthropic API (Claude.ai login)

Operating System

macOS (Darwin 25.3.0, arm64)
Reproduces on:

  • macOS default Terminal.app
  • iTerm2
  • cmux (terminal multiplexer)

Does NOT reproduce on Windows PowerShell with the same Claude Code version (where users typically have default outputStyle).

Terminal/Shell

zsh / macOS Terminal.app — but reproduces in iTerm2 and cmux.app as well, confirming this is not a terminal-specific issue.

Additional Information

Severity: Low/Medium — feature is fully unreachable for any user with a non-default outputStyle, and the failure is silent (no error, no log), making it indistinguishable from "the feature doesn't exist on macOS" from the user's perspective.

Discoverability: Very low — requires reading the open-source fork's source to identify. After 6 wrong hypotheses (vim mode, terminal compatibility, env var propagation, swarm_teammate, early_conversation, etc.), the actual root cause was only found by direct source inspection of promptSuggestion.ts:187.

Workaround that works (verified):

CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 claude --settings '{"outputStyle":"default"}'

Telemetry suggestion: Even if the strict check is intentional, consider emitting a tengu_prompt_suggestion_init event with source: 'unknown_query_source' or similar before returning, so users debugging this don't see zero telemetry and assume the feature is missing entirely.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

N/A (never worked on macOS with non-default outputStyle)

Claude Code Version

2.1.138 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Severity: Low/Medium — feature is fully unreachable for any user with a non-default outputStyle, and the failure is silent (no error, no log), making it indistinguishable from "the feature doesn't exist on macOS" from the user's perspective.

Discoverability: Very low — requires reading the open-source fork's source to identify. After 6 wrong hypotheses (vim mode, terminal compatibility, env var propagation, swarm_teammate, early_conversation, etc.), the actual root cause was only found by direct source inspection of promptSuggestion.ts:187.

Workaround that works (verified):

CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 claude --settings '{"outputStyle":"default"}'

Telemetry suggestion: Even if the strict check is intentional, consider emitting a tengu_prompt_suggestion_init event with source: 'unknown_query_source' or similar before returning, so users debugging this don't see zero telemetry and assume the feature is missing entirely.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗