[FEATURE] Execute queued built-in slash commands (e.g. /compact) at end of turn instead of delivering them to the model as text

Open 💬 0 comments Opened Jul 10, 2026 by danio0106

Environment

  • Claude Code version: 2.1.201
  • Client: VS Code extension (also reproducible in CLI)
  • OS: Windows 11

Current behavior

Typing a built-in slash command (e.g. /compact) while the agent is still working queues it as a plain user message. When the turn ends, the model receives it as literal text (The user sent a new message while you were working: /compact) and cannot execute it — compaction never happens. Verified empirically on 2.1.201: the context meter kept growing and the command arrived in the model's context as a regular message.

Notably, custom skills / slash commands queue and run just fine (they are executed by the model when the queued message is delivered). Only built-ins (/compact, /cost, /permissions, /clear, …) silently lose their command character when queued. #1077 reported this as a bug back in 0.2.108; it was closed by the stale bot without a fix.

Requested feature

When a queued message consists of a built-in slash command, hold it and execute it client-side once the agent becomes idle (in order with the rest of the queue), instead of delivering it to the model as text. Purely local commands (like /cost, cf. #1077) could even execute immediately.

Use case: fire-and-forget session hand-off across many parallel sessions

Power users run a dozen+ parallel sessions and rely on a hand-off chain:

  1. /handover — a custom skill that writes a detailed session-state file to disk,
  2. /compact — compact the conversation,
  3. /session-resume — a custom skill that reads the state file back after compaction.

Steps 1 and 3 queue perfectly today. Step 2 breaks the chain: the user must sit and watch the session, wait for the handover turn to finish, and only then type /compact at idle. With queued built-in execution, the whole chain could be typed in one go — walk away, and the session compacts and re-anchors itself unattended.

Workarounds we evaluated and rejected: keyboard-automation robots (unusable with many concurrent sessions — no way to target the right chat input), claude --resume from a second process (forks the session instead of compacting the open one), auto-compact (threshold not configurable, fires far too late — see #72062/#70681/#75335).

Related

  • #1077 — same underlying behavior, reported as a bug, closed stale
  • #71803 — agent-invokable compaction (complementary: that one lets the model trigger it; this request needs no model involvement, just deferred client-side execution of queued built-ins)

---
🤖 Filed with Claude Code

View original on GitHub ↗