What would you like to be added?
I propose adding a /inject command (or a similar mechanism for "asynchronous steering") to the CLI.
This feature would allow a user to input a string of text while the agent is actively processing a task or streaming a response. Instead of interrupting the process (like Ctrl+C), the /inject command would append the user's guidance directly into the current conversation's context window. The agent would then incorporate this new instruction into its next logical step (e.g., its next tool call or its next paragraph of reasoning) without losing the progress it has already made.
Proposed Syntax: /inject "Wait, I changed my mind, use the 'staging' database instead of 'production'."
Why is this needed?
Currently, interacting with the Gemini CLI is a synchronous experience. If a user notices the agent making a wrong assumption or heading in an undesired direction during a long-running multi-step task, they have two suboptimal options:
- Interrupt and Restart: Use
Ctrl+C to kill the process, which loses the work already done and requires the user to re-prompt from scratch.
- Wait and Correct: Wait for the agent to finish its incorrect path (wasting time and API tokens) and then issue a correction.
As the CLI moves toward more complex "Agent Mode" workflows, the ability to provide "mid-flight" course corrections is essential. It transforms the experience from "fire and forget" to a collaborative pairing session, significantly improving efficiency and reducing token waste.
Additional context
This feature is inspired by "Human-in-the-loop" (HITL) design patterns.
Implementation Idea: The CLI would need a background listener for the / prefix while the main process is streaming.
- When
/inject is triggered, the string is pushed to the conversation history as a "User" message or "System" hint.
- In a ReAct loop (thought/action/observation), the agent would see this injected context before deciding its next action.
Example Scenario:
- Agent: "I am now scanning all 500 files for deprecated functions..."
- User:
/inject "Only focus on the /utils folder to save time."
- Agent: "Understood. Adjusting scope to the /utils folder. Found 3 deprecated functions in..."
What would you like to be added?
I propose adding a
/injectcommand (or a similar mechanism for "asynchronous steering") to the CLI.This feature would allow a user to input a string of text while the agent is actively processing a task or streaming a response. Instead of interrupting the process (like Ctrl+C), the /inject command would append the user's guidance directly into the current conversation's context window. The agent would then incorporate this new instruction into its next logical step (e.g., its next tool call or its next paragraph of reasoning) without losing the progress it has already made.
Proposed Syntax:
/inject "Wait, I changed my mind, use the 'staging' database instead of 'production'."Why is this needed?
Currently, interacting with the Gemini CLI is a synchronous experience. If a user notices the agent making a wrong assumption or heading in an undesired direction during a long-running multi-step task, they have two suboptimal options:
Ctrl+Cto kill the process, which loses the work already done and requires the user to re-prompt from scratch.As the CLI moves toward more complex "Agent Mode" workflows, the ability to provide "mid-flight" course corrections is essential. It transforms the experience from "fire and forget" to a collaborative pairing session, significantly improving efficiency and reducing token waste.
Additional context
This feature is inspired by "Human-in-the-loop" (HITL) design patterns.
Implementation Idea: The CLI would need a background listener for the
/prefix while the main process is streaming./injectis triggered, the string is pushed to the conversation history as a "User" message or "System" hint.Example Scenario:
/inject "Only focus on the /utils folder to save time."