Repository navigation
Run in terminal: send the result to the agent so it continues #19586
Replies: 6 comments 2 replies
|
Related use case: clicking Run opens the bottom terminal drawer, which takes over the conversation. For short commands (a cleanup |
|
The commands my agent hands me are usually ones I still don't trust it to run itself without my confirmation. In Claude Desktop I click Run, the output shows up inline under the code block, and when it finishes the whole result goes back to the agent so it keeps going. In T3 it's click Run, the terminal opens, select the output, right-click, |
|
Adding to this from a related use case: long runs I hand off to the terminal (deploys, data jobs, test suites), which I come back to many times a day. Sending the output back covers short commands. For long ones, the agent also needs to follow the run while it's going:
Open question: should a run belong to the thread that started it, or to the project, so other threads can wait on it too? Building on this, I've opened a separate idea for runs that are approved now but run later, once conditions hold, and for device-approved |
|
Update: I'd like to match how Claude Desktop does this, since two comments here point to it. How it works there: Run on a Scope I'm asking approval for :
Out of scope: run records, MCP tools, #27549. |
|
The Proposal: in the composer, a message starting with |
|
I support the updated four-part scope as written. My use case is commands the agent hands over because it can't or shouldn't run them itself, such as a hook-blocked Server-side end detection through shell integration, without wrapping the command, makes sense. I agree with sending the command, exit code, and last 400 lines back and continuing automatically by default, with an attach-only setting for people who want to review first. Keeping "Add to chat" as the fallback when integration doesn't load and splitting inline output into a second PR keeps the first change small and useful. Could a maintainer sign off on this scope so @patrickdeangelis can implement it? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Update (2026-10-31): matching Claude Desktop
The proposal now follows how Claude Desktop's Run button works: output under the code block, the result sent to the agent so it continues, and end detection through shell integration on the server instead of a wrapper typed with the command. The scope I'm asking approval for is in this comment. #27066 was closed as a duplicate of this discussion.
The original proposal follows unchanged.
Problem
The "Run in terminal" button (#13060, and #17670 for multi-line blocks) runs a command from a chat code block in the thread terminal. The agent never sees the result. To continue, you have to select the output, right-click, choose "Add to chat", then send a message, or else copy and paste it.
This happens most when the agent can't run a command itself. For example, a hook blocks
git pushand the agent hands it to you. You run it, and the agent still doesn't know whether it worked.Claude Code's
!bash mode doesn't have this problem: the command runs inside the session, and its output goes straight into the agent's context.Related: #16680 covers the same gap from the other side: the user can't see the result of a command the agent ran.
Proposal
When a command started from a code block's Run button finishes, attach its output to the thread automatically, as terminal context with a line range, the same way "Add to chat" does. It includes the exit code, so the agent can tell success from failure without parsing the text:
A setting controls what happens:
How it would work
I have a working prototype. Its answers to the questions this raises:
$?, after it. Only the terminal the command went to watches for the end marker, only until that run ends, and only for that run's random id, so other output can't trigger it. It's all client-side, with no server or contract changes beyond the setting, so it works the same over remote and tunnel connections. I chose this over the terminal's subprocess tracking (see fix(terminal): detect commands that replace the shell #17665) because only the shell knows the exit code, and shell builtins never start a subprocess at all.Known trade-offs:
Questions for maintainers
If the direction and scope look right, I'll open a focused PR with screenshots and a recording.
All reactions