/loop: add output suppression for repeated identical results (with security safeguards)

Resolved 💬 5 comments Opened Mar 29, 2026 by ElazarPimentel Closed May 2, 2026

Problem

/loop is useful for polling (e.g., checking an inter-agent message queue every few minutes). But every cycle renders the full tool call block + "Running scheduled task" line in the terminal, even when there's nothing new. This floods the terminal scrollback and makes the session unusable for anything else.

Telling the LLM "say nothing if empty" via the prompt eliminates the LLM's text response, but CC still renders the Bash() tool execution block and the scheduler line every cycle. That's CC UI rendering, not controllable from the prompt.

Proposed solution

Add an output suppression mode to /loop that hides consecutive identical (or empty) outputs. This must include security safeguards since a silent loop running arbitrary bash is a significant risk (e.g., silent data exfiltration via rsync, curl, etc.).

Suppression behavior

  • Diff-based: suppress output only when it is identical to the previous cycle's output. First occurrence always renders.
  • Or user-defined predicate: e.g., /loop --quiet-when-empty 5m check-messages where the user defines what "quiet" means.
  • Not a blanket "hide everything" flag.

Required security safeguards

  1. Persistent status bar indicator: A visible (red/yellow) badge in the CC CLI status bar whenever any suppressed loop is active. Must show: count of active silent loops, the command each is running, and how long it's been running.
  1. Audit log: Every suppressed cycle must still be logged to a reviewable location (e.g., ~/.claude/loop-audit.log), even if not rendered in the terminal. The user should be able to cat or tail this at any time.
  1. Command allowlist or risk classification: Not every command should be eligible for output suppression. Arbitrary bash with network access (rsync, curl, scp, ssh, etc.) running silently is a data exfiltration vector. Either:
  • Require explicit user approval for suppressed loops containing network-capable commands
  • Or maintain an allowlist of commands eligible for quiet mode
  1. Kill switch: Easy way to list and kill all active loops, especially suppressed ones. Something like /loop --list and /loop --kill-all that's always accessible.
  1. Session-only scope: Suppressed loops should never be durable/persistent across sessions without re-confirmation.

Use case

Inter-agent messaging polling: /loop 5m llmmsg.sh read agent-name. The check runs every 5 minutes, returns [] 95% of the time. Only the 5% with actual messages should render in the terminal.

Current workarounds attempted

  1. Wrapper script (llmmsg-poll.sh) that outputs nothing on empty results — CC still renders the Bash tool call block.
  2. Prompt engineering ("say nothing if empty") — eliminates LLM text but Bash block still renders.
  3. Neither approach solves the terminal flooding.

🤖 Generated with Claude Code

View original on GitHub ↗

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