Experiment: does /clear queue in Claude Code?

claude-code
agents
workflow
Author
Published

November 6, 2026

Rambling

  • for dev workflow in CC one thign i noticed is how inconstent the /clear skill works
  • sometimes i ahve a lot ofisntirusctions tack above it the agnet sill working and i call  it and then it isntatnly clers. i want to be superand sometiems it waits utnil everyhitn usptream is done.
  • i am not sure
  • this is gap inc alriity is  blcoker for efifient skill based workflwos
  • apprently the docs ar ento celar about this too. so I want confirm wiht some epxiemrients here
  • The expiermts are decibr in the bottom expeirment secitons
  • we will store the new vocab require to learn and then the udnrsaning below

Vocab/Primer

Canonical definitions live in the Claude Code glossary; this is the working version used for the experiments.

  • session: one open claude code window
  • context: what claude remebres this session; clear wipes it
  • turn: one round - you send -> claude works -> claude replies
    • Turns consist of tool calls and input text processing
    • skill calls always start a new turn
  • tool call: actions inside a turn (Bash, Edit); a turn can have many.
    • There are two types
    • Forground (default): the turn waits for it -> Claude session stays busy
    • Background: it runs on its own, outside the turn, the turn ends -> Claude session is idle
      • goes to background when you ask (Ctrl+B) or it times out or the commnand is baned int he forground (e.g. ‘sleep’)
      • to for foreground: say ‘wait for it’
  • Slash command: /somethign either a built in slash command like clear or a skill develoepd by plugin or user
  • Queue: one list of everything typed mid-turn, in typed order
    • text -> handed to claude between tool calls, during the current turn
    • slash commands -> waits int he list, runs after the current turn ends
      • excetipison ther eare few built in slash commands that runisntanlty never queued: /status, /tasks, /usage
    • so text always runs before a queued slash command, whatever order you typed

We can understand this through two axies

  1. Is claude busy?
    • busy = a turn is running
    • idel = a turn finished. a background tool call counts as idle
  2. What did you Type
    • Text
    • slash commnad

Understanding

  • The core vocabular for answer these questiosn is really important.
  • Test 1 - does /clear wait behind running work?
    • /clear is a built in slash command; functionally it runs after the current turn ends in its own ‘turn’
      • So meaning it will wait for all foreground activity to end; it does not wait on background tool calls
    • text type during a turn, gets evaluated before the slash command (even if it is type after the slash command- as long as its type before the turn ends).
      • it gets evaluate during the turn at the next gap between tool calls to the quere
      • response happens before the turn ends
    • Answer: /clear waits behing all foreground work
  • Test 2 - if Claude stops to ask me something does the turn end -> does a queued /clear still wait?
    • Answer: turn does not end → /clear waits
    • Ask user question is a tool call that does not ‘end’ untill it is answer
    • so untill a asnwer is sbimitted hte turn is not over -> /clear does not run

Expeirments

  • These are all ‘gaps’ in the docs. so we are performaing expierments to get a more ifnormed answer
  • Note these were test on claude code v2.1.280

Test 1 - does /clear wait behind running work?

Protocol

In a scratch session:

    • not sleep 30 — the Bash tool blocks foreground sleep and backgrounds it, which ends the turn immediately and invalidates the test (attempt 1 did this)

Result

Test 1: question answered mid-turn, /clear still queued below

Test 1: question answered mid-turn, /clear still queued below

Answer: yes. /clear waited — but the typed question didn’t.

Typed mid-turn What happened
/clear queued until the turn ended
“what did I ask?” answered right away, with memory

Analysis

  • Text mid-turn → joins the running turn
  • Slash command mid-turn → waits for turn end
  • So /clear does queue — but typed text jumps ahead of it
  • The “inconsistency”: /clear on an idle session fires instantly; mid-turn it waits

Gaps

  • Assumes /clear was typed before the question
  • Screenshot ends before /clear fired — did it clear after the Stop hook?

Test 2 - if Claude stops to ask me something does the turn end -> does a queued /clear still wait?

In a scratch session:

    • fired → a pending question counts as idle
    • still queued → a pending question counts as busy

Answer: no, the turn does not end. /clear waited for my answer.

  • After the 30s sleep, the AskUserQuestion prompt appeared and /clear stayed queued
  • /clear only ran after I answered the question and the turn finished
  • So a pending question counts as busy — the turn is paused, not over
  • For the /dev-log loop: a skill that stops to ask something will hold the queue, not drop it