# \`agent\` CLI output always comes with leading whitespace

**URL:** <https://forum.cursor.com/t/agent-cli-output-always-comes-with-leading-whitespace/169453>\
**Category:** Help\
**Tags:** cli\
**Created:** [August 25, 2026, 4:00pm UTC](https://forum.cursor.com/t/agent-cli-output-always-comes-with-leading-whitespace/169453 "2026-08-25T16:00:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Cameron](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@Chris\_Cameron](https://forum.cursor.com/u/Chris_Cameron)\
**Post date:** [August 25, 2026, 4:00pm UTC](https://forum.cursor.com/t/agent-cli-output-always-comes-with-leading-whitespace/169453/1 "2026-08-25T16:00:08Z")

</div>

Hello all -

The `agent` CLI tool always prints code and commands in such a way that copying will result in leading whitespace:

 ![image](https://us1.discourse-cdn.com/cursor1/original/3X/1/3/1377f065600775ac4b6db05c2331dd04e41ede94.png)

With larger blocks of code - especially Python code - it’s a huge pain remove this extra leading space from every line.

Am I missing something for being able to copy output without this space? OpenCode and Claude Code show the code indented, but when I highlight to copy the empty space to the left of the text isn’t selected:

 ![image](https://us1.discourse-cdn.com/cursor1/original/3X/6/1/6102509114ca161bd67c282a355f67da60992fb4.png)

I’m using Konsole Version 26.04.3 as my terminal, but I doubt that’s the issue.

Any suggestions or tips? Thank you!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/colin/32/90452_2.png) [@Colin](https://forum.cursor.com/u/Colin)\
**Post date:** [August 25, 2026, 4:16pm UTC](https://forum.cursor.com/t/agent-cli-output-always-comes-with-leading-whitespace/169453/5 "2026-08-25T16:16:21Z")

</div>

Hey @Chris_Cameron, thanks for the report! You’re not missing anything. The interactive UI indents output with real space characters, so terminal selection picks them up.

There are two ways to get a clean copy today:

1. Type `/copy` in the CLI. This opens a picker of previous messages (you can also drill into individual steps of a message) and copies the raw text to your clipboard with no indentation. On Linux it needs `xclip` (X11) or `wl-clipboard` (Wayland) installed.
2. For one-off runs, non-interactive mode prints without the indent: `agent -p "your prompt"`.

I’ve also passed along the feedback about making direct terminal selection cleaner!
