Skip to content

Suggestion: option to hide UserPromptSubmit hook output from TUI #897

Closed

Description

@xiepengqi

What feature would you like to see?

Problem

When using the UserPromptSubmit hook to inject context into the LLM (e.g., memory recall, tool discovery), the hook's stdout output is always displayed in the TUI wrapped in <hook_result hook_event="UserPromptSubmit">. This adds visual noise for the user, since this context is meant for the AI, not for the human reading the terminal.

In contrast, Claude Code handles this better: hook output via additionalContext is injected as <system-reminder> blocks that are visible to the AI but hidden from the TUI display, keeping the terminal clean.

Suggestion

Add a config option (either in config.toml under [[hooks]] or as a global TUI setting) to suppress the display of UserPromptSubmit hook stdout in the TUI, while still injecting it into the LLM context.

Something like:

[[hooks]]
event = "UserPromptSubmit"
command = "./my-hook.sh"
suppress_tui_display = true   # <-- new option: inject into context but hide from TUI

Or alternatively, a global TUI setting:

[tui]
show_hook_output = false

This would allow users to use hooks for context injection without cluttering the terminal with <hook_result> blocks on every turn.

Additional information

I checked the existing issues and didn't find a similar request. The hooks feature is still in Beta, so adding this toggle early would make it easier for users to adopt hooks for context injection without sacrificing TUI cleanliness.

Activity

  1. added
    enhancement
    on Jun 18, 2026
  2. xiepengqi commented on Jun 19, 2026

    @xiepengqi
    Author

    Hi, I have a follow-up question regarding the current UserPromptSubmit hook behavior.

    Currently, the hook's stdout is not only displayed in the TUI but also appended to the conversation history as a user message. This means every turn adds another hook_result block to the context, causing the injected content (current time, cwd, tool suggestions, memories, etc.) to accumulate over time.

    Is this accumulation in the conversation history the intended behavior?

    For comparison, Claude Code handles similar injections via system-reminder blocks that are replaced each turn rather than appended, so the model always sees the latest context without historical copies piling up.

    It would be great if Kimi Code could support a similar silent/replace injection mode for hooks, where the output is visible to the model but not accumulated in history. Thanks!

  3. tt-a1i commented on Jun 20, 2026

    @tt-a1i
    Contributor

    I can take a narrow version of this: add a per-hook suppress_tui_display option for UserPromptSubmit allow-output. The hook output will still be injected into context, but it won't emit a visible hook result / replay entry. Blocking hook results should still stay visible.

  4. xiepengqi commented on Jun 22, 2026

    @xiepengqi
    Author

    @TT-ali Thanks for picking this up so quickly — the suppress_tui_display option in #929 looks like exactly what we need for the TUI noise problem.

    I reviewed the PR description and want to separate two concerns:

    1. TUI display suppression — feat(hooks): suppress user prompt hook display #929 addresses this: the hook output stays in the model context but is hidden from live events and replay. 👍
    2. Context accumulation across turns — From the PR description, it looks like the suppressed output is still kept in the model context and appended turn after turn, rather than being replaced each turn. Is that the intended design?

    If (2) is intentional, I’m happy to open a separate issue to discuss it. The use case is that UserPromptSubmit hooks often inject the same kinds of context (cwd, tool lists, memory snippets) on every turn, and over a long session the duplicated blocks can push useful conversation history out of the context window. Claude Code handles this by replacing the injected blocks each turn (via system-reminder-style context), so only the latest snapshot is present.

    Thanks again for the quick turnaround on the display side!

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions