claude-code - 💡(How to fix) Fix [FEATURE] Inject instructions into running task without interrupting (mid-execution context injection)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fix / Workaround

  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.

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)
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • 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.

  2. 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.

  3. /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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [FEATURE] Inject instructions into running task without interrupting (mid-execution context injection)