Skip to content

Expose Claude Code mid-turn message injection (typed-ahead / /btw) over ACP #871

Description

@Seluj78

Summary

Expose Claude Code's mid-turn message injection over ACP, so an ACP client can deliver a message to a turn that is already running (steering), the way the Claude Code CLI does with typed-ahead input and the /btw ("by the way") command.

Background

claude-agent-acp bridges the Claude Agent SDK to ACP. In the Claude Code CLI you can:

  • Type a message while the agent is mid-turn; it is picked up and incorporated into the running turn.
  • Use /btw to inject a "by the way" note into the in-flight turn so the model course-corrects without the turn ending.

The claude binary carries this natively (findBtwTriggerPositions, getBtwHistory, createBtwHistoryState, etc.).

The gap over ACP

There is no way to deliver input to a turn that is already running:

  • session/prompt starts or queues a separate turn. The adapter runs a mid-turn session/prompt only after the current turn settles: activateTurn / ensureActiveTurn promote the queued turn once the active one ends, and input is echoed/run FIFO (dist/acp-agent.js).
  • agentCapabilities._meta.claudeCode.promptQueueing: true advertises queue-next, not steering.
  • The only mid-turn levers are session/cancel and interrupt.

So an ACP client can queue a follow-up turn or cancel, but it cannot do what the CLI does: add to the turn in flight. Clients that want "send while working" have to fake it by holding the message and re-sending it as a new turn after Stopped, which is a different behavior (the agent finishes first, then reads the message, instead of course-correcting mid-work).

Ask

  1. A way to inject a message into the running turn (steering), equivalent to the CLI's typed-ahead input, so the model incorporates it mid-turn without ending the turn.
  2. Ideally a dedicated /btw-style semantic (a "by the way" note distinct from a full follow-up prompt) surfaced over ACP.

Possible shapes

  • A new ACP method or notification (for example session/steer, or session/prompt with an "append to current turn" flag) that the adapter forwards to the SDK's in-turn input / btw mechanism.
  • Or a _meta.claudeCode extension on an existing request that routes to the same SDK path.

If this needs a protocol-level primitive rather than a Claude-specific extension, it may belong in agentclientprotocol/agent-client-protocol; happy to move or cross-file.

Context

Filed from the agent-of-empires project, which drives claude-agent-acp and today can only offer queue-after (a follow-up turn) in its structured view, not the CLI's mid-turn behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions