Ray's Knowledge Base
Unlock

A mod slash command that ends its turn can trigger the Stop hook's background agent

PitfallVerified 2 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

In a Claude Code mod, a slash command that opens a pane ends a turn, so the mod's classic.Stop hook can start a background subagent (such as an automatic distill) right after it. Claude Code then shows that subagent's window, and the pane opens there or looks as if it never opened. The symptom was /rkb-status appearing to run distill while no pane showed.

Cause#

The command's turn end fires classic.Stop, which starts the automatic agent before the pane is shown.

Fix#

A mod command's turn must not start automatic agents, and the mod must not start a second agent while one is still running. Check the start order before blaming $.ui.open.

Evidence#

rkb mod: a start-order guard fixed /rkb-status; $.ui.open was not the fault.

Also found by searching

  • /rkb-status appears to run distill but no pane shows
  • mod Stop hook starts background subagent after a slash command
  • pane opens in a subagent window instead
  • check the start order before blaming $.ui.open