codex icon indicating copy to clipboard operation
codex copied to clipboard

Remove leading two-space indent from prompts

Open PaulRBerg opened this issue 11 months ago • 11 comments

What feature would you like to see?

When Codex displays prompts (e.g., system instructions, user prompts), it adds a two-space indent to each line. This makes copy-pasting prompts cumbersome because the pasted text retains the unwanted indentation.

Request: Remove the leading two-space indent from prompt output so that prompts can be copy-pasted directly without needing to strip whitespace.

Additional information

  • Codex version: codex-cli 0.73.0
  • Platform: Darwin 25.2.0 arm64 arm

PaulRBerg avatar Dec 18 '25 12:12 PaulRBerg

This would be very much appreciated this end.

Beautiful form follows beautiful function.

Perhaps a --tight-output flag so as not to disturb those this issue doesn't bother?

codex-cli 0.77.0 Linux 6.8.0-90-generic x86_64 Ubuntu 24.04.3 LTS (Noble Numbat)

simonallfrey avatar Dec 29 '25 21:12 simonallfrey

yes this should exist as a feature flag

robin-liquidium avatar Jan 03 '26 03:01 robin-liquidium

Please do this. It becomes a time sink to manage the text when you're having codex output commands to run.

pgibler avatar Feb 08 '26 09:02 pgibler

Here's a workaround I just came up with. I run it in another terminal after the agent has finished responding, and I get its last message without the extra indentation. Then I can copy properly from there. Helps both with indentation issues and when codex outputs what should be long one-liners. Not a solution, but a good enough workaround for me.

tail -n1 $(ls -t ~/.codex/sessions/*/*/*/*.jsonl | head -n1) | jq -r '.payload.last_agent_message'

emilan avatar Feb 18 '26 20:02 emilan

@emilan Thanks for this! Had to use this for codex version 0.92.0:

tail -n2 $(ls -t ~/.codex/sessions/*/*/*/*.jsonl | head -n1) | jq -r 'select(.payload.content) | .payload.content[0].text'

totoroot avatar Feb 24 '26 12:02 totoroot

How come this is not fixed yet?

It's a big part of frustration using Codex CLI and because ChatGPT Web interface becomes unusable and laggy mess after a long conversation, that's why I switched to Codex CLI (because CLI is just Text ,not React HTML garbage), but copy/pasting is terrible with 2 spaces padding always being there, why are all AI products not designed for daily use with stupid design decisions?

Anyone who has used these tools more than 5-10 minutes can spot usability problems immediately and these go not fixed like for months, and they want us to spend monthly subscriptions on these?

1.9K Issues 235 PRs might wanna put Codex work on those 🤦‍♂️

ZaDarkSide avatar Mar 22 '26 10:03 ZaDarkSide

tail -n2 $(ls -t ~/.codex/sessions/*/*/*/*.jsonl | head -n1) | jq -r 'select(.payload.type == "task_complete") | .payload.last_agent_message'

on codex-cli 0.118.0

verhovsky avatar Apr 08 '26 17:04 verhovsky

Another example of why this is a great feature request is that codex frequently generates bash commands with heredocs, which don't work unless the indentation is manually stripped.

Codex will very often say things like this:

• Try this command:

  cat <<EOF
  foo
  bar
  EOF

But this doesn't work if you just copy and paste as-is, because the EOF (with two leading spaces) doesn't terminate the heredoc.

The most frustrating part of this is that I can't work around it by just making a tighter selection with the mouse cursor - the only workaround I've found is to open a temporary editor buffer, paste the code into the buffer, manually unindent, paste into my terminal, then close the temporary editor buffer, which is a lot of steps and feels cumbersome.

I would looooove if the TUI had an explicit customization setting for padding which defaults to 2 as it does today, and we could set to 0 in the config.toml (or even making it a boolean setting like true|false would be perfect)

I understand the reason for the padding (it looks nice), but I suspect it causes too much frustration for users in general, for the niceness to be worth it.

bduffany avatar Apr 09 '26 15:04 bduffany

Another example of why this is a great feature request is that codex frequently generates bash commands with heredocs, which don't work unless the indentation is manually stripped.

Codex will very often say things like this:

• Try this command:

  cat <<EOF
  foo
  bar
  EOF

But this doesn't work if you just copy and paste as-is, because the EOF (with two leading spaces) doesn't terminate the heredoc.

The most frustrating part of this is that I can't work around it by just making a tighter selection with the mouse cursor - the only workaround I've found is to open a temporary editor buffer, paste the code into the buffer, manually unindent, paste into my terminal, then close the temporary editor buffer, which is a lot of steps and feels cumbersome.

I would looooove if the TUI had an explicit customization setting for padding which defaults to 2 as it does today, and we could set to 0 in the config.toml (or even making it a boolean setting like true|false would be perfect)

I understand the reason for the padding (it looks nice), but I suspect it causes too much frustration for users in general, for the niceness to be worth it.

This feature should be a no-brainer to be included in the very first public release, but the ones lacking any real brain are the AI that wrote the code and the execs that signed off on pretty > functional

ZaDarkSide avatar Apr 09 '26 16:04 ZaDarkSide

Please guys downvote to hell @etraut-openai because he says this is by "design" and closed as no planned...

https://github.com/openai/codex/issues/16431#issuecomment-4174267698

What a joke CLI without basic features when others have this fixed from beggining, Opencode is years light better than Codex in UI design.

dhaern avatar Apr 11 '26 03:04 dhaern

This is no longer an issue when using the default fullscreen mode. Copies in this mode ignore any incidental formatting and copy the underlying contents.

etraut-openai avatar Oct 12 '26 00:10 etraut-openai