Skip to content

[FEATURE]: /btw command — inject context into agent mid-task without interrupting #17691

@jblenman

Description

@jblenman

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Problem

When the agent is mid-task (executing a chain of tool calls), users can queue messages — but those messages wait until the entire task completes before the agent sees them. There's no way to inject context or corrections into the agent's current work without interrupting it.

Current behavior:

  1. Agent is mid-task (e.g., 10 tool calls into a refactor)
  2. User realizes the tests live in __tests__/ not test/
  3. User types a correction → message is queued
  4. Agent finishes the entire task (possibly doing it wrong) → then sees the correction as a new turn

Desired behavior:

  1. Agent is mid-task
  2. User types /btw the tests are in __tests__/ not test/
  3. Agent sees the message between tool calls during the current task
  4. Agent adjusts mid-flight without stopping or restarting

Proposed Solution

Add a /btw command (or equivalent mechanism) that injects a user message into the agent's current agentic loop between tool call iterations, rather than queueing it for after task completion.

How it would work

  1. User types /btw <message> while agent is working
  2. Message is placed in a priority queue (separate from normal message queue)
  3. In the main loop (prompt.ts), between loop iterations (after a tool call completes, before the next LLM call), check for pending /btw messages
  4. Inject as a user message in the conversation context before the next LLM call
  5. Agent sees the context and incorporates it — continues its current task, doesn't treat it as a new instruction

Key design points

  • Non-interrupting: Agent doesn't stop or restart — it folds the info into its next iteration
  • Lightweight: No new session, no subagent, no task management — just a message injection
  • Distinct from queued messages: Queued messages start a new turn after task completion; /btw messages augment the current turn

Use Cases

Course correction: "btw use the existing formatDate util instead of writing a new one"

Missing context: "btw that file moved to src/v2/ last week"

Preference: "btw don't add comments to the functions, just the module header"

Heads up: "btw I'm going to need the same change in the mobile app too, keep it portable"

Prior Art

  • Claude Code recently shipped /btw with exactly this behavior
  • Claude Code issue #29224 — side-channel responses for queued messages
  • Claude Code issue #30492 — priority message channel for mid-execution steering

Related Issues

Implementation Notes

The agentic loop in prompt.ts already iterates between tool calls. The injection point is natural — check a priority queue between iterations. The TUI already accepts input during agent execution. The delta is routing /btw-prefixed input to a priority queue instead of the normal message queue, and having the loop check it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions