feat: shell passthrough context injection and real-time streaming#77
Merged
emal-avala merged 3 commits intomainfrom Apr 6, 2026
Merged
feat: shell passthrough context injection and real-time streaming#77emal-avala merged 3 commits intomainfrom
emal-avala merged 3 commits intomainfrom
Conversation
Upgrades the `!` prefix shell command to: 1. Stream output in real-time using piped stdout/stderr with line-by-line reading, instead of capturing after completion with `.output()`. Users now see long-running command output as it happens. 2. Inject captured output into conversation history as a UserMessage with `is_meta: true`. The agent can reference shell output in subsequent turns without the user needing to copy-paste or use the Bash tool. 3. Truncate captured output at 50KB to prevent context window bloat from large command outputs (e.g., verbose test suites, build logs). The shell passthrough does not count as a turn and does not consume LLM tokens. It bridges the gap between "run this command yourself" and "let the agent run it via the Bash tool" by giving the user direct control while keeping the agent informed. Implements roadmap item 7.18.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades the
!prefix shell command (repl.rs:603) with two missing capabilities:.output()(waits for completion) toStdio::piped()with line-by-lineBufReaderoutput. Long-running commands now stream to the terminal as they execute.UserMessagewithis_meta: true. The agent can reference shell output in subsequent turns without the user copy-pasting or using the Bash tool.[output truncated at 50KB]when the limit is hit.Before
After
What doesn't change
!prefix syntax is unchangedImplements roadmap item 7.18.
Test plan
cargo check— clean compilecargo clippy -- -D warnings— zero warningscargo test— all 232+ tests pass! echo helloand verify output appears in real-time! lsthen ask agent "what files did you see?" — verify it references the output🤖 Generated with Claude Code