Find a file
Rutger Cappendijk 52182e43cd
agent_ui: Add ability to add terminal output to agent context (#47637)
Summary

This PR adds the ability to quote terminal selections into Agent
threads, similar to how editor selections can be quoted. Users can now
select text in the terminal and add it as context to their agent
conversation.

### Features

- **Context menu**: Added "Add to Agent Thread" option to the terminal's
right-click menu (only shows when text is selected)
- **Keyboard shortcut**: The existing `cmd->` / `ctrl->` shortcut now
works in the terminal
- **Collapsed display**: Terminal output appears as a collapsed
"Terminal" crease in the chat, just like code references
- **Works with both thread types**: Supports both ACP-style threads
(Claude Code) and text threads

### Implementation

- Extended `quote_selection` handler to check for terminal panel focus
after checking for editor selections
- Terminal content is formatted as ` ```terminal` code blocks via new
`insert_terminal_crease` method
- Refactored crease insertion into `insert_crease_impl` helper to
support both code snippets (with `TextSnippet` icon) and terminal output
(with `Terminal` icon)
- Added automatic detection and folding of ` ```terminal` blocks in
`set_message` so terminal content stays collapsed in sent message
history
- Terminal creases use a trailing space instead of newline so cursor
behavior matches user expectations

### Demo

1. Select text in terminal
2. Right-click → "Add to Agent Thread" (or press `cmd->`)
3. Terminal content appears as collapsed "Terminal" block in chat
4. Send message - AI receives full terminal output, but chat history
shows it collapsed

### General note

I'm new to open source and the codebase in general so let me know if
anything should be different!
I tried to stay in line with other patterns I saw.
I didn't see a way to setup an end to end test with a real terminal so I
just added a unit test for the adding of the text to the chat, if it
exists and I missed it then I think the test coverage could be improved
with a test that uses a real terminal + running the command

<img width="431" height="148" alt="image"
src="https://github.com/user-attachments/assets/854732f9-2a7f-4f31-867e-d54af068c97c"
/>


Release Notes:

- agent: Added the ability to send selections from terminals into the
Agent thread

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-01-29 15:15:03 +00:00
.cargo ci: Update typos versions and fix new occurrences (#40784) 2025-10-21 10:43:22 +00:00
.cloudflare docs: Document context servers (#21170) 2024-11-25 11:05:14 -05:00
.config git: Side-by-side diff UI (#47349) 2026-01-22 02:31:14 -05:00
.factory/prompts/docs-automation docs: Automatic Documentation Github Action using Droid (#45374) 2025-12-19 11:19:12 -06:00
.github ci: Define default shell for all workflows (#47883) 2026-01-28 14:07:06 -07:00
.zed worktree: Implement read_only_files worktree setting (#44376) 2026-01-04 13:18:34 +00:00
assets agent_ui: Add ability to add terminal output to agent context (#47637) 2026-01-29 15:15:03 +00:00
ci Move Nightly release to gh-workflow (#41349) 2025-10-28 13:57:23 -06:00
crates agent_ui: Add ability to add terminal output to agent context (#47637) 2026-01-29 15:15:03 +00:00
docs docs: Update content in the External Agents page (#47935) 2026-01-29 09:14:16 -03:00
extensions ci: Define default shell for all workflows (#47883) 2026-01-28 14:07:06 -07:00
legal Fix the markdown table (#38729) 2025-09-23 16:49:45 +00:00
nix nix: Pin cargo-about to 0.8.2 (#44901) 2025-12-16 11:00:46 -08:00
script Add SSH remote server for Windows (#47460) 2026-01-24 13:15:01 -05:00
tooling ci: Define default shell for all workflows (#47883) 2026-01-28 14:07:06 -07:00
.git-blame-ignore-revs Add PR 15352 to .git-blame-ignore-revs (#30870) 2025-05-17 11:35:58 +00:00
.gitattributes windows: Make sure zed.sh using the correct line ending (#37650) 2025-09-05 16:25:55 +00:00
.gitignore docs: Improve Git documentation accuracy and structure (#47419) 2026-01-23 08:43:24 -08:00
.mailmap Update .mailmap (#47413) 2026-01-22 23:57:26 +05:30
.prettierrc ci: Add check for formatting default.json (#30034) 2025-05-06 18:55:26 +00:00
.rules Remove -q from .rules (#46670) 2026-01-13 03:03:30 +00:00
AGENTS.md ai: Symlink an AGENTS.md file to .rules (#45939) 2026-01-19 15:29:42 +01:00
Cargo.lock ep_cli: rated-after: query (#47906) 2026-01-28 16:36:44 -08:00
Cargo.toml Fix shell injection vulnerability in terminal tool permissions (#47807) 2026-01-28 20:51:39 +00:00
CLAUDE.md Initial .rules file for agent with symlinks for other rules file paths (#29014) 2025-04-17 23:41:23 +00:00
clippy.toml Revert "Revert scheduler update (#46659)" (#46671) 2026-01-14 07:19:13 +00:00
CODE_OF_CONDUCT.md Remove community content from docs and point to zed.dev (#19895) 2024-10-29 09:44:58 -04:00
compose.yml Remove PostgREST (#41299) 2025-10-27 13:27:59 -04:00
CONTRIBUTING.md Screenshot testing (#45259) 2026-01-05 16:34:36 -05:00
debug.plist WIP 2023-12-14 09:25:14 -07:00
default.nix Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
docker-compose.sql collab: Setup database for LLM service (#15882) 2024-08-06 17:18:08 -04:00
Dockerfile-collab build: Bump Rust version to 1.93 (#47358) 2026-01-23 13:22:41 +01:00
Dockerfile-collab.dockerignore ci: Move collab to Dockerfile-collab (#18515) 2024-09-30 16:14:26 -04:00
Dockerfile-cross.dockerignore Add remote server cross compilation (#19136) 2024-10-12 23:23:56 -07:00
Dockerfile-distros Support More Linux (#18480) 2024-09-30 17:46:21 -04:00
Dockerfile-distros.dockerignore Support More Linux (#18480) 2024-09-30 17:46:21 -04:00
flake.lock build: Bump Rust version to 1.93 (#47358) 2026-01-23 13:22:41 +01:00
flake.nix nix: Resolve 'hostPlatform' rename warning in dev shell (#45045) 2025-12-16 15:57:26 -08:00
GEMINI.md Add missing GEMINI.md rule file for gemini-cli (#38885) 2025-10-02 09:47:29 -04:00
LICENSE-AGPL Update license year (#24191) 2025-02-04 09:02:59 -05:00
LICENSE-APACHE Update license year (#24191) 2025-02-04 09:02:59 -05:00
LICENSE-GPL Licenses: change license fields in Cargo.toml to AGPL-3.0-or-later. (#5535) 2024-01-27 13:51:16 +01:00
livekit.yaml Add LiveKit server to Docker Compose (#7907) 2024-02-16 10:49:48 -05:00
lychee.toml ci: Check for broken links (#30844) 2025-06-06 09:39:35 +00:00
Procfile Update instructions for local collaboration (#35689) 2025-08-06 11:10:28 -07:00
Procfile.all Add agent thread sharing (#46140) 2026-01-06 12:49:51 -08:00
Procfile.web Remove PostgREST (#41299) 2025-10-27 13:27:59 -04:00
README.md Add sponsor button to main Zed repo (#46807) 2026-01-14 10:38:51 -06:00
renovate.json Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
REVIEWERS.conl Remove previous teammates from REVIEWERS.conl (#46934) 2026-01-15 18:43:34 +00:00
rust-toolchain.toml build: Bump Rust version to 1.93 (#47358) 2026-01-23 13:22:41 +01:00
shell.nix Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
typos.toml Revert " Add vim/emacs modeline support " (#47479) 2026-01-23 15:24:37 +00:00

Zed

Zed CI

Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.


Installation

On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).

Other platforms are not yet available:

Developing Zed

Contributing

See CONTRIBUTING.md for ways you can contribute to Zed.

Also... we're hiring! Check out our jobs page for open roles.

Licensing

License information for third party dependencies must be correctly provided for CI to pass.

We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:

  • Is it showing a no license specified error for a crate you've created? If so, add publish = false under [package] in your crate's Cargo.toml.
  • Is the error failed to satisfy license requirements for a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to the accepted array in script/licenses/zed-licenses.toml.
  • Is cargo-about unable to find the license for a dependency? If so, add a clarification field at the end of script/licenses/zed-licenses.toml, as specified in the cargo-about book.

Sponsorship

Zed is developed by Zed Industries, Inc., a for-profit company.

If youd like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.