[FEATURE] Inject instructions into running task without interrupting (mid-execution context injection)

Resolved 💬 3 comments Opened May 16, 2026 by jawadtrader22 Closed May 20, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

When Claude Code is executing a long-running task (multi-file refactor, large build, multi-step EA development), I frequently realize mid-execution that I want to ADD scope to the current work — not replace it, not wait for it to finish.

Current options are all inadequate for this:

  1. Press Enter — message gets queued. It only runs AFTER the current task fully completes, as a separate turn. The new instruction is not merged into the ongoing work. If the running task finishes a refactor without my added context, I now need a second turn to add it — wasting time and tokens.
  1. Press Esc — interrupts the task destructively. In-progress tool calls are aborted, partial work may be lost or left in an inconsistent state. For long tasks this is too costly just to add a small instruction.
  1. /btw — read-only. Cannot edit files, cannot influence the running task. Only useful for asking questions.

The gap: there is no non-destructive way to say "ALSO do X while you're doing the current thing." The old pre-queue behavior approximated this (Enter would steer mid-task), but the current default queue behavior removed it entirely.

This impacts real workflows. Example from my own daily use (MQL5 Expert Advisor development): Claude Code is refactoring OnTick logic in a Grid EA across multiple files. Mid-execution I realize I also want input validation added to OnInit. Today I must either (a) wait for the full refactor to finish then ask in a new turn, or (b) Esc and break the in-progress work. Neither is acceptable for tight iteration loops.

The underlying problem: Claude Code currently treats user input during execution as either "interrupt now" or "wait until next turn" — there is no middle ground for "add this to what you're already doing."

Proposed Solution

Add a dedicated command — for example /inject, /add, or /also — that delivers a user message into Claude's active context at the next tool-call boundary, without ending or restarting the current turn.

Behavior:

  • User types /inject also add input validation to OnInit while Claude is mid-task
  • The message is captured and tagged as [additional scope] or [steering]
  • At the next safe boundary (e.g. before the next PreToolUse hook fires, between tool calls), the message is injected into Claude's context
  • Claude continues the current task with the merged scope, not as a separate turn
  • A visible indicator confirms the injection was received (e.g. "1 instruction injected" near the input box)

Optional refinements:

  • Differentiate /inject (merge into current work) from existing queue behavior (run after current work)
  • Allow viewing/canceling a pending injection before it lands at the next boundary
  • Keyboard shortcut alternative (e.g. Shift+Enter for inject vs Enter for queue)

This is technically feasible — Claude Code already runs PreToolUse hooks between tool calls, which is the exact interstitial window where injection could happen. Issue #30492 outlines the same mechanism in more detail.

Alternative Solutions

  1. Multi-file refactors where additional scope becomes obvious mid-execution
  2. Long EA/indicator development tasks (my use case — MQL5 Expert Advisor work) where I want to add a constraint or extra function without restarting the refactor
  3. Build/test pipelines where I want to add a follow-up check while the current step runs
  4. Any long autonomous workflow where waiting wastes time and Esc wastes work

Similar tools (Cursor, Codex) support analogous patterns. Claude Code GitHub has multiple related but distinct requests:

  • #30492 — Real-time steering: priority message channel
  • #25845 — Prompt queue with steer controls
  • #50246 — Message queue mode toggle
  • #34835 — Clarifying prompt for queue vs interrupt

This request differs: it's specifically for ADDITIVE injection (merge scope), not replacement, not interrupt, not deferred queue.

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

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